2.4 8个按键控制8个LED

下载相关:KEIL原工程

 1 //--------------------------------------------------------------------------
2 //
3 //程序名称: 8个按键控制8个LED;
4 //晶振: 11.0592MHz;
5 //MCU型号: STC89C52RC;
6 //电路板型号: EBV-MV(51实验板);
7 //--------------------------------------------------------------------------
8
9
10 //--------------------------------------------------------------------------
11 //硬件连接:
12 //EBVn-[VCC] -> MVn-[--VCC--]
13 //EBVn-[GND] -> MVn-[//GND//]
14
15 //EBVn-[P10] -> MVn-{EX2}-[L1]
16 //EBVn-[P11] -> MVn-{EX2}-[L2]
17 //EBVn-[P12] -> MVn-{EX2}-[L3]
18 //EBVn-[P13] -> MVn-{EX2}-[L4]
19 //EBVn-[P14] -> MVn-{EX2}-[L5]
20 //EBVn-[P15] -> MVn-{EX2}-[L6]
21 //EBVn-[P16] -> MVn-{EX2}-[L7]
22 //EBVn-[P17] -> MVn-{EX2}-[L8]
23
24 //EBVn-[P27] -> MVn-{EX14}-[K1]
25 //EBVn-[P26] -> MVn-{EX14}-[K2]
26 //EBVn-[P25] -> MVn-{EX14}-[K3]
27 //EBVn-[P24] -> MVn-{EX14}-[K4]
28 //EBVn-[P23] -> MVn-{EX14}-[K5]
29 //EBVn-[P22] -> MVn-{EX14}-[K6]
30 //EBVn-[P21] -> MVn-{EX14}-[K7]
31 //EBVn-[P20] -> MVn-{EX14}-[K8]
32
33 // -> MVn-{EX2}-(VCC)
34 //--------------------------------------------------------------------------
35
36
37 //--------------------------------------------------------------------------
38 //实验结果:
39 //8个按键控制8个LED亮灭
40 //--------------------------------------------------------------------------
41
42
43 //------------------------------------------------------
44 //头文件;
45 #include <AT89X52.H>
46
47
48 //------------------------------------------------------
49 //程序入口;
50 void main(void)
51 {
52 while(1)
53 {
54 P1 = P2; //P3端口状态复制到P1端口
55 }
56 }



KEY1副本

实验板草图副本

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

导航