Programming and Result: Using the Timer/Counter to Toggle an LED 100 Times/Second

The Timer/Counter is used to count against a known clock frequency, the internal clock source for the AVR microcontroller. In the first part of the experiment, an LED, connected to PORTB and Pin 0 is toggled every time the TCNT1 exceeds 10000. That makes the LED toggle 100 times per second, which is too fast for the eye to discern the blink. The TCCR1B Timer/Counter Control 16-bit Register B is used to turn on the CS10 (Clock Select) option of the control register to enable the timer for no prescaling.



Back to blog

Leave a comment

Please note, comments need to be approved before they are published.