بسم الله الرحمن الرحيم
ارجو من الاخوة الزملاء المساعدة فى قياس درجة الحرارة عن طريق ثرمستور
انا اطلعت على برنامج من تصميم الاخ م/ عبد العزير وارجو التعديل علية
المطلوب هو اظهار قيمة درجة الحرارة ارقام صحيحة وارقام عشرية
بهذا الشكل (000.0)
ولا يذيد عن هذا الشكل
حيث اخر قيمة من المعدلات هى من نوع float
البرنامج ارجو التعديل علية
sbit LCD_RS at RB2_bit;
sbit LCD_EN at RB3_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
float vt,rt,temp,y;
char red[8];
char *red1="000.0";
void adc1(){
vt=ADC_Read(0);
vt=vt*5/1024;
rt=vt*10000.0/(5.0-vt);
y=log(0.0001*rt);
y=3.354/1000+y*2.272/10000;
y=1/y;
temp=y-273.15;
FloatToStr(temp, red);
lcd_out(2,1,red);
lcd_chr(2,15,223);
lcd_chr(2,16,'c');
}
void main(){
trisa=0xff;
trisb=0;
trisc=0xff;
porta=0;
portb=0;
portc=0;
lcd_Init();
lcd_cmd(_LCD_CLEAR);
lcd_cmd(_LCD_CURSOR_OFF);
lcd_out(1,1,"thermistor TEMP");
while(1){
adc1();
delay_ms(2000);
}
}