Microcontroller › AVR › Help regarding Digital Thermometer › hi sandeeb,actually a program
hi sandeeb,
actually a program in this site in microcontrollers-avr is avialable.
i have pasted it below.
only thing is you need a interfacing diagram which is a single pin of LM 35 going to microcontroller and the rest 2 are vcc and ground.
you can get diagram from net.
i think it will work.
if the below code does not work in some software try to change the header file.
// Program to take input from a particular pin in AVR Microcontroller (ATmega16) #include<avr/io.h> #include<util/delay.h>
int main (void)
{
unsigned int i=0;
DDRA=~_BV(PA0); // PA0 as input pin
PORTA=0x00;
DDRD=0xff;
while(1)
{
PORTD=0x01;
while(PORTD!=0)
{
if(bit_is_set(PINA,PA0)) //If PA0=1
{
_delay_ms(100);
if(bit_is_set(PINA,PA0))//Check it again due to swithc debouncing
PORTD=(PORTD<<1); //Left shift value of PORTD by 1
}
}
}
}