Close or Esc Key

Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

ADC interface with atmega32 with two sensors

1 post / 0 new
s.manisrinivas
s.manisrinivas's picture
Offline
Last seen: 1 day 17 hours ago
Joined: 16/09/2015 - 12:05
ADC interface with atmega32 with two sensors

HI friends ,

  I need help from you that, I am using ATmega32 avr development board for ADC multiple channels  and i am using two POT sensors.What is my doubt is  I want a small delay after two channel conversions,say delay is 2 sec (for example).After every delay conversions have to display.

I tried but i cannot make delay,for i used timer buts its vain.so, please help me guys

 

here is my code.

#include<avr/io.h>
#define LED PD4 
 
int main()
{
uint8_t timerOverflowCount=0;
DDRD=0xff;         //configure PORTD as output
TCNT0=0x00;
TCCR0 = (1<<CS00) | (1<<CS02);
 
while(1)
{
while ((TIFR & 0x01) == 0); 
 TCNT0 = 0x00;
 TIFR=0x01; //clear timer1 overflow flag              
timerOverflowCount++;
if (timerOverflowCount>=6)
{
PORTD ^= (0x01 << LED);
timerOverflowCount=0;
}
}
}