多路数据采集控制器_第1页
多路数据采集控制器_第2页
多路数据采集控制器_第3页
多路数据采集控制器_第4页
多路数据采集控制器_第5页
已阅读5页,还剩39页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

杨弋、程于、王嘉敏、任召宝:多路数据采集控制器(ROTUES杨弋、程于、王嘉敏、任召宝:多路数据采集控制器(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,/*"数};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,/*"据};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,/*"统",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显示函数段voidcheckstate(){DI=0;RW=1;do{E=1;E=0;//仅当第7位为0时才可操作(判别busy信号)}while(busy==1);}voidwritecommand(unsignedcharcommand)//写命令checkstate();DI=0;RW=0;P1=command;E=1;E=0;}voidwritedate(unsignedchardate)//写数据{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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论