2.6 74HC573原理实验

相关下载:KEIL原工程

 1 //--------------------------------------------------------------------------
2 //来源: http://hi.baidu.com/mculove/home
3 //程序名称: 74HC573原理实验
4 //晶振: 11.0592MHz;
5 //MCU型号: STC89C52RC;
6 //电路板型号: EBV-MV(51实验板);
7 //--------------------------------------------------------------------------
8
9
10
11
12 //--------------------------------------------------------------------------
13 //硬件连接:
14 //EBVn-[VCC] -> MVn-[--VCC--]
15 //EBVn-[GND] -> MVn-[//GND//]
16 //MVn-{EX7}-[Q0] -> MVn-{EX2}-[L1]
17 //MVn-{EX7}-[Q1] -> MVn-{EX2}-[L2]
18 //MVn-{EX7}-[Q2] -> MVn-{EX2}-[L3]
19 //MVn-{EX7}-[Q3] -> MVn-{EX2}-[L4]
20 //MVn-{EX7}-[Q4] -> MVn-{EX2}-[L5]
21 //MVn-{EX7}-[Q5] -> MVn-{EX2}-[L6]
22 //MVn-{EX7}-[Q6] -> MVn-{EX2}-[L7]
23 //MVn-{EX7}-[Q7] -> MVn-{EX2}-[L8]
24 // -> MVn-{EX2}-(VCC)
25 // -> MVn-{EX7}-(VCC)
26
27 //EBVn-[P27] -> MVn-{EX7}-[D7]
28 //EBVn-[P26] -> MVn-{EX7}-[D6]
29 //EBVn-[P25] -> MVn-{EX7}-[D5]
30 //EBVn-[P24] -> MVn-{EX7}-[D4]
31 //EBVn-[P23] -> MVn-{EX7}-[D3]
32 //EBVn-[P22] -> MVn-{EX7}-[D2]
33 //EBVn-[P21] -> MVn-{EX7}-[D1]
34 //EBVn-[P20] -> MVn-{EX7}-[D0]
35
36 //EBVn-[P10] -> MVn-{EX7}-[LE]
37 //EBVn-[P11] -> MVn-{EX7}-[nOE]
38
39 //--------------------------------------------------------------------------
40
41
42
43
44 //--------------------------------------------------------------------------
45 //实验结果:
46 //控制74HC573,LED实现了流水灯显示
47 //--------------------------------------------------------------------------
48
49
50
51
52
53
54 //------------------------------------------------------
55 //头文件;
56 #include <AT89X52.H>
57
58 #define HC573_LE P1_0
59 #define HC573_nOE P1_1
60
61
62 //------------------------------------------------------
63 //函数名:延时程序;
64 void delay(void)
65 {
66 unsigned char i,j; //定义变量i,j;
67 for(i = 0;i < 250;i++) //延时程序;
68 for(j = 0;j < 250;j++);
69 }
70
71
72 //------------------------------------------------------
73 //函数名:程序入口;
74 void main(void)
75 {
76 HC573_nOE = 0; //HC573允许输出
77 while(1)
78 {
79 HC573_LE = 1; //HC573不锁存
80 P2 = ~0X01; //将数据11111110B复位到P2端口,HC573同步输出.
81 delay(); //延时程序
82 P2 = ~0X02;
83 delay();
84 P2 = ~0X04;
85 delay();
86 P2 = ~0X08;
87 HC573_LE = 0; //HC573锁存,以下P2变化不起动作,直到锁存解除.
88 delay();
89 P2 = ~0X10;
90 delay();
91 P2 = ~0X20;
92 delay();
93 P2 = ~0X40;
94 delay();
95 P2 = ~0X80;
96 delay();
97 }
98 }



HC573副本

 

HC573

posted on 2012-01-05 17:56  mculove  阅读(2504)  评论(0编辑  收藏  举报

导航