📄 main.lst
字号:
C51 COMPILER V7.06 MAIN 11/16/2008 16:00:19 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.08.08
15 版本:V1.1
16 版权所有,盗版必究。
17 Copyright(C) 电脑圈圈 2008-2018
18 All rights reserved
19 *******************************************************************/
20
21 #include <AT89X52.H> //头文件
22 #include "Led.h"
23 #include "UART.h"
24 #include "pdiusbd12.h"
25 #include "UsbCore.h"
26 #include "config.h"
27
28 #ifdef DEBUG0
code uint8 HeadTable[][74]={
"********************************************************************\r\n",
"****** 《圈圈教你玩USB》之 假U盘 ******\r\n",
"****** AT89S52 CPU ******\r\n",
"****** 建立日期:",__DATE__," ******\r\n",
"****** 建立时间:",__TIME__," ******\r\n",
"****** 作者:电脑圈圈 ******\r\n",
"****** 欢迎访问作者的 ******\r\n",
"****** USB专区:http://group.ednchina.com/93/ ******\r\n",
"****** BLOG1:http://www.ednchina.com/blog/computer00 ******\r\n",
"****** BLOG2:http://computer00.21ic.org ******\r\n",
"********************************************************************\r\n",
};
#endif
43
44
45 /********************************************************************
46 函数功能:主函数。
47 入口参数:无。
48 返 回:无。
49 备 注:无。
50 ********************************************************************/
51 void main(void) //主函数
52 {
53 1 #ifdef DEBUG0
uint8 i;
#endif
C51 COMPILER V7.06 MAIN 11/16/2008 16:00:19 PAGE 2
56 1
57 1 uint16 id;
58 1 uint8 InterruptSource;
59 1
60 1 EA=1; //打开中断
61 1
62 1 InitUART(); //初始化串口
63 1
64 1 id=D12ReadID();
65 1
66 1 #ifdef DEBUG0
for(i=0;i<15;i++) //显示信息
{
Prints(HeadTable[i]);
}
Prints("Your D12 chip\'s ID is: ");
PrintShortIntHex(id);
if(id==0x1012)
{
Prints(". ID is correct! Congratulations!\r\n\r\n");
}
else
{
Prints(". ID is incorrect! What a pity!\r\n\r\n");
}
#endif
84 1
85 1 UsbDisconnect(); //先断开USB连接
86 1 UsbConnect(); //将USB连接上
87 1 ConfigValue=0; //配置值初始化为0
88 1
89 1 while(1) //死循环
90 1 {
91 2 if(D12GetIntPin()==0) //如果有中断发生
92 2 {
93 3 D12WriteCommand(READ_INTERRUPT_REGISTER); //写读中断寄存器的命令
94 3 InterruptSource=D12ReadByte(); //读回第一字节的中断寄存器
95 3 if(InterruptSource&0x80)UsbBusSuspend(); //总线挂起中断处理
96 3 if(InterruptSource&0x40)UsbBusReset(); //总线复位中断处理
97 3 if(InterruptSource&0x01)UsbEp0Out(); //端点0输出中断处理
98 3 if(InterruptSource&0x02)UsbEp0In(); //端点0输入中断处理
99 3 if(InterruptSource&0x04)UsbEp1Out(); //端点1输出中断处理
100 3 if(InterruptSource&0x08)UsbEp1In(); //端点1输入中断处理
101 3 if(InterruptSource&0x10)UsbEp2Out(); //端点2输出中断处理
102 3 if(InterruptSource&0x20)UsbEp2In(); //端点2输入中断处理
103 3 }
104 2 if(ConfigValue!=0) //如果已经设置为非0的配置,则可以返回数据
105 2 {
106 3 }
107 2 }
108 1 }
109 ////////////////////////End of function//////////////////////////////
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 102 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 3
C51 COMPILER V7.06 MAIN 11/16/2008 16:00:19 PAGE 3
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -