AVR Microcontroller

Welcome To AVR Microcontroller

The 

icrocontroller/" target="_blank">AVR is one of the most powerful architecture in processor design. It was developed in the year 1996 by ATMEL Corporation. This architecture was designed by Alf-Egil Bogen and Vegard Wollan and the naming convention was derived from both the developers and it stands for Alf-Egil Bogen Vegard Wollan RISC microcontroller and mostly we called it as Advanced Virtual RISC machine. The first AVR microcontroller was AT90S8515 but it was not able to interrupt the commercial market with the competitor where after the AT90S1200 was started his business in the commercial market in the year 1997.

Basically, the AVR architecture is available in 3 categories in the market for their different features as:

  • Tiny AVR: Small in size and very less memory used for small applications.
  • Mega AVR: This is the most popular used microcontroller in the market which is having flash memory up to 256kb, number of peripherals, and it is suitable for moderate to complex applications.
  • X-Mega AVR: This is the most high-end controller used for complex microcontrollers that need more FLASH & RAM memory with high-speed operation. Mostly it is used for commercial purposes.

Why AVR Microcontroller?

The AVR microcontroller is very fast than others which can able to execute most of the instructions in one execution cycle. The AVR microcontrollers are 4 times faster than PIC microcontrollers. It consumes very little power and can have different modes to control the power consumption for devices.

There is so much Processor design architecture, and I think most of the important architectures you can get here in my processor page. Here I am going to discuss the AVR microcontroller. Let’s go start with AVR microcontroller. There are so many controllers variants available, but I am considering ATMEGA-8 microcontroller. because it is a very good standard microcontroller for you if you want to learn the microcontroller driver programming.

Introduction to ATmega8 Microcontroller:

The ATmega8 is a low-power CMOS 8-bit microcontroller based on the AVR RISC architecture. By executing powerful instructions in a single clock cycle, the ATmega8 achieves throughputs approaching 1 MIPS per MHz, allowing the system designer to optimize power consumption versus processing speed.

Features of ATmega-8 Microcontroller:

  • Advanced RISC Architecture:
    • 130 Powerful Instructions – Most Single-clock Cycle Execution
    • 32 × 8 General Purpose Working Registers
    • Fully Static Operation
    • Up to 16MIPS Throughput at 16MHz
    • On-chip 2-cycle Multiplier
  • High Endurance Non-volatile Memory segments:
    • 8Kbytes of In-System Self-Programmable Flash program memory
    • 512Bytes EEPROM
    • 1Kbyte Internal SRAM
    • Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
    • Data retention: 20 years at 85°C/100 years at 25°C (1)
    • Optional Boot Code Section with Independent Lock Bits
    • In-System Programming by On-chip Boot Program
    • True Read-While-Write Operation
    • Programming Lock for Software Security
  • Peripheral Features:
    • Two 8-bit Timer/Counters with Separate Prescaler, one Compare Mode
    • One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode
    • Real-Time Counter with Separate Oscillator
    • Three PWM Channels
    • 8-channel ADC in TQFP and QFN/MLF package (Eight Channels 10-bit Accuracy)
    • 6-channel ADC in PDIP package (Six Channels 10-bit Accuracy)
    • Byte-oriented Two-wire Serial Interface
    • Programmable Serial USART
    • Master/Slave SPI Serial Interface
    • Programmable Watchdog Timer with Separate On-chip Oscillator
    • On-chip Analog Comparator
  • Special Micro-controller Features:
    • Power-on Reset and Programmable Brown-out Detection
    • Internal Calibrated RC Oscillator
    • External and Internal Interrupt Sources
    • Five Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, and Standby
  • I/O and Packages:
    • 23 Programmable I/O Lines
    • 28-lead PDIP, 32-lead TQFP, and 32-pad QFN/MLF
  • Operating Voltages:
    • 2.7V – 5.5V (ATmega8L)
    • 4.5V – 5.5V (ATmega8)
  • Speed Grades:
    • 0 – 8MHz (ATmega8L)
    • 0 – 16MHz (ATmega8)
  • Power Consumption at 4Mhz, 3V, 25C:
    • Active: 3.6mA
    • Idle Mode: 1.0mA
    • Power-down Mode: 0.5µA

The architecture of AVR microcontroller:

The ATmega8 is an 8-bit MCU. 8-bit means it can process 8 bits of data per clock cycle. Its data bus has 8 lines. As it is based on CMOS technology, It consumes less power. It is designed on the basis of RISC architecture. RISC stands for “Reduced Instruction Set Computer”. This is one of the most famous architectures that exist in the world. Another type is CISC which stands for “Complex Instruction Set Computer”.

AVR arch design
AVR Microcontroller Architecture Design

ATmega8 Pin Diagram Description:

The main feature of Atmega8 Microcontroller is that all the pins of the Microcontroller support two signals except 5-pins. The Atmega8 microcontroller consists of 28 pins where pins 9,10,14,15,16,17,18,19 are used for port B, Pins 23,24,25,26,27,28 and 1 are used for port C and pins 2,3,4,5,6,11,12 are used for port D.

atmega8 Pin diag
ATmega8 Microcontroller 28-Pin PDIP Diagram

VCC: Digital supply voltage. We will be connecting the positive terminal of 5 volt regulated supply at this pin.
GND: Ground. We will be connecting the ground terminal of 5 volt regulated supply at this pin.

