- #include "reg51.h"
- #include "intrins.h”
- typedef unsigned char u8;
- typedef unsigned int u16;
- sbit SRCLK=P3^6;
- sbit RCLK=P3^5;
- sbit SER=P3^4;
-
- u8 ledhang[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
- u8 ledlie[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
- void delay(u16 i)
- {
- while(i--);
- }
- void Hc595SendByte(u8 dat)
- {
- u8 a;
- SRCLK=0;
- RCLK=0;
- for(a=0;a<8;a++)
- {
- SER=dat>>7;
- dat<<=1;
- SRCLK=1;
- _nop_();
- _nop_();
- SRCLK=0;
- }
- RCLK=1;
- _nop_();
- _nop_();
- RCLK=0;
- }
- void main()
- {
- u8 i;
- while(1)
- {
- P0=0x7f;
- for(i=0;i<8;i++)
- {
- P0=ledhang[i];
- Hc595SendByte(ledlie[i]);
- delay(50000);
- Hc595SendByte(0x00);
- }
- }
- }
复制代码
请问这个程序为什么不能使8*8点阵做出流水灯的效果
|