a4arijit
Newbie level 6
Hi,
I am presently trying to build up a project on a temperature sensor with the help of LM35DZ using an atmega16 uC and trying to display the result on a 16x2 LCD...I have compiled a code but its not working(since I'm a complete noob)...I am posting the code in this thread..Please correct me,any help will be highly appreciated..
____________________________________________________
Code:
#include <mega16.h>
#include <delay.h>
#include <stdio.h>
#include <lcd.h>
#asm
.equ __lcd_port=0x18 ;PORTB
#endasm
#define ADC_VREF_TYPE 0x60
unsigned int i;
unsigned char j;
unsigned char adc_val;
unsigned int adc_volt;
void adc_test()
{
for(j=0;j<3;j++)
{
for(i=0;i<6;i++)
{
adc_val = read_adc(i);
adc_volt = (adc_val * 195.3)/10;
}
delay_ms(500);
}
}
void main()
{
unsigned char rows=2;
unsigned char cols=16;
lcd_init(cols);
lcd_clear();
lcd_gotoxy((cols/2)-6,(rows/2)-1);
lcd_putsf("Temp Reading=");
lcd_gotoxy((cols/2)-3,(rows/2));
lcd_putsf("adc_volt");
}
_____________________________________________________
I am presently trying to build up a project on a temperature sensor with the help of LM35DZ using an atmega16 uC and trying to display the result on a 16x2 LCD...I have compiled a code but its not working(since I'm a complete noob)...I am posting the code in this thread..Please correct me,any help will be highly appreciated..
____________________________________________________
Code:
#include <mega16.h>
#include <delay.h>
#include <stdio.h>
#include <lcd.h>
#asm
.equ __lcd_port=0x18 ;PORTB
#endasm
#define ADC_VREF_TYPE 0x60
unsigned int i;
unsigned char j;
unsigned char adc_val;
unsigned int adc_volt;
void adc_test()
{
for(j=0;j<3;j++)
{
for(i=0;i<6;i++)
{
adc_val = read_adc(i);
adc_volt = (adc_val * 195.3)/10;
}
delay_ms(500);
}
}
void main()
{
unsigned char rows=2;
unsigned char cols=16;
lcd_init(cols);
lcd_clear();
lcd_gotoxy((cols/2)-6,(rows/2)-1);
lcd_putsf("Temp Reading=");
lcd_gotoxy((cols/2)-3,(rows/2));
lcd_putsf("adc_volt");
}
_____________________________________________________