Sign In

Trouble In Transforming Celsius To Farenheit And Getting Farenheit In Decimal

thomas thomas.girgs@gmail.com Egypt

Hardware: Pic18f4620 Running On 8 Mhz Software: C Project Using Microc

i want to make farenheit appear in decimal form

Images

Program

             // LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections

void main() { unsigned int result ,T,T2;
unsigned char x[7];
unsigned char y[7];
TRISD=0;
ADCON1=14;
lcd_init();
adc_init();
lcd_cmd(_LCD_CURSOR_OFF);
lcd_cmd( _LCD_CLEAR);
for(;;){
result=adc_read(0);
T=(unsigned long)500*result/1023;
T2=(unsigned long)(T*9/5)+32 ;
inttostr(T,x);
inttostr(T2,y);
lcd_out(1,1,"Temp=");
lcd_out_cp(ltrim(x));
lcd_out_cp(0b11011111);
lcd_out_cp("c");
lcd_out(2,1,"Temp=");
lcd_out_cp(ltrim(y));
lcd_out_cp(0b11011111);
lcd_out_cp("F");
if(T>25){RD0_bit=1;
}
else{RD0_bit=0;}
delay_ms(500);

  }
}

Replies

R Avinash
2016-08-19 16:44:40
So how it is shown on LCD right now? Post a picture ...

Post a reply to thomas

Think you can help thomas ? Then post your thoughts that might help thomas. You will earn a lot of reputation in the technical community.

If your program is in multiple files, then ZIP the entire folder and attach below

Images and Screenshots

These helps other better understand your suggestion.