In our previous article at We Observed, we talked about the introduction to robotics and then we talked about what is microcontroller and microprocessor. Today we will talk about AVR. As you know To complete a Project we need a brain, which will control all the parts and sync with them. There is the number of families of microcontrollers which are used in different work as per their feasibility, capability to perform the desired task. The very common in this are 8051, AVR, PIC and ARM microcontrollers. These are the main brain of Embaded system and soul of any projects. We will start with AVR, We will Complete it and then we will move to the next family.
The main advantage of the microcontroller is that they require low time for performing any of the operations and also due to the higher integration their cost, size.
Here we are introducing you with AVR family of microcontroller along with its introduction, use, and many cool facts.
Brain Behind Embedded System Part 1 AVR
History Of AVR
The AVR was developed in the year 1996 by Atmel Corporation. The architecture of AVR was developed by Alf-Egil Bogen and Vegard Wollan. The AVR derives from the name its developer and stands for Alf-Egil Bogen Vegard Wollan RISC microcontroller, also known as Advanced Virtual RISC.
What Is Advanced Virtual RISC Or AVR?
The Advanced Virtual RISC (AVR) or AVR Studio is software under which various microcontroller is provided and simulation of the various program is done with the help of coding. We will discuss it detail description in later on. But here we covering the details of avr categories and it’s type.
The AVR is directly connected to the embedded system as all the embedded items consist of microcontroller embedded in it. The microcontroller is used commercially for compound applications, which need large memory and also high speed. The AVR microcontroller performs most of the command in the single execution cycle.
Categories Of AVR:
- TinyAVR: Less memory, small size, suitable only for simpler applications.
- MegaAVR: These are the most popular ones having a good amount of memory, higher number of inbuilt peripherals and suitable for moderate to complex applications.
- XmegaAVR: Used commercially for complex applications which require large program memory and high speed of applications.
- Application-specific AVR: MegaAVRs with special features not found on the other members of the AVR family, such as LCD controller,USB controller, advanced PWM, CAN etc.
- FPSLIC (AVR with FPGA): Field Programmable System Level Integrated Circuits(FPSLIC device) combine all the basic system building blocks (logic, memory and uC) in an SRAM-based monolithic field programmable device.
The AT refers to Atmel, the manufacturer, Mega means that the microcontroller belongs to MegaAVR category, 16 signifies the flash memory of the controller, which is 16KB. After Combining all together we will get ATMega 16 and ATMega 32 , Both are very Common, inexpensive as well as popular. They are also the brain of Arduino boards.
Also Check: List of 4 Simple Hackathon Ideas 2019
What Special About AVR?
They are fast, AVR microcontroller executes most of the instruction in single execution cycle. AVRs are about 4 times faster than PICs; they consume less power and can be operated in different power saving modes.
AVR is an 8-bit microcontroller belonging to the family of RISC. In RISC architecture the instruction set of the computer are not only fewer in number but also simpler and faster in operation. The other type of categorization is CSIC.
Building Blocks of AVR Microcontrollers
Different microcontroller have different I/O ports. Like ATmega16 have four (PORTA, PORTB, PORTC and PORTD) 8-bit input-output ports. And each having 8 pins for input-output. Means we have total 32 pins for I/O and ATmega 8 have two (PORTB and PORTD) 8-bit and one (PORTC) 7-bit input-output ports. means we have a total 23 pins for I/O.
Every microcontroller have an oscillator to generate clock frequency. Like AT mega16 have a by default set to the calibrated oscillator of 1 MHz, the maximum frequency of the internal oscillator is 8 MHz.
So ATmega 16 can be operated using an external crystal oscillator with a maximum frequency of 16MHz.
Each AVR microcontroller have inbuilt ADC. Like ATmega16 and ATmega8 are equipped with an 8 channel ADC with a resolution of 10-bits. ADC reads the analog input for e.g., sensor input and converts it into digital information which is understandable by the microcontroller.
Timer/ Counter are basically used to provide a delay in the circuits. Timers are used to set a time period and counters count this. ATmega16 consists of two 8-bit and one 16-bit timer/ counter. Timers are useful for generating precision actions.
It is present with the internal oscillator. Watchdog timer continuously monitors a resets the controller if the code gets stuck at any execution action for more than a defined time interval.
As the name suggests they are used to stop main execution and enter into interrupt service routine. ATmega16 consists of 21 interrupt sources out of which four are external. The remaining are interrupts which support the peripherals like USART, ADC, and Timers etc.
The term USART stands for the Universal Synchronous and Asynchronous Receiver and Transmitter interface is available for interfacing with an external device capable of communicating serially
General Purpose Registers
In AVR microcontroller each pin is associated with a register, like ATmega16 is equipped with 32 general purpose registers which are coupled directly with the Arithmetic Logic Unit (ALU) of CPU.
AVR family of controllers have In-System Programmable Flash Memory which can be programmed without removing the IC from the circuit, ISP allows to reprogram the controller while it is in the application circuits.
Serial Peripheral Interface,SPI port is used for serial communication between two devices on a common clock source. The data transmission rate of SPI is more than that of USART.
Two-wire Interface (TWI) can be used to set up a network of devices, many devices can be connected over TWI interface forming a network, the devices can simultaneously transmit and receive and have their own unique address.
Configuration Of ATMega
- ROM-16 KB
- RAM-1 KB
- EEPROM- 512 Bytes
- I/O pins-32
- Timer- 3
- Operation Voltage- 4.5-5.5 V
- Operating Frequency- 0-16 MHz
- Packaging- 40
That’s all for Brain Behind Embedded System. Next, we will deal with the pin configuration of ATMega 16.
It is a 40 Pin IC, Some of the features of ATmega16 are as follows:
- 16 KB of flash memory
- 1KB of SRAM
- 512 bytes of EEPROM
- 8-channel 10- bit ADC
- Two 8 bit TIMER/Counter
- One 16 bit TIMER/ Counter
- 4 PWM Channels
- In system programmable port
- USART Port
- SPI Port
- I2C Port
- Analog Comparator
What is Single Execution Cycle?
Ans In ATmega 16 clock frequency (fclk) is 12MHz. The ATMega 16 takes 12 clock cycles and the majority of the instruction are executed in one cycle. AVR microcontrollers can execute most of the instruction in a single machine cycle also, But one cycle (machine) takes only one clock cycle.
So the performance per clock cycle is 12 times higher with AVR. The ATmega16A is a low-power CMOS 8-bit microcontroller based on the Atmel AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the ATmega16A achieves throughputs approaching 1MIPS per MHz allowing the system designer to optimize power consumption versus processing speed.
Also Check: How To Deal With Social Media Addiction?
Now, After the Brain behind Embedded System we will cover the topic Embedded System and its working, and uses in the project. So get ready to understand the fundamental of Embedded System.