Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <atmel_start.h>
  2. #include <avr/interrupt.h>
  3. #include <util/delay.h>
  4. #include <usart_basic.h>
  5.  
  6.  
  7. ISR(TIMER1_COMPA_vect)
  8. {
  9. PORTD ^= 0xff; // Interrupt 반전신호 통해 LED 점멸
  10. }
  11.  
  12. int main(void)
  13. {
  14. atmel_start_init();
  15. DDRD = 0x0c; // 포트지정
  16.  
  17. TCCR1A = 0x00;
  18. TCCR1B = (1<<WGM12)|(1<<CS11)|(1<<CS10); // 64분주 지정(prescaler)
  19. TCCR1C = 0x00;
  20. OCR1AH = (62499 >>8);
  21. OCR1AL = 62499 & 0xff;
  22. TIMSK1 = (1<<OCIE1A);
  23.  
  24. sei();
  25.  
  26.  
  27. while (1);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement