Summary of AVR I/O Ports
This article introduces AVR microcontrollers, highlighting their subgroups and common features like I/O ports, timers, and ADCs. It specifically details the configuration of I/O ports using the ATMEGA32 example, explaining the three 8-bit registers (DDRx, PORTx, PINx) required to set pin directions. The text clarifies that setting a bit in the Data Direction Register (DDRx) determines whether a pin acts as an input or output.
Parts used in the AVR Microcontroller Project:
- ATmega microcontrollers
- ATtiny microcontrollers
- Xmega microcontrollers
- UC3 microcontrollers
- SAM3 microcontrollers
- SAM4 microcontrollers
- ATMEGA8 microcontroller
- ATMEGA16 microcontroller
- ATMEGA32 microcontroller
AVR microcontrollers are the advanced microcontrollers. From 1996 onwards these are come into existence. In AVR family there are so many controllers are available. Mainly the AVR family is sub grouped as ATmega, ATtiny, Xmega, UC3, SAM3 and SAM4. In these form 8 to 32 bit controllers are available. All the controllers having some common and some different features, those are coming to common features all are having I/O ports, timer/counters, interrupts and etc, coming to special features those are A/D converters, PWM, D/A converter, on chip I2C, serial communication interfacings, on chip EEPROM and etc. we can use all these features according to our requirement by programming.
Each registers of these three registers are 8-bit registers means generally each port has 8 pins as like each register has 8-bits and each pin refers on bit of register. If we want to configure any pin of the port we can configure the corresponding bits of all three registers. In this article I am taking example as ATMEGA32 microcontroller. Now conceder pins 22-29 of the microcontroller, if we want to configure these 8-pins, there is a need of configure corresponding three registers of 8-bits. Here explaining clearly, in ATMEGA32 pin 22-29 refers PORTC. So if we want to configure PORTC, we need to configure DDRC, PORTC and PINC registers.
- When did AVR microcontrollers come into existence?
AVR microcontrollers came into existence from 1996 onwards. - What are the main subgroups of the AVR family?
The main subgroups are ATmega, ATtiny, Xmega, UC3, SAM3, and SAM4. - How many I/O ports do ATMEGA8, ATMEGA16, and ATMEGA32 have?
These controllers generally have four I/O ports named PORTA, PORTB, PORTC, and PORTD. - What are the three registers needed to configure GPIO pins?
The three registers are DDRx, PORTx, and PINx. - How is a pin configured as an output in the DDRx register?
A pin is configured as an output if the corresponding bit in the DDRxn register is written as logic one. - How is a pin configured as an input in the DDRx register?
A pin is configured as an input if the corresponding bit in the DDRxn register is written as logic zero. - What does the DDRx register stand for?
DDRx stands for Data Direction Register. - How are the 8 bits of these registers divided?
The 8 bits are divided into two 4-bit groups called lower nibbles and upper nibbles.