Port B (PB7-PB0):

Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running. Depending on the clock selection fuse settings, PB6 can be used as input to the inverting Oscillator amplifier and input to the internal clock operating the circuit. Depending on the clock selection fuse settings, PB7 can be used as output from the inverting Oscillator amplifier. If the Internal Calibrated RC Oscillator is used as the chip clock source, PB7-6 is used as TOSC2-1 input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set.

Port C(PC5-PC0):

Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port C output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running.

Port D (PD7-PD0):

The Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running.

PC6/RESET:

If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the electrical characteristics of PC6 differ from those of the other pins of Port C. If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level on this pin for longer than the minimum pulse length will generate a Reset, even if the clock is not running.

RESET:

The Pin -1 is the RST (Reset) pin and applying a low-level signal for a time longer than the minimum pulse length will produce a RESET.

Avec: The AVcc is the supply voltage pin for the A/D Converter, Port C (3…0), and ADC (7…6). It should be externally connected to Vcc, even if the ADC is not used. If the ADC is used, it should be connected to Vcc through a low-pass filter. Note that Port C (5…4) uses digital supply voltage, Vcc.

Aref: The Aref is the analog reference pin for the A/D Converter. ADC7…6 (TQFP and QFN/MLF Package Only) In the TQFP and QFN/MLF package, ADC7…6 serves as analog inputs to the A/D converter. These pins are powered from the analog supply and serve as 10-bit ADC channels.

Introduction to AVR Studio

AVR Studio is an Integrated Development Environment for writing and debugging AVR applications in Windows 98/XP/ME/2000/3/7/10 and Windows NT environments. AVR Studio provides a project management tool, source file editor, and chip simulator. It also interfaces with In-Circuit Emulators and development boards available for the AVR 8-bit RISC family of microcontrollers. Simplifying the development tasks, AVR Studio allows customers to significantly reduce time-to-market. You can download the AVR Studio in this link https://www.microchip.com/mplab/avr-support/atmel-studio-7.

Features of AVR Studio:

  • Integrated Development Environment for Writing, Compiling and Debugging Software.
  • Fully Symbolic Source-level Debugger.
  • Configurable Memory Views, Including SRAM, EEPROM, Flash, Registers, and I/Os.
  • Unlimited Number of Break Points.
  • Online HTML Help.
  • Variable Watch/Edit Window with Drag-and-drop Function.
  • Extensive Program Flow Control Options.
  • Simulator Port Activity Logging and Pin Input Stimuli.
  • File Parser Support for COFF, UBROF6, UBROF8, and Hex Files.
  • Support for C, Pascal, BASIC and Assembly Languages.
  •  

Introduction to AVR GCC (WinAVR):

The AVR GCC plug-in is a GUI front-end to GNU make and avr-GCC. The plug-in requires GNU make and avr-GCC for basic operations and avr-objdump from the AVR GNU Binutils for generating list files. To avoid problems setting up the built environment, it is recommended to install the WinAVR distribution available at the link.

The plug-in component will automatically detect an installed WinAVR distribution and set up the required tools accordingly. An AVR GCC plug-in project is a collection of source files and configurations. A configuration is a set of options that specify how to build and link the files in a project. On creating a new project, the “default” configuration is created. A user can choose to continue using this configuration, adding/removing options as the project evolves or create one or more new configurations to use in the project.

ATmega8 Microcontroller Programming:

Every microcontroller there are so many features and you can use it as per your requirement to program and use it. So we will go one by one feature programming. So that our objective is like how to able to write any microcontroller programming.

ATmega8 GPIO Programming:

The AVR is one of the most powerful architecture in processor design. It was developed in the year 1996 by ATMEL Corporation. This architecture was designed by Alf-Egil Bogen and Vegard Wollan and the naming convention was derived from both the developers and it stands for Alf-Egil Bogen Vegard Wollan RISC microcontroller and mostly we called it as Advanced Virtual RISC machine. The first AVR microcontroller was AT90S8515 but it was not able to interrupt the commercial market with the competitor where after the AT90S1200 was started his business in the commercial market in the year 1997.

Basically, the AVR architecture is available in 3 categories in the market for their different features as:

  • Tiny AVR: Small in size and very less memory used for small applications.
  • Mega AVR: This is the most popular used microcontroller in the market which is having flash memory up to 256kb, number of peripherals, and it is suitable for moderate to complex applications.
  • X-Mega AVR: This is the most high-end controller used for complex microcontrollers which need more FLASH & RAM memory with high-speed operation. Mostly it is used for commercial purposes.

Why AVR Microcontroller?

The AVR microcontroller is very fast than others which can able to execute most of the instructions in one execution cycle. The AVR microcontrollers are 4 times faster than PIC microcontrollers. It consumes very little power and can have different modes to control the power consumption for devices.

There is so much Processor design architecture, and I think most of the important architectures you can get here in my processor page. Here I am going to discuss the AVR microcontroller. Let’s go start with AVR microcontroller. There are so many controllers variants available, but I am considering ATMEGA-8 microcontroller. because it is a very good standard microcontroller for you if you want to learn the microcontroller driver programming.

1 thought on “AVR Microcontroller”

  1. swarup kumar nath

    Very nice explanation of AVR microcontroller tutorial. Thank you so much Piembsystech.

Leave a Reply

Scroll to Top