资源预览内容
第1页 / 共11页
第2页 / 共11页
第3页 / 共11页
第4页 / 共11页
第5页 / 共11页
第6页 / 共11页
第7页 / 共11页
第8页 / 共11页
第9页 / 共11页
第10页 / 共11页
亲,该文档总共11页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
/ / / /Function:Test Temperature.-30+105 / /Used Equation / /RT/R25=e(B*(1/(T+273)-(1/298) / / / /Change List:V0.9 - V0.91(07,02) / /Change display A error / / / /V0.91 - V0.92 (07,03) / /Add Temp Tab jiaozheng 70100C / / /*/#include“ADUC812.h“ #include“math.h“ #include“intrins.h“ #include“string.h“ #include“stdio.h“ #include“dada.h“bdata unsigned char LCD_data8; /* Display Buffer */ intssdata3;#define Temp_100235 #define Temp_401352sbits_data = P20; /* LCD Serial Data Port */ sbit clk_lcd = P22; /* LCD Clock Port */sbit lcd_cs = P21; /* LCD Chip Select Port */sbitled=P27;/* LCD Command Name Define */ #define cmd_off 0x00 /* LCD Control Power Down */ #define cmd_on 0x01 /* LCD Control Power Up */ #define cmd_LCD_off 0x02 /* Close LCD */ #define cmd_LCD_on 0x03 /* Open LCD */ #define cmd_LCD_B3C4 0x29 /* LCD Mode 1/3BAIS,1/4DUTY */ #define cmd_LCD_RC 0x18 /* LCD Control Internal Oscillator 256K */data unsigned char Comm_buff16; /* Serial Port Receiver Buffer */ /data unsigned char Comm_len; /* Serial Port Receiver Data Length */ /bit Comm_ready; /* Serial Port Receiver Flag */* LCD Code 0,1,2.A,B,F,0.,1.,.A.,B.,F. */ unsigned char code LCD_code = 0xeb,0x60,0xc7,0xe5,0x6c,0xad,0xaf,0xe0,0xef,0xed,0xee,0x2F,0 x8b,0x67,0x8F,0x8e,0xfb,0x70,0xd7,0xf5,0x7c,0xbd,0xbf,0xf0,0xff,0xfd,0xfe,0x3f,0 x9b,0x77,0x9f,0x9e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0 x00,0x00,0x00,0x00;/* delay */ void Delay(int p)/* Delay p Clock Cycle */ int j; for(j=0;j=5) con5=con5+1; if(con59)/* V0.9 - V0.91 chang dispaly A error */ con5=0; con4=con4+1; if(con49) con4=0; con3=con3+1; if(con39) con3=0; con2=con2+1; if(con29) con2=0;con1=con1+1; /* V0.91 end */ /LCD_data7=/LCD_code; /* LCD Data */ LCD_data6=LCD_codecon1; LCD_data5=LCD_codecon2; LCD_data4=LCD_codecon3+0x10; LCD_data3=LCD_codecon4; LCD_data2=LCD_codecon5;LCD_data1=0xcc;/LCD_codecom2; LCD_data0=0x8b;/LCD_codecom1; LCD_Display(); /* Clear LCD */ void Clear_LCD() LCD_data0 = 0x00;LCD_data1 = 0x00;LCD_data2 = 0x00;LCD_data3 = 0x00;LCD_data4 = 0x00;LCD_data5 = 0x00;LCD_data6 = 0x00;LCD_data7 = 0x00;LCD_data8 = 0x00; LCD_Display(); /* LCD Inital */ void Inital_LCD(void)LCD_CMD(cmd_off); /* Close LCD System Oscillator */LCD_CMD(cmd_LCD_off); /* Close LCD Bisa Control */LCD_CMD(cmd_LCD_RC); /* Start internal RC Oscillator */LCD_CMD(cmd_on); /* Open LCD System Oscillator */LCD_CMD(cmd_LCD_on); /* Open LCD Bisa Control */LCD_CMD(cmd_LCD_B3C4); /* Set Mode 1/3BAIS,1/4DUTY */ /* Serial Port set */ void Inital_Serial(void) SCON=0x52;/* Serial Mode 1 */ TMOD=0x21;/* T1 Mode 2 */TH1=0xFD; TL1=0xFD;/* Baud 9600 */ TR1=1;/* Start T1 */ TI=1;/* Open Int T1 */ EA=1;/* Open All Int */ /* LCD Check */ LCD_Check() inti; for(i=0;i4; if(Channel=0x01) Sum=0; for(i=0;i V0.92 ADD check Tab */ if(Sum=Temp_100) for(i=0;i75;i+) if(Sum=ADC_Datai)j=i; Temp=Temp_Tabj+(Temp_Tabj+1-Temp_Tabj)*(ADC_Dataj- Sum)/(ADC_Dataj-ADC_Dataj+1); /* V0.92 change end */ else Temp=1.0/(log(Sum/2250.0)/3470.0+(1.0/298.0)-273.0; Delay(50); /Temp=101.372;printf(“temperature=%.1fn“,Temp); Delay_ms(900); Display(Temp); Delay(20);
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号