求教:诺基亚5110液晶如何显示变量?

2020-01-22 12:17发布

       我想在诺基亚5110上显示个浮点型变量,要怎么进行转换显示呢,弄了老半天都不行,请大虾们求教……
       或者有这方面资料的希望共享下,谢谢了·····
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
15条回答
zbj2014cn
2020-01-23 23:36
void LCD_write_count(unsigned long int count)
{
                unsigned char tempstr[9]={0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30} ;
        //将count送入缓冲区
              tempstr[0]=count/10000000+0x30;
              tempstr[1]=count%10000000/1000000+0x30;
              tempstr[2]=count%10000000%1000000/100000+0x30;
              tempstr[3]=count%10000000%1000000%100000/10000+0x30;
              tempstr[4]=count%10000000%1000000%100000%10000/1000+0x30;
              tempstr[5]=count%10000000%1000000%100000%10000%1000/100+0x30;
              tempstr[6]=count%10000000%1000000%100000%10000%1000%100/10+0x30;
              tempstr[7]=count%10000000%1000000%100000%10000%1000%100%10+0x30;
   //判断count显示位数
         if(count>10000000)
                     {

                             LCD_write_char(tempstr[0]);
                             LCD_write_char(tempstr[1]);
                             LCD_write_char(tempstr[2]);
                             LCD_write_char(tempstr[3]);
                             LCD_write_char(tempstr[4]);
                             LCD_write_char(tempstr[5]);
                             LCD_write_char(tempstr[6]);
                             LCD_write_char(tempstr[7]);
                     }

                     else if((10000000>count)&&(count>=1000000))
                     {

                              LCD_write_char(tempstr[1]);
                              LCD_write_char(tempstr[2]);
                              LCD_write_char(tempstr[3]);
                              LCD_write_char(tempstr[4]);
                              LCD_write_char(tempstr[5]);
                              LCD_write_char(tempstr[6]);
                              LCD_write_char(tempstr[7]);

                     }
                     else if((1000000>count)&&(count>=100000))
                     {
                             LCD_write_char(tempstr[2]);
                             LCD_write_char(tempstr[3]);
                             LCD_write_char(tempstr[4]);
                             LCD_write_char(tempstr[5]);
                             LCD_write_char(tempstr[6]);
                             LCD_write_char(tempstr[7]);

                     }
                     else if((100000>count)&&(count>=10000))
                     {

                             LCD_write_char(tempstr[3]);
                         LCD_write_char(tempstr[4]);
                         LCD_write_char(tempstr[5]);
                         LCD_write_char(tempstr[6]);
                         LCD_write_char(tempstr[7]);
                     }
                     else if((10000>count)&&(count>=1000))
                     {

                             LCD_write_char(tempstr[4]);
                             LCD_write_char(tempstr[5]);
                             LCD_write_char(tempstr[6]);
                             LCD_write_char(tempstr[7]);
                     }
                     else if((1000>count)&&(count>=100))
                     {

                              LCD_write_char(tempstr[5]);
                              LCD_write_char(tempstr[6]);
                              LCD_write_char(tempstr[7]);
                     }
                     else if((100>count)&&(count>=10))
                     {

                              LCD_write_char(tempstr[6]);
                              LCD_write_char(tempstr[7]);
                     }
                     else
                     {

                             LCD_write_char(tempstr[7]);
                     }
}

一周热门 更多>