51单片机 74HC595应用实例+Proteus仿真
51单片机 74HC595应用实例+Proteus仿真
- Proteus仿真

实例代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| #include <reg52.h> #include <intrins.h> #define uint unsigned int #define uchar unsigned char
sbit SH_CP = P2^0; sbit DS = P2^1; sbit ST_CP = P2^2; uchar temp; uchar code DSY_CODE[]= { 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90 };
void Delay(uint x) { uchar i; while(x--) { for(i=0;i<120;i++); } }
void In\_595() { uchar i; for(i=0;i<8;i++) { temp <<= 1; DS = CY; SH_CP = 1; \_nop\_(); \_nop\_(); SH_CP = 0; } }
void Out\_595() { ST_CP = 0; \_nop\_(); ST_CP = 1; \_nop\_(); ST_CP = 0; }
void main() { uchar i; while(1) { for(i=0;i<10;i++) { temp = DSY_CODE[i]; In\_595(); Out\_595(); Delay(200); } } }
|
实例代码和仿真资源
1 2 3
| 链接:https://pan.baidu.com/s/1RQYGDR6tLvLRW9UFMEc3cA 提取码:q8gk
|
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!