Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define F_CPU 8000000
- #include <avr/io.h>
- int main(void)
- {
- //Table 11-3 Compare Output Mode, Fast PWM mode
- //Table 11-5 Waveform Generation Mode Bit Description
- //COM0A0 - non-inverting
- TCCR0A |= (0<<WGM02)|(1<<WGM01)|(1<<WGM00)|(1<<COM0A1);
- //Table 11-6 Clock Select Bit Description
- TCCR0B |= (0<<CS02)|(0<<CS01)|(1<<CS00); //pre-scale factor = 1
- OCR0A=128; // 128/256 = 0.5 duty cycle
- //make PWM pin output
- DDRB |= (1<<DDB0);
- while(1){}
- return 0;
- }
Add Comment
Please, Sign In to add comment