我想把温度值用12864显示出来,但是温度变量的值不显示,请各位大神帮忙看看。
程序如下
#include
#include
#define uchar unsigned char
#define uint unsigned int
sbit RS=P1^0;
sbit RW=P1^1;
sbit E=P1^2;
sbit DQ=P1^3;
uchar code table1[]="温度:";
uchar code table2[]="°C";
void display1();
void display2();
void display3();
unsigned int read_temp();
void init_12864();
void write_com(uchar com);
unsigned char str[10] ;
unsigned int t ;
void main()
{
init_12864();
display1();
display2();
while(1)
{
t=read_temp();
sprintf(str,"%d",t);
display3();
write_com(0x01);
}
}
void DELAY_MS (unsigned int a)//毫秒级延时函数
{