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

正文內(nèi)容

空氣溫濕度測(cè)量?jī)x設(shè)計(jì)畢業(yè)設(shè)計(jì)-資料下載頁(yè)

2025-06-18 12:45本頁(yè)面
  

【正文】 能:延時(shí)函數(shù),延時(shí)約n個(gè)10us*****************************************/void delay_n10us(uint n) //延時(shí)n個(gè)10us12M晶振{ uint i。 for(i=n。i0。i) { _nop_()。_nop_()。_nop_()。_nop_()。_nop_()。_nop_()。 }} /****************第一部分LCD1602設(shè)置結(jié)束****************************************//*****************第二部分SHT10設(shè)置開(kāi)始****************************************/ sbit DATA = P3^0。 //定義通訊數(shù)據(jù)端口sbit SCK = P3^1。 //定義通訊時(shí)鐘端口typedef union { unsigned int i。 //定義了兩個(gè)共用體 float f。 } value。 enum {TEMP,HUMI}。 //TEMP=0,HUMI=1 define noACK 0 //用于判斷是否結(jié)束通訊define ACK 1 //結(jié)束數(shù)據(jù)傳輸 //adr mand r/w define STATUS_REG_W 0x06 //000 0011 0 define STATUS_REG_R 0x07 //000 0011 1 define MEASURE_TEMP 0x03 //000 0001 1 define MEASURE_HUMI 0x05 //000 0010 1 define RESET 0x1e //000 1111 0 /****************定義函數(shù)****************/void s_transstart(void)。 //啟動(dòng)傳輸函數(shù)void s_connectionreset(void)。 //連接復(fù)位函數(shù)char s_write_byte(unsigned char value)。//SHT10寫(xiě)函數(shù)char s_read_byte(unsigned char ack)。 //SHT10讀函數(shù)char s_measure(unsigned char *p_value, unsigned char *p_checksum, unsigned char mode)。//測(cè)量溫濕度函數(shù)void calc_sht10(float *p_humidity ,float *p_temperature)。//溫濕度補(bǔ)償/************************************************ 模塊名稱(chēng):s_transstart()。 功 能:啟動(dòng)傳輸函數(shù)*************************************************/ void s_transstart(void) // generates a transmission start { DATA=1。 SCK=0。 //Initial state _nop_()。 SCK=1。 _nop_()。 DATA=0。 _nop_()。 SCK=0。 _nop_()。_ nop_()。 nop_()。 SCK=1。 _nop_()。 DATA=1。 _nop_()。 SCK=0。 } /********************************************** 模塊名稱(chēng):s_connectionreset()。 功 能:連接復(fù)位函數(shù)************************************************/ void s_connectionreset(void) // munication reset: DATAline=1 and at least 9 SCK cycles followed by transstart { unsigned char i。 DATA=1。 SCK=0。 //Initial state for(i=0。i9。i++) //9 SCK cycles { SCK=1。 SCK=0。 } s_transstart()。 //transmission start } /********************************************** 模塊名稱(chēng):s_write_byte()。 功 能:SHT10寫(xiě)函數(shù)**********************************************/ char s_write_byte(unsigned char value) // writes a byte on the Sensibus and checks the acknowledge { unsigned char i,error=0。 for (i=0x80。i0。i/=2) //shift bit for masking { if (i amp。 value) DATA=1。 //masking value with i , write to SENSIBUS else DATA=0。 SCK=1。 //clk for SENSIBUS _nop_()。_nop_()。_nop_()。 //pulswith approx. 3 us SCK=0。 } DATA=1。 //release DATAline SCK=1。 //clk 9 for ack error=DATA。 //DATA在第9個(gè)上升沿將被SHT10自動(dòng)下拉為低電平。 _nop_()。_nop_()。_nop_()。 SCK=0。 DATA=1。 //release DATAline return error。 //返回:0成功,1失敗} /**********************************************模塊名稱(chēng):s_read_byte()。 功 能:SHT10讀函數(shù)***********************************************/ char s_read_byte(unsigned 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。 } /************************************************模塊名稱(chēng):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。 } /*****************************************************模塊名稱(chēng):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_h
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1