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

正文內(nèi)容

單片機(jī)倉庫恒溫恒濕監(jiān)控系統(tǒng)的設(shè)計概述-資料下載頁

2025-06-29 11:21本頁面
  

【正文】 ES=1;TR0=1;TR1=1;high_time=50;low_time=50;PIDInit ( amp。spid ); /*Initialize Structure */ = 10; /* Set PID Coefficients*/ = 8; =6; = 100; /* Set PID Setpoint */while(1){if(plus==0){EA=0;for(a=0;a5;a++)for(b=0;b102;b++){}if(plus==0){set_humid++;flag=0;}}else if(subs==0){for(a=0;a5;a++)for(b=0;a102;b++){}if(subs==0){set_humid;flag=0;}}else if(stop==0){for(a=0;a5;a++)for(b=0;b102;b++){}if(stop==0){flag=0;break;}EA=1;}get_humid();b=humid;if(flag_2==1)a=b;if((abs(ab))5)humid=a;elsehumid=b;a=humid;flag_2=0;if(++count130){display();count1=0;}pare_humid();}TR0=0;z=1;while(1){EA=0;if(stop==0){for(a=0;a5;a++)for(b=0;b102;b++){}if(stop==0)disp_1(phil);// break;}EA=1;}while(2){if(plus==0){EA=0;for(a=0;a5;a++)for(b=0;b102;b++){}if(plus==0){set_humid++;flag=0;}}else if(subs==0){for(a=0;a5;a++)for(b=0;a102;b++){}if(subs==0){set_humid;flag=0;}}else if(stop==0){for(a=0;a5;a++)for(b=0;b102;b++){}if(stop==0){flag=0;break;}EA=1;}get_humid();b=humid;if(flag_2==1)a=b;if((abs(ab))5)humid=a;elsehumid=b;a=humid;flag_2=0;if(++count130){display();count1=0;}pare_humid();}TR0=0;z=1;while(2){EA=0;if(stop==0){for(a=0;a5;a++)for(b=0;b102;b++){}if(stop==0)disp_1(phil);// break;}EA=1;}} /*溫濕度采集子程序*/#define DATA P1_1#define SCK P1_0#define ACK 1#define noACK 0#define MEASURE_TEMP 0x03 /*測量溫度命令*/#define MEASURE_HUMI 0x05/*測量濕度命令*//*讀溫濕度數(shù)據(jù)*/char s-measure(unsigned char *p value, unsigned char *p_checksum, unsigned char mode){unsigned char error=0。unsigned int i。s_transstart()。 /*傳輸開始*/switch(mode){caseTEMP:error+=s_write_byte(measure_temp)。break。caseHUMI:error+=s_write_byte(measure_humi)。break。default:break。}for(i=0。i<65535。i++) if(DATA==0) break。if (DATA) reeor+=1。*(p_value)=s_read_byte(ACK)。*(p_value+1)=s_read_byte(ACK)。*p_checksum=s_read_byte(noACK)。return error。}/*溫濕度值標(biāo)度變換及溫度補(bǔ)償*/void calc_sth15(float *p_hunid,float *p_humidature){const float c1=-4.0。const float c2=0.0405。const float c3=-0.0000028。const float t1=-0.01。const float t2=0.00008。float rh=p_hunid。float t=p_humid。float rh_lin。float th_ture。float t_c。t_c=t0.01-40。rh_lin=c3rhrh+c2rh+c1。trh_ture=(t_c-25)(t1+t2rh)+rh_lin。p_humid=t-c。p_hunid=rh_ture。}/*從相對溫度和濕度計算露點*/char calc_dewpoint(float h,float t){float logex,dew_point。logex=0.66077+7.5t/(237.3+t)+[log10(h)-2]。dew_point=(logex-0.66077)237.3/(0.66077+7.5-logex)。return dew_point。}/*89C51系統(tǒng)程序及子程序*/includeincludeincludeincludestruct PID {unsigned int SetPoint; /*設(shè)定目標(biāo) Desired Value*/unsigned int Proportion; /*比例常數(shù) Proportional Const*/unsigned int Integral; /*積分常數(shù) Integral Const */unsigned int Derivative; /*微分常數(shù) Derivative Const*/unsigned int LastError; /*Error[1] */unsigned int PrevError; /*Error[2] */unsigned int SumError; /*Sums of Errors*/}; struct PID spid; /*PID Control Structure*/unsigned int rout; /*PID Response (Output) */unsigned int rin; /*PID Feedback (Input) */sbit data1=P1^0;sbit clk=P1^1;sbit plus=P2^0;sbit subs=P2^1;sbit stop=P2^2;sbit output=P3^4;sbit DQ=P3^3;unsigned char flag,flag_1=0;unsigned char high_time,low_time,count=0;/*占空比調(diào)節(jié)參數(shù)*/unsigned char set_humid=35;unsigned char humid;unsigned char i;unsigned char j=0;unsigned int s;/*延時子程序,延時時間以12M晶振為準(zhǔn),延時時間為30ustime */void delay(unsigned char time){unsigned char m,n;for(n=0;ntime;n++)for(m=0;m2;m++){}}/* 寫一位數(shù)據(jù)子程序 */void write_bit(unsigned char bitval){EA=0;DQ=0; /*拉低DQ以開始一個寫時序*/if(bitval==1){_nop_();DQ=1; /*如要寫1,則將總線置高*/}delay(5); /*延時90us供DA18B20采樣*/DQ=1; /*釋放DQ總線*/_nop_();_nop_();EA=1;}/* 寫一字節(jié)數(shù)據(jù)子程序*/void write_byte(unsigned char val){unsigned char i;unsigned char temp;EA=0; /*關(guān)中斷*/TR0=0;for(i=0;i8;i++) /*寫一字節(jié)數(shù)據(jù),一次寫一位*/{temp=vali; /*移位操作,將本次要寫的位移到最低位*/temp=tempamp。1;write_bit(temp); /*向總線寫該位*/}delay(7); /*延時120us后*/// TR0=1;EA=1; /*開中斷*/}/* 讀一位數(shù)據(jù)子程序 */unsigned char read_bit(){unsigned char i,value_bit;EA=0;DQ=0; /*拉低DQ,開始讀時序*/_nop_();_nop_();DQ=1; /*釋放總線*/for(i=0;i2;i++){}value_bit=DQ;EA=1;return(value_bit);}/* 讀一字節(jié)數(shù)據(jù)子程序 */unsigned char read_byte(){unsigned char i,value=0;EA=0;for(i=0;i8;i++){if(read_bit()) /*讀一字節(jié)數(shù)據(jù),一個時序中讀一次,并作移位處理*/value|=0x01i;delay(4); /*延時80us以完成此次都時序,之后再讀下一數(shù)據(jù)*/}EA=1;return(value);}/* 復(fù)位子程序 */unsigned char reset(){unsigned char presence;EA=0;DQ=0; /*拉低DQ總線開始復(fù)位*/delay(30); /*保持低電平480us*/DQ=1; /*釋放總線*/delay(3);presence=DQ; /*獲取應(yīng)答信號*/delay(28); /*延時以完成整個時序*/EA=1;return(presence); /*返回應(yīng)答信號,有芯片應(yīng)答返回0,無芯片則返回1*/}/* 獲取溫度子程序 */void get_humid(){unsigned char i,j;do{i=reset(); /*復(fù)位*/}while(i!=0); /*1為無反饋信號*/i=0xcc; /*發(fā)送設(shè)備定位命令*/write_byte(i);i=0x44; /*發(fā)送開始轉(zhuǎn)換命令*/write_byte(i);delay(180); /*延時*/do{i=reset(); /*復(fù)位*/}while(i!=0);i=0xcc; /*設(shè)備定位*/write_byte(i);i=0xbe; /*讀出緩沖區(qū)內(nèi)容*/write_byte(i);j=read_byte();i=read_byte();i=(i4)amp。0x7f;s=(unsigned int)(jamp。0x0f);s=(s*100)/16;j=j4;humid=i|j; /*獲取的溫度放在humid中*/humid=i|j; /*獲取的溫度放在humid中*/}/*================================================================Initialize PID Structure================================================================*/void PIDInit (struct PID *pp) {memset ( pp,0,sizeof(struct PID));}/*================================================================PID計算部分 ================================================================*/unsigned int PIDCalc( struct PID *pp, unsigned int NextPoint ){unsigned int dError,Error;E
點擊復(fù)制文檔內(nèi)容
高考資料相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1