Guest User

Untitled

a guest
Feb 22nd, 2018
90
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 8000000
  2. #include <avr/io.h>
  3.  
  4. int main(void)
  5. {
  6. //Table 11-3 Compare Output Mode, Fast PWM mode
  7. //Table 11-5 Waveform Generation Mode Bit Description
  8. //COM0A0 - non-inverting
  9. TCCR0A |= (0<<WGM02)|(1<<WGM01)|(1<<WGM00)|(1<<COM0A1);
  10. //Table 11-6 Clock Select Bit Description
  11. TCCR0B |= (0<<CS02)|(0<<CS01)|(1<<CS00); //pre-scale factor = 1
  12.  
  13. OCR0A=128; // 128/256 = 0.5 duty cycle
  14.  
  15. //make PWM pin output
  16. DDRB |= (1<<DDB0);
  17.  
  18. while(1){}
  19.  
  20. return 0;
  21. }
Add Comment
Please, Sign In to add comment