📄 ex6-4.lst
字号:
248 2 delay();
249 2 if (down_button==0) return(3);
250 2 }
251 1 return(15);
252 1 }
253 //
254 void main (void) {
255 1 char keys;
256 1
257 1 txOK=1;
258 1 max=99;
259 1 mode=0;
260 1 operation=0;
261 1 init_LCD();
262 1 clear_LCD();
263 1 gotoxy(2,0);
264 1 display_LCD_string("20");
265 1 display=now;
266 1 display_time();
267 1 tmpday=today;
268 1 display_date();
269 1 EA=1;
270 1 com_initialize();
271 1 timer0_initialize();
272 1 IT0=1;
273 1 EX0=1;
274 1 adc_wr=0;
275 1 temp_wr=0;
276 1 adc_wr=1;
277 1 do {
278 2 keys=gotkey();
279 2 switch(keys) {
280 3 case 0 :
281 3 mode++;
282 3 if(mode==8) mode=0;
283 3 if(mode==7)
284 3 {
285 4 clear_LCD();
286 4
287 4 gotoxy(2,0);
288 4 display_LCD_string("20");
289 4 display=now;
290 4 display_time();
291 4 tmpday=today;
292 4 display_date();
293 4 }
294 3 if(mode==2)
295 3 {
296 4 clear_LCD();
297 4 gotoxy(2,2);
298 4 display_LCD_string("Send data");
299 4 }
300 3 if(mode==3)
301 3 {
302 4
C51 COMPILER V8.08 EX6_4 11/21/2008 00:54:13 PAGE 6
303 4 clear_LCD();
304 4 gotoxy(2,2);
305 4 display_LCD_string("Get data");
306 4 }
307 3
308 3 //*************************************************
309 3 if(mode==4)
310 3 {
311 4 clear_LCD();
312 4 gotoxy(2,0);
313 4 display_LCD_string("T:");
314 4 gotoxy(2,2);
315 4 display_LCD_string("min:");
316 4 gotoxy(2,10);
317 4 display_LCD_string("max:");
318 4 }
319 3 //*****************************************
320 3 if(mode==6)
321 3 {
322 4 clear_LCD();
323 4 gotoxy(2,0);
324 4 display_LCD_string("SET heatfast: ");
325 4 }
326 3 //*****************************
327 3 gotoxy(1,12);
328 3 write_LCD_data(int2char[mode]);
329 3 if(mode==1) {
330 4 display=now;
331 4 tmpday=today;
332 4 }
333 3 if(mode==2) {
334 4 now=display;
335 4 today=tmpday;
336 4 }
337 3 break;
338 3 case 1 :
339 3 if(mode==0) break;
340 3 if(mode==1) {
341 4 operation++;
342 4 if(operation==5) operation=0;
343 4 }
344 3 //****************************************
345 3 if(mode==2) {
346 4 send_count=1;
347 4 SBUF=read_byte(0)+32;// 传送数据
348 4 for(ii=11;ii<16;ii++)
349 4 {
350 5 gotoxy(2,ii);
351 5 display_LCD_string(".");
352 5 delay();
353 5 delay();
354 5 delay();
355 5 }
356 4
357 4 }
358 3 if(mode==3) {
359 4 write_byte(0,0);
360 4 write_byte(0,0);
361 4 write_byte(1,6);
362 4 write_byte(2,today.year);
363 4 write_byte(3,today.month);
364 4 write_byte(4,today.day);
C51 COMPILER V8.08 EX6_4 11/21/2008 00:54:13 PAGE 7
365 4 write_byte(5,now.hour);
366 4 AT93C66_add=6;
367 4 adc_wr=0;
368 4 temp_wr=1;
369 4 adc_wr=1;
370 4 for(ii=9;ii<16;ii++)
371 4 {
372 5 gotoxy(2,ii);
373 5 display_LCD_string(".");
374 5 delay();
375 5 delay();
376 5 delay();
377 5 }
378 4 }
379 3 //***************************************
380 3 if(mode==4) //设置最小温度
381 3
382 3 {
383 4 min++;
384 4 if(min==100) min=0;
385 4 t=min;
386 4 gotoxy(2,6);
387 4 t1=t/10;
388 4 write_LCD_data(int2char[t1]);
389 4 t1=t%10;
390 4 write_LCD_data(int2char[t1]);
391 4 }
392 3 //****************************************
393 3 if(mode==5) //调置最大温度
394 3
395 3 {
396 4
397 4 max++;
398 4 if(max==100) max=0;
399 4 tt=max;
400 4 gotoxy(2,14);
401 4 tt1=tt/10;
402 4 write_LCD_data(int2char[tt1]);
403 4 tt1=tt%10;
404 4 write_LCD_data(int2char[tt1]);
405 4 }
406 3 //****************************************
407 3 if(mode==6) //设置加热速度
408 3 {
409 4
410 4
411 4 heatfast++;
412 4 if(heatfast==3) heatfast=0;
413 4 gotoxy(2,14);
414 4 write_LCD_data(int2char[heatfast]);
415 4 }
416 3 gotoxy(1,14);
417 3 write_LCD_data(int2char[operation]);
418 3 break;
419 3 case 2 :
420 3 if(mode!=1) break;
421 3 switch(operation) {
422 4 case 0 : display.hour++;
423 4 if(display.hour>=24)
424 4 display.hour=0;
425 4 gotoxy(1,0);
426 4 display_LCD_number
C51 COMPILER V8.08 EX6_4 11/21/2008 00:54:13 PAGE 8
427 4 (display.hour);
428 4 break;
429 4 case 1 : display.minute++;
430 4 if(display.minute>=60)
431 4 display.minute=0;
432 4 gotoxy(1,3);
433 4 display_LCD_number
434 4 (display.minute);
435 4 break;
436 4 case 2 : tmpday.year++;
437 4 if(tmpday.year>=100)
438 4 tmpday.year=0;
439 4 display_date();
440 4 break;
441 4 case 3 : tmpday.month++;
442 4 if(tmpday.month>12) tmpday.
443 4 month=1;
444 4 display_date();
445 4 break;
446 4 case 4 : tmpday.day++;
447 4 if(tmpday.day>monthday
448 4 (tmpday.year,
449 4 tmpday.month))
450 4 tmpday.day=1;
451 4 display_date();
452 4 break;
453 4 }
454 3 break;
455 3 case 3 :
456 3 if(mode!=1) break;
457 3 switch(operation) {
458 4 case 0 : display.hour--;
459 4 if(display.hour<0) display.hour=23;
460 4 gotoxy(1,0);
461 4 display_LCD_number(display.hour);
462 4 break;
463 4 case 1 : display.minute--;
464 4 if(display.minute<0)
465 4 display.minute=59;
466 4 gotoxy(1,3);
467 4 display_LCD_number
468 4 (display.minute);
469 4 break;
470 4 case 2 : tmpday.year--;
471 4 if(tmpday.year<0) tmpday.year=99;
472 4 display_date();
473 4 break;
474 4 case 3 : tmpday.month--;
475 4 if(tmpday.month<1) tmpday.month=12;
476 4 display_date();
477 4 break;
478 4 case 4 : tmpday.day--;
479 4 if(tmpday.day<1)
480 4 tmpday.day=monthday
481 4 (tmpday.year,tmpday.month);
482 4 display_date();
483 4 break;
484 4 }
485 3 }
486 2 } while(1);
487 1 }
488
C51 COMPILER V8.08 EX6_4 11/21/2008 00:54:13 PAGE 9
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 2127 ----
CONSTANT SIZE = 108 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 42 3
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 + -