找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1632|回复: 2
收起左侧

使用STC15单片机驱动LCD12864显示熄屏的问题

[复制链接]
ID:708768 发表于 2021-4-30 14:41 | 显示全部楼层 |阅读模式
LCD总是会显示一段时间后就不显示了,就是显示屏像处于熄屏状态,每次显示到熄灭的时间长度都不一样,我测试过,程序没有卡死,显示屏的供电也没有问题,请问是什么问题

单片机源程序如下:

  1. /*---------------------------------------------------------------------*/
  2. /* --- STC MCU International Limited ----------------------------------*/
  3. /* --- STC 1T Series MCU Demo Programme -------------------------------*/
  4. /* 如果要在程序中使用此代码,请在程序中注明使用了宏晶科技的资料及程序   */
  5. /*---------------------------------------------------------------------*/



  6. /*************        本程序功能说明        **************



  7. ******************************************/

  8. #define MAIN_Fosc                24000000UL        //定义主时钟  22118400UL
  9. #define LcmXPixel 128 //横向宽度
  10. #define LcmYPixel 64 //纵向高度
  11. #define MIN(A,B) ((A)<(B)?(A):(B))
  12. #define Uchar unsigned char
  13. #define Uint unsigned int
  14. #define        Timer0_Reload        (MAIN_Fosc / 1000)                //Timer 0 中断频率, 1000次/秒

  15. //DS1302地址定义
  16. #define ds1302_sec_add                        0x80                //秒数据地址
  17. #define ds1302_min_add                        0x82                //分数据地址
  18. #define ds1302_hr_add                        0x84                //时数据地址
  19. #define ds1302_date_add                        0x86                //日数据地址
  20. #define ds1302_month_add                0x88                //月数据地址
  21. #define ds1302_day_add                        0x8a                //星期数据地址
  22. #define ds1302_year_add                        0x8c                //年数据地址
  23. #define ds1302_control_add                0x8e                //控制数据地址
  24. #define ds1302_charger_add                0x90                                          
  25. #define ds1302_clkburst_add                0xbe


  26. #include <intrins.h>
  27. #include        "STC15Fxxxx.H"


  28. ///


  29. ///
  30. /*************        IO口定义        **************/


  31. sbit CS = P3^6; //片选
  32. sbit SID = P3^4; //数据
  33. sbit SCK = P3^2; //Clock 信号
  34. sbit RS = P3^3; //数据指令选择
  35. sbit Key = P3^4; //测试架锁定按键(测试架专用)
  36. sbit RES = P3^5; //测试架复位是板载 RC 复位,可以不需要 IO 口操作
  37. sbit turn_counter = P4^2;  //电机转圈计数脚

  38. //DS1302引脚定义
  39. sbit RST=P0^0;
  40. sbit IO=P0^1;
  41. sbit DS_SCK=P0^2;

  42. Uchar code ASCIIchardot[];
  43. Uchar code bmp1[];
  44. Uchar code bmp2[];
  45. Uchar code bmp3[];
  46. Uchar code ComTable[]={3,2,1,0,7,6,5,4,};
  47. Uchar second_high;
  48. Uchar second_low;
  49. u8 cnt=0;  //按键延时计时

  50. //
  51. u8        display_index;        //显示位索引
  52. bit        B_1ms;                        //1ms标志

  53. u8        Tday,Thour,Tminute,Tsecond;        //RTC变量
  54. u16        Tmsecond;

  55. u32        Tset;  u32        Tuse;  u32        Tleft;

  56. u32        Tlockm;
  57. int mark=0;
  58. int ds1302_second=0;
  59. //DS1302
  60. Uchar dis_time_buf[16]={0};
  61. Uchar time_buf[8] ={0x20,0x21,0x04,0x02,0x09,0x00,0x00,0x05};//初始时间2021年4月02号09点00分00秒 星期五
  62. Uint t;
  63. Uint motor_turn=0;  //电机转动圈数
  64. Uint counter1, counter2;//电机转动计数1、计数2
  65. Uint interrupt_counter=0;//中断计数
  66. Uint interrupt_counter1=1;




  67. /****************  外部函数声明和外部变量声明 *****************/



  68.   //串口模式下只能写不能读,也不能查忙,因此用户要控制好速度不要太快
  69. void WriteCommand( Uchar CommandByte )
  70. {
  71.         Uchar i;
  72.         CS=0;
  73.         RS=0; //Command
  74.         for(i=0;i<8;i++)
  75.         {         SCK=1;
  76.                 SID=( (CommandByte>>(7-i)) &0x01);
  77.                 SCK=0;
  78.                 _nop_();
  79.                 SCK=1;
  80.         }
  81. }

  82. void WriteData( Uchar DataByte )
  83. {
  84.         Uchar i;
  85.         CS=0;
  86.         RS=1; //Data
  87.         for(i=0;i<8;i++)
  88.         {
  89.                 SCK=1;
  90.                 SID=( (DataByte>>(7-i)) &0x01);
  91.                 SCK=0;
  92.                 _nop_();
  93.                 SCK=1;
  94.         }
  95. }

  96. void DelayMS(unsigned int MS)
  97. {
  98.         unsigned char us,usn;
  99.         while(MS!=0)
  100.         {
  101.                 usn = 2; //for 12M
  102.                 while(usn!=0)
  103.                 {
  104.                         us=0xf6;
  105.                         while (us!=0){us--;};
  106.                         usn--;
  107.                 }
  108.                 MS--;
  109.         }
  110. }


  111. void LcmClear( Uchar FillData )
  112. {
  113.         Uint i,j;
  114.         for(i=0;i<8;i++)
  115.         {
  116.                 WriteCommand(0xB0|ComTable[i]); //Set Page Address
  117.                 WriteCommand(0x10); //Set Column Address = 0
  118.                 WriteCommand(0x01); //Colum from S1 -> S128 auto add
  119.                 for(j=0;j<128;j++)
  120.                 {
  121.                         WriteData( FillData );
  122.                 }
  123.         }
  124. }

  125. void LcmInit( void )
  126. {
  127.         WriteCommand(0xAE); //Display OFF
  128.         WriteCommand(0xA2); //1/64 Duty 1/9 Bias
  129.         WriteCommand(0xA0); //ADC select S0->S131(玻璃设计用 S1-S128)
  130.         WriteCommand(0xC0); //com1 --> com64
  131.         WriteCommand(0x24); //对某些模块没用,用的外部 Rb/Ra
  132.         WriteCommand(0x81); //Sets V0
  133.         WriteCommand(48); //内部电位器调节对比度
  134.         WriteCommand(0x2F); //voltage follower ON regulator ON booster ON
  135.         WriteCommand(0xA6); //Normal Display (not reverse dispplay)
  136.         WriteCommand(0xA4); //Entire Display Disable
  137.         WriteCommand(0x40); //Set Display Start Line = com0
  138.         WriteCommand(0xB0); //Set Page Address = 0
  139.         WriteCommand(0x10); //Set Column Address 4 higher bits = 0
  140.         WriteCommand(0x01); //Set Column Address 4 lower bits = 1 , from IC SEG1 -> SEG128
  141.         LcmClear(0);
  142.         WriteCommand(0xAF); //Display ON
  143. }
  144. //显示 ASICC 字符的函数
  145. void LcmPutChar(Uchar col,Uchar page,Uchar Order)
  146. {
  147.         Uchar i;
  148.         Uint x;
  149.         x = (Order-0x20)*0x10; //ASICC 字符从 0x20 开始,每个 16 byte
  150.         WriteCommand(ComTable[page&0x07]|0xB0); //Set Page Address
  151.         WriteCommand( ((col+1)>>4) | 0x10); //Set Column Address High Byte
  152.         WriteCommand( (col+1)&0x0F ); //Low Byte Colum from S128 -> S1 auto add
  153.         for(i=0;i<8;i++)
  154.         {
  155.                 WriteData( ASCIIchardot[x] );
  156.                 x++;
  157.         }
  158.         page++; //下半字符 page+1
  159.         WriteCommand(ComTable[page&0x07]|0xB0); //Set Page Address
  160.         WriteCommand( ((col+1)>>4) | 0x10); //Set Column Address High Byte
  161.         WriteCommand( (col+1)&0x0F ); //Low Byte Colum from S128 -> S1 auto add
  162.         for(i=0;i<8;i++)
  163.         {
  164.                 WriteData( ASCIIchardot[x] );
  165.                 x++;
  166.         }
  167.         page--; //写完一个字符 page 还原
  168. }
  169. //显示字符串的函数
  170. void LcmPutStr(Uchar col,Uchar page,Uchar *puts)
  171. {
  172.         while(*puts != '\0') //判断字符串时候显示完毕
  173.         {
  174.                 if(col>(LcmXPixel-8)) //判断行末空间是否足够放一个字符,自动换行
  175.                 {
  176.                         page=page+2;
  177.                         col=0;
  178.                 }
  179.                 if(page>(LcmYPixel/8-2)) //到了屏幕最下角,自动返回左上角
  180.                 {
  181.                         page=0;
  182.                         col=0;
  183.                 }
  184.                 LcmPutChar(col,page+4,*puts);
  185.                 puts++;
  186.                 col=col+8; //下一个字符 8 列之后
  187.         }
  188. }
  189. //显示 3 位数的数值(0-999)
  190. void LcmPutNum(Uchar col,Uchar page,u16 Num)
  191. {
  192.         Uchar a,b,c;

  193.         a=Num/100;
  194.         b=(Num%100)/10;
  195.         c=Num%10;

  196.         if(a==0)  //也不写空格,直接跳过去
  197.         LcmPutChar(col,page,0x20);
  198.         else LcmPutChar(col,page+4,a+0x30);
  199.         if(a==0 && b==0) //也不写空格,直接跳过?
  200.         LcmPutChar(col,page,0x20);
  201.         else LcmPutChar(col+8,page+4,b+0x30);
  202.         LcmPutChar(col+16,page+4,c+0x30);
  203.          
  204. }

  205. /********************** RTC演示函数 ************************/
  206. void        RTC(void)       //一轮计数后59到01,没能刷新十位,应该为01,
  207. {        
  208.         if(++Tsecond >=60)
  209.         {
  210.                 LcmClear(0);
  211.                 Tsecond = 0;Tlockm++;
  212.                 if(++Tminute >= 60)
  213.                 {
  214.                         LcmClear(0);        
  215.                         Tminute = 0;
  216.                         if(++Thour >= 24)                        
  217.                         {
  218.                           LcmClear(0);        
  219.                                 Thour = 0;
  220.                           Tday++;
  221.                         }
  222.                 }
  223.         }
  224. }

  225. /*单字节写入一字节数据*/

  226. //向DS1302写入一字节数据
  227. void ds1302_write_byte(Uchar addr, Uchar d)
  228. {
  229.         Uchar i;
  230.         RST=1;                                        //启动DS1302总线        
  231.         //写入目标地址:addr
  232.         addr = addr & 0xFE;   //最低位置零,寄存器0位为0时写,为1时读
  233.         for (i = 0; i < 8; i ++)
  234.         {
  235.                 if (addr & 0x01) {
  236.                         IO=1;
  237.                         }
  238.                 else {
  239.                         IO=0;
  240.                         }
  241.                 DS_SCK=1;      //产生时钟
  242.                 DS_SCK=0;
  243.                 addr = addr >> 1;
  244.                 }        
  245.         //写入数据:d
  246.         for (i = 0; i < 8; i ++) {
  247.                 if (d & 0x01) {
  248.                         IO=1;
  249.                         }
  250.                 else {
  251.                         IO=0;
  252.                         }
  253.                 DS_SCK=1;    //产生时钟
  254.                 DS_SCK=0;
  255.                 d = d >> 1;
  256.                 }
  257.         RST=0;                //停止DS1302总线
  258. }

  259. //从DS1302读出一字节数据
  260. Uchar ds1302_read_byte(Uchar addr)
  261. {

  262.         Uchar i,temp;        
  263.         RST=1;                                        //启动DS1302总线
  264.         //写入目标地址:addr
  265.         addr = addr | 0x01;    //最低位置高,寄存器0位为0时写,为1时读
  266.         for (i = 0; i < 8; i ++) {
  267.                 if (addr & 0x01) {
  268.                         IO=1;
  269.                         }
  270.                 else {
  271.                         IO=0;
  272.                         }
  273.                 DS_SCK=1;
  274.                 DS_SCK=0;
  275.                 addr = addr >> 1;
  276.                 }        
  277.         //输出数据:temp
  278.         for (i = 0; i < 8; i ++) {
  279.                 temp = temp >> 1;
  280.                 if (IO) {
  281.                         temp |= 0x80;
  282.                         }
  283.                 else {
  284.                         temp &= 0x7F;
  285.                         }
  286.                 DS_SCK=1;
  287.                 DS_SCK=0;
  288.                 }        
  289.         RST=0;                                        //停止DS1302总线
  290.         return temp;
  291. }
  292. //向DS302写入时钟数据
  293. void ds1302_write_time(void)
  294. {
  295.         ds1302_write_byte(ds1302_control_add,0x00);                        //关闭写保护
  296.         ds1302_write_byte(ds1302_sec_add,0x80);                                //暂停时钟
  297.         //ds1302_write_byte(ds1302_charger_add,0xa9);            //涓流充电
  298.         ds1302_write_byte(ds1302_year_add,time_buf[1]);                //年
  299.         ds1302_write_byte(ds1302_month_add,time_buf[2]);        //月
  300.         ds1302_write_byte(ds1302_date_add,time_buf[3]);                //日
  301.         ds1302_write_byte(ds1302_hr_add,time_buf[4]);                //时
  302.         ds1302_write_byte(ds1302_min_add,time_buf[5]);                //分
  303.         ds1302_write_byte(ds1302_sec_add,time_buf[6]);                //秒
  304.         ds1302_write_byte(ds1302_day_add,time_buf[7]);                //周
  305.         ds1302_write_byte(ds1302_control_add,0x80);                        //打开写保护     
  306. }
  307. //从DS302读出时钟数据
  308. void ds1302_read_time(void)  
  309. {
  310.         time_buf[1]=ds1302_read_byte(ds1302_year_add);                //年
  311.         time_buf[2]=ds1302_read_byte(ds1302_month_add);                //月
  312.         time_buf[3]=ds1302_read_byte(ds1302_date_add);                //日
  313.         time_buf[4]=ds1302_read_byte(ds1302_hr_add);                //时
  314.         time_buf[5]=ds1302_read_byte(ds1302_min_add);                //分
  315.         time_buf[6]=(ds1302_read_byte(ds1302_sec_add))&0x7f;//秒,屏蔽秒的第7位,避免超出59
  316.         time_buf[7]=ds1302_read_byte(ds1302_day_add);                //周         
  317. }
  318. //DS1302初始化函数
  319. void ds1302_init(void)
  320. {
  321.         RST=0;                        //RST脚置低
  322.         DS_SCK=0;                        //SCK脚置低
  323.         RST=1;                        //RST脚置高
  324.         ds1302_write_byte(0x8e, 0);
  325.         RST=0;                        //RST脚置低

  326. }

  327. void main( void )
  328. {

  329.      //button
  330.       Uchar b0click=0;         Uchar b0cflag=0;          Uchar B0PressOnce=0;
  331.           Uchar b1click=0;         Uchar b1cflag=0;          Uchar B1PressOnce=0;
  332.           Uchar b2click=0;         Uchar b2cflag=0;          Uchar B2PressOnce=0;
  333.           Uchar b3click=0;         Uchar b3cflag=0;          Uchar B3PressOnce=0;
  334.           Uchar b4click=0;         Uchar b4cflag=0;          Uchar B4PressOnce=0;
  335.           Uchar b5click=0;         Uchar b5cflag=0;          Uchar B5PressOnce=0;
  336.           Uchar b6click=0;         Uchar b6cflag=0;          Uchar B6PressOnce=0;

  337.           Uchar LTclick=0;         Uchar LTcflag=0;          Uchar LTPressOnce=0;
  338.          //
  339.          //page1`
  340.          Uchar pagenum=88;          Uchar secodein=191;           Uchar select=1;
  341.          Uchar secode1=0;         Uchar secode2=0;  Uchar secode3=0;
  342.           //

  343.          //page2
  344.          Uchar         select_2=1;
  345.           //

  346.           //page4
  347.          Uchar select_4=1;Uchar secode1_4=5; Uchar secode2_4=0;Uchar secode3_4=0;         u16 VTBI=500;        //        Uchar secode4_4=0;
  348.          //page41
  349.          Uchar seday_4=2;
  350.           //

  351.           //page5
  352.          Uchar select_5=1;
  353.          //

  354.          //page6
  355.          Uchar Bolusvol=15;Uchar BolusTime=1;Uchar select_6=1;
  356.          //

  357.          //page8
  358.          Uchar Demandvol=15;        Uchar LockoutTime=15;Uchar select_8=1; Uchar secode1_8=0;         Uchar secode2_8=1;  Uchar secode3_8=5;
  359.          //

  360.          //page10
  361.          Uchar select_10=1;
  362.           //

  363.           //page11
  364.          Uchar seday_10=1;
  365.          //

  366.           //page21
  367.            u16 delaytime=0;  u16 VINF=0;          u16 lockouttime=0;         u16 runtime=0;         u16 infcount=0;           u32 lightcount=0;        u32 bolushandcount=0;
  368.           //


  369.          //start
  370.          Uchar confirmflag=0;        Uchar startcount=0;
  371.          //

  372.             //run
  373.           Uchar run=0;           Uchar beep=0;          u16 bolusrun=0;         u16 bolustime=0;         Uchar bolusflag=0;          Uchar lockflag=0;          Uchar stateflag=0;         Uchar onoffflag=1;
  374.           Uchar onoffstate=1;
  375.          //

  376.          //light switch
  377.           Uchar lighton=0;  
  378.          //


  379.         Uchar contrast=30; //对比度=48(根据我们常用的外部电阻参数来的)
  380.         DelayMS(10);
  381.         RES = 0;
  382.         DelayMS(200);
  383.         RES = 1;
  384.         DelayMS(50);
  385.         LcmInit();
  386. //*********************ds1302实时时钟初始化***************************
  387.   ds1302_init();
  388.         ds1302_write_time(); //写入初始值

  389. //********************************************************************
  390.     P0M1 = 0;        P0M0 = 0;        //设置为准双向口
  391.         P1M1 = 0;        P1M0 = 0;        //设置为准双向口
  392.         P2M1 = 0;        P2M0 = 0;        //设置为准双向口
  393.         P3M1 = 0;        P3M0 = 0;        //设置为准双向口
  394.         P4M1 = 0;        P4M0 = 0;        //设置为准双向口
  395.         P5M1 = 0;        P5M0 = 0;        //设置为准双向口
  396.         P6M1 = 0;        P6M0 = 0;        //设置为准双向口
  397.         P7M1 = 0;        P7M0 = 0;        //设置为准双向口




  398.         //*********************************中断3用于触发开关机************
  399.         INT_CLKO |= 0x20;  //使能外部中断3下降沿中断
  400.         //****************************************************************
  401.         display_index = 0;
  402.         AUXR |= 0x80;        //Timer0 set as 1T, 16 bits timer auto-reload,
  403.         TMOD &= 0xF0;                //设置定时器模式
  404.   TL0 = 0x00;//        TH0 = (u8)(Timer0_Reload / 256);
  405.   TH0 = 0xDC;//        TL0 = (u8)(Timer0_Reload % 256);
  406.         ET0 = 1;        //Timer0 interrupt enable
  407.         TR0 = 1;        //Timer0 run
  408.         EA = 1;                //打开总中断
  409.         TF0 = 0;
  410.         Thour   = 0;        //初始化时间值
  411.         Tminute = 0;
  412.         Tsecond = 0;
  413.         Tday= 0;
  414.         Tset= 0;
  415.         Tuse= 0;
  416.         Tleft= 0;
  417.     //

  418.         while(1)
  419.         {        
  420.   



  421. //        if(B_1ms){B_1ms = 0;if(++Tmsecond >= 75){Tmsecond = 0;RTC();}}//1秒到        250-255        254
  422.                         if(P27==0){b0click=1;}else{b0click=0;b0cflag=0;} if(b0click==1&&b0cflag==0){b0cflag=1;B0PressOnce=1;}  //b6      27
  423.                          if(P24==0){b1click=1;}else{b1click=0;b1cflag=0;} if(b1click==1&&b1cflag==0){b1cflag=1;B1PressOnce=1;beep=0;}  //up      22
  424.                         if(P23==0){b2click=1;}else{b2click=0;b2cflag=0;} if(b2click==1&&b2cflag==0){b2cflag=1;B2PressOnce=1;beep=1;}  //down    23
  425.                   if(P22==0){b3click=1;}else{b3click=0;b3cflag=0;} if(b3click==1&&b3cflag==0){b3cflag=1;B3PressOnce=1;}  //add           24
  426.                         if(P25==0){b4click=1;}else{b4click=0;b4cflag=0;} if(b4click==1&&b4cflag==0){b4cflag=1;B4PressOnce=1;}  //select         25
  427.                         if(P26==0){b5click=1;}else{b5click=0;b5cflag=0;} if(b5click==1&&b5cflag==0){b5cflag=1;B5PressOnce=1;}  //start/stop                26
  428. //                        if(P27==0){b6click=1;}else{b6click=0;b6cflag=0;} if(b6click==1&&b6cflag==0){b6cflag=1;B1PressOnce=1;}  //out bolus btn

  429.                         if(B0PressOnce==1){B0PressOnce=0;if(onoffflag==0){onoffflag=1;}else{onoffflag=0;}}
  430.                   
  431.                     if(onoffflag==1)
  432.                         {if(onoffstate==0){onoffstate=1;contrast=30;}//kaiji
  433.                         }else
  434.                         {if(onoffstate==1){onoffstate=0;contrast=0;}//guanji
  435.                         }

  436.                     if(counter1==1){LTclick=1;}else{LTclick=0;LTcflag=0;} if(LTclick==1&<cflag==0){LTcflag=1;LTPressOnce=1;}//lighton替换为counter1
  437.                         if(beep==0) {P16=1;}        else{P16=0;}
  438.                         if(run==0) {P17=1;}        else{P17=0;}
  439.                         if(bolusrun==0) {P17=1;}        else{P17=0;}
  440. //                        if(P14==0){counter1=0;}else{counter1=1;}//lighton替换为counter1

  441. //                        if(lightcount<infcount*Bolusvol+bolushandcount*Demandvol){P17=0;}else{P17=1;}
  442.                         VINF=infcount*Bolusvol+bolushandcount*Demandvol;
  443. if(motor_turn<170){P17=0;}else{P17=1;}
  444.                


  445.                     WriteCommand(0x81); //Sets V0
  446.                     WriteCommand(contrast); //恢复对比度

  447.                         if(pagenum==88)
  448.                         {         LcmClear(0x00);
  449.                           if(B1PressOnce==1){LcmPutStr(0,0,"1");run=1;}
  450.                           if(B2PressOnce==1){LcmPutStr(50,0,"2");run=0;}
  451.                           if(B3PressOnce==1){LcmPutStr(0,2,"3");}
  452.                           if(B4PressOnce==1){LcmPutStr(50,2,"4");}
  453.                           if(B5PressOnce==1){LcmPutStr(0,4,"5");}
  454.                                 if(lightcount<=20){run=0;}
  455.                                 LcmPutNum(100,6,motor_turn);
  456.                         }

  457.                         if(pagenum==1)
  458.                          {
  459.                           LcmPutStr(0,0,"Security Code");   
  460.                           LcmPutNum(10,3,secode1);
  461.                           LcmPutNum(30,3,secode2);
  462.                           LcmPutNum(50,3,secode3);
  463. //                          
  464.                           if(select==1){LcmPutStr(27,5,"^       ");}
  465.                           if(select==2){LcmPutStr(23,5,"   ^     ");}
  466.                           if(select==3){LcmPutStr(26,5,"     ^  ");}

  467.                           if(B2PressOnce==1)
  468.                           {
  469.                           B2PressOnce=0;
  470.                           if(select==1){if(secode1<9){secode1++; }else{secode1=0;}}
  471.                           if(select==2){if(secode2<9){secode2++; }else{secode2=0;}}
  472.                           if(select==3){if(secode3<9){secode3++; }else{secode3=0;}}
  473.                           }
  474.                           if(B3PressOnce==1)
  475.                           {
  476.                           B3PressOnce=0;
  477.                            if(select==1)      {select=2;}
  478.                             else if(select==2){select=3;}
  479.                                 else if(select==3){select=1;}
  480.                           }
  481.                           if(B4PressOnce==1)
  482.                           {
  483.                                  B4PressOnce=0;
  484.                                   if(secode1==1&&secode2==9&&secode3==1)
  485.                                           {
  486.                                            LcmPutStr(10,5,"Code Right");
  487.                                           DelayMS(20000);
  488.                                          pagenum=2;
  489.                                           LcmClear(0x00);
  490.                                           }
  491.                                 else
  492.                                         {
  493.                                          LcmPutStr(10,5,"Code Worror");
  494.                                           DelayMS(20000);
  495.                                           LcmPutStr(10,5,"           ");
  496.                                         }        
  497.                           }
  498. //                                         LcmPutNum(100,6,motor_turn);
  499.                           }


  500.                          if(pagenum==2)
  501.                         {
  502.                           LcmPutStr(0,0,"New Patient?");
  503.                           LcmPutStr(25,2,"YES");
  504.                           LcmPutStr(25,4,"NO");
  505.                           
  506.                           if(select_2==1){LcmPutStr(5,2,">");LcmPutStr(5,4,"  ");}
  507.                           if(select_2==2){LcmPutStr(5,4,">");LcmPutStr(5,2,"  ");}

  508.                           if(B3PressOnce==1)
  509.                           {
  510.                                   B3PressOnce=0;
  511.                             if(select_2==1)     {select_2=2;}
  512.                             else if(select_2==2){select_2=1;}
  513.                           }

  514.                           if(B4PressOnce==1)
  515.                           {
  516.                                   B4PressOnce=0;
  517.                                  if(select_2==1){pagenum=4;LcmClear(0x00);}
  518.                                  else {pagenum=3;LcmClear(0x00);}
  519.                           }
  520. //               LcmPutNum(100,6,motor_turn);      
  521.                         }



  522.                         if(pagenum==3)
  523.                         {
  524.                           LcmPutStr(0,0,"Review Mode");
  525.                           LcmPutStr(15,2,"Adjust Setting");         
  526.                           LcmPutStr(5,2,">");

  527.                           if(B4PressOnce==1)
  528.                           {
  529.                                   B4PressOnce=0;
  530.                                 pagenum=12;LcmClear(0x00);
  531.                           }
  532. //                 LcmPutNum(100,6,motor_turn);   
  533.                         }


  534.                         if(pagenum==4)
  535.                         {
  536.                           LcmPutStr(0,0,"Vol To Be Inf");
  537.                           LcmPutNum(5,3,secode1_4);
  538.                           LcmPutNum(25,3,secode2_4);
  539.                           LcmPutNum(46,3,secode3_4);
  540. //                          LcmPutNum(65,3,secode4_4);
  541.               LcmPutStr(100,3,"mls");                          

  542.                           if(select_4==1){LcmPutStr(22,5,"^           ");}
  543.                           if(select_4==2){LcmPutStr(18,5,"   ^        ");}
  544.                           if(select_4==3){LcmPutStr(21,5,"     ^      ");}
  545. //                          if(select_4==4){LcmPutStr(18,5,"        ^   ");}

  546.                           if(B2PressOnce==1)
  547.                           {
  548.                           B2PressOnce=0;
  549.                           if(select_4==1){if(secode1_4<9){secode1_4++; }else{secode1_4=0;}}
  550.                           if(select_4==2){if(secode2_4<9){secode2_4++; }else{secode2_4=0;}}
  551.                           if(select_4==3){if(secode3_4<9){secode3_4++; }else{secode3_4=0;}}
  552. //                          if(select_4==4){if(secode4_4<9){secode4_4++; }else{secode4_4=0;}}
  553.                           }
  554.                           VTBI=        secode1_4*100+secode2_4*10+secode3_4;
  555.                           if(B3PressOnce==1)
  556.                           {
  557.                           B3PressOnce=0;
  558.                            if(select_4==1)      {select_4=2;}
  559.                             else if(select_4==2){select_4=3;}
  560.                                 else if(select_4==3){select_4=1;}
  561. //                                else if(select_4==4){select_4=1;}
  562.                           }
  563.                           if(B4PressOnce==1)
  564.                           {
  565.                                  B4PressOnce=0;
  566.                                   if(secode1_4!=0||secode2_4!=0||secode3_4!=0)
  567.                                           {
  568.                                          pagenum=41;
  569.                                           LcmClear(0x00);
  570.                                           }
  571.                                 else
  572.                                         {
  573.                                          LcmPutStr(10,5,"Vol Error");
  574.                                           DelayMS(30000);
  575.                                           LcmPutStr(10,5,"           ");
  576.                                         }        
  577.                           }
  578. //                   LcmPutNum(100,6,motor_turn);  
  579.                         }


  580.                          if(pagenum==41)
  581.                         {
  582.                           LcmPutStr(0,0,"Dutation Days");
  583.                           LcmPutStr(23,3,"  ");
  584.                           LcmPutNum(25,3,seday_4);
  585.               LcmPutStr(80,3,"Days");                          
  586.                           if(B2PressOnce==1)
  587.                           {
  588.                           B2PressOnce=0;

  589.                            if(seday_4<10){seday_4++; }else{seday_4=1;}
  590.                           }

  591.                           if(B4PressOnce==1)
  592.                           {
  593.                                  B4PressOnce=0;
  594.                                 pagenum=5;
  595.                                  LcmClear(0x00);
  596.                           }
  597. //                LcmPutNum(100,6,motor_turn);     
  598.                         }
  599.                         

  600.                          if(pagenum==5)
  601.                         {
  602.                           LcmPutStr(0,0,"Infusion Type");
  603.               LcmPutStr(10,2,"-PIB+Demand");        
  604.                           LcmPutStr(15,4,"-Library");
  605.                           LcmPutStr(20,6,"YES");
  606.                           LcmPutStr(70,6,"NO");                          
  607.                           
  608.                           if(select_5==1){LcmPutStr(5,6,">");LcmPutStr(55,6,"  ");}
  609.                           if(select_5==2){LcmPutStr(55,6,">");LcmPutStr(5,6,"  ");}

  610.                           if(B3PressOnce==1)
  611.                           {
  612.                                   B3PressOnce=0;
  613.                             if(select_5==1)     {select_5=2;}
  614.                             else if(select_5==2){select_5=1;}
  615.                           }

  616.                           if(B4PressOnce==1)
  617.                           {
  618.                                  B4PressOnce=0;
  619.                 if(select_5==1){pagenum=10;LcmClear(0x00);}
  620.                                 else {pagenum=6;LcmClear(0x00);}
  621.                           }
  622. //                LcmPutNum(100,6,motor_turn);   
  623.                         }
  624.                         

  625.                         if(pagenum==6)
  626.                         {
  627.                           LcmPutStr(0,0,"PIB Bolus Volume");
  628.               LcmPutNum(5,2,Bolusvol);        
  629.                           LcmPutStr(60,2,"mls");

  630.                           LcmPutStr(0,4,"PIB Bolus Interval");
  631.                           LcmPutStr(4,6,"  ");
  632.               LcmPutNum(5,6,BolusTime);        
  633.                           LcmPutStr(60,6,"hrs");
  634.                                             
  635.                           if(select_6==1){LcmPutStr(5,2,"> ");LcmPutStr(5,6," ");}
  636.                           if(select_6==2){LcmPutStr(5,6,">");LcmPutStr(5,2," ");}

  637.                           if(B2PressOnce==1)
  638.                           {
  639.                           B2PressOnce=0;
  640.                           if(select_6==1){if(Bolusvol<15){Bolusvol++; }else{Bolusvol=0;}}
  641.                           if(select_6==2){if(BolusTime<12){BolusTime++; }else{BolusTime=1;}}
  642.                           }

  643.                           if(B3PressOnce==1)
  644.                           {
  645.                                   B3PressOnce=0;
  646.                             if(select_6==1)     {select_6=2;}
  647.                             else if(select_6==2){select_6=1;}
  648.                           }

  649.                           if(B4PressOnce==1)
  650.                           {
  651.                                  B4PressOnce=0;
  652.                                 pagenum=8;
  653.                                 LcmClear(0x00);
  654.                           }
  655. //                 LcmPutNum(100,6,motor_turn);   
  656.                         }
  657.                         

  658.                         if(pagenum==8)
  659.                         {
  660.                           LcmPutStr(4,2,"  ");
  661.                           if(select_8==1){LcmPutStr(5,2,">");}else{LcmPutStr(5,2," ");}
  662.                           if(select_8==2){LcmPutStr(21,6,"_");}
  663.                           if(select_8==3){LcmPutStr(41,6,"_");}        
  664.                           if(select_8==4){LcmPutStr(61,6,"_");}        
  665.                           DelayMS(100);//0.01s
  666.                           LcmPutStr(0,0,"Demand Volume");
  667.               LcmPutNum(5,2,Demandvol);        
  668.                           LcmPutStr(80,2,"mls");

  669.                           LcmPutStr(0,4,"Lockout Time");
  670.         
  671.                           LcmPutStr(80,6,"min");

  672.                           LcmPutNum(5,6,secode1_8);
  673.                           LcmPutNum(25,6,secode2_8);
  674.                           LcmPutNum(45,6,secode3_8);
  675.                           DelayMS(300);//0.03s
  676.                                     

  677.                           if(B2PressOnce==1)
  678.                           {
  679.                           B2PressOnce=0;
  680.                           if(select_8==1){if(Demandvol<15){Demandvol++; }else{Demandvol=0;}}
  681.                           if(select_8==2){if(secode1_8<1){secode1_8++; }else{secode1_8=0;}}
  682.                           if(select_8==3){if(secode1_8==1){if(secode2_8<2){secode2_8++; }else{secode2_8=0;}} else if(secode2_8<9){secode2_8++; }else{secode2_8=0;}}
  683.                           if(select_8==4){if(secode1_8==1&&secode2_8==2){secode3_8=0;} else {if(secode3_8<9){secode3_8++; }else{secode3_8=0;}}}
  684.                           }

  685.                           if(secode1_8*100+secode2_8*10+secode3_8>=120)        {secode1_8=1;secode2_8=2;secode3_8=0;}
  686.                           LockoutTime=secode1_8*100+secode2_8*10+secode3_8;



  687.                           if(B3PressOnce==1)
  688.                           {
  689.                                   B3PressOnce=0;
  690.                             if(select_8==1)     {select_8=2;}
  691.                             else if(select_8==2){select_8=3;}
  692.                                 else if(select_8==3){select_8=4;}
  693.                                 else if(select_8==4){select_8=1;}
  694.                           }
  695.                           if(B4PressOnce==1)
  696.                           {
  697.                                  B4PressOnce=0;
  698.                                 pagenum=10;
  699.                                 LcmClear(0x00);
  700.                           }
  701. //         LcmPutNum(100,6,motor_turn);
  702.                         }                                 
  703.                         
  704.                           

  705.                          if(pagenum==10)
  706.                         {
  707.                           LcmPutStr(0,0,"Secondary Porgram?");
  708.                           LcmPutStr(25,4,"YES");
  709.                           LcmPutStr(25,6,"NO");
  710.                           
  711.                           if(select_10==1){LcmPutStr(5,4,">");LcmPutStr(5,6,"  ");}
  712.                           if(select_10==2){LcmPutStr(5,6,">");LcmPutStr(5,4,"  ");}

  713.                           if(B3PressOnce==1)
  714.                           {
  715.                                   B3PressOnce=0;
  716.                             if(select_10==1)     {select_10=2;}
  717.                             else if(select_10==2){select_10=1;}
  718.                           }

  719.                           if(B4PressOnce==1)
  720.                           {
  721.                                   B4PressOnce=0;
  722.                                  if(select_10==1){pagenum=11;LcmClear(0x00);}
  723.                                  else {pagenum=12;LcmClear(0x00);}
  724.                           }
  725. //                 LcmPutNum(100,6,motor_turn);   
  726.                         }


  727.                         if(pagenum==11)
  728.                         {
  729.                           LcmPutStr(0,0,"Set Day To Begin");
  730.                           LcmPutStr(23,3,"  ");
  731.                           LcmPutNum(25,3,seday_10);
  732.               LcmPutStr(80,3,"Days");
  733.                           LcmPutStr(0,6,"PIB+Demand");                          
  734.                           if(B2PressOnce==1)
  735.                           {
  736.                           B2PressOnce=0;

  737.                            if(seday_10<4){seday_10++; }else{seday_10=1;}
  738.                           }

  739.                           if(B4PressOnce==1)
  740.                           {
  741.                                  B4PressOnce=0;
  742.                                 pagenum=12;
  743.                                  LcmClear(0x00);
  744.                                 LcmPutStr(0,2,"confirm your input");
  745.                                 DelayMS(30000);
  746.                                                                                                            
  747.                           }
  748. //                 LcmPutNum(100,6,motor_turn);   
  749.                         }


  750.                         if(pagenum==12)
  751.                         {
  752.                            LcmPutStr(0,0,"Vol To Be Inf");
  753.                            LcmPutNum(25,2,VTBI);

  754.                            LcmPutStr(80,2,"mls");
  755.                            LcmPutStr(90,6,"1/7");
  756.                            if(B4PressOnce==1)
  757.                           {
  758.                                  B4PressOnce=0;
  759.                                 pagenum=13;
  760.                                  LcmClear(0x00);
  761.                           }
  762. //                                 LcmPutNum(100,6,motor_turn);
  763.                         }

  764.                         if(pagenum==13)
  765.                         {

  766.                            LcmPutStr(0,0,"Dutation Days");
  767.                            LcmPutNum(25,2,seday_4);
  768.                            LcmPutStr(80,2,"Days");
  769.                            LcmPutStr(90,6,"2/7");
  770.                            if(B4PressOnce==1)
  771.                           {
  772.                                  B4PressOnce=0;
  773.                                 pagenum=14;
  774.                                  LcmClear(0x00);
  775.                           }
  776. //                                 LcmPutNum(100,6,motor_turn);
  777.                         }

  778.                         if(pagenum==14)
  779.                         {

  780.                            LcmPutStr(0,0,"Bolus Volume");
  781.                            LcmPutNum(25,2,Bolusvol);
  782.                            LcmPutStr(80,2,"mls");
  783.                            LcmPutStr(90,6,"3/7");
  784.                            if(B4PressOnce==1)
  785.                           {
  786.                                  B4PressOnce=0;
  787.                                 pagenum=15;
  788.                                  LcmClear(0x00);
  789.                           }
  790. //                                 LcmPutNum(100,6,motor_turn);
  791.                         }
  792.                         if(pagenum==15)
  793.                         {

  794.                            LcmPutStr(0,0,"Bolus Interval");
  795.                            LcmPutNum(25,2,BolusTime);
  796.                            LcmPutStr(80,2,"hrs");
  797.                            LcmPutStr(90,6,"4/7");
  798.                            if(B4PressOnce==1)
  799.                           {
  800.                                  B4PressOnce=0;
  801.                                 pagenum=16;
  802.                                  LcmClear(0x00);
  803.                           }
  804. //                         LcmPutNum(100,6,motor_turn);
  805.                         }

  806.                         if(pagenum==16)
  807.                         {

  808.                            LcmPutStr(0,0,"Demand Volume");
  809.                            LcmPutNum(25,2,Demandvol);
  810.                            LcmPutStr(80,2,"mls");
  811.                            LcmPutStr(90,6,"5/7");
  812.                            if(B4PressOnce==1)
  813.                           {
  814.                                  B4PressOnce=0;
  815.                                 pagenum=17;
  816.                                  LcmClear(0x00);
  817.                           }
  818. //                         LcmPutNum(100,6,motor_turn);
  819.                         }

  820.                         if(pagenum==17)
  821.                         {

  822.                            LcmPutStr(0,0,"Lockout Time");
  823.                            LcmPutNum(25,2,LockoutTime);
  824.                            LcmPutStr(80,2,"min");
  825.                            LcmPutStr(90,6,"6/7");
  826.                            if(B4PressOnce==1)
  827.                           {
  828.                                  B4PressOnce=0;
  829.                                 pagenum=18;
  830.                                  LcmClear(0x00);
  831.                           }
  832. //                         LcmPutNum(100,6,motor_turn);
  833.                         }

  834.                         if(pagenum==18)
  835.                         {

  836.                            LcmPutStr(0,0,"Set Day To Begin");
  837.                            LcmPutNum(25,2,seday_10);
  838.                            LcmPutStr(80,2,"Days");
  839.                            LcmPutStr(90,6,"7/7");
  840.                            if(B4PressOnce==1)
  841.                           {
  842.                                  B4PressOnce=0;
  843.                                 pagenum=12;
  844.                                  LcmClear(0x00);
  845.                           }
  846.                           confirmflag=1;
  847. //                         LcmPutNum(100,6,motor_turn);
  848.                         }
  849.                           
  850.                          if(b5click==0)
  851.                          {
  852.                          if(pagenum>=12)
  853.                          {
  854.                           confirmflag=1;}startcount=0;
  855.                          }

  856.                          if(b5click==1&&confirmflag==1)
  857.                          {
  858.                         
  859.                          DelayMS(5000);
  860.                          startcount++;

  861.                           if(startcount==6)
  862.                           {

  863.                                 
  864.                                 if(stateflag==0)
  865.                                 {
  866.                                         if(select_10==1)
  867.                                                 {
  868.                                                         pagenum=20;Thour=0;Tminute=0;Tsecond=0;Tday=0;
  869.                                 dis_time_buf[13]=0x00;
  870.                                 time_buf[6]=0x00;
  871.                                 ds1302_write_byte(ds1302_control_add,0x00);                        //关闭写保护
  872.                                 ds1302_write_byte(ds1302_sec_add,time_buf[6]);                //秒
  873.                                 ds1302_write_byte(ds1302_control_add,0x80);                        //打开写保护
  874.             }   //ds1302秒置零
  875.                                         else
  876.             {
  877.                                                   pagenum=21;Thour=0;Tminute=0;Tsecond=0;Tday=0;
  878.                                 dis_time_buf[13]=0x00;
  879.                                 time_buf[6]=0x00;
  880.                                 ds1302_write_byte(ds1302_control_add,0x00);                        //关闭写保护
  881.                                 ds1302_write_byte(ds1302_sec_add,time_buf[6]);                //秒
  882.                                 ds1302_write_byte(ds1302_control_add,0x80);                        //打开写保护                                         
  883.                                                 }
  884.                                         stateflag=1;LcmClear(0x00);
  885.                                 }
  886.                                 else if(stateflag==1){TR0 = 0;LcmPutStr(0,6,"SYS IS SUSPEND");stateflag=2;}
  887.                                 else if(stateflag==2){TR0 = 1;LcmPutStr(0,6,"              ");stateflag=1;}
  888.                                 
  889.                                 confirmflag=0;
  890.                           }
  891.                           if(b5click==0&&startcount<6)
  892.                           {
  893.                              startcount=0;
  894.                }
  895.                    }





  896.                           if(pagenum==20) //wait for the start secondary program
  897.                         {  
  898.                                  seday_10=4;
  899.                            runtime=Tday*24*60+Thour*60+Tminute;    //u16  u8
  900.                            Tset=seday_10*24*60;       //u32    Uchar
  901.                            Tuse=runtime;             //u32  u16
  902.                            Tleft=Tset-Tuse;
  903.                            
  904.                            if(Tleft>1440){LcmPutNum(30,2,(Tleft/1440));}else{LcmPutNum(30,2,0);}LcmPutStr(55,2,"d");
  905.                             if(Tleft/60>24){LcmPutNum(60,2,(Tleft/60)%24);}else{LcmPutNum(60,2,Tleft/60);}LcmPutStr(85,2,"h");
  906.                                 LcmPutNum(90,2,Tleft%60);LcmPutStr(115,2,"m");


  907.                         LcmPutStr(0,0,"waitforthestart");


  908.                          if(runtime>=seday_10*24*60)
  909.                          {pagenum=21;delaytime=0;LcmClear(0x00);
  910.                          Thour=0;Tminute=0;Tsecond=0;Tday=0;
  911.                                 dis_time_buf[13]=0x00;
  912.                                 time_buf[6]=0x00;
  913.                                 ds1302_write_byte(ds1302_control_add,0x00);                        //关闭写保护
  914.                                 ds1302_write_byte(ds1302_sec_add,time_buf[6]);                //秒
  915.                                 ds1302_write_byte(ds1302_control_add,0x80);                        //打开写保护
  916.                          }
  917. //                         LcmPutNum(100,6,motor_turn);
  918.                         }

  919.                                                                                                                                                                                                                            

  920.                          if(pagenum==21)  
  921.                         {
  922.                           
  923. //                           lighton                           
  924.                            runtime=Tday*24*60+Thour*60+Tminute;
  925.                            Tset=seday_4*24*60;
  926.                            Tuse=runtime;
  927.                            Tleft=Tset-Tuse;

  928.                            if(VINF<=VTBI&&runtime<=(seday_4*24*60))
  929.                            {
  930.                             LcmPutNum(10,0,VINF);        LcmPutStr(50,0,"/");LcmPutNum(70,0,VTBI);LcmPutStr(105,0,"ml");        //has been infused /  to be infuse
  931.                             LcmPutStr(0,2,"PIB");
  932.                             if(Tleft>1440){LcmPutNum(30,2,(Tleft/1440));}else{LcmPutNum(30,2,0);}LcmPutStr(55,2,"d");
  933.                             if(Tleft/60>24){LcmPutNum(60,2,(Tleft/60)%24);}else{LcmPutNum(60,2,Tleft/60);}LcmPutStr(85,2,"h");
  934.                                 LcmPutNum(90,2,Tleft%60);LcmPutStr(115,2,"m");
  935.                                 LcmPutStr(0,4,"Dem");


  936.                                 
  937.                                 lockouttime=Tlockm;
  938.                            if(lockouttime>=LockoutTime){lockflag=1;}else{lockflag=0;}
  939.                            if(lockflag==1){LcmPutStr(60,4,"ready   ");}else{LcmPutStr(60,4,"unready");}
  940.                            if(B1PressOnce==1){B1PressOnce=0;if(lockflag==1){Tlockm=0;bolushandcount++;}}
  941.                            if(LTPressOnce==1){LTPressOnce=0;lightcount++;}
  942.                            
  943.                            infcount=runtime/(BolusTime*60);



  944.                           LcmPutNum(10,6,Thour);
  945.                           LcmPutNum(40,6,Tminute);
  946.                           LcmPutNum(70,6,Tsecond);

  947.                                  //                            LcmPutNum(0,6,stateflag);           LcmPutNum(50,6,bolushandcount);  LcmPutNum(90,6,lightcount);





  948.                            }else
  949.                            {
  950.                                 LcmClear(0x00);LcmPutStr(50,0,"Infuse has been finshed");
  951. //                                beep=0;DelayMS(5000);beep=1;DelayMS(5000);
  952.                            }
  953. //                                                   LcmPutNum(100,6,motor_turn);


  954.                         }



  955. //                        LcmPutNum(100,6,pagenum);
  956. //                        LcmClear(0xff);                                                                                                                                 


  957.    
  958.         
  959. }
  960. }

  961.    

  962. /********************** Timer0 1ms中断函数 ************************/
  963. void timer0 (void) interrupt TIMER0_VECTOR
  964. {
  965.         B_1ms = 1;                //1ms标志
  966. }
  967. /********************* INT3中断函数 *************************/
  968. void INT3_int (void) interrupt INT3_VECTOR                //进中断时已经清除标志
  969. {
  970. //  INT_CLKO &= 0xDF; //若需要手动清除中断标志,可先关闭中断,此时系统会自动清除内部中断标志
  971.   interrupt_counter++;  //中断次数计数

  972. }

  973. void tm0_isr() interrupt 1           //中断入口
  974. {
  975. //  interrupt_counter1++;  //中断次数计数
  976.    
  977.   TL0 = 0x00;                        //设定定时器初值
  978.         TH0 = 0xDC;                        //设定定时器初值
  979.   //每500us进行中断,输出取反,即1ms周期的方波
  980.           t++;

  981.          if(t==400)               //间隔200ms(50ms*4)读取一次时间
  982.   {

  983.    t=0;
  984.    ds1302_read_time();  //读取时间
  985. //   dis_time_buf[0]=(time_buf[0]>>4); //年   
  986. //   dis_time_buf[1]=(time_buf[0]&0x0f);
  987. //   
  988. //   dis_time_buf[2]=(time_buf[1]>>4);   
  989. //   dis_time_buf[3]=(time_buf[1]&0x0f);
  990. //  

  991. //   
  992. //   
  993. //   dis_time_buf[4]=(time_buf[2]>>4); //月  
  994. //   dis_time_buf[5]=(time_buf[2]&0x0f);
  995. //   

  996. //   dis_time_buf[6]=(time_buf[3]>>4); //日   
  997. //   dis_time_buf[7]=(time_buf[3]&0x0f);
  998. //   
  999. //   dis_time_buf[14]=(time_buf[7]&0x07); //星期
  1000. //   
  1001. //   //第2行显示  
  1002. //   dis_time_buf[8]=(time_buf[4]>>4); //时   
  1003. //   dis_time_buf[9]=(time_buf[4]&0x0f);   

  1004. //  

  1005. //   dis_time_buf[10]=(time_buf[5]>>4); //分   
  1006. //   dis_time_buf[11]=(time_buf[5]&0x0f);   

  1007.    dis_time_buf[12]=(time_buf[6]>>4); //秒   
  1008.    dis_time_buf[13]=(time_buf[6]&0x0f);
  1009.          
  1010.                   if((dis_time_buf[12]+'0')=='0'&&(dis_time_buf[13]+'0')=='1')  
  1011.                         {
  1012.                                 Tmsecond=0;
  1013.                                 RTC();
  1014.                                 dis_time_buf[13]=0x00;
  1015.                                 time_buf[6]=0x00;
  1016.                                 ds1302_write_byte(ds1302_control_add,0x00);                        //关闭写保护
  1017.                                 ds1302_write_byte(ds1302_sec_add,time_buf[6]);                //秒
  1018.                                 ds1302_write_byte(ds1302_control_add,0x80);                        //打开写保护  
  1019.                         }

  1020. // ******************电机转圈计数********************
  1021.         counter2=counter1;//保存上次状态
  1022.         counter1 = turn_counter;
  1023.         if((counter1==0)&&(counter2==1))//下降沿      //电机转动圈数超999时,千位会以字母表示?
  1024.         {
  1025.                 motor_turn++; //电机转动圈数
  1026.         }
  1027. //***************************************************        
  1028.   }
  1029. }



  1030. /* ASICC 字库代码 8x16 点阵 */
  1031. unsigned char code ASCIIchardot[16*96] = {
  1032. /*-- 文字: --*/
  1033. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1034. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1035. /*-- 文字: ! --*/
  1036. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1037. 0x00,0x00,0x0E,0x1F,0x1F,0x0E,0x00,0x00,0x00,0x00,0x00,0xB0,0xB0,0x00,0x00,0x00,
  1038. /*-- 文字: " --*/
  1039. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1040. 0x00,0x1C,0x1C,0x00,0x00,0x1C,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1041. /*-- 文字: # --*/
  1042. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1043. 0x00,0x04,0x1F,0x1F,0x04,0x1F,0x1F,0x04,0x00,0x40,0xF0,0xF0,0x40,0xF0,0xF0,0x40,
  1044. /*-- 文字: $ --*/
  1045. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1046. 0x00,0x0C,0x1E,0x73,0x71,0x18,0x08,0x00,0x00,0x20,0x30,0x1C,0x9C,0xF0,0x60,0x00,
  1047. /*-- 文字: % --*/
  1048. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1049. 0x18,0x3C,0x24,0x3D,0x1B,0x06,0x0C,0x00,0x00,0x60,0xC0,0xB0,0x78,0x48,0x78,0x30,
  1050. /*-- 文字: & --*/
  1051. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1052. 0x00,0x0D,0x1F,0x12,0x1E,0x0C,0x00,0x00,0x00,0xE0,0xF0,0x10,0x90,0xE0,0xF0,0x90,
  1053. /*-- 文字: ' --*/
  1054. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1055. 0x00,0x00,0x00,0x1C,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1056. /*-- 文字: ( --*/
  1057. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1058. 0x00,0x00,0x03,0x0F,0x1C,0x10,0x00,0x00,0x00,0x00,0xE0,0xF8,0x1C,0x04,0x00,0x00,
  1059. /*-- 文字: ) --*/
  1060. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1061. 0x00,0x00,0x10,0x1C,0x0F,0x03,0x00,0x00,0x00,0x00,0x04,0x1C,0xF8,0xE0,0x00,0x00,
  1062. /*-- 文字: * --*/
  1063. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1064. 0x00,0x01,0x05,0x07,0x03,0x07,0x05,0x01,0x00,0x00,0x40,0xC0,0x80,0xC0,0x40,0x00,
  1065. /*-- 文字: + --*/
  1066. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1067. 0x00,0x01,0x01,0x07,0x07,0x01,0x01,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,
  1068. /*-- 文字: , --*/
  1069. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1070. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x3C,0x38,0x00,0x00,
  1071. /*-- 文字: - --*/
  1072. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1073. 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1074. /*-- 文字: . --*/
  1075. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1076. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,
  1077. /*-- 文字: / --*/
  1078. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1079. 0x00,0x00,0x00,0x01,0x07,0x1E,0x18,0x00,0x00,0x18,0x78,0xE0,0x80,0x00,0x00,0x00,
  1080. /*-- 文字: 0 --*/
  1081. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1082. 0x00,0x00,0x0F,0x1F,0x10,0x16,0x1F,0x0F,0x00,0x00,0xE0,0xF0,0xD0,0x10,0xF0,0xE0,
  1083. /*-- 文字: 1 --*/
  1084. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1085. 0x00,0x04,0x04,0x0C,0x1F,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xF0,0x00,0x00,
  1086. /*-- 文字: 2 --*/
  1087. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1088. 0x00,0x0C,0x1C,0x10,0x11,0x1F,0x0E,0x00,0x00,0x30,0x70,0xD0,0x90,0x10,0x10,0x00,
  1089. /*-- 文字: 3 --*/
  1090. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1091. 0x00,0x0C,0x1C,0x11,0x11,0x1F,0x0E,0x00,0x00,0x60,0x70,0x10,0x10,0xF0,0xE0,0x00,
  1092. /*-- 文字: 4 --*/
  1093. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1094. 0x00,0x00,0x1F,0x1F,0x00,0x07,0x07,0x00,0x00,0xC0,0xC0,0x40,0x40,0xF0,0xF0,0x40,
  1095. /*-- 文字: 5 --*/
  1096. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1097. 0x00,0x1F,0x1F,0x11,0x11,0x11,0x10,0x00,0x00,0x10,0x10,0x10,0x30,0xE0,0xC0,0x00,
  1098. /*-- 文字: 6 --*/
  1099. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1100. 0x00,0x03,0x07,0x1E,0x1A,0x13,0x01,0x00,0x00,0xE0,0xF0,0x10,0x10,0xF0,0xE0,0x00,
  1101. /*-- 文字: 7 --*/
  1102. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1103. 0x00,0x10,0x10,0x11,0x17,0x1E,0x18,0x00,0x00,0x00,0x70,0xF0,0x80,0x00,0x00,0x00,
  1104. /*-- 文字: 8 --*/
  1105. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1106. 0x00,0x0E,0x1F,0x13,0x11,0x1F,0x0E,0x00,0x00,0xE0,0xF0,0x10,0x90,0xF0,0xE0,0x00,
  1107. /*-- 文字: 9 --*/
  1108. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1109. 0x00,0x0F,0x1F,0x10,0x10,0x1F,0x0F,0x00,0x00,0x00,0x90,0xB0,0xF0,0xC0,0x80,0x00,
  1110. /*-- 文字: : --*/
  1111. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1112. 0x00,0x00,0x00,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,
  1113. /*-- 文字: ; --*/
  1114. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1115. 0x00,0x00,0x00,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x34,0x3C,0x38,0x00,0x00,
  1116. /*-- 文字: < --*/
  1117. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1118. 0x00,0x01,0x03,0x06,0x0C,0x18,0x10,0x00,0x00,0x00,0x80,0xC0,0x60,0x30,0x10,0x00,
  1119. /*-- 文字: = --*/
  1120. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1121. 0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,
  1122. /*-- 文字: > --*/
  1123. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1124. 0x00,0x10,0x18,0x0C,0x06,0x03,0x01,0x00,0x00,0x10,0x30,0x60,0xC0,0x80,0x00,0x00,
  1125. /*-- 文字: ? --*/
  1126. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1127. 0x00,0x0C,0x1C,0x11,0x13,0x1E,0x0C,0x00,0x00,0x00,0x00,0xB0,0xB0,0x00,0x00,0x00,
  1128. /*-- 文字: @ --*/
  1129. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1130. 0x0F,0x1F,0x10,0x11,0x13,0x12,0x1F,0x0F,0xE0,0xF0,0x10,0x90,0xD0,0x50,0xD0,0xD0,
  1131. /*-- 文字: A --*/
  1132. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1133. 0x00,0x07,0x0F,0x18,0x18,0x0F,0x07,0x00,0x00,0xF0,0xF0,0x80,0x80,0xF0,0xF0,0x00,
  1134. /*-- 文字: B --*/
  1135. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1136. 0x00,0x1F,0x1F,0x11,0x11,0x1F,0x0E,0x00,0x00,0xF0,0xF0,0x10,0x10,0xF0,0xE0,0x00,
  1137. /*-- 文字: C --*/
  1138. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1139. 0x00,0x0F,0x1F,0x10,0x10,0x1C,0x0C,0x00,0x00,0xE0,0xF0,0x10,0x10,0x70,0x60,0x00,
  1140. /*-- 文字: D --*/
  1141. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1142. 0x00,0x1F,0x1F,0x10,0x18,0x0F,0x07,0x00,0x00,0xF0,0xF0,0x10,0x30,0xE0,0xC0,0x00,
  1143. /*-- 文字: E --*/
  1144. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1145. 0x00,0x1F,0x1F,0x11,0x11,0x11,0x10,0x00,0x00,0xF0,0xF0,0x10,0x10,0x10,0x10,0x00,
  1146. /*-- 文字: F --*/
  1147. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1148. 0x00,0x1F,0x1F,0x11,0x11,0x11,0x10,0x00,0x00,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,
  1149. /*-- 文字: G --*/
  1150. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1151. 0x00,0x0F,0x1F,0x10,0x10,0x1C,0x0C,0x00,0x00,0xE0,0xF0,0x10,0x90,0xF0,0xF0,0x00,
  1152. /*-- 文字: H --*/
  1153. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1154. 0x00,0x1F,0x1F,0x01,0x01,0x1F,0x1F,0x00,0x00,0xF0,0xF0,0x00,0x00,0xF0,0xF0,0x00,
  1155. /*-- 文字: I --*/
  1156. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1157. 0x00,0x00,0x10,0x1F,0x1F,0x10,0x00,0x00,0x00,0x00,0x10,0xF0,0xF0,0x10,0x00,0x00,
  1158. /*-- 文字: J --*/
  1159. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1160. 0x00,0x00,0x00,0x00,0x00,0x1F,0x1F,0x00,0x00,0x60,0x70,0x10,0x10,0xF0,0xE0,0x00,
  1161. /*-- 文字: K --*/
  1162. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1163. 0x00,0x1F,0x1F,0x01,0x07,0x1E,0x18,0x00,0x00,0xF0,0xF0,0x00,0xC0,0xF0,0x30,0x00,
  1164. /*-- 文字: L --*/
  1165. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1166. 0x00,0x1F,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xF0,0x10,0x10,0x10,0x10,0x00,
  1167. /*-- 文字: M --*/
  1168. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1169. 0x00,0x1F,0x1F,0x04,0x03,0x04,0x1F,0x1F,0x00,0xF0,0xF0,0x00,0x80,0x00,0xF0,0xF0,
  1170. /*-- 文字: N --*/
  1171. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1172. 0x00,0x1F,0x1F,0x06,0x03,0x01,0x1F,0x1F,0x00,0xF0,0xF0,0x00,0x00,0x80,0xF0,0xF0,
  1173. /*-- 文字: O --*/
  1174. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1175. 0x00,0x0F,0x1F,0x10,0x10,0x1F,0x0F,0x00,0x00,0xE0,0xF0,0x10,0x10,0xF0,0xE0,0x00,
  1176. /*-- 文字: P --*/
  1177. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1178. 0x00,0x1F,0x1F,0x11,0x11,0x1F,0x0E,0x00,0x00,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,
  1179. /*-- 文字: Q --*/
  1180. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1181. 0x00,0x0F,0x1F,0x10,0x10,0x1F,0x0F,0x00,0x00,0xE0,0xF0,0x10,0x18,0xFC,0xE4,0x00,
  1182. /*-- 文字: R --*/
  1183. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1184. 0x00,0x1F,0x1F,0x11,0x11,0x1F,0x0E,0x00,0x00,0xF0,0xF0,0x00,0x80,0xF0,0x70,0x00,
  1185. /*-- 文字: S --*/
  1186. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1187. 0x00,0x0C,0x1E,0x13,0x11,0x18,0x08,0x00,0x00,0x20,0x30,0x10,0x90,0xF0,0x60,0x00,
  1188. /*-- 文字: T --*/
  1189. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1190. 0x00,0x10,0x10,0x1F,0x1F,0x10,0x10,0x00,0x00,0x00,0x00,0xF0,0xF0,0x00,0x00,0x00,
  1191. /*-- 文字: U --*/
  1192. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1193. 0x00,0x1F,0x1F,0x00,0x00,0x1F,0x1F,0x00,0x00,0xE0,0xF0,0x10,0x10,0xF0,0xE0,0x00,
  1194. /*-- 文字: V --*/
  1195. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1196. 0x00,0x1F,0x1F,0x00,0x00,0x1F,0x1F,0x00,0x00,0xC0,0xE0,0x30,0x30,0xE0,0xC0,0x00,
  1197. /*-- 文字: W --*/
  1198. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1199. 0x00,0x1F,0x1F,0x00,0x03,0x00,0x1F,0x1F,0x00,0x80,0xF0,0x70,0x80,0x70,0xF0,0x80,
  1200. /*-- 文字: X --*/
  1201. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1202. 0x00,0x18,0x1C,0x07,0x03,0x1C,0x18,0x00,0x00,0x70,0xF0,0x00,0x80,0xF0,0x70,0x00,
  1203. /*-- 文字: Y --*/
  1204. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1205. 0x00,0x1E,0x1F,0x01,0x01,0x1F,0x1E,0x00,0x00,0x00,0x00,0xF0,0xF0,0x00,0x00,0x00,
  1206. /*-- 文字: Z --*/
  1207. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1208. 0x00,0x10,0x10,0x11,0x13,0x1E,0x1C,0x00,0x00,0x70,0xF0,0x90,0x10,0x10,0x10,0x00,
  1209. /*-- 文字: [ --*/
  1210. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1211. 0x00,0x00,0x1F,0x1F,0x10,0x10,0x00,0x00,0x00,0x00,0xFE,0xFE,0x02,0x02,0x00,0x00,
  1212. /*-- 文字: \ --*/
  1213. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1214. 0x00,0x18,0x1E,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xE0,0x78,0x18,0x00,
  1215. /*-- 文字: ] --*/
  1216. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1217. 0x00,0x00,0x10,0x10,0x1F,0x1F,0x00,0x00,0x00,0x00,0x02,0x02,0xFE,0xFE,0x00,0x00,
  1218. /*-- 文字: ^ --*/
  1219. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1220. 0x00,0x10,0x30,0x60,0x60,0x30,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1221. /*-- 文字: _ --*/
  1222. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1223. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
  1224. /*-- 文字: ` --*/
  1225. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1226. 0x00,0x00,0x40,0x60,0x70,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1227. /*-- 文字: a --*/
  1228. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1229. 0x00,0x00,0x04,0x04,0x04,0x07,0x03,0x00,0x00,0x60,0xF0,0x90,0x90,0xF0,0xF0,0x00,
  1230. /*-- 文字: b --*/
  1231. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1232. 0x00,0x1F,0x1F,0x04,0x04,0x07,0x03,0x00,0x00,0xF0,0xF0,0x10,0x10,0xF0,0xE0,0x00,
  1233. /*-- 文字: c --*/
  1234. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1235. 0x00,0x03,0x07,0x04,0x04,0x06,0x02,0x00,0x00,0xE0,0xF0,0x10,0x10,0x30,0x20,0x00,
  1236. /*-- 文字: d --*/
  1237. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1238. 0x00,0x03,0x07,0x04,0x04,0x1F,0x1F,0x00,0x00,0xE0,0xF0,0x10,0x10,0xF0,0xF0,0x00,
  1239. /*-- 文字: e --*/
  1240. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1241. 0x00,0x03,0x07,0x04,0x04,0x07,0x03,0x00,0x00,0xE0,0xF0,0x90,0x90,0x90,0x80,0x00,
  1242. /*-- 文字: f --*/
  1243. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1244. 0x00,0x01,0x0F,0x1F,0x11,0x11,0x11,0x00,0x00,0x00,0xF0,0xF0,0x00,0x00,0x00,0x00,
  1245. /*-- 文字: g --*/
  1246. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1247. 0x00,0x03,0x07,0x04,0x04,0x07,0x07,0x00,0x00,0xE2,0xF2,0x12,0x12,0xFE,0xFC,0x00,
  1248. /*-- 文字: h --*/
  1249. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1250. 0x00,0x1F,0x1F,0x04,0x04,0x07,0x03,0x00,0x00,0xF0,0xF0,0x00,0x00,0xF0,0xF0,0x00,
  1251. /*-- 文字: i --*/
  1252. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1253. 0x00,0x04,0x04,0x37,0x37,0x00,0x00,0x00,0x00,0x10,0x10,0xF0,0xF0,0x10,0x10,0x00,
  1254. /*-- 文字: j --*/
  1255. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1256. 0x00,0x00,0x04,0x04,0x37,0x37,0x00,0x00,0x00,0x02,0x02,0x02,0xFE,0xFC,0x00,0x00,
  1257. /*-- 文字: k --*/
  1258. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1259. 0x00,0x1F,0x1F,0x00,0x01,0x07,0x06,0x00,0x00,0xF0,0xF0,0x80,0xC0,0x70,0x30,0x00,
  1260. /*-- 文字: l --*/
  1261. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1262. 0x00,0x10,0x10,0x1F,0x1F,0x00,0x00,0x00,0x00,0x10,0x10,0xF0,0xF0,0x10,0x10,0x00,
  1263. /*-- 文字: m --*/
  1264. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1265. 0x00,0x07,0x07,0x04,0x07,0x04,0x07,0x03,0x00,0xF0,0xF0,0x00,0xE0,0x00,0xF0,0xF0,
  1266. /*-- 文字: n --*/
  1267. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1268. 0x00,0x07,0x07,0x04,0x04,0x07,0x03,0x00,0x00,0xF0,0xF0,0x00,0x00,0xF0,0xF0,0x00,
  1269. /*-- 文字: o --*/
  1270. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1271. 0x00,0x03,0x07,0x04,0x04,0x07,0x03,0x00,0x00,0xE0,0xF0,0x10,0x10,0xF0,0xE0,0x00,
  1272. /*-- 文字: p --*/
  1273. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1274. 0x00,0x07,0x07,0x04,0x04,0x07,0x03,0x00,0x00,0xFE,0xFE,0x10,0x10,0xF0,0xE0,0x00,
  1275. /*-- 文字: q --*/
  1276. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1277. 0x00,0x03,0x07,0x04,0x04,0x07,0x07,0x00,0x00,0xE0,0xF0,0x10,0x10,0xFE,0xFE,0x00,
  1278. /*-- 文字: r --*/
  1279. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1280. 0x00,0x07,0x07,0x01,0x02,0x06,0x06,0x00,0x00,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,
  1281. /*-- 文字: s --*/
  1282. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1283. 0x00,0x03,0x07,0x04,0x04,0x04,0x04,0x00,0x00,0x10,0x90,0x90,0x90,0xF0,0x60,0x00,
  1284. /*-- 文字: t --*/
  1285. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1286. 0x00,0x04,0x1F,0x1F,0x04,0x04,0x04,0x00,0x00,0x00,0xE0,0xF0,0x10,0x10,0x10,0x00,
  1287. /*-- 文字: u --*/
  1288. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1289. 0x00,0x07,0x07,0x00,0x00,0x07,0x07,0x00,0x00,0xE0,0xF0,0x10,0x10,0xF0,0xF0,0x00,
  1290. /*-- 文字: v --*/
  1291. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1292. 0x00,0x07,0x07,0x00,0x00,0x07,0x07,0x00,0x00,0xC0,0xE0,0x30,0x30,0xE0,0xC0,0x00,
  1293. /*-- 文字: w --*/
  1294. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1295. 0x00,0x07,0x07,0x00,0x03,0x00,0x07,0x07,0x00,0xC0,0xF0,0x30,0xC0,0x30,0xF0,0xC0,
  1296. /*-- 文字: x --*/
  1297. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1298. 0x00,0x06,0x07,0x01,0x01,0x07,0x06,0x00,0x00,0x30,0x70,0xC0,0xC0,0x70,0x30,0x00,
  1299. /*-- 文字: y --*/
  1300. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1301. 0x00,0x07,0x07,0x00,0x00,0x07,0x07,0x00,0x02,0xE2,0xF2,0x16,0x1C,0xF8,0xE0,0x00,
  1302. /*-- 文字: z --*/
  1303. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1304. 0x00,0x04,0x04,0x04,0x05,0x07,0x06,0x00,0x00,0x30,0x70,0xD0,0x90,0x10,0x10,0x00,
  1305. /*-- 文字: { --*/
  1306. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1307. 0x00,0x00,0x01,0x0F,0x1E,0x10,0x00,0x00,0x00,0x80,0xC0,0x78,0x3C,0x04,0x00,0x00,
  1308. /*-- 文字: | --*/
  1309. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1310. 0x00,0x00,0x00,0x1F,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x00,0x00,0x00,
  1311. /*-- 文字: } --*/
  1312. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1313. 0x00,0x00,0x10,0x1E,0x0F,0x01,0x00,0x00,0x00,0x00,0x04,0x3C,0x78,0xC0,0x80,0x00,
  1314. /*-- 文字: ~ --*/
  1315. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1316. 0x0C,0x18,0x10,0x18,0x0C,0x04,0x0C,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1317. /*-- 文字:  --*/
  1318. /*-- Fixedsys12; 此字体下对应的点阵为:宽 x 高=8x16 --*/
  1319. 0x00,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0x00,
  1320. };
复制代码


回复

使用道具 举报

ID:96682 发表于 2021-4-30 17:49 来自手机 | 显示全部楼层
问题是显示屏的背光完全由程序自行控制
回复

使用道具 举报

ID:708768 发表于 2021-4-30 17:57 来自手机 | 显示全部楼层
wc86110 发表于 2021-4-30 17:49
问题是显示屏的背光完全由程序自行控制

感谢回复,我使用的是不用背光的显示屏,问题已经解决了,我把RTC函数里的三个lcm clear(0)去掉后就没有问题了,虽然不太理解,可能是因为命令发送过快导致的吧
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表