freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

溫濕度傳感器畢業(yè)論文-資料下載頁(yè)

2025-06-23 21:26本頁(yè)面
  

【正文】 gned char ack) // reads a byte form the Sensibus and gives an acknowledge in case of ack=1 { unsigned char i,val=0。 DATA=1。 //release DATAline for (i=0x80。i0。i/=2) //shift bit for masking { SCK=1。 //clk for SENSIBUS if (DATA) val=(val | i)。 //read bit _nop_()。_nop_()。_nop_()。 //pulswith approx. 3 us SCK=0。 } if(ack==1)DATA=0。 //in case of ack==1 pull down DATALine else DATA=1。 //如果是校驗(yàn)(ack==0),讀取完后結(jié)束通訊 _nop_()。_nop_()。_nop_()。 //pulswith approx. 3 us SCK=1。 //clk 9 for ack _nop_()。_nop_()。_nop_()。 //pulswith approx. 3 us SCK=0。 _nop_()。_nop_()。_nop_()。 //pulswith approx. 3 us DATA=1。 //release DATAline return val。 } /************************************************模塊名稱:s_measure()。 功 能:測(cè)量溫濕度函數(shù)*************************************************/ char s_measure(unsigned char *p_value, unsigned char *p_checksum, unsigned char mode) // makes a measurement (humidity/temperature) with checksum { unsigned error=0。 unsigned int i。 s_transstart()。 //transmission start switch(mode){ //send mand to sensor case TEMP : error+=s_write_byte(MEASURE_TEMP)。 break。 case HUMI : error+=s_write_byte(MEASURE_HUMI)。 break。 default : break。 } for (i=0。i65535。i++) if(DATA==0) break。 //wait until sensor has finished the measurement if(DATA) error+=1。 // or timeout (~2 sec.) is reached *(p_value) =s_read_byte(ACK)。 //read the first byte (MSB) *(p_value+1)=s_read_byte(ACK)。 //read the second byte (LSB) *p_checksum =s_read_byte(noACK)。 //read checksum return error。 } /*****************************************************模塊名稱:calc_sht10()。 功 能:溫濕度補(bǔ)償函數(shù)******************************************************/ void calc_sht10(float *p_humidity ,float *p_temperature)// calculates temperature [C] and humidity [%RH] // input : humi [Ticks] (12 bit) // temp [Ticks] (14 bit)// output: humi [%RH]// temp [C]{ const float C1=。 // for 12 Bit const float C2=+。 // for 12 Bit const float C3=。 // for 12 Bit const float T1=+。 // for 14 Bit @ 5V const float T2=+。 // for 14 Bit @ 5V float rh=*p_humidity。 // rh: Humidity [Ticks] 12 Bit float t=*p_temperature。 // t: Temperature [Ticks] 14 Bit float rh_lin。 // rh_lin: Humidity linear float rh_true。 // rh_true: Temperature pensated humidity float t_C。 // t_C: Temperature [C] t_C=t* 40。 //calc. temperature from ticks to [C] rh_lin=C3*rh*rh + C2*rh + C1。 //calc. humidity from ticks to [%RH] rh_true=(t_C25)*(T1+T2*rh)+rh_lin。 //calc. temperature pensated humidity [%RH] if(rh_true100)rh_true=100。 //cut if the value is outside of if(rh_true)rh_true=。 //the physical possible range *p_temperature=t_C。 //return temperature [C] *p_humidity=rh_true。 //return humidity[%RH]}/*******************第二部分SHT10設(shè)置結(jié)束****************************************//*********************按鍵處理模塊************************************************/uint flag=65。//定義上限值,初始值設(shè)定為65 ,設(shè)置為全局變量uchar key。sbit ADDE=P1^3。 //+sbit SUBK=P1^4。 //void keyscan(){ ADDE=1。 SUBK=1。 key=ADDEamp。amp。SUBK。 if(key==0) { delay_n10us(100)。 if(key==0) { if(ADDE==0) { {if(flag100) { flag++。 } else { flag=0。 } } while(!ADDE)。 } if(SUBK==0) { if(flag0) { flag。 } else { flag=99。 } while(!SUBK)。 //鎖定狀態(tài) } } }}/********************************報(bào)警模塊*****************************************/sbit led=P1^7。 //指示燈sbit beep=P3^6。 //蜂鳴器/**********************************************************************************//***************************************主函數(shù)*************************************/void main(void){ value humi_val,temp_val。 uint shijishidu。 //實(shí)際濕度 unsigned char error,checksum。 uint wendu,shidu。 LCD_init()。 s_connectionreset()。 LCD_disp_str(8,2,T)。 LCD_disp_str(0,2,R)。/*****************************初始化溫度顯示區(qū)***********************************/ LCD_disp_str(0,1,shidu_H: %)。/*****************************初始化濕度顯示區(qū)***********************************/ LCD_disp_str(1,2, . %)。 delay_n10us(20000)。 // while(1) { error=0。 error+=s_measure((unsigned char*) amp。,amp。checksum,HUMI)。 //measure humidity error+=s_measure((unsigned char*) amp。,amp。checksum,TEMP)。 //measure temperature if(error!=0) { s_connectionreset()。 //in case of an error: connection reset } else { keyscan()。 LCD_disp_char(8,1,(flag/10)+39。039。)。 LCD_disp_char(9,1,(flag%10)+39。039。)。 =(float)。 //converts integer to float =(float)。 //converts integer to float calc_sht10(amp。,amp。)。 //calculate humidity, temperature wendu=10*。 LCD_disp_char(9,2,0x3a)。 LCD_disp_char(10,2,(wendu%1000)/100+39。039。)。 //顯示溫度十位 LCD_disp_char(11,2,(wendu%100)/10+39。039。)。 //顯示溫度個(gè)位 LCD_disp_char(12,2,0x2e)。 // LCD_disp_char(13,2,(wendu%10)+39。039。)。 //顯示溫度小數(shù)點(diǎn)后第一位 LCD_disp_char(14,2,0xdf)。 LCD_disp_char(15,2,0x43)。 shidu=10*。 LCD_dis
點(diǎn)擊復(fù)制文檔內(nèi)容
語(yǔ)文相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1