📄 main.lst
字号:
229 1 #ifdef LCD
230 1 LcdCls();
231 1 #endif
232 1
233 1 Prints("\r\nYour DS18B20's ROM is: ");
234 1 for(i=0;i<8;i++)
235 1 {
236 2 PrintHex(DS18B20Rom[i]);
237 2 }
238 1 Prints("\r\n");
239 1
240 1 Prints("\r\nSystem time is set to: \r\n");
241 1 DispTime();
C51 COMPILER V7.50 MAIN 06/02/2008 21:26:15 PAGE 5
242 1
243 1 while(1)
244 1 {
245 2 if(SystemTick>9999)SystemTick=0;
246 2 #ifndef LCD //如果没有使用LCD,则使用数码管显示系统时钟节拍
LedBuffer[3]=(SystemTick/2)%10;
LedBuffer[2]=((SystemTick/2)%100)/10;
LedBuffer[1]=((SystemTick/2)%1000)/100;
LedBuffer[0]=((SystemTick/2)%10000)/1000;
#endif
252 2
253 2 if(SystemTick%200==0)NeedRefresh=1;
254 2 if(NeedRefresh) //每秒刷新一次
255 2 {
256 3 NeedRefresh=0;
257 3 Prints("\r\n");
258 3 DispAdc();
259 3 DispTemperature();
260 3 DispTime();
261 3 if(Temperature>(16*(10*(int16)(AlarmTemperature>>4)+(AlarmTemperature&0x0F)))) //检查温度是否超过
262 3 {
263 4 BeepAlarmCount=30;
264 4 i=20;
265 4 }
266 3 /* if(AlarmTime[3]==1) //检查闹钟时间是否到
267 3 {
268 3 if(AlarmTime[2]==Time[2])
269 3 {
270 3 if(AlarmTime[1]==Time[1])
271 3 {
272 3 if(AlarmTime[0]==Time[0])
273 3 {
274 3 BeepAlarmCount=344;
275 3 i=20;
276 3 }
277 3 }
278 3 }
279 3 }*/
280 3 }
281 2
282 2 if(OldSystemTick!=SystemTick) //每5ms进入1次
283 2 {
284 3 OldSystemTick=SystemTick;
285 3 if(BeepAlarmCount)
286 3 {
287 4 i--;
288 4 switch(BeepAlarmCount%8) //BB响处理
289 4 {
290 5 case 0: //短响
291 5 case 6:
292 5 case 4:
293 5 BeepOn();
294 5 if(i==0)
295 5 {
296 6 BeepAlarmCount--;
297 6 i=20;
298 6 }
299 5 break;
300 5
301 5 case 7: //短停
302 5 case 5:
303 5 case 1:
C51 COMPILER V7.50 MAIN 06/02/2008 21:26:15 PAGE 6
304 5 BeepOff();
305 5 if(i==0)
306 5 {
307 6 BeepAlarmCount--;
308 6 i=20;
309 6 }
310 5 break;
311 5
312 5 case 2: //长响
313 5 BeepOn();
314 5 if(i==0)
315 5 {
316 6 BeepAlarmCount--;
317 6 i=80;
318 6 }
319 5 break;
320 5
321 5 case 3: //长停
322 5 BeepOff();
323 5 if(i==0)
324 5 {
325 6 BeepAlarmCount--;
326 6 i=80;
327 6 }
328 5 break;
329 5 }
330 4 }
331 3 }
332 2
333 2 if(KeyDown) //有键按下
334 2 { //处理按下的键
335 3 NeedRefresh=1;
336 3 BeepAlarmCount=0;
337 3 if(KeyDown&KEY1)
338 3 {
339 4 DispKeyDown(1);
340 4 KeyDown&=~KEY1;
341 4 OnLed1();
342 4 DispStatus=DISP_ADC; //显示ADC
343 4 }
344 3 if(KeyDown&KEY2)
345 3 {
346 4 DispKeyDown(2);
347 4 KeyDown&=~KEY2;
348 4 OnLed2();
349 4 DispStatus=DISP_TIME; //显示时间
350 4 }
351 3 if(KeyDown&KEY3)
352 3 {
353 4 DispKeyDown(3);
354 4 KeyDown&=~KEY3;
355 4 OnLed3();
356 4 DispStatus=DISP_TEMP; //显示温度
357 4 }
358 3 if(KeyDown&KEY4)
359 3 {
360 4 DispKeyDown(4);
361 4 KeyDown&=~KEY4;
362 4 OnLed4();
363 4 DispStatus=DISP_SET_TIME; //设置时间
364 4 DispSetTime();
365 4 }
C51 COMPILER V7.50 MAIN 06/02/2008 21:26:15 PAGE 7
366 3 if(KeyDown&KEY5)
367 3 {
368 4 DispKeyDown(5);
369 4 KeyDown&=~KEY5;
370 4 OnLed5();
371 4 }
372 3 if(KeyDown&KEY6)
373 3 {
374 4 DispKeyDown(6);
375 4 KeyDown&=~KEY6;
376 4 OnLed6();
377 4 }
378 3 if(KeyDown&KEY7)
379 3 {
380 4 DispKeyDown(7);
381 4 KeyDown&=~KEY7;
382 4 OnLed7();
383 4 }
384 3 if(KeyDown&KEY8)
385 3 {
386 4 DispKeyDown(8);
387 4 KeyDown&=~KEY8;
388 4 OnLed8();
389 4 DispStatus=DISP_SET_ALARM_TIME;
390 4 SetAlarmClock();
391 4 }
392 3 }
393 2
394 2 if(KeyUp) //有键释放
395 2 { //处理释放的键
396 3 if(KeyUp&KEY1)
397 3 {
398 4 DispKeyUp(1);
399 4 KeyUp&=~KEY1;
400 4 OffLed1();
401 4 }
402 3 if(KeyUp&KEY2)
403 3 {
404 4 DispKeyUp(2);
405 4 KeyUp&=~KEY2;
406 4 OffLed2();
407 4 }
408 3 if(KeyUp&KEY3)
409 3 {
410 4 DispKeyUp(3);
411 4 KeyUp&=~KEY3;
412 4 OffLed3();
413 4 }
414 3 if(KeyUp&KEY4)
415 3 {
416 4 DispKeyUp(4);
417 4 KeyUp&=~KEY4;
418 4 OffLed4();
419 4 }
420 3 if(KeyUp&KEY5)
421 3 {
422 4 DispKeyUp(5);
423 4 KeyUp&=~KEY5;
424 4 OffLed5();
425 4 }
426 3 if(KeyUp&KEY6)
427 3 {
C51 COMPILER V7.50 MAIN 06/02/2008 21:26:15 PAGE 8
428 4 DispKeyUp(6);
429 4 KeyUp&=~KEY6;
430 4 OffLed6();
431 4 }
432 3 if(KeyUp&KEY7)
433 3 {
434 4 DispKeyUp(7);
435 4 KeyUp&=~KEY7;
436 4 OffLed7();
437 4 }
438 3 if(KeyUp&KEY8)
439 3 {
440 4 DispKeyUp(8);
441 4 KeyUp&=~KEY8;
442 4 OffLed8();
443 4 }
444 3 }
445 2 }
446 1 }
447 ////////////////////////End of function//////////////////////////////
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1740 ----
CONSTANT SIZE = 1069 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 33 17
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 + -