delifadzli
Member level 2
here is sample source...that i have made using PCW C compiler...it about simple code on LM35 + LCD operation
this source explain about the temperature which being detect by LM35 display to LCD
here i wanna ask....isn't this code can be used?
since...when i compile ..there is no error.....
#include <16f877a.h>
#device ADC=10
#FUSES HS,NOWDT,NOPROTECT,NOLVP
#USE DELAY (CLOCK=20000000)
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <lcd.c>
//Define parameter
unsigned int temp_adc=0;
char L;
float temp;
void main()
{
set_tris_D(0x00); // Config PORTD for LCD display.
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_INTERNAL); // All channels are config as analog I/p.
lcd_init();
printf (L, "Temperature is:");
//procedure ADC
while(1)
{
temp_adc=read_adc();
temp= 5*temp_adc*(100.00/1023.00);
lcd_gotoxy(1,1);
lcd_putc('\f');
printf(lcd_putc,"Temp is:%f",temp);
delay_ms(50);
}
}
i hope some respond...
if there's no error, perhaps i will concentrating more on the hardware part
this source explain about the temperature which being detect by LM35 display to LCD
here i wanna ask....isn't this code can be used?
since...when i compile ..there is no error.....
#include <16f877a.h>
#device ADC=10
#FUSES HS,NOWDT,NOPROTECT,NOLVP
#USE DELAY (CLOCK=20000000)
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <lcd.c>
//Define parameter
unsigned int temp_adc=0;
char L;
float temp;
void main()
{
set_tris_D(0x00); // Config PORTD for LCD display.
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_INTERNAL); // All channels are config as analog I/p.
lcd_init();
printf (L, "Temperature is:");
//procedure ADC
while(1)
{
temp_adc=read_adc();
temp= 5*temp_adc*(100.00/1023.00);
lcd_gotoxy(1,1);
lcd_putc('\f');
printf(lcd_putc,"Temp is:%f",temp);
delay_ms(50);
}
}
i hope some respond...
if there's no error, perhaps i will concentrating more on the hardware part