北方民族大學(xué)計(jì)算機(jī)控制課設(shè)按要求設(shè)置溫度控制系統(tǒng)硬件仿真流程圖程序_第1頁(yè)
北方民族大學(xué)計(jì)算機(jī)控制課設(shè)按要求設(shè)置溫度控制系統(tǒng)硬件仿真流程圖程序_第2頁(yè)
北方民族大學(xué)計(jì)算機(jī)控制課設(shè)按要求設(shè)置溫度控制系統(tǒng)硬件仿真流程圖程序_第3頁(yè)
北方民族大學(xué)計(jì)算機(jī)控制課設(shè)按要求設(shè)置溫度控制系統(tǒng)硬件仿真流程圖程序_第4頁(yè)
北方民族大學(xué)計(jì)算機(jī)控制課設(shè)按要求設(shè)置溫度控制系統(tǒng)硬件仿真流程圖程序_第5頁(yè)
已閱讀5頁(yè),還剩36頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、運(yùn)算機(jī)掌握硬件圖終極版仿真程序 主程序流程圖 中斷服務(wù)子程序流程圖#include #include #include #include struct PID spid;/ PID Control structure unsigned int rout;/ PID response output unsigned int rin;/ PID feedbackinput sbit A0=P00; sbit A1=P01; sbit WR=P02; sbit RD=P03; sbit A0_2=P30; sbit A1_2=P31; sbit WR_2=P36; sbit RD_2=P37; un

2、signed char flag,flag_1=0;/標(biāo)志未 初始化unsigned char high_time,low_time,count=0;/ 占空比 調(diào)劑參數(shù)unsigned char set_temper;/ 設(shè)定溫 度unsigned char temper;/ 測(cè)量的溫度 unsigned char i; unsigned char j=0; unsigned int s; /*1602 液晶初始化 */ uchar code table=Temper; uchar num; uchar num_cal; sbit rs=P15; / 數(shù)據(jù)命令挑選sbit rw=P16; /

3、 讀寫(xiě) 挑選sbit en=P17; / 使能端sbit lcd_le=P34; sbit lcd_8253=P35; void delayuchar z / 延時(shí) uchar x,y; forx=z;x0;x- fory=110;y0;y-; void lcd_comuchar com / 命令函數(shù) rs=0; rw=0; en=0; lcd_8253=0; lcd_le=1; P0=com; lcd_8253=1; lcd_le=0; delay5; en=1; delay5; en=0; void lcd_datauchar date / 數(shù)據(jù) rs=1; rw=0; en=0; lcd

4、_8253=0; lcd_le=1; P0=date; lcd_8253=1; lcd_le=0; delay5; en=1; delay5; en=0; void init_lcd / 初始化 lcd_com0 x38; lcd_com0 x0f; lcd_com0 x06; lcd_com0 x80; lcd_com0 x01; *LCD顯示子程序*/ void display unsigned char disp_num6; unsigned int k,k1; k=high_time; k=k%1000; k1=k/100;/ 得到百位溫度值 ifk1=1 disp_num0=0; e

5、lse disp_num0=0 x60; k=k%100;/得到十位的溫度值 disp_num1=numberk/10; disp_num2=numberk%10; k=temper; k=k%100;/得到個(gè)位的溫度值 disp_num3=numberk/10; disp_num4=numberk%10+1; disp_num5=numbers/10; disp_1disp_num; fornum=0;numSetPoint-NextPoint;/運(yùn)算 出偏差pp-SumError+=Error;/積分dError=pp-LastError-pp-PrevError;/ 當(dāng)前微分 pp-Pr

6、evError=pp-LastError; pp-LastError=Error; returnpp-Proportion*Error / 比例項(xiàng)+pp-Integral*pp-SumError / 積分項(xiàng) +pp-Derinative*dError; / 微分項(xiàng) compare_temper unsigned char i; ifset_tempertemper/ 判斷溫度 Ifset_temper-temper1/ 判定溫差是否大于 1 度 high_time=100;low_time=0; else fori=0;i10;i+ get_tember;/ 得 到當(dāng)前溫度rin=s;/ 讀輸

7、入 rout=PIDCalc&spin,rin;/輸 出 pid 運(yùn)算結(jié)果 ifhigh_time=100 high_time=unsigned charrout/800; else high_time=100; low_time=100-high_time; else ifset_temper0 high_time=0; low_time=100; else fori=0;i10;i+ get_temper; rin=s;/ 讀輸入rout=PIDCalc&spin,rin;/ 輸出 pid 運(yùn)算結(jié)果 ifhigh_time100 high_time=unsigned char rout/1

8、0000; else high_time=0; low_time=100-high_time; /* T1 中斷服務(wù)子程序 * * */ void serve_T1interrupt 1 using 1 ifnum_cal=20 num_cal=0; get_temper;/ 獵取溫度;compare_temper;/Smith 算法及溫度處理RD=1; WR=0; A0=0; A1=0; P1=rout;/ 更新 8253 脈沖 TH0=0 x2f; TL0=0 xe0; else=num_cal+; * * */ 主程序* * */ main unsigned char z; unsigned char a,b,flag_2=1,count1=0; unsigned char phil=2,0 xce,0 x60,0 x1c,2; TMOD=0 x21; TH0=0 x2f; TL0=0 x40; SCON=0 x50; PCON=0 x00; TH1=0 xfd; TL1=0 xfd; PS=1; EA=1; EX1=0; ET0=1; ES=1; TR0=1; TR1=1; high_time=50; low_time=50; / 高電平常間 / 低電平常間init_lcd; / 液晶初始化8253_init; /8253 初始化PIDInit&spid; /

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論