📄 mainloop.lst
字号:
C51 COMPILER V7.06 MAINLOOP 06/23/2003 11:17:00 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE MAINLOOP
OBJECT MODULE PLACED IN Mainloop.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE Mainloop.c OPTIMIZE(2,SPEED) DEBUG OBJECTEXTEND
stmt level source
1 /*
2 //*************************************************************************
3 //
4 // ZLGMCU
5 // www.zlgmcu.com
6 // File Name: mainloop.C
7 // Revision: 0.4(2002-07-08)
8 // Author: Liu Ying Bin
9 // Use library: USB51S.LIB
10 // Note: USB51S.LIB不带DMA控制功能
11 //*************************************************************************
12 */
13
14
15 #include <stdio.h>
16 #include <string.h>
17 #include <reg51.h> /* special function register declarations */
18 #include "mainloop.h"
19 #include "isr.h"
20 #include "protozlg.h"
21
22 /*
23 //*************************************************************************
24 // Public static data
25 //*************************************************************************
26 */
27
28 extern EPPFLAGS bEPPflags;
29 extern unsigned char idata GenEpBuf[];
30 extern unsigned char idata EpBuf[];
31 extern unsigned int data d12_addr;
32
33 extern unsigned int data D12_DATA;
34 extern unsigned int data D12_COMMAND;
35
36
37 sfr CKCON = 0x8F;//87C52x2用
38 //sbit clksel = P2^0;
39 sbit test_bit = P2^0;
40
41 //D12中断服务
42 usb_isr() interrupt 0
43 {
44 1 DISABLE;
45 1 fn_usb_isr();//调用D12中断服务子程序
46 1 test_bit = ~ test_bit;
47 1 ENABLE;
48 1 }
49
50 void main(void)
51 {
52 1 P0 = 0xFF;//初始化I/O口
53 1 P1 = 0xFF;
54 1 P2 = 0xFF;
55 1 P3 = 0xFF;
C51 COMPILER V7.06 MAINLOOP 06/23/2003 11:17:00 PAGE 2
56 1
57 1 // CKCON = 0x00;
58 1 CKCON = 0x01;
59 1
60 1 // if(clksel == 1)
61 1 // CKCON = CKCON | 0x01;
62 1
63 1 D12_DATA = 0xff02; //定义数据地址
64 1 D12_COMMAND = 0xff03; //定义命令地址
65 1
66 1
67 1 MCU_D12CS = 0x0;
68 1 D12SUSPD = 0x0;
69 1
70 1 IT0 = 0;//初始化中断
71 1 EX0 = 1;
72 1 PX0 = 0;
73 1 EA = 1;
74 1
75 1 MCU_D12CS = 0x1;
76 1 MCU_D12CS = 0x0;
77 1 D12_SetDMA(0x0);
78 1 bEPPflags.value = 0;
79 1
80 1 reconnect_USB();//联接USB总线
81 1
82 1 /* Main program loop */
83 1 while( TRUE ){
84 2 if(bEPPflags.bits.configuration)
85 2 check_key_LED();//连接正常,调用按键和LED控制处理
86 2
87 2 usbserve();//USB服务数据处理
88 2
89 2 } // Main Loop
90 1 }
91
92 void check_key_LED(void)
93 {
94 1 static unsigned char c, last_key = 0xf;
95 1
96 1 c = MCU_SWM0 & MCU_SWM1;
97 1 c &= 0x0f;
98 1 if (c != last_key) {
99 2 D12_WriteEndpoint(3, 1, &c);//按键状态改变,发送信息给主机
100 2 }
101 1 last_key = c;
102 1
103 1 if(bEPPflags.bits.ep1_rxdone) {
104 2 DISABLE;//接收到主机发来的LED控制信息
105 2 bEPPflags.bits.ep1_rxdone = 0;
106 2 ENABLE;
107 2 MCU_LED0 = !(GenEpBuf[3] & 0x1);//控制LED状态
108 2 MCU_LED1 = !(GenEpBuf[3] & 0x2);
109 2 }
110 1 }
111
112
113
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 214 ----
C51 COMPILER V7.06 MAINLOOP 06/23/2003 11:17:00 PAGE 3
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 2 ----
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 + -