多路數(shù)據(jù)采集控制器_第1頁
多路數(shù)據(jù)采集控制器_第2頁
多路數(shù)據(jù)采集控制器_第3頁
多路數(shù)據(jù)采集控制器_第4頁
多路數(shù)據(jù)采集控制器_第5頁
已閱讀5頁,還剩39頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

楊弋、程于、王嘉敏、任召寶:多路數(shù)據(jù)采集控制器(ROTUES楊弋、程于、王嘉敏、任召寶:多路數(shù)據(jù)采集控制器(ROTUES仿真軟件)--#-d2=d4;}pianxuan(1);shuju();if(lei!=0x7f)lei++;}}gotoagain;}/*REG51.HHeaderfileforgeneric80C51and80C31microcontroller.Copyright(c)1988-2002KeilElektronikGmbHandKeilSoftware,Inc.Allrightsreserved.*/#ifndef__REG51_H__#define__REG51_H__/*BYTERegister*/sfrPCON=0x87;sfrTCON=0x88;sfrTMOD=0x89;sfrP0sfrP1sfrP2sfrP3sfrPSWsfrACCsfrBsfrSPsfrDPLsfrDPH=sfrP0sfrP1sfrP2sfrP3sfrPSWsfrACCsfrBsfrSPsfrDPLsfrDPH=0x80;=0x90;=0xA0;=0xB0;=0xD0;=0xE0;=0xF0;=0x81;=0x82;=0x83;sfrTL0=0x8A;

sfrTL1=0x8B;sfrTH0=0x8C;sfrTH1=0x8D;sfrIE=0xA8;sfrIP=0xB8;sfrSCON=0x98;sfrSBUF=0x99;/*BITRegister*//*PSW*/sbitCY=0xD7;sbitAC=0xD6;sbitF0=0xD5;sbitRS1=0xD4;sbitRS0=0xD3;sbitOV=0xD2;sbitP=0xD0;/*TCON*/sbitTF1=0x8F;sbitTR1=0x8E;sbitTF0=0x8D;sbitTR0=0x8C;sbitIE1=0x8B;sbitIT1=0x8A;sbitIE0=0x89;sbitIT0=0x88;/*IE*/sbitEA=0xAF;sbitES=0xAC;sbitET1=0xAB;sbitEX1=0xAA;sbitET0=0xA9;sbitEX0=0xA8;

/*IP/*IP*/sbitPS=0xBC;sbitPT1=0xBB;sbitPX1=0xBA;sbitPT0=0xB9;sbitPX0=0xB8;/*P3/*P3*/sbitRD=0xB7;sbitWR=0xB6;sbitT1=0xB5;sbitT0=0xB4;sbitINT1=0xB3;sbitINT0=0xB2;sbitTXD=0xB1;sbitRXD=0xB0;/*SCON*/sbitSM0=0x9F;sbitSM1=0x9E;sbitSM2=0x9D;sbitREN=0x9C;sbitTB8=0x9B;sbitRB8=0x9A;sbitTI=0x99;sbitRI=0x98;#endif/*INTRINS.HIntrinsicfunctionsforC51.Copyright(c)1988-2004KeilElektronikGmbHandKeilSoftware,Inc.Allrightsreserved.*/

#ifndef__INTRINS_H#define__INTRINS_H(void);_(bit);(void);_(bit);(unsignedchar,unsignedchar);(unsignedint,unsignedchar);(unsignedlong,unsignedchar);(unsignedchar,unsignedchar);(unsignedint,unsignedchar);(unsignedlong,unsignedchar);(float);(unsignedchar_sfr);(unsignedchar_sfr);externbit_testbexternunsignedchar_cror_externunsignedint_iror_externunsignedlong_lror_externunsignedchar_crol_externunsignedint_irol_externunsignedlong_lrol_externunsignedchar_chkfloatexternvoid_push_externvoid_pop_#endif/*MATH.HPrototypesformathematicfunctions.Copyright(c)1988-2002KeilElektronikGmbHandKeilSoftware,Inc.Allrightsreserved.*/#ifndef__MATH_H__#define__MATH_H__#pragmaSAVE#pragmaREGPARMSexterncharcabs(charval);externintabs(intval);externlonglabs(longval);externfloatfabs(floatval);externfloatsqrt(floatval);externfloatexp(floatval);externfloatlog(floatval);externfloatlog10(floatval);externfloatsin(floatval);externfloatcos(floatval);externfloattan(floatval);externfloatasin(floatval);externfloatacos(floatval);externfloatatan(floatval);externfloatsinh(floatval);externfloatcosh(floatval);externfloattanh(floatval);externfloatatan2(floaty,floatx);externfloatceil(floatval);externfloatfloor(floatval);externfloatmodf(floatval,float*n);externfloatfmod(floatx,floaty);externfloatpow(floatx,floaty);#pragmaRESTORE#endif#defineucharunsignedchar#defineucharunsignedchar#defineuintunsignedintsbitSTART=P3人4;sbitLimit_up=P2人5;sbitLimit_down=P2人6;sbitOE=P3A6;sbitEOC=P3A5;uintAD;voidadc(){START=1;START=0;while(EOC==0){OE=1;}AD=P0;OE=0;if(AD>240){Limit_up=0;Limit_down=1;}else{if(AD<26){Limit_up=1;Limit_down=0;}else{Limit_up=1;Limit_down=1;}}}LCD顯示代碼ucharcodeqi[]={0x08,0x04,0x08,0x03,0xC8,0x00,0xFF,0xFF,0x48,0x00,0x88,0x01,0x0A,0x08,0x42,0x24,0x62,0x13,0xD2,0x08,0x4A,0x06,0xC6,0x41,0x42,0x80,0xC0,0x7F,0x00,0x00,0x00,0x00,/*"楊",0*/};ucharcodeduo[]={0x00,0x00,0x00,0x81,0x00,0x89,0x20,0x89,0x90,0x44,0x88,0x44,0x54,0x42,0x53,0x25,0xA2,0x29,0x22,0x11,0x12,0x11,0x0A,0x09,0x06,0x05,0x00,0x03,0x00,0x01,0x00,0x00,/*"多",0*/};ucharcodelu[]={0x00,0x20,0x7E,0x3F,0x22,0x20,0xE2,0x1F,0x3E,0x11,0x20,0x11,0x10,0x02,0x08,0x7F,0x0F,0x23,0xB4,0x22,0x44,0x22,0xA4,0x22,0x9C,0x7E,0x04,0x03,0x00,0x01,0x00,0x00,/*"路};ucharcodesu[]={0x10,0x42,0x92,0x42,0x54,0x2A,0x38,0x2E,0xFF,0x13,0x38,0x1A,0x54,0x26,0x52,0x02,0x80,0x40,0xF0,0x20,0x1F,0x13,0x12,0x0C,0x10,0x33,0xF0,0x60,0x10,0x20,0x00,0x00,/*"數(shù)};ucharcodeju[]={0x08,0x02,0x08,0x42,0x08,0x81,0xFF,0x7F,0x88,0x40,0x40,0x30,0xFE,0x0F,0x92,0xFC,0x92,0x44,0x92,0x44,0xF2,0x47,0x92,0x44,0x92,0x44,0x9E,0xFC,0x80,0x00,0x00,0x00,/*"據(jù)};ucharcodecai[]={0x00,0x20,0x84,0x20,0x84,0x10,0x94,0x10,0xA4,0x08,0x84,0x04,0x84,0x02,0xD2,0xFF,0xA2,0x01,0x82,0x02,0xA2,0x04,0x9A,0x08,0x82,0x18,0x80,0x30,0x80,0x10,0x00,0x00,/*"采",4*/};ucharcodeji[]={0x00,0x00,0x10,0x44,0x08,0x44,0xFC,0x25,0x57,0x25,0x54,0x15,0x54,0x0D,0x54,0xFF,0xFD,0x05,0x56,0x0D,0x54,0x15,0x54,0x25,0x54,0x65,0x00,0x25,0x00,0x04,0x00,0x00,/*"集};ucharcodexi[]={0x00,0x00,0x00,0x40,0x02,0x21,0x22,0x13,0xB2,0x09,0xAA,0x05,0x66,0x41,0x62,0x81,0x22,0x7F,0x11,0x01,0x4D,0x05,0x81,0x09,0x01,0x13,0x01,0x62,0x00,0x00,0x00,0x00,/*"系",6*/};ucharcodetong[]={0x20,0x20,0x30,0x22,0x2C,0x23,0xA3,0x12,0x60,0x12,0x10,0x92,0x84,0x40,0xC4,0x30,0xA4,0x0F,0x9D,0x00,0x86,0x00,0x84,0x3F,0xA4,0x40,0xC4,0x41,0x84,0x70,0x00,0x00,/*"統(tǒng)",7*/};ucharcodediv0[]={0x80,0x10,0x80,0x10,0x00,0x00,0x80,0x0B,0x80,0x0A,0x80,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};ucharcodediv1[]={0x42,0x84,0x42,0x84,0x00,0x00,0x00,0xE0,0x00,0x20,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};ucharcodediv2[]={0x10,0x42,0x10,0x42,0x00,0x00,0x03,0x00,0x02,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};ucharcodediv3[]={0x84,0x00,0x84,0x00,0x00,0x00,0xB8,0x00,0xA8,0x00,0xE8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};ucharcodeling_0[]={0x00,0x00,0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20,0x10,0x10,0xE0,0x0F,0x00,0x00};/*"0",0*/ucharcodeyi_1[]={0x00,0x00,0x10,0x20,0x10,0x20,0xF8,0x3F,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00};/*"1",1*/ucharcodeer_2[]={0x00,0x00,0x70,0x30,0x08,0x28,0x08,0x24,0x08,0x22,0x88,0x21,0x70,0x30,0x00,0x00};/*"2",2*/ucharcodesan_3[]={0x00,0x00,0x30,0x18,0x08,0x20,0x88,0x20,0x88,0x20,0x48,0x11,0x30,0x0E,0x00,0x00};/*"3",3*/ucharcodesi_4[]={0x00,0x00,0x00,0x07,0xC0,0x04,0x20,0x24,0x10,0x24,0xF8,0x3F,0x00,0x24,0x00,0x00};/*"4",4*/ucharcodewu_5[]={0x00,0x00,0xF8,0x19,0x08,0x21,0x88,0x20,0x88,0x20,0x08,0x11,0x08,0x0E,0x00,0x00};/*"5",5*/ucharcodeliu_6[]={0x00,0x00,0xE0,0x0F,0x10,0x11,0x88,0x20,0x88,0x20,0x18,0x11,0x00,0x0E,0x00,0x00};/*"6",6*/ucharcodeqi_7[]={0x00,0x00,0x38,0x00,0x08,0x00,0x08,0x3F,0xC8,0x00,0x38,0x00,0x08,0x00,0x00,0x00};/*"7",7*/ucharcodeba_8[]={0x00,0x00,0x70,0x1C,0x88,0x22,0x08,0x21,0x08,0x21,0x88,0x22,0x70,0x1C,0x00,0x00};/*"8",8*/ucharcodejiu_9[]={0x00,0x00,0xE0,0x00,0x10,0x31,0x08,0x22,0x08,0x22,0x10,0x11,0xE0,0x0F,0x00,0x00};/*"9",9*/ucharcodeping[]={0x20,0x44,0x3C,0x43,0x20,0x20,0x20,0x10,0xBF,0x0B,0x24,0x04,0x24,0x43,0x00,0x40,0xF2,0x27,0x1A,0x18,0xD6,0x07,0x12,0x08,0x12,0x10,0xF2,0x27,0x02,0x60,0x00,0x00,/*"頻",0*/};ucharcodelv[]={0x00,0x08,0x0C,0x0A,0x14,0x09,0xA4,0x08,0x04,0x08,0x64,0x0A,0x35,0x0B,0xAE,0xFE,0x64,0x0A,0x24,0x0B,0x14,0x0C,0xA4,0x08,0x14,0x09,0x04,0x0A,0x04,0x08,0x00,0x00,/*"率",1*/};ucharcodefu[]={0xF8,0x0F,0x08,0x00,0xFF,0xFF,0x08,0x08,0xF8,0x0F,0x00,0x00,0x02,0x7F,0x7A,0x25,0x4A,0x25,0x4A,0x25,0x4A,0x3F,0x4A,0x25,0x4A,0x25,0x7A,0x25,0x02,0x7F,0x00,0x00,/*"幅};ucharcodezhi[]={0x80,0x00,0x40,0x00,0xF0,0xFF,0x2F,0x00,0x02,0x40,0x04,0x40,0xE4,0x7F,0xA4,0x4A,0xB4,0x4A,0xAF,0x4A,0xA6,0x4A,0xA4,0x4A,0xE4,0x7F,0x04,0x40,0x00,0x40,0x00,0x00,/*"值",4*/};ucharcodeHz[]={0x08,0x20,0xF8,0x3F,0x08,0x21,0x00,0x01,0x00,0x01,0x08,0x21,0xF8,0x3F,0x08,0x20,/*"H",0*/0x00,0x00,0x80,0x21,0x80,0x30,0x80,0x2C,0x80,0x22,0x80,0x21,0x80,0x30,0x00,0x00,/*"z",1*/};ucharcodeV[]={0x08,0x00,0x78,0x00,0x88,0x07,0x00,0x38,0x00,0x0E,0xC8,0x01,0x38,0x00,0x08,0x00,/*"V",0*/0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};ucharcodemaohao[]={0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x30,0xC0,0x30,0x00,0x00,0x00,0x00,0x00,0x00,};LCD顯示函數(shù)段voidcheckstate(){DI=0;RW=1;do{E=1;E=0;//僅當(dāng)?shù)?位為0時才可操作(判別busy信號)}while(busy==1);}voidwritecommand(unsignedcharcommand)//寫命令checkstate();DI=0;RW=0;P1=command;E=1;E=0;}voidwritedate(unsignedchardate)//寫數(shù)據(jù){checkstate();DI=1;RW=0;P1=date;E=1;E=0;}voidpianxuan(unsignedinti){if(i==1)CS1=0,CS2=1;if(i==2)CS1=1,CS2=0;if(i==3)CS1=0,CS2=0;}voidshuju(){writecommand(ye);writecommand(lei);writedate(shu);}//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>voidcleanscreen()//清屏unsignedcharpage,i;pianxuan(3);for(page=0xb8;page<=0xbf;page++){writecommand(page);writecommand(0x40);for(i=0;i<64;i++)writedate(0x00);}pianxuan(1);lei=0x40;for(ye=0xb8;ye<0xbf;ye++){shu=0xff;shuju();}ye=0xb8;for(lei=0x40;lei<=0x7f;lei++){shu=0x80;shuju();}ye=0xbf;for(lei=0x40;lei<=0x7f;lei++){shu=0x01;shuju();}lei=0x7f;for(ye=0xb9;ye<=0xbe;ye++){shu=0xff;shuju();}}voidcleanall(){unsignedcharpage,i;pianxuan(3);for(page=0xb8;page<=0xbf;page++){writecommand(page);writecommand(0x40);for(i=0;i<64;i++)writedate(0x00);}}voidinit(void)//開顯示,起始行0行{writecommand(0xc0);writecommand(0x3f);}voiddelay_50us(uintt){ucharj;for(;t>0;t--)for(j=19;j>0;j--);}voidqing(){uchari;for(i=0xb9;i<=0xbe;i++){ye=i;shu=0x00;shuju();}}voidwritehz(charr,charc,charchip,char*hz){//寫漢字子程序16*16ucharx,y;writecommand(0xc0);writecommand(0x3f);ye=r;lei=c;pianxuan(chip);for(x=0;x<16;x++){shu=hz[2*x+32*y];shuju();lei++;}lei=lei-16;ye=ye+0x01;for(x=0;x<16;x++)

溫馨提示

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

評論

0/150

提交評論