Hello,
I learning AVR programming,
I have made a code to toggle AVR pin at an interval using interrupts
Here' the code
AVR Timer: CTC mode
I learning AVR programming,
I have made a code to toggle AVR pin at an interval using interrupts
Here' the code
Code (Text):
- #include <avr/io.h>
- #include <avr/interrupt.h>
- // initialize timer, interrupt and variable
- void timer1_init()
- {
- // set up timer with prescaler = 64 and CTC mode
- TCCR1B |= (1 << WGM12)|(1 << CS11)|(1 << CS10);
- TIMSK1 |= (1 << OCIE1B); // Output Compare B Match Interrupt Enable
- // initialize counter
- TCNT1 = 0;
- // initialize compare...