Last active
March 21, 2016 14:16
-
-
Save raghavendrahassy/5bd2afa441c0ecc9c82c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment