Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define F_CPU 16e6
- #include <avr/io.h>
- int main(void) {
- /* Replace with your application code */
- DDRB = (1 << PB1); // PB1/OC1A output pin
- TCCR1A = (0 << COM1A1)|(1 << COM1A0);// Toggle OC1A on compare match
- TCCR1B = (1 << CS12)|(0 << CS11)|(1 << CS10)|(1 << WGM12);// 1024x prescaler and CTC mode with OCR1A top (mode 4)
- OCR1A = 15624;// top value to give 500ms period
- while (1) {
- // Do nothing...
- }
- return (0); // Never reaches this
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement