Tag: Timer

  • ATmega328PB 16-bit Timer TC3 – Fast PWM Mode

    I have used this FAST PWM mode to trigger two interrupt service routines. The timer compares register A sets the frequency. I have not enabled the output compare pins. since it was used by some other peripheral. So by doing this, I generate a PWM signal by issuing a command in the ISR.

  • ATmega328PB 16-bit Timer TC1 – CTC Mode

    Timers are essential components in microcontrollers that allow precise timing and synchronization for various applications. The ATmega328PB microcontroller offers several timer/counters, including Timer/Counter 1 (TC1), which is a 16-bit timer with advanced features. In this blog post, I will explore how to utilize Timer 1 in CTC (Clear Timer on Compare Match) mode on the…

  • ATmega328PB 8-Bit Timer TC0 – Normal Mode

    The simplest mode of operation is the Normal mode (WGM0[2:0] = 0x0). In this mode, the counting direction is always up (incrementing), and no counter clear is performed. The counter simply overruns when it passes its maximum 8-bit value (TOP=0xFF) and then restarts from the bottom (0x00). In Normal mode operation, the Timer/Counter Overflow flag…

  • Up Counting Timer using STM32L476

    I have created this Upcounting timer using the RTC of STM32L476vgt. In this timer, time will keep on incrementing and it will be displayed using the onboard LCD. How to Read RTC of STM32L476G-DISCO Here is the code that I have used to make this. I have used STM32 CUBE IDE for programming and debugging…