main.lst
来自「C8051ucos源码」· LST 代码 · 共 291 行
LST
291 行
C51 COMPILER V8.02 MAIN 01/09/2009 16:20:59 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN MAIN.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE program\MAIN.c LARGE BROWSE DEBUG OBJECTEXTEND PRINT(.\MAIN.lst) OBJECT(MAI
-N.obj)
line level source
1
2 #include "C8051F020.h"
3 #include "CM240128.H"
4 #include "menu.h"
5 #include "引导菜单.h"
6 #include "输入状态栏.h"
7 #include "fm24c256.h"
8 #include "gprs.h"
9 #include "数据存储.h"
10 #include "m41t0drv.h"
11 #include <string.h>
12 #include "comm.h"
13 #include "unic.h"
14 #include "数据发送.h"
15 #include <intrins.h>
16 //--------------------------------------------------------------------------------------------------------
-------
17 # define uchar unsigned char
18 # define uint unsigned int
19 #define BAUDRATE 115200 // Baud rate of UART in bps
20 #define SYSCLK 11059200 // SYSCLK frequency in Hz
21 #define dq P7_0
22 unsigned char debug =1;
23 unsigned char MainMenu;
24 extern xdata DataType InputData;
25 extern unsigned int gb ;
26 bit flag;
27 uint Temperature;
28 uchar temp_buff[9];//存取读取得字节,READ SCRATCHPAD为9字节,READ为8字节
29 uchar id_buff[8];
30 uchar *p;
31 uchar code Crctable[256]={
32 0,94,188,226,97,63,221,131,194,156,126,32,163,253,31,65,
33 157,195,33,127,252,162,64,30,95,1,227,189,62,96,130,220,
34 35,125,159,193,66,28,254,160,225,191,93,3,128,222,60,98,
35 190,224,2,92,223,129,99,61,124,34,192,158,29,67,161,255,
36 70,24,250,164,39,121,155,197,132,218,56,102,229,187,89,7,
37 219,133,103,57,186,228,6,88,25,71,165,251,120,38,196,154,
38 101,59,217,135,4,90,184,230,167,249,27,69,198,152,122,36,
39 248,166,68,26,153,199,37,123,58,100,134,216,91,5,231,185,
40 140,210,48,110,237,179,81,15,78,16,242,172,47,113,147,205,
41 17,79,173,243,112,46,204,146,211,141,111,49,178,236,14,80,
42 175,241,19,77,206,144,114,44,109,51,209,143,12,82,176,238,
43 50,108,142,208,83,13,239,177,240,174,76,18,145,207,45,115,
44 202,148,118,40,171,245,23,73,8,86,180,234,105,55,213,139,
45 87,9,235,181,54,104,138,212,149,203,41,119,244,170,72,22,
46 233,183,85,11,136,214,52,106,43,117,151,201,74,20,246,168,
47 116,42,200,150,21,75,169,247,182,232,10,84,215,137,107,53};
48
49 void tempDelay(uchar us)
50 {
51 1 while(us--);
52 1 }
53
C51 COMPILER V8.02 MAIN 01/09/2009 16:20:59 PAGE 2
54 void init18b20(void)
55 {
56 1 dq=1;
*** ERROR C202 IN LINE 56 OF PROGRAM\MAIN.C: 'P7_0': undefined identifier
57 1 _nop_();
58 1 dq=0;
*** ERROR C202 IN LINE 58 OF PROGRAM\MAIN.C: 'P7_0': undefined identifier
59 1 tempDelay(86); tempDelay(86); tempDelay(86); tempDelay(86);
60 1 tempDelay(86); tempDelay(86); tempDelay(86); tempDelay(86);
61 1 tempDelay(86); tempDelay(86); tempDelay(86); tempDelay(86);
62 1 _nop_();
63 1 dq=1;
*** ERROR C202 IN LINE 63 OF PROGRAM\MAIN.C: 'P7_0': undefined identifier
64 1 tempDelay(14); tempDelay(14); tempDelay(14); tempDelay(14);
65 1 tempDelay(14); tempDelay(14); tempDelay(14); tempDelay(14);
66 1 tempDelay(14); tempDelay(14); tempDelay(14); tempDelay(14);
67 1 _nop_(); _nop_(); _nop_();
68 1
69 1 if(dq==0)
*** ERROR C202 IN LINE 69 OF PROGRAM\MAIN.C: 'P7_0': undefined identifier
70 1 flag=1;//成功
71 1 else
72 1 flag=0;
73 1 tempDelay(20); tempDelay(20); tempDelay(20); tempDelay(20);
74 1 tempDelay(20); tempDelay(20); tempDelay(20); tempDelay(20);
75 1 tempDelay(20); tempDelay(20); tempDelay(20); tempDelay(20);
76 1 _nop_(); _nop_();
77 1 dq=1;
*** ERROR C202 IN LINE 77 OF PROGRAM\MAIN.C: 'P7_0': undefined identifier
78 1 }
79 void GoMainMenu(void)
80 {
81 1 MainMenu=1;
82 1 }
83
84 void delay(void)
85 {
86 1 unsigned char i,j;
87 1 for(i=0;i<250;i++)
88 1 {
89 2 for(j=0;j<250;j++);
90 2 }
91 1 }
92
93 void fs(unsigned char z)
94 {
95 1 bit ReceiveBit;
96 1 SBUF1=z;//temp1;
97 1 ReceiveBit= 0;
98 1 while( ReceiveBit== 0)
99 1 {ReceiveBit=SCON1&0X2;}
100 1 SCON1 &=0XFD;
101 1 ReceiveBit= 0;
102 1 }
103
104 unsigned char js(void)
105 {
106 1 bit ReceiveBit;
107 1 unsigned char temp1;
108 1 aaa:
109 1
110 1 ReceiveBit=SCON1&0X1;
C51 COMPILER V8.02 MAIN 01/09/2009 16:20:59 PAGE 3
111 1 if(ReceiveBit== 0)goto aaa;
112 1 while( ReceiveBit== 1){
113 2
114 2 SCON1 &=0XFE;
115 2 temp1 = SBUF1;
116 2 return temp1;
117 2 }
118 1 }
119
120
121
122 void main (void)
123 {
124 1 xdata unsigned char disbuf[20];
125 1 xdata DateTimeTYP datetime;
126 1 static idata unsigned char oldmin,i;
127 1 unsigned int timeval;
128 1 xdata unsigned char jsbuf[256];
129 1 Oscillator_Init();
130 1 WatchDog(0);
131 1 Port_IO_Init();
132 1
133 1 P74OUT = 0x3f;
134 1 P0MDOUT = 0xff;
135 1 P1MDOUT = 0x0f; // 1对应的引脚是推挽输出 0对应的引脚是漏极开路输出 开机默认:0x00
136 1 P2MDOUT = 0; // 1对应的引脚是推挽输出 0对应的引脚是漏极开路输出 开机默认:0x00
137 1 P3MDOUT = 0;
138 1
139 1 P7 = 0xff;//gprs控制
140 1
141 1 P2=0xff;
142 1 P3=0xff;
143 1 T3Stup(1000);
144 1 EA=1;
145 1 TickCount=6000;//下次心跳延时时间 (TickCount/1000)秒
146 1 Lcd_Init();
147 1 ClrDisplay();
148 1 CommInit();
149 1 OSCXCN = 0x67; // start external oscillator with
150 1
151 1
152 1 while (!(OSCXCN & 0x80)) ; // Wait for crystal osc. to settle
153 1
154 1 OSCICN = 0x88; // select external oscillator as SYSCLK
155 1
156 1
157 1 SCON1 = 0x50; // SCON0: mode 1, 8-bit UART, enable RX
158 1 SCON0 = 0x50; // SCON0: mode 1, 8-bit UART, enable RX
159 1 TMOD = 0x20; // TMOD: timer 1, mode 2, 8-bit reload
160 1 TH1 = -(SYSCLK/BAUDRATE/16); // set Timer1 reload value for baudrate
161 1 TR1 = 1; // start Timer1
162 1 CKCON |= 0x10; // Timer1 uses SYSCLK as time base
163 1 PCON |= 0x90; // SMOD00 = 1
164 1 TI0 = 1; // Indicate TX0 ready
165 1 SCON1 |= 0x12; // Indicate TX1 ready
166 1
167 1 for(i=0;i<200;i++){jsbuf[i]=0;}
168 1 UART1SETUP(115200,8);
169 1 UART1DISABLE();
170 1
171 1 //SBUF1 =0x00;//串口输出
172 1 //UART0SETUP(57600,8);//设置串口
C51 COMPILER V8.02 MAIN 01/09/2009 16:20:59 PAGE 4
173 1 //UART0DISABLE();//关串口中断
174 1 GetM41T0Time(&datetime);
175 1 InputData.datetime[0] = (datetime.year>>4)+'0';
176 1 InputData.datetime[1] = (datetime.year&0x0f)+'0';
177 1 InputData.datetime[2] = (datetime.month>>4)+'0';
178 1 InputData.datetime[3] = (datetime.month&0x0f)+'0';
179 1 InputData.datetime[4] = (datetime.date>>4)+'0';
180 1 InputData.datetime[5] = (datetime.date&0x0f)+'0';
181 1 InputData.datetime[6] = (datetime.hour>>4)+'0';
182 1 InputData.datetime[7] = (datetime.hour&0x0f)+'0';
183 1 InputData.datetime[8] = (datetime.min>>4)+'0';
184 1 InputData.datetime[9] = (datetime.min&0x0f)+'0';
185 1 InputData.datetime[10] = 0;
186 1 InputData.datetime[11] = 0;
187 1 AppendData(&InputData);
188 1 /*
189 1 UART0SETUP(57600,8);//设置串口
190 1 UART0DISABLE();//关串口中断
191 1 if(DataInit()!=0)
192 1 {
193 1 //-------------------------------------------
194 1 //欢迎界面及启动GPRS
195 1 SetCurrLoc(0,0);
196 1 DisplayStr("系统初始化请等待...",30);
197 1 for(i=0;i<60000;i++);
198 1 LoadServerIP();
199 1
200 1 if(strlen(ServerIp)>7)GPRSInit();
201 1 //-------------------------------------------
202 1 }
203 1 UART0ENABLE();//开串口中断
204 1 */
205 1 GoMainMenu();
206 1 while (1)
207 1 {
208 2 if(MainMenu==1){MainMenu=0;MENU_Boot(0);}
209 2 CommInceptProc();
210 2 MenuScan();
211 2 MenuIncept(InputStateInput());
212 2 /*
213 2 if(TickCount==0)
214 2 {
215 2 TickCount=60000;//下次心跳延时时间 (TickCount/1000)秒
216 2 UART0Write(" ",3);
217 2 }
218 2 */
219 2 GetM41T0Time(&datetime);
220 2 if(oldmin!=datetime.min)
221 2 {
222 3 oldmin=datetime.min;
223 3 disbuf[0] = '2';
224 3 disbuf[1] = '0';
225 3 disbuf[2] = (datetime.year>>4)+'0';
226 3 disbuf[3] = (datetime.year&0x0f)+'0';
227 3 disbuf[4] = '-';
228 3 disbuf[5] = (datetime.month>>4)+'0';
229 3 disbuf[6] = (datetime.month&0x0f)+'0';
230 3 disbuf[7] = '-';
231 3 disbuf[8] = (datetime.date>>4)+'0';
232 3 disbuf[9] = (datetime.date&0x0f)+'0';
233 3 disbuf[10] = '|';
234 3 disbuf[11] = (datetime.hour>>4)+'0';
C51 COMPILER V8.02 MAIN 01/09/2009 16:20:59 PAGE 5
235 3 disbuf[12] = (datetime.hour&0x0f)+'0';
236 3 disbuf[13] = ':';
237 3 disbuf[14] = (datetime.min>>4)+'0';
238 3 disbuf[15] = (datetime.min&0x0f)+'0';
239 3 disbuf[16] = 0;
240 3 disbuf[17] = 0;
241 3 disbuf[18] = 0;
242 3 disbuf[19] = 0;
243 3 SetCurrLoc(10,0);
244 3 DisplayFill(' ',20);
245 3 SetCurrLoc(14,0);
246 3 DisplayStr(disbuf,20);
247 3 timeval = (disbuf[11]-0x30);
248 3 timeval*=10;
249 3 timeval += (disbuf[12]-0x30);
250 3 timeval*=10;
251 3 timeval += (disbuf[14]-0x30);
252 3 timeval*=10;
253 3 timeval += (disbuf[15]-0x30);
254 3 if(timeval == GetAutoSendTime())
255 3 {
256 4 MENU_DataSend(0);//时间到数据发送
257 4 }
258 3 }
259 2 }
260 1 }
261
262 //--------------------------------------------------------------------------------------------------------
----------
263
C51 COMPILATION COMPLETE. 0 WARNING(S), 5 ERROR(S)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?