Hey Fellas! Hope you are doing fine. Microcontrollers play an important role in the development of embedded systems. They are used where automation is an integral part of the system. Today, I am going to unlock the details on the Introduction to Atmega16.
It is a 40-pin low power 8-bit microcontroller which is developed using CMOS technology and based on AVR architecture. This is the most commonly used AVR microcontroller which belongs to Atmel Mega family.
You must have a look at microcontroller called Atmega328 that also belongs to the mega family.
Other microcontrollers that are readily available and fall under AVR category are Atmega 8 and Atmega 32. All these controllers perform similar tasks, however, they are only different in terms of their memory size and cost.
I’ll discuss each and everything related to this controller so you don’t need to scrape through the internet and find all information in one place. Let’s dive in and explore what is this about, its main features, pin diagram and everything you need to know.
Introduction to Atmega16
- Atmega16 is a 40-pin low power microcontroller which is developed using CMOS technology.
- CMOS is an advanced technology which is mainly used for developing integrated circuits. It comes with low power consumption and high noise immunity.
- Atmega16 is an 8-bit controller based on AVR advanced RISC (Reduced Instruction Set Computing) architecture. AVR is family of microcontrollers developed by Atmel in 1996.
- It is a single chip computer that comes with CPU, ROM, RAM, EEPROM, Timers, Counters, ADC and four 8-bit ports called PORTA, PORTB, PORTC, PORTD where each port consists of 8 I/O pins.
- Atmega16 has built-in registers that are used to make a connection between CPU and external peripherals devices. CPU has no direct connection with external devices. It can take input by reading registers and give output by writing registers.
- Atmega16 comes with two 8-bit timers and one 16-bit timer. All these timers can be used as counters when they are optimized to count the external signal.
- Most of the necessary peripherals required to run automatic functions are incorporated in this device like ADC (analog to digital converter), Analog comparator, USART, SPI, which make it economical as compared to a microprocessor that requires external peripheral to perform various functions.
- Atmega16 comes with 1KB of static RAM which is a volatile memory i.e stores information for short period of time and highly depends on the constant power supply. Whereas 16KB of flash memory, also known as ROM, is also incorporated in the device which is non-volatile in nature and can store information for long period of time and doesn’t lose any information when the power supply is disconnected.
- Atmega16 works on a maximum frequency of 16MHz where instructions are executed in one machine cycle.
Architecture of Atmega16
Following figure shows the architecture of Atmega16 that is based on Harvard Architecture and comes with separate buses and memories. Instructions are stored in the program memory.
CPU is like a brain of the controller which helps in executing a number of instructions. It can handle interrupts, perform calculations and control peripherals with the help of registers. Atmega16 comes with two buses called instruction bus and data bus.
The CPU reads the instructions in the instruction bus while data bus is used to read or write the corresponding data. The CPU mainly consists of the program counter, general purpose registers, stack pointer, instruction register and an instruction decoder.
The controller program is stored in ROM, also known as non-volatile programmable flash memory. The flash memory comes with a resolution of at least 10,000 write/erase cycles. Flash memory is mainly divided into two parts known as Application flash section and booth flash section.
Program of the controller is stored in the applications flash section. While booth flash section is optimized to work directly when the controller is powered up.
The SRAM (static random access memory) is used for storing information temporarily and comes with 8-bit registers. This is just like a regular computer RAM which is used to supply data through the runtime.
The EEPROM (Electronically Erasable Read Only Memory) is non-volatile memory used as a long time storage. It has no involvement in executing the main program. It is used for storing the configuration of the system and device parameters which continues to work in the reset of the application processor.
EEPROM comes with a limited write cycle up to 100,000 while read cycles are unlimited. While using EEPROM, write minimum instructions as per requirement, so you can get benefit from this memory for a longer time.
The interrupt is used for an emergency which puts the main function on hold and executes the necessary instructions at that time. Once the interrupt is called and executed the code switches back to the main program.
6. Analog and Digital I/O Modules
Digital I/O modules are used to set a digital communication between the controller and external devices. While analog I/O modules are used for transferring analog information. Analog comparators and ADC fall under the category of analog I/O modules.
Timers are used for calculating the internal signal within the controller. Atmega16 comes with two 8-bit timers and one 16-bit timer. All these timers work as a counter when they are optimized for external signals.
8. Watchdog Timer
The watchdog timer is a remarkable addition in this controller which is used to generate the interrupt and reset the timer. It comes with 128kHz distinct CLK source.
9. Serial Communication
Atmega16 comes with USART and SPI units that are used for developing serial communication with the external devices.
Following figure shows the pin diagram of this AVR microcontroller Atmega16.
- Atmega16 is preferred over other microcontrollers like Atmel 8051 because it comes with much faster ability to execute instructions and consist of modified RISC processor.
- It has a built-in flash which comes with features of a bootloader. It has built-in 10-bit ADC, SPI, PWM, and EEPROM.
Pin Description of Atmega16
Atmega16 comes with 40 pins where each pin is used to perform a specific task. There are total 32 I/O pins and four ports. Each port consists of 8 I/O pins.
- PORTA = 8 Pins ( Pin 33 – 40 )
- PORTB = 8 Pins ( Pin 1 – 8 )
- PORTC = 8 Pins ( Pin 22 – 29 )
- PORTD = 8 Pins ( Pin 14 – 21 )
Following are the main functions associated with pins.
PORTA. Pins from 33 to 40 fall under PORTA. It acts like analog inputs to A/D converter. However, in the absence of A/D converter, PORTA is used as an 8-bit bidirectional I/O port. It comes with internal pull-up resistors.
PORTC. PORTC is an I/O bidirectional port that consists of 8 pins. Pin from 22 to 29 belongs to this port. Similar to other ports, it comes with internal pull-up resistors.
PORTD. Pin from 14 to 21 belongs to this port. It is a bidirectional port where each pin can be used as input or output pin. However, there are additional features associated with this port like interrupts, serial communication, timer, and PWM.
Reset. Pin9 is an active low reset Pin. A low-level pulse for longer than minimum pulse length will produce a reset. Short pulses are unlikely to produce reset.
VCC. Pin10 is a power supply pin for this controller. The power supply of 5 V is required to put this controller in a running condition.
GND. Pin11 is a ground pin.
AREF. Pin32 is an analog reference pin mainly used for A/D converter.
AVCC. Pin30 is an AVCC which is a supply voltage pin for PORTA and ADC. It is connected to VCC through a low pass filter in the presence of ADC. However, in the absence of ADC, AVCC is externally connected to VCC.
Pin 12 & 13. A crystal oscillator is connected with these pins. Atmega16 works at the internal frequency of 1MHZ; the oscillator is added to generate high clock pulses and frequency.
AVR controllers come with a wide range of applications where automation is required. Following are the main applications of Atmega16.
- Medical equipment
- Home automation
- Embedded systems
- Arduino Projects
- Used in automobiles and industrial automation
- Home appliances and security systems
- Temperature and pressure control devices
That’s all for today. I hope you have got enough information regarding Atmega16. If you are unsure or have any question, you can approach me in the comment section below. I’d love to help you in any way I can. Feel free to keep us updated with your valuable suggestions and feedback. They help us provide you quality content. Thanks for reading the article.