一段关于DS18B20的程序:
while(1)
{
Reset();
write_byte(jump_ROM);
write_byte(0x4e); //写暂存器命令
write_byte(0x02);
write_byte(0x01);
write_byte(peizhi); //写分辨率的配置字节
Reset();
write_byte(jump_ROM);
write_byte(convert);
write_byte(read_EEROM);
TMPL = read_byte();
TMPH = read_byte();
}
不管配置字节改为几分辨率,到最后通过数码管读TMPH和TMPL总是显示05和80,大家帮忙分析分析。为什么啊? |