Tag: atmega328pb

  • 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…

  • How to use S109AFTG Microstep Driver with ATmega328PB Programmed using Microchip Studio

    When I opened the case. I found a PCB which is screwed to a big heatsink. I unscrewed the bolts and saw that there is S109AFTG. The IC is sandwiched between the PCB and the heatsink. A small aluminum block is also used for heat transfer between the IC and the heatsink. It has a…

  • How to make a plant watering system using Arduino Uno

    Sometimes we are so busy in our work or in our day-to-day life that we forget to water our plants on time. Or in the summertime when the plants need additional water to sustain themselves in the high-temperature region like New Delhi. This is a simple project that one can assemble and implement within a…

  • How to use AT24C32 EEPROM with ATmega328PB in Microchip Studio

    AT24C32 is an i2c compatible serial EEPROM which can be programmed using a microcontroller. The AT24C32 provides 32,768 bits of serial electrically erasable and programmableread-only memory (EEPROM). The device’s cascadable feature allows up to 8 devices to share a common 2-wire bus. The device is optimized for use in many industrial and commercial applicationswhere low…

  • How to use DS1307 RTC with ATmega328PB via I2C in Microchip Studio

    The DS1307 Real Time Clock uses I2c communication lines to connect with the microcontroller. I2C uses two lines commonly known as Serial Data/Address or SDA and Serial Clock Line or SCL. The two lines SDA and SCL are standardised and they are implemented using either an open collector or open drain configuration. What this means…

  • How to use UART Receive complete ISR of ATmega328PB using microchip studio

    When you enable the communication using the UART. You have the flexibility to either use the Polling or Interrupt method to continue with your programming. Polling halts the execution of the program and waits for the UART peripheral to receive something so that program execution must continue. But it eats a lot of the computing…

  • How to use internal temperature sensor of ATmega328pb

    ATmega328PB is a new semiconductor microcontroller from Microchip semiconductors. I have used its previous generation which is ATmega328 and ATmega328P. They were usually found on Arduino Uno and Arduino nano. This new IC has a temperature sensor built into it. Which is handy for measuring the die temperature. Which can make device stable in high-temperature…

  • How to set up UART of ATmega328pb in Atmel Studio 7.0

    To set up uart in Atmel studio 7.0. Firstly you will need a common baud rate. Then you go to section 24.11 of the datasheet. You will find common calculated values for the UBRRn register. UBRRn register is comprised of high and low registers. First, you have to initialise the Data direction registers for the…