Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- #include <avr/interrupt.h>
- volatile uint16_t counter;
- int main(void)
- {
- DDRB |= (1<<PB5);
- TCCR0B |= (1 << CS00) | (1 << CS01);
- TCNT0 = 0;
- TIMSK0 |= (1<<TOIE0);
- sei(); // enable interrupts
- while (1)
- {
- if (TCNT0 >= 100)
- {
- PORTB ^= _BV(PB5);
- TCNT0 = 0; // reset counter
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement