Praveen Kumar P S
Member level 4
- Joined
- Aug 21, 2014
- Messages
- 79
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 8
- Location
- India
- Activity points
- 627
Hello guys....
I wanted to interface my Lm35 with pic18f4550...
here is my code::
The output i got in my lcd is
Adc Read:87.00
Tem Read:0.00 C
i dont know why is it giving 0.00 ...plz help..
Thank You...
I wanted to interface my Lm35 with pic18f4550...
here is my code::
Code:
#include <18f4550.h>
#device ADC=10
#fuses XT, HS, NOWDT, NOPROTECT, BROWNOUT, NOLVP, PUT
#use delay(clock=48000000)
//#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,ERRORS)
#include<flex_lcd216.c>
void main()
{
float32 T , val;
delay_ms(500);
lcd_init();
lcd_setcursor_vb(1,1);
printf(lcd_putc,"\f ");
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_INTERNAL);
for(;;)
{
set_adc_channel(0);
delay_ms(2);
T=read_adc();
delay_ms(10);
val=T*20*(5/1023);
lcd_gotoxy(1,1);
delay_ms(10);
printf(lcd_putc,"Adc Read:%3.2f ",T);
lcd_gotoxy(1,2);
delay_ms(10);
printf(lcd_putc,"Tem Read:%3.2f \xDFC",val);
delay_ms(500);
output_toggle(PIN_D1);
delay_ms(10);
output_toggle(PIN_E1);
delay_ms(10);
}
}
The output i got in my lcd is
Adc Read:87.00
Tem Read:0.00 C
i dont know why is it giving 0.00 ...plz help..
Thank You...