📄 ndsbscui.lst
字号:
C51 COMPILER V6.14 NDSBSCUI 07/15/2005 09:38:50 PAGE 1
C51 COMPILER V6.14, COMPILATION OF MODULE NDSBSCUI
OBJECT MODULE PLACED IN .\NDSBSCUI.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE .\NDSBSCUI.C DEBUG OBJECTEXTEND
stmt level source
1 /*********************************************************************************
2 * *
3 * FileName: NdsBscDis.c *
4 * Function: Main subroutine of the User Interface(UI) controller in BSC *
5 * CPU: ATMEL AT89C52 *
6 * SystemName: NDS18000 *
7 * SubSystem: BSC-User Interface(UI) *
8 * System clock: 11.0592MHz *
9 * Startup: 14/Oct/2002 *
10 * Author: XuYiBo *
11 * *
12 *********************************************************************************/
13 #include <AT89X52.H>
14 #include <intrins.h>
15
16 #include "NDSBSCUI.H"
17 #include "display.h"
18 #include "General.h"
19 #include "Keyboard.h"
20 #include "Serial.h"
21
22 UIMemory xdata UIDataArea _at_ MEMORY_ADDRESS;
23 UISema xdata UISemaphore _at_ SEMAPHORE_ADDRESS;
24
25 unsigned char code ucInitTitle[] ="SYSTEM INITIALIZING PLEASE WAIT ";
26 unsigned char code ucRamErrorTitle1[]="System Error:MEMORY TEST FAILURE!(0x01) "; //Can`t access physical
-paramenter eara
27 unsigned char code ucRamErrorTitle2[]="System Error:MEMORY TEST FAILURE!(0x02) "; //Can`t access keyboard
-paramenter eara
28 unsigned char code ucRamErrorTitle3[]="System Error:MEMORY TEST FAILURE!(0x03) "; //Can`t access display p
-aramenter eara
29 unsigned char code ucRamErrorTitle4[]="System Error:MEMORY TEST FAILURE!(0x04) "; //Can`t access system pa
-ramenter eara
30
31
32 ///////////////////////////////////////////////////////////////////////////////
33 ///////////////////////////////////////////////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////////////////
35 ///////////////////////////////////////////////////////////////////////////////
36
37 void main(void)
38 {
39 1 unsigned char data ucTmp;
40 1
41 1 P0 = 0xff;
42 1 P1 = 0xff;
43 1 P2 = 0xff;
44 1 P3 = 0xff;
45 1 AUXR = 0x02;
46 1
47 1 DelayTime(40); //delay 40ms
48 1 //display Init title
49 1 InitDisplay(); //Initialize the variables used by display functions
50 1 DisplayRom(ucInitTitle);
51 1
C51 COMPILER V6.14 NDSBSCUI 07/15/2005 09:38:50 PAGE 2
52 1 //Release all semaphore
53 1 UISemaphore.ucSysAreaSem = 0xff;
54 1 UISemaphore.ucDisAreaSem = 0xff;
55 1 UISemaphore.ucKeyAreaSem = 0xff;
56 1 UISemaphore.ucExamAreaSem= 0xff;
57 1 UISemaphore.ucReserved[0]= 0xff;
58 1 UISemaphore.ucReserved[1]= 0xff;
59 1 UISemaphore.ucReserved[2]= 0xff;
60 1 UISemaphore.ucReserved[3]= 0xff;
61 1 //Initialize Dual Port Ram
62 1 ucTmp=0;
63 1 while(1)
64 1 {
65 2 UISemaphore.ucExamAreaSem = 0x00; //request semaphore
66 2 if( UISemaphore.ucExamAreaSem == 0x00)
67 2 {
68 3 UIDataArea.Exam_Buffer.ExamDirtyFlag = 0;
69 3 UIDataArea.Exam_Buffer.ConnectFlag = 0;
70 3 UIDataArea.Exam_Buffer.Current[0] = 0;
71 3 UIDataArea.Exam_Buffer.Current[1] = 0;
72 3 UIDataArea.Exam_Buffer.ExciterLevel[0] = 0;
73 3 UIDataArea.Exam_Buffer.ExciterLevel[1] = 0;
74 3 UIDataArea.Exam_Buffer.TravelPow = 0;
75 3 UIDataArea.Exam_Buffer.ReflectPow = 0;
76 3 UIDataArea.Exam_Buffer.AmpTemp = 0;
77 3 UIDataArea.Exam_Buffer.RxTemp = 0;
78 3 UIDataArea.Exam_Buffer.TxTemp = 0;
79 3 UIDataArea.Exam_Buffer.RXIF_LOCK = 0;
80 3 UIDataArea.Exam_Buffer.RXRF_LOCK = 0;
81 3 UIDataArea.Exam_Buffer.TXIF_LOCK = 0;
82 3 UIDataArea.Exam_Buffer.TXRF_LOCK = 0;
83 3 UISemaphore.ucExamAreaSem = 0xff; //releast semaphore
84 3 SetCursorPos(32);
85 3 DisplayChar('.');
86 3 break;
87 3 }
88 2 else
89 2 {
90 3 UISemaphore.ucExamAreaSem = 0xff; //releast semaphore
91 3 if( ++ucTmp == 0)
92 3 {//MEMORY TEST FAILURE!
93 4 DisplayRom(ucRamErrorTitle1);
94 4 }
95 3 else
96 3 {
97 4 DelayTime(20); //delay 20ms
98 4 }
99 3 }
100 2 }
101 1
102 1 ucTmp=0;
103 1 while(1)
104 1 {
105 2 UISemaphore.ucKeyAreaSem = 0x00; //request semaphore
106 2 if(UISemaphore.ucKeyAreaSem == 0)
107 2 {
108 3 UIDataArea.KeyBuffer.KeyValue = 0x00;
109 3 UISemaphore.ucKeyAreaSem = 0xff; //release semaphore
110 3 SetCursorPos(33);
111 3 DisplayChar('.');
112 3 break;
113 3 }
C51 COMPILER V6.14 NDSBSCUI 07/15/2005 09:38:50 PAGE 3
114 2 else
115 2 {
116 3 UISemaphore.ucKeyAreaSem = 0xff; //release semaphore
117 3 if( ++ucTmp == 0)
118 3 {//MEMORY TEST FAILURE!
119 4 DisplayRom(ucRamErrorTitle2);
120 4 }
121 3 else
122 3 {
123 4 DelayTime(20); //delay 20ms
124 4 }
125 3 }
126 2 }
127 1
128 1 ucTmp=0;
129 1 while(1)
130 1 {
131 2 UISemaphore.ucDisAreaSem = 0x00; //request semaphore
132 2 if(UISemaphore.ucDisAreaSem == 0)
133 2 {
134 3 UIDataArea.DisBuffer.DisParaDirtyFlag = 0x00;
135 3 UISemaphore.ucDisAreaSem = 0xff; //release semaphore
136 3 SetCursorPos(34);
137 3 DisplayChar('.');
138 3 break;
139 3 }
140 2 else
141 2 {
142 3 UISemaphore.ucDisAreaSem = 0xff; //release semaphore
143 3 if( ++ucTmp == 0)
144 3 {//MEMORY TEST FAILURE!
145 4 DisplayRom(ucRamErrorTitle3);
146 4 }
147 3 else
148 3 {
149 4 DelayTime(20); //delay 20ms
150 4 }
151 3 }
152 2 }
153 1
154 1 ucTmp=0;
155 1 while(1)
156 1 {
157 2 UISemaphore.ucSysAreaSem = 0x00; //request semaphore
158 2 if(UISemaphore.ucSysAreaSem == 0)
159 2 {
160 3 UIDataArea.SysPara.ucAction_Flag = 0x00;
161 3 UIDataArea.SysPara.ucSysparaDirtyFlag = 0x00;
162 3 UISemaphore.ucSysAreaSem = 0xff; //release semaphore
163 3 SetCursorPos(35);
164 3 DisplayChar('.');
165 3 break;
166 3 }
167 2 else
168 2 {
169 3 UISemaphore.ucSysAreaSem = 0xff; //release semaphore
170 3 if( ++ucTmp == 0)
171 3 {//MEMORY TEST FAILURE!
172 4 DisplayRom(ucRamErrorTitle4);
173 4 }
174 3 else
175 3 {
C51 COMPILER V6.14 NDSBSCUI 07/15/2005 09:38:50 PAGE 4
176 4 DelayTime(20); //delay 20ms
177 4 }
178 3 }
179 2 }
180 1 //.............................................................................
181 1 InitKeyboard(); //Initialize the variables used by keyboard functions
182 1 InitSerial(); //Initialize the variables used by serial port functions
183 1 //Initialize finish,Waiting LINK LAYER longin
184 1
185 1 DisplayRom(ucInitTitle);
186 1 SetCursorPos(32);
187 1 DisplayChar('.');
188 1 DisplayChar('.');
189 1 DisplayChar('.');
190 1 DisplayChar('.');
191 1 DisplayChar('.');
192 1 DisplayChar('.');
193 1 SetCursorPos(0);
194 1
195 1 while(1)
196 1 {
197 2 UISemaphore.ucSysAreaSem = 0x00; //request semaphore
198 2 if(UISemaphore.ucSysAreaSem == 0)
199 2 {//Request successful
200 3 if( (UIDataArea.SysPara.ucAction_Flag!=0) && (UIDataArea.SysPara.ucSysparaDirtyFlag!=0) )
201 3 {
202 4 GetSysPara();
203 4 UIDataArea.SysPara.ucSysparaDirtyFlag = 0x00;
204 4 break;
205 4 }
206 3 }
207 2 UISemaphore.ucSysAreaSem = 0xff; //release semaphore
208 2 DelayTime(10);
209 2 }
210 1 UISemaphore.ucSysAreaSem = 0xff; //release semaphore
211 1
212 1
213 1 ///////////////////////////////////////////////////////////////////////////////
214 1 ///////////////////////////////////////////////////////////////////////////////
215 1 ///////////////////////////////////////////////////////////////////////////////
216 1 ///////////////////////////////////////////////////////////////////////////////
217 1
218 1
219 1 TMOD = 0x21;
220 1 T2CON = 0x00;
221 1 SCON = 0x50; //Enable receive
222 1 TL0 = 0x00;
223 1 TH0 = 0x00;
224 1 TL1 = 0xFD; //SERIAL IO BAUD RATE=9600bps(SYSTEM CLOCK=11.0592MHz)
225 1 TH1 = 0xFD;
226 1 TI = 0;
227 1 TR0 = 1;
228 1 TR1 = 1;
229 1 TR2 = 1;
230 1 ET0 = 1;
231 1 ET2 = 1;
232 1 ES = 1;
233 1 EA = 1;
234 1 //=========================================================================//
235 1 // MainLoop //
236 1 //=========================================================================//
237 1 while(1)
C51 COMPILER V6.14 NDSBSCUI 07/15/2005 09:38:50 PAGE 5
238 1 {
239 2 //..........................................................................System parameter
240 2 UISemaphore.ucSysAreaSem = 0x00; //request semaphore
241 2 if(UISemaphore.ucSysAreaSem == 0)
242 2 {//Request successful
243 3 if( UIDataArea.SysPara.ucSysparaDirtyFlag!=0 )
244 3 {
245 4 GetSysPara();
246 4 UIDataArea.SysPara.ucSysparaDirtyFlag = 0x00;
247 4 }
248 3 }
249 2 UISemaphore.ucSysAreaSem = 0xff; //release semaphore
250 2
251 2 ProcSerial(); //.................process received data
252 2 //..........................................................................display buffer
253 2 UISemaphore.ucDisAreaSem = 0x00; //request semaphore
254 2 if(UISemaphore.ucDisAreaSem == 0)
255 2 {
256 3 if( UIDataArea.DisBuffer.DisParaDirtyFlag == 1)
257 3 {
258 4 DisplayEx();
259 4 UIDataArea.DisBuffer.DisParaDirtyFlag = 0x00;
260 4 UISemaphore.ucDisAreaSem = 0xff; //release semaphore
261 4 }
262 3 }
263 2 UISemaphore.ucDisAreaSem = 0xff; //release semaphore
264 2
265 2 ProcSerial(); //.................process received data
266 2 //..........................................................................key buffer
267 2 if( IsKeyBufEmpty() != 0)
268 2 {//Key buffer not empty
269 3
270 3 UISemaphore.ucKeyAreaSem = 0x00; //request semaphore
271 3 if(UISemaphore.ucKeyAreaSem == 0)
272 3 {
273 4 if( UIDataArea.KeyBuffer.KeyValue == 0)
274 4 {//按键已经取走,可以放下一个键
275 5 UIDataArea.KeyBuffer.KeyValue = GetKey();
276 5 }
277 4 }
278 3 UISemaphore.ucKeyAreaSem = 0xff; //release semaphore
279 3 }
280 2
281 2 ProcSerial(); //.................process received data
282 2
283 2 }
284 1 }
285
286
287 ///////////////////////////////////////////////////////////////////////////////
288 ///////////////////////////////////////////////////////////////////////////////
289
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 559 ----
CONSTANT SIZE = 205 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 1
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
C51 COMPILER V6.14 NDSBSCUI 07/15/2005 09:38:50 PAGE 6
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -