Skip to content

Instantly share code, notes, and snippets.

@raghavendrahassy
Created March 21, 2016 16:31
Show Gist options
  • Save raghavendrahassy/65f4b4f0e13ce036b48c to your computer and use it in GitHub Desktop.
Save raghavendrahassy/65f4b4f0e13ce036b48c to your computer and use it in GitHub Desktop.
#include<avr/io.h>
#define LED PD4
int main()
{
DDRD=0xff; //configure PORTD as output
OCR1AH = 0x3d;
OCR1AL = 0x09;
TCCR1B = (1<<CS10) | (1<<CS12);
while(1)
{
while ((TIFR & 0x10) == 0);
TCNT1L = 0x00;
TCNT1H = 0x00;
TIFR=0x10; //clear timer1 overflow flag
PORTD ^= (0x01 << LED);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment