关于TA6932用固定寻址方式显示问题
时间:10-02
整理:3721RD
点击:
tp=MSB;
tp<<=8;
tp=tp|LSB;
wendu=tp*0.0625;
int_temp=wendu*10+0.5;
//int_temp=int_temp*10;
//int_temp=985;
//TA6932_Write(int_temp);
//int_temp=-114; //test
//-----------------------------------------------
//if( tp>=125 && f_temp>0 ) //3?1y127 ?è??ê?HHHH
//TA6932_Read();
if(int_temp>1250)
{
Write_data(DIG0,0X76);
Write_data(DIG1,0X76);
Write_data(DIG2,0X76);
Write_data(DIG3,0X76);
//led_status=5;
// return ;
}
else if((int_temp>999) && (int_temp<=1250))
{
Write_data(DIG0,led_tab[int_temp/1000]);
Write_data(DIG1,led_tab[int_temp%1000/100]);
Write_data(DIG2,led_tabp[int_temp%1000%100/10]);
Write_data(DIG3,led_tab[int_temp%1000%100%10]);
}
else if((int_temp<=999&&int_temp>=100))
{
Write_data(DIG0,0x00);
Write_data(DIG1,led_tab[int_temp/100]);
Write_data(DIG2,led_tabp[int_temp%100/10]);
Write_data(DIG3,led_tab[int_temp%100%10]);
}
else if((int_temp<100&&int_temp>=0))
{
Write_data(DIG0,0x00);
Write_data(DIG1,0x00);
Write_data(DIG2,led_tabp[int_temp/10]);
Write_data(DIG3,led_tab[int_temp%10]);
}
else if((int_temp<0&&int_temp>-100))
{
int_temp=~int_temp;
int_temp=int_temp+1;
Write_data(DIG0,0x00);
Write_data(DIG1,0x40);
Write_data(DIG2,led_tabp[int_temp/10]);
Write_data(DIG3,led_tab[int_temp%10]);
}
else if((int_temp<=-100&&int_temp>=-400))
{
int_temp=~int_temp+1;
Write_data(DIG0,0x40);
Write_data(DIG1,led_tab[int_temp/100]);
Write_data(DIG2,led_tabp[int_temp%100/10]);
Write_data(DIG3,led_tab[int_temp%100%10]);
}
else if(int_temp<-400)
{
Write_data(DIG0,0X38);
Write_data(DIG1,0X38);
Write_data(DIG2,0X38);
Write_data(DIG3,0X38);
}
DS18B20能读出温度数据,但现实一直都是0.0,大神看看程序哪里有问题
tp<<=8;
tp=tp|LSB;
wendu=tp*0.0625;
int_temp=wendu*10+0.5;
//int_temp=int_temp*10;
//int_temp=985;
//TA6932_Write(int_temp);
//int_temp=-114; //test
//-----------------------------------------------
//if( tp>=125 && f_temp>0 ) //3?1y127 ?è??ê?HHHH
//TA6932_Read();
if(int_temp>1250)
{
Write_data(DIG0,0X76);
Write_data(DIG1,0X76);
Write_data(DIG2,0X76);
Write_data(DIG3,0X76);
//led_status=5;
// return ;
}
else if((int_temp>999) && (int_temp<=1250))
{
Write_data(DIG0,led_tab[int_temp/1000]);
Write_data(DIG1,led_tab[int_temp%1000/100]);
Write_data(DIG2,led_tabp[int_temp%1000%100/10]);
Write_data(DIG3,led_tab[int_temp%1000%100%10]);
}
else if((int_temp<=999&&int_temp>=100))
{
Write_data(DIG0,0x00);
Write_data(DIG1,led_tab[int_temp/100]);
Write_data(DIG2,led_tabp[int_temp%100/10]);
Write_data(DIG3,led_tab[int_temp%100%10]);
}
else if((int_temp<100&&int_temp>=0))
{
Write_data(DIG0,0x00);
Write_data(DIG1,0x00);
Write_data(DIG2,led_tabp[int_temp/10]);
Write_data(DIG3,led_tab[int_temp%10]);
}
else if((int_temp<0&&int_temp>-100))
{
int_temp=~int_temp;
int_temp=int_temp+1;
Write_data(DIG0,0x00);
Write_data(DIG1,0x40);
Write_data(DIG2,led_tabp[int_temp/10]);
Write_data(DIG3,led_tab[int_temp%10]);
}
else if((int_temp<=-100&&int_temp>=-400))
{
int_temp=~int_temp+1;
Write_data(DIG0,0x40);
Write_data(DIG1,led_tab[int_temp/100]);
Write_data(DIG2,led_tabp[int_temp%100/10]);
Write_data(DIG3,led_tab[int_temp%100%10]);
}
else if(int_temp<-400)
{
Write_data(DIG0,0X38);
Write_data(DIG1,0X38);
Write_data(DIG2,0X38);
Write_data(DIG3,0X38);
}
DS18B20能读出温度数据,但现实一直都是0.0,大神看看程序哪里有问题