📄 main.lst
字号:
C51 COMPILER V7.06 MAIN 04/12/2006 11:51:39 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\HEX\main.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND OBJECT(.\HEX\main.obj)
stmt level source
1 #ifndef __MAIN_C__
2 #define __MAIN_C__
3 #endif
4
5 #include "head.h"
6 #include "usbdef.h"
7 #include "ch375inc.h"
8 #include "uart.h"
9 #include "mcuFun.h"
10 #include "ch375.h"
11
12 uint8 eaCount, debug;
13 uint16 tCount;
14 uint8 idata ep1Buf[8];
15
16 unsigned char RECV_LEN; // 刚接收到的数据的长度
17 unsigned char RECV_BUFFER[CH375_MAX_DATA_LEN]; // 数据缓冲区,用于保存接收到的下传数据,长度为0到64字节
18 unsigned char *cmd_buf;
19 unsigned char *ret_buf;
20 unsigned char mVarSetupRequest; // USB请求码
21 unsigned char mVarSetupLength; // 后续数据长度
22 unsigned char *VarSetupDescr; // 描述符偏移地址
23 unsigned char VarUsbAddress ; //USB设备地址
24 bit CH375FLAGERR; //错误清0
25 bit CH375CONFLAG; //配置标志
26 mREQUEST_PACKET request; //usb请求数据缓冲区
27
28 //我的连接
29 //CH375 51
30 //D0-7 P0.0-7
31 //A0 P2.6
32 //RD RD
33 //WR WR
34 //CS P2.7
35 //INT INT0
36 //故
37 //0x7fff 命令端口, A0=1
38 //0x3fff 数据端口, A0=0
39 sbit led = P1^0;
40 sbit CH375_INT_WIRE = P3^2; // CH375中断请求输出,低电平有效
41
42 //-----------------------------------
43 //串行数据接收程序
44 //-----------------------------------
45 void receive(void)
46 {
47 1 unsigned int count;
48 1 unsigned char buf;
49 1
50 1 RECV_LEN=0;
51 1 cmd_buf = RECV_BUFFER; // 接收缓冲区
52 1 while( 1 )
53 1 {
54 2 RI=0;
55 2 *cmd_buf = SBUF;
C51 COMPILER V7.06 MAIN 04/12/2006 11:51:39 PAGE 2
56 2 cmd_buf++;
57 2 RECV_LEN++;
58 2 if( RECV_LEN == 64 )
59 2 {
60 3 while( 1 )
61 3 {
62 4 count=10000;
63 4 while( RI==0 )
64 4 {
65 5 count--;
66 5 if( count==0 )
67 5 return;
68 5 }
69 4 RI=0;
70 4 buf=SBUF;
71 4 }
72 3 }
73 2 count=10000;
74 2 while( RI==0 )
75 2 {
76 3 count--;
77 3 if( count==0 )
78 3 return;
79 3 }
80 2 }
81 1 }
82
83 void main(void)
84 {
85 1 tOut t;
86 1 debug=0x00;
87 1 eaCount=0;
88 1 led = 0;
89 1 ComInit();
90 1
91 1 uartPutStr("///////////////////////////////////////////////////////////////////////////////\n\r");
92 1 uartPutStr(__DATE__);
93 1 uartPutStr("\n\r");
94 1 uartPutStr(__TIME__);
95 1 uartPutStr("\n\r");
96 1 disConnect();
97 1 CH375_Init( ); // 初始化CH375
98 1 uartPrint("ch375 inited!\n\r", NULL, 0);
99 1 while ( 1 )
100 1 {
101 2 if(w(&t, 5))
102 2 {
103 3 ep1Buf[0]=0x02;
104 3 ep1Buf[0]=0x00;
105 3 ep1Buf[0]=0x00;
106 3 reset(&t);
107 3 led=!led;
108 3 //ep1Up(3);
109 3 }
110 2 if( RI==1 ) // 从串口接收到的数据
111 2 {
112 3 receive();
113 3 uartPrint("uart rec!\n\r", NULL, 0);
114 3 }
115 2
116 2 CH375_INT_WIRE=1;
117 2 if( CH375_INT_WIRE==0 ) // 从USB设备接收到数据
C51 COMPILER V7.06 MAIN 04/12/2006 11:51:39 PAGE 3
118 2 {
119 3 mCh375Interrupt();
120 3 // 将从USB设备接收到的数据发送到串口
121 3 }
122 2 }
123 1 }
124
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 235 ----
CONSTANT SIZE = 134 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 89 4
IDATA SIZE = 8 ----
BIT SIZE = 2 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -