📄 main.lst
字号:
316 1 fg_1s1=0;
317 1
318 1
319 1
320 1 }
321
322
323 //key10----service
324 //开始载客
325 //计算里程和费用(里程费用和等待费用)
326 void up_taxi(void)
327 {
328 1
329 1 fg_on=1;
330 1
331 1 if ( time_temp[2]<=0x22 && time_temp[2] >=0x6 )
332 1 fg_day_ng=1;
333 1 else fg_day_ng=0;
334 1
335 1 //判断起步价格
336 1 if(fg_qibu)
337 1 if ( fg_day_ng )
338 1 buf_pre=qibu_day;
339 1
340 1 else
341 1 buf_pre=qibu_ng;
342 1 fg_qibu=0;
343 1
344 1
345 1
346 1
347 1
348 1
349 1 clr_ram(buf_bcd,8); //清除bcd缓冲区单元
350 1 hextobcd(buf_dis,buf_bcd); //转化距离为bcd
351 1
352 1
353 1 //显示里程
354 1 //显示里程
355 1 lcd_temp[0]=0xc0;
356 1 lcd_temp[1]=0xef;
357 1 lcd_temp[2]=0xb3;
358 1 lcd_temp[3]=0xcc;
359 1 lcd_temp[4]=0xa3;//显示冒号
360 1 lcd_temp[5]=0xba;
361 1
362 1 if ( buf_bcd[3] )
363 1 lcd_temp[6]=buf_bcd[3]+0x30;
364 1 else lcd_temp[6]=0x20;
365 1 if ( buf_bcd[3]==0 && buf_bcd[2]==0 )
C51 COMPILER V7.50 MAIN 08/28/2005 16:44:46 PAGE 7
366 1 lcd_temp[7]=0x20;
367 1 else lcd_temp[7]=buf_bcd[2]+0x30;
368 1
369 1 lcd_temp[8]=buf_bcd[1]+0x30;
370 1
371 1 lcd_temp[9]=0x2e; //点
372 1
373 1
374 1 lcd_temp[10]=buf_bcd[0]+0x30;
375 1 //KM
376 1 lcd_temp[11]=0x4B;
377 1 lcd_temp[12]=0x4D;
378 1
379 1
380 1 lcd_dis_mul(16,0x88,lcd_temp);
381 1 clr_lcd(lcd_temp,16);
382 1
383 1
384 1 clr_ram(buf_bcd,8); //清除bcd缓冲区单元
385 1 hextobcd(buf_pre,buf_bcd); //转为费用为bcd
386 1 //显示费用
387 1 lcd_temp[0]=0xb7;
388 1 lcd_temp[1]=0xd1;
389 1 lcd_temp[2]=0xd3;
390 1 lcd_temp[3]=0xc3;
391 1 lcd_temp[4]=0xa3;//显示冒号
392 1 lcd_temp[5]=0xba;
393 1
394 1
395 1 if ( buf_bcd[5] )
396 1 lcd_temp[6]=buf_bcd[5]+0x30;
397 1 else lcd_temp[6]=0x20;
398 1 if ( buf_bcd[5]==0 && buf_bcd[4]==0 )
399 1 lcd_temp[7]=0x20;
400 1 else lcd_temp[7]=buf_bcd[4]+0x30;
401 1
402 1 lcd_temp[8]=buf_bcd[3]+0x30;
403 1
404 1 lcd_temp[9]=0x2e; //点
405 1
406 1
407 1 lcd_temp[10]=buf_bcd[2]+0x30;
408 1
409 1 //显示元
410 1 lcd_temp[11]=0x59;
411 1 lcd_temp[12]=0x00;
412 1
413 1 lcd_dis_mul(16,0x90,lcd_temp);
414 1 clr_lcd(lcd_temp,16);
415 1
416 1 //根据100m脉冲加1,代表100m ,根据价格计算费用
417 1 if ( fg_100 )
418 1 { buf_dis+=1; //里程加100m
419 2 fg_100=0; //清标志
420 2
421 2 //price
422 2 if ( buf_dis<=30 ) buf_pre=buf_pre;
423 2 if( buf_dis>30 && buf_dis<=80 && fg_day_ng ) buf_pre+=midd_day ;
424 2 if( buf_dis>30 && buf_dis<=80 && !fg_day_ng ) buf_pre=buf_pre+midd_day/10*extra;
425 2 if( buf_dis>80 && fg_day_ng ) buf_pre+=huikong_day;
426 2 if( buf_dis>80 && !fg_day_ng ) buf_pre+=(huikong_day/10*extra);
427 2 }
C51 COMPILER V7.50 MAIN 08/28/2005 16:44:46 PAGE 8
428 1
429 1 //等待费用
430 1 if ( buf_sp<=5 && fg_1s1 )
431 1 {
432 2 wait_sec+=1; //等待累加1s
433 2 dis_wmin=wait_min= wait_sec/60;
434 2 dis_wsec=wait_second=wait_sec%60;
435 2 }
436 1 //解决了问题,终于发现问题了!!
437 1 if ( wait_min >5 && wait_second==0 &&fg_1s1 )
438 1 fg_wait=1; //类似中断处理内设置标志位
439 1
440 1 if ( fg_wait )
441 1
442 1 { fg_wait=0;
443 2 if ( fg_day_ng )
444 2 buf_pre+=wait_day;
445 2 else
446 2 buf_pre=buf_pre+(wait_day/10*extra);
447 2 }
448 1
449 1 fg_1s1=0;
450 1
451 1
452 1 }
453
454
455
456
457
458 //key1-1--service
459 //将时间存显示缓冲区单元
460 void dis_time( void )
461 {
462 1 static uchar temp;
463 1 lcd_temp[0]=0xca; //汉字
464 1 lcd_temp[1]=0xb1;
465 1 lcd_temp[2]=0xbc;
466 1 lcd_temp[3]=0xe4;
467 1 lcd_temp[4]=0xa3;
468 1 lcd_temp[5]=0xba;
469 1
470 1 temp=time_temp[2] ; //小时
471 1 temp>>=4 ; //循环右移四位
472 1 temp&=0x0f ; //取高四位
473 1 lcd_temp[6]=temp+0x30;
474 1 temp=time_temp[2] ;
475 1 temp&=0x0f ; //取高四?
476 1 lcd_temp[7]=temp+0x30;
477 1
478 1
479 1 lcd_temp[8]=0xa3; //冒号
480 1 lcd_temp[9]=0xba;
481 1
482 1
483 1 temp=time_temp[1] ;
484 1 temp>>=4 ; //循环右移四位
485 1 temp&=0x0f ; //取高四位
486 1 lcd_temp[10]=temp+0x30;
487 1 temp=time_temp[2] ;
488 1 temp&=0x0f ; //取高四?
489 1 lcd_temp[11]=temp+0x30;
C51 COMPILER V7.50 MAIN 08/28/2005 16:44:46 PAGE 9
490 1
491 1
492 1 lcd_temp[12]=0xa3; //冒号
493 1 lcd_temp[13]=0xba;
494 1
495 1 temp=time_temp[0] ;
496 1 temp>>=4 ; //循环右移四位
497 1 temp&=0x0f ; //取高四位
498 1 lcd_temp[14]=temp+0x30;
499 1 temp=time_temp[0] ;
500 1 temp&=0x0f ; //取高四?
501 1 lcd_temp[15]=temp+0x30;
502 1
503 1 lcd_dis_mul(16,0x90,lcd_temp);
504 1 clr_lcd(lcd_temp,16);
505 1
506 1 }
507
508
509 //key1-2--service
510 //将日期存显示缓冲区单元
511 void dis_date(void)
512 { static uchar temp;
513 1 lcd_temp[0]=0xc8; //汉字
514 1 lcd_temp[1]=0xd5;
515 1 lcd_temp[2]=0xc6;
516 1 lcd_temp[3]=0xda;
517 1 lcd_temp[4]=0xa3;
518 1 lcd_temp[5]=0xba;
519 1
520 1 temp=date_temp[0] ; //小时
521 1 temp>>=4 ; //循环右移四位
522 1 temp&=0x0f ; //取高四位
523 1 lcd_temp[6]=temp+0x30;
524 1 temp=date_temp[0] ;
525 1 temp&=0x0f ; //取高四?
526 1 lcd_temp[7]=temp+0x30;
527 1
528 1
529 1 lcd_temp[8]=0x2e; //
530 1 lcd_temp[9]=0x00;
531 1
532 1
533 1 temp=date_temp[1] ;
534 1 temp>>=4 ; //循环右移四位
535 1 temp&=0x0f ; //取高四位
536 1 lcd_temp[10]=temp+0x30;
537 1 temp=date_temp[1] ;
538 1 temp&=0x0f ; //取高四?
539 1 lcd_temp[11]=temp+0x30;
540 1
541 1
542 1 lcd_temp[12]=0x2e; //冒号
543 1 lcd_temp[13]=0x00;
544 1
545 1 temp=date_temp[2] ;
546 1 temp>>=4 ; //循环右移四位
547 1 temp&=0x0f ; //取高四位
548 1 lcd_temp[14]=temp+0x30;
549 1 temp=date_temp[2] ;
550 1 temp&=0x0f ; //取高四?
551 1 lcd_temp[15]=temp+0x30;
C51 COMPILER V7.50 MAIN 08/28/2005 16:44:46 PAGE 10
552 1
553 1 lcd_dis_mul(16,0x88,lcd_temp);
554 1 clr_lcd(lcd_temp,16);
555 1
556 1
557 1 }
558
559
560 //按键三显示硕?
561 //显示日营业额
562 void dis_sp(void)
563 {
564 1 //显示速度
565 1 lcd_temp[0]=0xcb;
566 1 lcd_temp[1]=0xd9;
567 1 lcd_temp[2]=0xb6;
568 1 lcd_temp[3]=0xc8;
569 1 lcd_temp[4]=0xa3;//显示冒号
570 1 lcd_temp[5]=0xba;
571 1
572 1 clr_ram(buf_bcd,8);
573 1 hextobcd(buf_sp,buf_bcd);
574 1
575 1 if ( buf_bcd[2] )
576 1 lcd_temp[6]=buf_bcd[2]+0x30;
577 1 else lcd_temp[6]=0x20;
578 1 if ( buf_bcd[2]==0 && buf_bcd[1]==0 )
579 1 lcd_temp[7]=0x20;
580 1 else lcd_temp[7]=buf_bcd[1]+0x30;
581 1
582 1 lcd_temp[8]=buf_bcd[0]+0x30;
583 1
584 1 //KM/h
585 1 lcd_temp[9]=0x4B; //km
586 1 lcd_temp[10]=0x4D;
587 1
588 1 lcd_temp[11]=0x2f; ///
589 1 lcd_temp[12]=0x68; //h
590 1
591 1 lcd_dis_mul(16,0x90,lcd_temp);
592 1 clr_lcd(lcd_temp,16);
593 1
594 1 //显示日额
595 1 clr_ram(buf_bcd,8); //清除bcd缓冲区单元
596 1 hextobcd(day_pre,buf_bcd); //转为费用为bcd
597 1 //显示费用
598 1 lcd_temp[0]=0xc8;
599 1 lcd_temp[1]=0xd5;
600 1 lcd_temp[2]=0xb6;
601 1 lcd_temp[3]=0xee;
602 1 lcd_temp[4]=0xa3;//显示冒号
603 1 lcd_temp[5]=0xba;
604 1
605 1
606 1 if ( buf_bcd[5] )
607 1 lcd_temp[6]=buf_bcd[5]+0x30;
608 1 else lcd_temp[6]=0x20;
609 1 if ( buf_bcd[5]==0 && buf_bcd[4]==0 )
610 1 lcd_temp[7]=0x20;
611 1 else lcd_temp[7]=buf_bcd[4]+0x30;
612 1
613 1 lcd_temp[8]=buf_bcd[3]+0x30;
C51 COMPILER V7.50 MAIN 08/28/2005 16:44:46 PAGE 11
614 1
615 1 lcd_temp[9]=0x2e; //点
616 1
617 1
618 1 lcd_temp[10]=buf_bcd[2]+0x30;
619 1
620 1 //显示元
621 1 lcd_temp[11]=0x59;
622 1 lcd_temp[12]=0x00;
623 1
624 1 lcd_dis_mul(16,0x88,lcd_temp);
625 1 clr_lcd(lcd_temp,16);
626 1
627 1
628 1 }
629
630
631
632 //key1_service
633 //切换显示time and date
634 void dis_time_date(void)
635 {
636 1 if( fg_on)
637 1 on_taxi();
638 1 if (!key_fg)
639 1 { dis_time();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -