📄 main.lst
字号:
640 2 dis_date();
641 2 }
642 1
643 1 else dis_sp();
644 1
645 1
646 1 }
647
648 //key2-1--service
649 //显示上次载客数据
650 //里程和费用
651 void dis_pre_data(void)
652 {
653 1
654 1 clr_ram(buf_bcd,8); //清除bcd缓冲区单元
655 1 hextobcd(pre_dis,buf_bcd); //转化距离为bcd
656 1
657 1
658 1 //显示里程
659 1 //显示里程
660 1 lcd_temp[0]=0xc0;
661 1 lcd_temp[1]=0xef;
662 1 lcd_temp[2]=0xb3;
663 1 lcd_temp[3]=0xcc;
664 1 lcd_temp[4]=0xa3;//显示冒号
665 1 lcd_temp[5]=0xba;
666 1
667 1 if ( buf_bcd[3] )
668 1 lcd_temp[6]=buf_bcd[3]+0x30;
669 1 else lcd_temp[6]=0x20;
670 1 if ( buf_bcd[3]==0 && buf_bcd[2]==0 )
671 1 lcd_temp[7]=0x20;
672 1 else lcd_temp[7]=buf_bcd[2]+0x30;
673 1
674 1 lcd_temp[8]=buf_bcd[1]+0x30;
675 1
C51 COMPILER V7.50 MAIN 08/28/2005 16:44:46 PAGE 12
676 1 lcd_temp[9]=0x2e; //点
677 1
678 1
679 1 lcd_temp[10]=buf_bcd[0]+0x30;
680 1 //KM
681 1 lcd_temp[11]=0x4B;
682 1 lcd_temp[12]=0x4D;
683 1
684 1
685 1 lcd_dis_mul(16,0x88,lcd_temp);
686 1 clr_lcd(lcd_temp,16);
687 1
688 1
689 1 clr_ram(buf_bcd,8); //清除bcd缓冲区单元
690 1 hextobcd(pre_pre,buf_bcd); //转为费用为bcd
691 1 //显示费用
692 1 lcd_temp[0]=0xb7;
693 1 lcd_temp[1]=0xd1;
694 1 lcd_temp[2]=0xd3;
695 1 lcd_temp[3]=0xc3;
696 1 lcd_temp[4]=0xa3;//显示冒号
697 1 lcd_temp[5]=0xba;
698 1
699 1
700 1 if ( buf_bcd[5] )
701 1 lcd_temp[6]=buf_bcd[5]+0x30;
702 1 else lcd_temp[6]=0x20;
703 1 if ( buf_bcd[5]==0 && buf_bcd[4]==0 )
704 1 lcd_temp[7]=0x20;
705 1 else lcd_temp[7]=buf_bcd[4]+0x30;
706 1
707 1 lcd_temp[8]=buf_bcd[3]+0x30;
708 1
709 1 lcd_temp[9]=0x2e; //点
710 1
711 1
712 1 lcd_temp[10]=buf_bcd[2]+0x30;
713 1
714 1 //显示元
715 1 lcd_temp[11]=0x59;
716 1 lcd_temp[12]=0x00;
717 1
718 1 lcd_dis_mul(16,0x90,lcd_temp);
719 1 clr_lcd(lcd_temp,16);
720 1
721 1
722 1 }
723
724
725 //key2-2--service
726 //显示计费参数
727 void dis_para(void)
728 {
729 1
730 1 lcd_temp[0]=0X53;//S
731 1 lcd_temp[1]=0X3A;//:
732 1
733 1 // 起步价格10
734 1 clr_ram(buf_bcd,8); //清除bcd缓冲区单元
735 1 hextobcd(qibu_day,buf_bcd);
736 1 lcd_temp[2]=buf_bcd[4]+0X30;
737 1 lcd_temp[3]=buf_bcd[3]+0X30;
C51 COMPILER V7.50 MAIN 08/28/2005 16:44:46 PAGE 13
738 1
739 1 clr_ram(buf_bcd,8); //清除bcd缓冲区单元
740 1
741 1 lcd_temp[4]=0x20; //空格
742 1 lcd_temp[5]=0X4D; //M
743 1 lcd_temp[6]=0X3A; //:
744 1 hextobcd(midd_day,buf_bcd);
745 1 lcd_temp[7]=buf_bcd[2]+0X30;
746 1 lcd_temp[8]=0x2e;
747 1 lcd_temp[9]=buf_bcd[1]+0X30;
748 1
749 1 clr_ram(buf_bcd,8); //清除bcd缓冲区单元
750 1
751 1 lcd_temp[10]=0x20; //空格
752 1 lcd_temp[11]=0X48; //H
753 1 lcd_temp[12]=0X3A; //:
754 1 hextobcd(huikong_day,buf_bcd);
755 1 lcd_temp[13]=buf_bcd[2]+0X30;
756 1 lcd_temp[14]=0x2e; //.
757 1 lcd_temp[15]=buf_bcd[1]+0X30;
758 1
759 1 lcd_dis_mul(16,0x88,lcd_temp);
760 1 clr_lcd(lcd_temp,16);
761 1
762 1 }
763
764
765 //显示等待?
766 void dis_wait_time(void)
767 {
768 1
769 1
770 1
771 1 //待时 B4FD,CAB1,A3BA,
772 1 lcd_temp[0]=0xb4;
773 1 lcd_temp[1]=0xFD;
774 1 lcd_temp[2]=0xCA;
775 1 lcd_temp[3]=0xB1;
776 1 lcd_temp[4]=0xA3;
777 1 lcd_temp[5]=0xBA;
778 1
779 1
780 1 clr_ram(buf_bcd,8); //清除bcd缓冲区单元
781 1 hextobcd(dis_wmin,buf_bcd);
782 1 lcd_temp[6]=buf_bcd[1]+0X30;
783 1 lcd_temp[7]=buf_bcd[0]+0X30;
784 1
785 1
786 1 lcd_temp[8]=0x3a; //冒号
787 1 lcd_temp[9]=0x00;
788 1
789 1
790 1 clr_ram(buf_bcd,8); //清除bcd缓冲区单元
791 1 hextobcd(dis_wsec,buf_bcd);
792 1 lcd_temp[10]=buf_bcd[1]+0X30;
793 1 lcd_temp[11]=buf_bcd[0]+0X30;
794 1
795 1 lcd_dis_mul(16,0x90,lcd_temp);
796 1 clr_lcd(lcd_temp,16);
797 1 }
798
799
C51 COMPILER V7.50 MAIN 08/28/2005 16:44:46 PAGE 14
800
801
802 //key2--service
803 //服务程序
804 void dis_data_para(void)
805 {
806 1 if( fg_on)
807 1 on_taxi();
808 1
809 1 if(key_fg)
810 1 { dis_pre_data();
811 2
812 2 }
813 1 else { dis_wait_time();
814 2 dis_para();
815 2 }
816 1
817 1 }
818
819
820
821
822
823 //key9----service
824 //停止载客
825 //转移数据---里程,费用,等待时间,同时清零,还有清除按键值
826 void down_taxi(void )
827 {
828 1
829 1 if(fg_on)
830 1 { fg_on=0;
831 2
832 2 pre_dis=buf_dis; //存上次里程
833 2 pre_pre=buf_pre; //存上次费用
834 2 buf_dis=0; //清零,为下次载客准备
835 2 buf_pre=0;
836 2
837 2
838 2 fg_qibu=1; //重先设置标志
839 2
840 2 // dis_wmin=wait_min; //载客结束存等待分钟
841 2 // dis_wsec=wait_sec; //载客结束存等待秒
842 2
843 2 wait_sec=wait_min=wait_second=0;
844 2
845 2 //min
846 2
847 2 //day_pre+=pre_pre; //存至每天营业额
848 2 //week_pre+=pre_pre; //存至每周营业额
849 2 //month_pre+=pre_pre; //存至每月营业额
850 2 total_pre+=pre_pre; //营业额
851 2 day_pre+=pre_pre;
852 2 }
853 1
854 1 else dis_time_date();
855 1
856 1
857 1 }
858
859
860 //查表显示缓冲区单元内容
861 void display (void )
C51 COMPILER V7.50 MAIN 08/28/2005 16:44:46 PAGE 15
862 {
863 1 static uint i;
864 1 if (fg_1s)
865 1 {
866 2 fg_1s=0;
867 2 for(i=0;i<8;i++)
868 2 // trd[i]+=table_shape0[ dis_temp[i] ] ; //查表
869 2
870 2 no=8; //写7290八个字节
871 2 suba=0X10; //器内地址
872 2 sla=0X70; //器件地址
873 2
874 2
875 2 if ( ! ISendStr(sla,suba,trd,no) )
876 2
877 2 error_type=0x03; //显示错误,代码0x03
878 2
879 2 }
880 1
881 1
882 1 }
883
884
885
886 //定时器0中断服务程序
887 //定时37.68ms计算速度
888 void timer0_isr(void) interrupt 1
889 {
890 1 TH0=0X6C;
891 1 TL0=0XD0;
892 1 if( buf_dia ) buf_dia--;
893 1
894 1 else {
895 2 buf_dia=dia;
896 2 buf_sp=buf_sp_temp;
897 2 buf_sp_temp=0;
898 2 }
899 1 }
900
901 //ex0---service
902 //对霍尔脉冲计算 ,并用于计算里程100m和费用100m的到来!
903 void ex_int0(void) interrupt 0
904 {
905 1 buf_sp_temp+=1; //霍尔脉冲加1
906 1
907 1 if( buf_pu ) buf_pu--;
908 1 else { buf_pu=pu;
909 2 fg_100=1;
910 2
911 2 }
912 1
913 1
914 1
915 1
916 1 }
917
918 //ex1---service
919 //调用其它函数时候,不要使用using
920 void ex_int1 (void) interrupt 2
921 { stack[0]=no;
922 1 stack[1]=suba;
923 1 stack[2]=sla;
C51 COMPILER V7.50 MAIN 08/28/2005 16:44:46 PAGE 16
924 1
925 1
926 1 key_fg=~key_fg;
927 1 no=1; //读取7290 1个字节
928 1 suba=0X01; //器内地址
929 1 sla=0X70; //器件地址
930 1 if ( ! IRcvStr(sla,suba,mrd,no) )
931 1
932 1 error_type=0x04; //读按键值错误,代码0x04
933 1
934 1 buf_key=*mrd ; //存按键值
935 1
936 1 no=stack[0];
937 1 suba=stack[1];
938 1 sla=stack[2];
939 1 }
940
941 void dis_seri(void)
942 {
943 1
944 1 static uchar i;
945 1 for(i=0;i<6;i++)
946 1 dis_temp[i]=buf_seri[i];
947 1
948 1 for(i=6;i<7;i++)
949 1 dis_temp[i]=0;
950 1
951 1 }
952
953
954 //处理按键
955 void process_key(void)
956 {
957 1
958 1 switch( buf_key )
959 1 {// case 0 : dis_time_date() ; break; //无按键显示时间
960 2 case 1 : dis_time_date() ; break; //按键1切换时间和日期,?
961 2 case 2 : dis_data_para() ;break; //按键2切换显示统计信息(上次载客里程和数据),和计费参屎偷却
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -