Wednesday, May 23, 2012

Robotics: Using Atmega16 Microcontroller - Introduction

What is a Microcontroller?

A microcontroller is a single chip, self-contained computer which incorporates all the basic components of a personal computer on a much smaller scale. Microcontrollers are often referred to as single chip devices or single chip computers. The main consequence of the microcontroller’s small size is that its resources are far more limited than those of a desktop personal computer. 

In functional terms, a microcontroller is a programmable single chip which controls a process or system. Microcontrollers are typically used as embedded controllers where they control part of a larger system such as an appliance, automobile, scientific instrument or a computer peripheral. Microcontrollers are designed to be low cost solutions; therefore using them can drastically reduces part and design costs for a project.

Physically, a microcontroller is an integrated circuit with pins along each side. The pins presented by a microcontroller are used for power, ground, oscillator, I/O ports, interrupt request signals, reset and control. In contrast, the pins exposed by a microprocessor are most often memory bus signals (rather than I/O ports).

A microcontroller has seven main components:
  • Central processing unit (CPU)
  • ROM
  • RAM
  • Input and Output
  • Timer
  • Interrupt circuitry
  • Buses
The Microcontroller we will use is ATMega16 from AVR Family.

Why Atmel AVR?

Atmel's AVR RISC architecture has the following salient features:
  • RISC architecture with mostly fixed length instructions, load-store memory access & 32 general purpose registers.
  • A two stage instruction pipeline that speeds up execution.
  • Majority of instructions take one clock cycle.
  • Up to 10-MHzclock operation.
  • Wide variety of on-chip peripherals, including digital I/O, ADC, EEPROM, Timer, UART, RTC, PWM, etc.
  • Internal program and data memory.
  • In-system programmable.
  • Available in 8-64 pin packages to suit variety of applications.
  • Up to 12 times faster performance than conventional CISC architeture.
  • Wide operating voltage from 2.7 to 6V.

The ATMega 16  Microcontroller

AT - It stands for the company that produced the microcontroller, ATMEL.
Mega - Stands for the family of Microcontroller. The other families from Atmel are Tiny & X-Mega.
16 - Stands for the 16KB flash memory that is present in the microcontroller.

Pin Configuration

Atmega16 Microcontroller Pin Configuration

Pin 1 - 8   -> Port B
Pin 14-21 -> Port D
Pin 22-29 -> Port C
Pin 33-40 -> Port A

All 40 pins are I/O pins,i.e, all pins are capable of taking input as well as giving output. Port A has special use as it can be used as Analog to Digital Converter (ADC). ADC works by taking a reference value in between 0-5V. Any value above the reference is considered 1 (High) and any value below it is considered 0 (Low).

Pin 10, 30 -> 5V VCC (Input Voltage)
Pin 11, 31 -> Ground
Pin 12, 13 -> for Crystal Oscillator (used for controlling frequency)
Pin 32       -> It gives the reference voltage for ADC. It is internally set at 2.65V.

For detailed explanation about the microcontroller hardware, download the datasheet from here.

1 comments: