基于单片机的炉温温度控制系统设计 联系客服

发布时间 : 星期日 文章基于单片机的炉温温度控制系统设计更新完毕开始阅读2b31385a852458fb770b56fc

河南理工大学毕业设计论文

if(DQ) v_alue|=0x80; delay(6); }

return(v_alue); }

//向 1-WIRE 总线上写一个字节 void write_byte(char val) { byte i;

for (i=8; i>0; i--) { DQ = 0; DQ = val&0x01; delay(5); DQ = 1; val=val/2; } delay(5); }

//读取温度

unsigned int Read_Temperature(void) { union{ byte c[2]; unsigned int x; }temp; ow_reset(); write_byte(0xCC); write_byte(0xBE); temp.c[1]=read_byte(); temp.c[0]=read_byte();

4

河南理工大学毕业设计论文

ow_reset(); write_byte(0xCC); write_byte(0x44); return temp.x; }

//BCD码转换

void bcd_transform(void) { unsigned char b,c,n; unsigned int; unsigned int tm,a; tm=Read_Temperature(); a=tm>>4;

c=(unsigned char)a&0x00ff; n=c/100; b=c0; temp[0]=tab3[n]; n=b/10; temp[1]=tab3[n]; nonce_t[0]=n; n=b; temp[2]=tab3[n]; nonce_t[1]=n; temp[3]='.';

a=(unsigned char)tm&0x000f; for(b=0;b<=4;b++) { temp[b+4]=tab4[a][b]; }

nonce_t[2]=tab0[a]; temp[8]=0x00; }

//整数部分 //小数部分 5