📄 main.lst
字号:
C51 COMPILER V7.06 MAIN 11/16/2008 15:59:29 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN Main.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE Main.c BROWSE DEBUG OBJECTEXTEND TABS(1)
stmt level source
1 /******************************************************************
2 本程序只供学习使用,未经作者许可,不得用于其它任何用途
3
4 欢迎访问我的USB专区:http://group.ednchina.com/93/
5 欢迎访问我的blog: http://www.ednchina.com/blog/computer00
6 http://computer00.21ic.org
7
8 感谢PCB赞助商——电子园: http://bbs.cepark.com/
9
10 main.c file
11
12 作者:电脑圈圈
13 建立日期: 2008.06.27
14 修改日期: 2008.06.27
15 版本:V1.1
16 版权所有,盗版必究。
17 Copyright(C) 电脑圈圈 2008-2018
18 All rights reserved
19 *******************************************************************/
20
21 #include <AT89X52.H> //头文件
22 #include "Key.h"
23 #include "Led.h"
24 #include "UART.h"
25 #include "pdiusbd12.h"
26
27 code uint8 HeadTable[][74]={
28 "********************************************************************\r\n",
29 "****** 《圈圈教你玩USB》之 学习板测试程序 ******\r\n",
30 "****** AT89S52 CPU ******\r\n",
31 "****** 建立日期:",__DATE__," ******\r\n",
32 "****** 建立时间:",__TIME__," ******\r\n",
33 "****** 作者:电脑圈圈 ******\r\n",
34 "****** 欢迎访问作者的 ******\r\n",
35 "****** USB专区:http://group.ednchina.com/93/ ******\r\n",
36 "****** BLOG1:http://www.ednchina.com/blog/computer00 ******\r\n",
37 "****** BLOG2:http://computer00.21ic.org ******\r\n",
38 "****** 请按K1-K8分别进行测试 ******\r\n",
39 "********************************************************************\r\n",
40 };
41
42 /********************************************************************
43 函数功能:主函数。
44 入口参数:无。
45 返 回:无。
46 备 注:无。
47 ********************************************************************/
48 void main(void) //主函数
49 {
50 1 uint8 i;
51 1 uint16 id;
52 1
53 1 EA=1; //打开中断
54 1 InitKeyboard(); //初始化按键
55 1 InitUART(); //初始化串口
C51 COMPILER V7.06 MAIN 11/16/2008 15:59:29 PAGE 2
56 1
57 1 for(i=0;i<16;i++) //显示信息
58 1 {
59 2 Prints(HeadTable[i]);
60 2 }
61 1
62 1 id=D12ReadID();
63 1
64 1 Prints("Your D12 chip\'s ID is: ");
65 1 PrintShortIntHex(id);
66 1
67 1 if(id==0x1012)
68 1 {
69 2 Prints(". ID is correct! Congratulations!\r\n\r\n");
70 2 }
71 1 else
72 1 {
73 2 Prints(". ID is incorrect! What a pity!\r\n\r\n");
74 2 }
75 1
76 1 while(1) //死循环
77 1 {
78 2 LEDs=~KeyPress; //将按键结果取反后控制LED
79 2 if(KeyDown) //有键按下
80 2 { //处理按下的键
81 3 if(KeyDown&KEY1)
82 3 {
83 4 Prints("KEY1 down\r\n");
84 4 KeyDown&=~KEY1;
85 4 }
86 3 if(KeyDown&KEY2)
87 3 {
88 4 Prints("KEY2 down\r\n");
89 4 KeyDown&=~KEY2;
90 4 }
91 3 if(KeyDown&KEY3)
92 3 {
93 4 Prints("KEY3 down\r\n");
94 4 KeyDown&=~KEY3;
95 4 }
96 3 if(KeyDown&KEY4)
97 3 {
98 4 Prints("KEY4 down\r\n");
99 4 KeyDown&=~KEY4;
100 4 }
101 3 if(KeyDown&KEY5)
102 3 {
103 4 Prints("KEY5 down\r\n");
104 4 KeyDown&=~KEY5;
105 4 }
106 3 if(KeyDown&KEY6)
107 3 {
108 4 Prints("KEY6 down\r\n");
109 4 KeyDown&=~KEY6;
110 4 }
111 3 if(KeyDown&KEY7)
112 3 {
113 4 Prints("KEY7 down\r\n");
114 4 KeyDown&=~KEY7;
115 4 }
116 3 if(KeyDown&KEY8)
117 3 {
C51 COMPILER V7.06 MAIN 11/16/2008 15:59:29 PAGE 3
118 4 Prints("KEY8 down\r\n");
119 4 KeyDown&=~KEY8;
120 4 }
121 3 }
122 2
123 2 if(KeyUp)//有键释放
124 2 {//处理释放的键
125 3 if(KeyUp&KEY1)
126 3 {
127 4 Prints("KEY1 up\r\n");
128 4 KeyUp&=~KEY1;
129 4 }
130 3 if(KeyUp&KEY2)
131 3 {
132 4 Prints("KEY2 up\r\n");
133 4 KeyUp&=~KEY2;
134 4 }
135 3 if(KeyUp&KEY3)
136 3 {
137 4 Prints("KEY3 up\r\n");
138 4 KeyUp&=~KEY3;
139 4 }
140 3 if(KeyUp&KEY4)
141 3 {
142 4 Prints("KEY4 up\r\n");
143 4 KeyUp&=~KEY4;
144 4 }
145 3 if(KeyUp&KEY5)
146 3 {
147 4 Prints("KEY5 up\r\n");
148 4 KeyUp&=~KEY5;
149 4 }
150 3 if(KeyUp&KEY6)
151 3 {
152 4 Prints("KEY6 up\r\n");
153 4 KeyUp&=~KEY6;
154 4 }
155 3 if(KeyUp&KEY7)
156 3 {
157 4 Prints("KEY7 up\r\n");
158 4 KeyUp&=~KEY7;
159 4 }
160 3 if(KeyUp&KEY8)
161 3 {
162 4 Prints("KEY8 up\r\n");
163 4 KeyUp&=~KEY8;
164 4 }
165 3 }
166 2 }
167 1 }
168 ////////////////////////End of function//////////////////////////////
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 449 ----
CONSTANT SIZE = 1458 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 3
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILER V7.06 MAIN 11/16/2008 15:59:29 PAGE 4
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -