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

正文內容

基于無線傳感器的農(nóng)業(yè)環(huán)境監(jiān)測系統(tǒng)本科生畢業(yè)設計論文-資料下載頁

2025-06-27 20:20本頁面
  

【正文】 Answer()。 dat=SHT11_Receivebyte()。 SHT11_End()。 return(dat)。}/***************************************函數(shù)名稱:SHT11_Measure(uchar mand,uint time)。函數(shù)功能:設置SHT11檢測功能,并返回相應的檢測結果函數(shù)說明:mand形參用于設定溫度檢測還是濕度檢測,time形參用于設定檢測過程中的等待時間,以確定檢測結果的位數(shù)11ms/55ms/210ms 分別對應8位/12位/14位 ****************************************/uint SHT11_Measure(uchar mand,uchar time){ uint dat=0。 uchar data_high,data_low。 SHT11_Start()。 SHT11_Sendbyte(mand)。 SHT11_Answer()。 Delay_Ms(time)。 SHT11_Test_Finish()。 data_high=SHT11_Receivebyte()。 MCU_Answer()。 data_low=SHT11_Receivebyte()。 SHT11_End()。 dat=(dat|data_high)。 dat=(dat8)|data_low。 return(dat)。}/****************************************函數(shù)名稱:Convert_Tempeture(uint dat)。函數(shù)功能:將檢測到的數(shù)據(jù)轉化為相應的溫度數(shù)據(jù)函數(shù)說明:溫度轉換公式T=d1+d2*SOt 公式中的參數(shù)d1=40,d2= 適用于14位測量精度*****************************************/float SHT11_Convert_Tempeture14bit(uint dat){ float tempeture1。 tempeture1=40+*dat。 if(tempeture1) { flag_tempeture=1。 } else if(tempeture1) { flag_tempeture=1。 } else { flag_tempeture=0。 } return(tempeture1)。}/*****************************************函數(shù)名稱:SHT11_Convert_Humidity(uint dat,float temp)函數(shù)功能:將檢測到的數(shù)據(jù)轉化為相應的濕度數(shù)據(jù)函數(shù)說明:相對濕度轉換公式RHline=C1+C2*SOrh+C3*SOrh*SOrh(檢測數(shù)據(jù)的線性化 SOrh為單片機接收到的數(shù)據(jù)) RHtrue=(tempeture25)*(t1+t2*SOrh)+RHline 公式中的參數(shù):C1=4,C2=0,0405,C3= t1=,t2= 適用于12位測量精度******************************************/float SHT11_Convert_Humidity12bit(uint dat,float temp){ float RHline,RHtrue。 RHline=4+**dat*dat。 RHtrue=(temp25)*(+*dat)+RHline。 if(RHtrue) { flag_humidity=1。 } else { flag_humidity=0。 } return(RHtrue)。}/****************************************函數(shù)名稱:Convert_Tempeture12bit(uint dat)。函數(shù)功能:將檢測到的數(shù)據(jù)轉化為相應的溫度數(shù)據(jù)函數(shù)說明:溫度轉換公式T=d1+d2*SOt 公式中的參數(shù)d1=40,d2= 適用于12位測量精度float SHT11_Convert_Tempeture12bit(uint dat){ float tempeture1。 tempeture1=40+*dat。 if(tempeture1) { flag_tempeture=1。 } else { flag_tempeture=0。 } return(tempeture1)。}*****************************************//*****************************************函數(shù)名稱:SHT11_Convert_Humidity8bit(uint dat,float temp)函數(shù)功能:將檢測到的數(shù)據(jù)轉化為相應的濕度數(shù)據(jù)函數(shù)說明:相對濕度轉換公式RHline=C1+C2*SOrh+C3*SOrh*SOrh(檢測數(shù)據(jù)的線性化 SOrh為單片機接收到的數(shù)據(jù)) RHtrue=(tempeture25)*(t1+t2*SOrh)+RHline 公式中的參數(shù):C1=4,C2=0,648,C3= t1=,t2= 適用于12位測量精度float SHT11_Convert_Humidity8bit(uint dat,float temp){ float RHline,RHtrue。 RHline=4+**dat*dat。 RHtrue=(temp25)*(+*dat)+RHline。 if(RHtrue) { flag_humidity=1。 } else { flag_humidity=0。 } return(RHtrue)。}******************************************/endifTSL2561程序代碼include//TSL2561地址define ucharunsigned chardefine uintunsigned int //設備讀寫地址define SLAVE_ADDR_W 0x72define SLAVE_ADDR_RD 0x73//命令控制寄存器define CONTROL 0x80define TIMING 0x81define DATA0LOW 0x8Cdefine DATA0HIGH 0x8Ddefine DATA1LOW 0x8Edefine DATA1HIGH 0x8FucharDatalow,Datahigh0,Datalow1,DataHigh1,Command,Channel0,Channel1,temp。sbitsda=P2^0。sbitscl=P2^1。void delay(){。}void delaylms(uchar x){uchara,b。for(a=x。a0。a)for(b=100。b0。b)。}void start(){sda=1。delay()。scl=1。delay()。scl=1。delay()。sda=0。delay()。}void stop(){sda=0。delay()。scl=1。delay()。sda=1。delay()。}void respons(){uchar i。scl=1。delay()。while((sda==1)amp。amp。(i250))i++。scl=0。delay()。}void write_byte(unsigned chardate){uchari。for(i=0。i8。i++){scl=0。date=1。sda=CY。delay()。scl=1。delay()。}ucharread_byte(){uchar i,k。scl=0。delay()。sda=1。//釋放資源delay()。for(i=0。i8。i++){scl=1。delay()。k=(k1)|sda。scl=0。delay()。}return k。}void TSL2561_Write(ucharmand,uchardate){start()。write_byte(SLAVE_ADDR_WR)。respons()。write_byte(mand)。respons()。write_byte(date)。respons()。stop()。}ucharTSL2561_Read(ucharmand){uchardate。start()。write_byte(SLAVE_ADDR_WR)。respons()。write_byte(mand)。respons()。start()。write_byte(SLAVE_ADDR_RD)。respons()。date=read_byte()。stop()。return date。}//讀取光照強度viod Read_Light(){DataLow0=TSL2561_Read(DATA0LOW)。DataHigh0=TSL2561_Read(DATA0HIGH)。Channel0=256*DataHigh0+DataLow0。DataLow1=TSL2561_Read(DATA1LOW)。DataHigh1=TSL2561_Read(DATA1HIGH)。Channel1=246*DataHigh1+DataLow1。}void Init(){EA=1。TMOD=0x20。TL1=0xfd。TH1=0xfd。TR1=1。//SMOD=0。SM 0=0。SM 1=1。REN=1。ES=1。}void main(){Init()。TSL2561_Write(CONTROL,0x03)。//設置TSL2561未開啟狀態(tài)while(1){Read_Light()。//讀取光強/*id=TSL2561_Read(CONTROL)。SBUF=id。P1=id,*/P1=DataLow0。SBUF=DataLow0。//把通道0低字節(jié)數(shù)據(jù)傳到串口緩存區(qū)delay1ms(200)。P1DataHigh0。SBUF=DataHigh0。//把通道0高字節(jié)數(shù)據(jù)傳到串口緩存區(qū)delay1ms(200)。P1=DataLow1。SBUF=DataLow1。delay1ms(200)。P1=DataHigh1。SBUF=DataHigh1。delay1ms(200)。}}void serial() interrupt4{if(RI==1){Ri=0。P1=SBUF。}else if(TI==1){TI=0。}}PTR2000程序代碼include // 引用標準庫的頭文件include define uchar unsigned chardefine uint unsigned intdefine REQ_SEND0x33define REQ_RESEND0x66define SEND_OVER0x99//為簡化起見,假設了7位固定的采集數(shù)據(jù)define DATA00x10define DATA10x20define DATA20x30define DATA30x40define DATA40x50define DATA50x60define DATA60x70sbit TXEN = P2^0。sbit CS = P2^1。sbit PWR = P2^2。void ClearT_buf()。//清除t_buf函數(shù)void ClearR_buf()。//清除r_buf函數(shù)void Delay()。//延時5msvoid GetData()。//采集數(shù)據(jù)void Send()。//采集并發(fā)送函數(shù)void SendOver()。//通知PC機發(fā)送結束函數(shù)xdata uchar Flag_Start = 0 。//開始接受數(shù)據(jù)標志位xdata uchar Flag_RSend = 0 。//請求發(fā)送標志位xdata uchar Flag_ReSend = 0 。//請求重發(fā)標志位xdata uchar Flag_Delay = 1 。//延時5ms標志xdata uchar Data[7]。//采集的7個字節(jié)數(shù)據(jù)xdata uchar tCount = 0。xdata uchar t_buf[11]。// 1開始字節(jié)$,1長度字節(jié)LEN,// 7字節(jié)數(shù)據(jù),1校驗和字節(jié),// 1 結束字節(jié)*xdata uchar rCount = 0 。xdata uchar r_buf[5]。// 1開始字節(jié)$,1長度字節(jié)LEN,// 1字節(jié)指令,1校驗和字節(jié),// 1 結束字節(jié)*/* 定時器0中斷服務子程序 */void timer() interrupt 1 using 2
點擊復制文檔內容
數(shù)學相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1