仓库温湿度监测系统毕业设计 下载本文

}

{ }

dat[5]=(temperature*10/16)/100; dat[6]=((temperature*10/16)0)/10; dat[7]=15;

dat[8]=((temperature*10/16)0);

dat[4]=14;

temperature=~temperature+1;

/****************中断*****************************/ void timer0() interrupt 1 {

TR1=0; TR0=0; TF0=0;

ET0=0; T0Over=1; }

/*************湿度传感器频率采集及转换模块***************/ void readfrequency() {

unsigned int ftequency,RH; TMOD=0x51; TH0=0x4C;

33

TL0=0X00; TH1=0; TL1=0; TR1=1; TR0=1;

EA=1; T0Over=0; while(!T0Over) write_com(0x80+0x40);

write_shuju(table2[shuju1[0]]); write_com(0x80+0x41);

write_shuju(table2[shuju1[1]]); write_com(0x80+0x42);

write_shuju(table2[shuju1[2]]); write_com(0x80+0x43);

write_shuju(table2[shuju1[3]]); write_com(0x80+0x44);

write_shuju(table2[shuju1[4]]); write_com(0x80+0x45);

write_shuju(table2[shuju1[5]]); write_com(0x80+0x46);

write_shuju(table2[shuju1[6]]); write_shuju(table2[shuju1[7]]); write_shuju(table2[shuju1[8]]);

34

ET0=1; ET1=0;

ftequency=(TH1*256+TL1)*20; minrange=0; maxrange=0; if(ftequency) { if(ftequency<6033)

maxrange=1;

if(ftequency>7351)

minrange=1;

if(6330

RH=5880-0.8*ftequency;

if(6033<=ftequency<=6330)

RH=5860-0.8*ftequency;

shuju1[0]=10; shuju1[1]=11; shuju1[2]=12; shuju1[3]=15; shuju1[4]=RH/100; shuju1[5]=(RH0)/10; shuju1[6]=14; shuju1[7]=(RH); shuju1[8]=13;

}

}

35