AVR microcontroller
AVR microcontroller
(RISC)
Instruction execute in single cycle
Harvard Architecture
• CPU can read both an instruction and data from memory at the
same time that makes it faster.
Read, Write can`t occur at the same time due to same memory and
signal pathway for data and instructions.
AVR internal architecture
Pin configuration of ATmeag32
•ATMEGA32 has four ports, PORTA,
PORTB, PORTC and PORTD, each one
having 8 pins.
•The remaining 8 are mostly consumed by
supply pins (VCC, AVCC), ground (GND),
reset, XTAL pins, and other minor stuffs.
•Every MCU has an internal oscillator
which determines its frequency of
oscillator. But we can connect an external
crystal oscillator to generate higher
frequencies and clock pulses. This
external oscillator is connected across the
XTAL pins (XTAL1 and XTAL2).
Pin configuration of ATmeag32
•Can you see some things written in the
brackets? Like PA0 (ADC0), PB5 (MOSI),
PC2 (TCK), PD1 (TXD), etc. Well, these are
the extra features that the MCU can offer
you apart from GPIO. In other words,
these pins show dual behavior. If nothing
is specified, they act as GPIO pins. The
secondary features of these pins become
active only if you enable certain bits of
some registers. These are called
peripherals
AVR Peripherals
● There are several peripherals that AVR offers in ATMEGA32, some are as follows:
o ADC – Analog to Digital Converter – usually 10-12 bit
o Timers – 8 bit and 16 bit timers
o JTAG – Joint Test Action Group
o TWI – Two Wire Interface (or) I2C – Inter-Integrated Circuit
o USART – Universal Synchronous Asynchronous Receiver Transmitter
o UART – Universal Asynchronous Receiver Transmitter
o SPI – Serial Peripheral Interface
o WDT– Watchdog Timer …and many more!
AVR Peripherals
● ADC stands for Analog to Digital Conversion. The term is self-explaining. This feature
converts Analog signals into Digital signals. (8-channel ADC for ATmega32)
● JTAG corresponds to testing of the circuit. When we make a circuit and fix the MCU
onto it, we use JTAG to verify whether our connection, soldering, circuit design, etc is
correct or not.
AVR Peripherals
● TWI/I2C (its actually I-square-C) is a revolutionary technology by Philips, in which two devices
are connected and communicate by using two wires.
● USART/UART is related to serial communication in which the MCU sends and receives signals
from another device based on serial protocol.
● WDT (Watch Dog Timer) is something interesting it seems. The name is also quite interesting.
Just like a watchdog always keeps an eye on it’s master to protect him from any harm, WDT
keeps an eye on the execution of the code to protect the MCU from any harm. A WDT is a
computer hardware or software timer that triggers a system reset or other corrective action if
the main program, due to some fault condition, such as a hang, neglects to regularly service
the watchdog (writing a “service pulse” to it, also referred to as “kicking the dog”, “petting the
dog”, “feeding the watchdog” or “waking the watchdog”). The intention is to bring the system
back from the unresponsive state into normal operation.