Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #define F_CPU 16e6
  2. #include <avr/io.h>
  3.  
  4.  
  5.  
  6. int main(void) {
  7. /* Replace with your application code */
  8.  
  9. DDRB = (1 << PB1); // PB1/OC1A output pin
  10. TCCR1A = (0 << COM1A1)|(1 << COM1A0);// Toggle OC1A on compare match
  11. TCCR1B = (1 << CS12)|(0 << CS11)|(1 << CS10)|(1 << WGM12);// 1024x prescaler and CTC mode with OCR1A top (mode 4)
  12. OCR1A = 15624;// top value to give 500ms period
  13.  
  14. while (1) {
  15. // Do nothing...
  16. }
  17. return (0); // Never reaches this
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement