#include<avr/io.h>
#include<util/delay.h>
#include<stdio.h>
void cmd()
{
PORTB=0x04;
_delay_ms(150);
PORTB=0x00;
}
void display()
{
PORTB=0x05;
_delay_ms(150);
PORTB=0x01;
}
void lcdstring(unsigned char *p)
{
while(*p!='\0')
{
PORTC=*p;
display();
p++;
}
}
unsigned char arr[]={0x38,0x0e,0x80,0x06};
unsigned int a;
unsigned char res[4];
int i;
void main()
{
DDRA=0x00;
DDRB=0xff;
DDRC=0xff;
for(i=0;i<=3;i++)
{
PORTC=arr[i];
cmd();
}
lcdstring("Temperature is");
ADMUX=0xc0;
ADCSRA=(1<<ADEN)|(1<<0);
while(1)
{
ADCSRA|=(1<<ADSC);
while(!(ADCSRA&(1<<ADIF)));
a=(ADC)/4;
sprintf(res,"%d",a);
PORTC=0xc0;
cmd();
lcdstring(res);
}
}
#include<util/delay.h>
#include<stdio.h>
void cmd()
{
PORTB=0x04;
_delay_ms(150);
PORTB=0x00;
}
void display()
{
PORTB=0x05;
_delay_ms(150);
PORTB=0x01;
}
void lcdstring(unsigned char *p)
{
while(*p!='\0')
{
PORTC=*p;
display();
p++;
}
}
unsigned char arr[]={0x38,0x0e,0x80,0x06};
unsigned int a;
unsigned char res[4];
int i;
void main()
{
DDRA=0x00;
DDRB=0xff;
DDRC=0xff;
for(i=0;i<=3;i++)
{
PORTC=arr[i];
cmd();
}
lcdstring("Temperature is");
ADMUX=0xc0;
ADCSRA=(1<<ADEN)|(1<<0);
while(1)
{
ADCSRA|=(1<<ADSC);
while(!(ADCSRA&(1<<ADIF)));
a=(ADC)/4;
sprintf(res,"%d",a);
PORTC=0xc0;
cmd();
lcdstring(res);
}
}