Advertisement
Guest User

Untitled

a guest
May 26th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #define F_CPU 16000000UL
  2. #include
  3. void timer1_init(); //initialize timer
  4.  
  5. int main(void)
  6. {
  7.  
  8. DDRC|= 1<<PINC0;
  9. while(1)
  10. {
  11. if(TIFR &(1<<OCF1A))
  12. {
  13. PORTC^=1<<PINC0;
  14. }
  15. TIFR|=1<<OCF1A;
  16. }
  17. void timer_init()
  18. {
  19. TCCR1B|=(1<<WGM12)|(1<<CS11)|(1<<CS10);
  20. TCNT1=0; // initialize counter
  21. OCR1A=24999;
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement