今天 有网友提示说我的tlc0831 测量电压的时候,显示有问题,
后面的2位显示总是一样的,比如电压只能从 00 11 22 33显示等等
回来从新读了一遍程序,发现了一个bug,
原来的程序:
final=temp_read*1.95;
i= final / 100;
j= (final-i*100)/10; //final % 10;
k= final % 10;
LCD_write_string(0,LINE1," TLC0831 TEST ");
LCD_write_string(0,LINE2,"Voltage is . v");
LCD_write_char(0x0b,LINE2,i|0x30);
LCD_write_char(0x0d,LINE2,j|0x30);
LCD_write_char(0x0e,LINE2,j|0x30);
正确的程序:
final=temp_read*1.95;
i= final / 100;
j= (final-i*100)/10; //final % 10;
k= final % 10;
LCD_write_string(0,LINE1," TLC0831 TEST ");
LCD_write_string(0,LINE2,"Voltage is . v");
LCD_write_char(0x0b,LINE2,i|0x30);
LCD_write_char(0x0d,LINE2,j|0x30);
LCD_write_char(0x0e,LINE2,k|0x30);
其实就是最后一行的显示没有更新的缘故。
Tue Aug 7 2007
文章评论(0条评论)
登录后参与讨论