TLC549与1602显示
时间:10-02
整理:3721RD
点击:
为什么我采集TLC549的值无法在1602上显示?一直显示的是0000
uchar code table4[]="0123456789.-";
void display()
{
uchar num;
write_com(0x80);
for(num=0;num<5;num++)
{
write_date(table1[num]);
}
write_date(table4[12]);
write_date(table4[table5[0]]);
write_date(table4[table5[1]]);
write_date(table4[table5[2]]);
write_date(table4[table5[3]]);
write_com(0x80+0x40);
for(num=0;num<3;num++)
{
write_date(table2[num]);
}
write_date(table4[shi_sh]);
write_date(table4[ge_sh]);
write_com(0x80+0x40+0x07);
for(num=0;num<5;num++)
{
write_date(table3[num]);
}
write_date(table4[shi_xia]);
write_date(table4[ge_xia]);
}
void main()
{
int temp;
float AD_DATA; //定义A/D转换数据变量
init();
while(1)
{
key();
AD_DATA=TLC549ADC(); //读取当前电压值A/D转换数据
temp=AD_DATA*5*1000/256;
table5[0]=temp/1000;
table5[1]=temp/100%10;
table5[2]=temp/10%10;
table5[3]=temp%10;
shi_sh=warn_sh%100/10;
ge_sh=warn_sh%10;
shi_xia=warn_xia%100/10;
ge_xia=warn_xia%10;
display();
}
}
PCB加工找华强电路 http://www.hqpcb.com 样板2天出货
uchar code table4[]="0123456789.-";
void display()
{
uchar num;
write_com(0x80);
for(num=0;num<5;num++)
{
write_date(table1[num]);
}
write_date(table4[12]);
write_date(table4[table5[0]]);
write_date(table4[table5[1]]);
write_date(table4[table5[2]]);
write_date(table4[table5[3]]);
write_com(0x80+0x40);
for(num=0;num<3;num++)
{
write_date(table2[num]);
}
write_date(table4[shi_sh]);
write_date(table4[ge_sh]);
write_com(0x80+0x40+0x07);
for(num=0;num<5;num++)
{
write_date(table3[num]);
}
write_date(table4[shi_xia]);
write_date(table4[ge_xia]);
}
void main()
{
int temp;
float AD_DATA; //定义A/D转换数据变量
init();
while(1)
{
key();
AD_DATA=TLC549ADC(); //读取当前电压值A/D转换数据
temp=AD_DATA*5*1000/256;
table5[0]=temp/1000;
table5[1]=temp/100%10;
table5[2]=temp/10%10;
table5[3]=temp%10;
shi_sh=warn_sh%100/10;
ge_sh=warn_sh%10;
shi_xia=warn_xia%100/10;
ge_xia=warn_xia%10;
display();
}
}
PCB加工找华强电路 http://www.hqpcb.com 样板2天出货