Sunday, June 12, 2016

More to come


Comming soon....
a bug is the biggest lie we know!

Saturday, June 11, 2016

Introduction To AVR



Microcontroller: Microcontroller can be termed as the single chip computer which includes in it the number of peripherals like RAM, EPROM, Timers etc. required to perform some predefined task.

Does this mean that the microcontroller is another name for a computer…?  The answer is NO!

The computer on one hand is designed to perform all the general purpose tasks on a single machine like you can use a computer to run a software to perform calculations or you can use a computer to store some multimedia file or to access internet through the browser, whereas the microcontrollers are meant to perform only the specific tasks, for e.g., switching the AC off automatically when room temperature drops to a certain defined limit and again turning it ON when temperature rises above the defined limit.
There are number of popular families of microcontrollers which are used in different applications as per there capability and feasibility to perform the desired task, most common of these are 8051, AVR and PIC microcontrollers. In this article we will introduce you with AVR family of microcontrollers.

AVR microcontrollers are available in three categories-

  1. TinyAVR – Less memory, small size, suitable only for simpler applications 
  2. MegaAVR – These are the most popular ones having good amount of memory (upto 256 KB), more number of inbuilt peripherals and is suitable for moderately complex applications. 
  3.  XmegaAVR – Rarely available commercially and are used for very complex applications requiring large program memory and high speed.

What’s special about AVR?
They are fast: AVR executes most of the instructions 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. Let’s do the comparison between the three most commonly used families of microcontrollers.

8051
PIC
AVR
SPEED
Slow
Moderate
Fast
MEMORY
Small
Large
Large
ARCHITECTURE
RISC
RISC
RISC
ADC
Not Present
Inbuilt
Inbuilt
Timers
Inbuilt
Inbuilt
Inbuilt
PWM Channels
Not Present
Inbuilt
Inbuilt
JTAG Debugger
Not Present
Not Present
Inbuilt

AVR are the 8-bit Reduced Instruction Set Computer (RISC) based controllers. RISC is a categorization which defines certain rules by which the instruction set of the computer are not only fewer in number but also simpler in operation, the other type of categorization is CISC (Complex Instruction Set Computers). We will explore more on this when we will learn about the architecture of AVR microcontrollers.

Let’s see what this all mean. What is 8-bit? This means the microcontroller is capable of transmitting and receiving 8-bit data. The input/output registers available are of 8-bits. The AVR family controllers have register based architecture which means that both the operands for an operation are stored in a register and the result of the operation is also stored in the register. Below fig shows a simple example performing OR operation between two input registers and storing the value in Output Register. The CPU takes values from two input registers INPUT-1 and INPUT-2, performs the logical operation and stores the value into the OUTPUT register. All this happens in 1 execution cycle.



In our journey with the AVR we will be working on Atmega16 microcontroller, which is a 40-pin IC and belongs to the megaAVR category of AVR family. Some of the features of Atmega16 are-

  • ·         16KB of Flash memory.
  • ·         512 Bytes of EEPROM.
  • ·         Available in 40-Pin DIP.
  • ·         8-Channel 10-bit ADC.
  • ·         Two 8-bit Timers/Counters.
  • ·         One 16-bit Timer/Counter.
  • ·         4 PWM Channels.
  • ·         In System Programmer (ISP).
  • ·         Serial USART.
  • ·         SPI Interface.
  • ·         Digital to Analog Comparator.


We will be exploring all the features as we go through and learn about it.