nitsakh
Member level 1
The following HiTech C code is written to display the temperature on LCD with PIC16F877A.However,0 value is displayed.
Atleast the voltage should get displayed.Please help with the problem in code.
Thank You.
Now some random garbage values like,99,28,192,424 etc are getting displayed.
Atleast the voltage should get displayed.Please help with the problem in code.
Code:
#include <htc.h>
#include<math.h>
#include<stdio.h>
#include "lcd.h"
__CONFIG(0x2F4A);
void adc_read()
{
ADCON0=0x00;
ADCON1=0b10000000;
ADON=1;
GODONE=1;
while(GODONE);
ADON=0;
}
void main()
{
TRISA=0xFF;
lcd_init();
lcd_goto(0);
lcd_puts("LM35 Test");
lcd_goto(0x40);
unsigned int val;
char buff[4];
while(1)
{
lcd_goto(0x40);
adc_read();
__delay_ms(2000);
val=ADRESL;
sprintf(buff,"%d",val);
lcd_puts(buff);
__delay_ms(5000);
}
}
Thank You.
Now some random garbage values like,99,28,192,424 etc are getting displayed.
Last edited: