Sunday, June 27, 2010

Types of AVR’s

AVRs are generally classified into four broad groups:
tinyAVR -- the ATtiny series
o 8-32-pin package
o 1-8 kB program memory
o Limited peripheral set
• megaAVR -- the ATmega series
o 28-100-pin package
o 4-256 kB program memory
o Extended instruction set (Multiply instructions and instructions for handling larger program memories)
o Extensive peripheral set
• XMEGA -- the ATxmega series
o 44-64-100-pin package (A4, A3, A1)
o 16-384 kB program memory
o Extended performance features, such as DMA, "Event System", and cryptography support.
o Extensive peripheral set with DACs
• Application specific AVR
o megaAVRs with special features not found on the other members of the AVR family, such as USB controller, LCD controller, advanced PWM, CAN etc.
o FPSLIC (Field Programmable System Level Integrated Circuit), an AVR core on-die with an FPGA. The FPSLIC uses SRAM for the AVR program code, unlike all other AVRs. Partly due to the relative speed difference between SRAM and flash, the AVR core in the FPSLIC can run at up to 50MHz.

What is an AVR?



The AVR family of microcontrollers are named after two Norvegian students (Alf-Egil Bogen and Vegard Wollan) who invented them. AVR stands for Alf and Vegard's Risc architecture. AVR that comes from Atmel are economical, feature-rich microcontrollers featuring flash program memory. The entire family shares the same instruction set and basic architecture, so you don't have to re-learn a new architecture when going from a small 8 pin part with 2K of program memory to a large pin part with 8K or more of program storage.
All AVR microcontrollers are in-system programmable through a serial interface. You can program the chip's flash program storage as well as EEPROM using simple software and just 4 wires to your target board. Easy in-circuit programmability combined with flash memory makes it easy to update code in the field or during development.
The AVR architecture was designed from the ground up for efficiency with C code. There are a number of C compilers available commercially and for free. You can also use the straightforward assembly language approach.
The AVR is a Modified Harvard architecture 8-bit RISC single chip microcontroller. It was developed by Atmel in 1996. Harvard architecture means that the program and data are stored in separate memory spaces which are accessible simultaneously. The AVR was one of the first microcontroller families to use on-chip flash memory for program storage, as opposed to One-Time Programmable ROM, EPROM, or EEPROM used by other microcontrollers at the time. Flash memory is a nonvolatile (persistent on power-down) programmable memory.
Low power and high performance AVR microcontrollers can handle demanding 8 and 16-bit applications. With a single cycle instruction RISC CPU, picoPower technology, and a rich feature set, the AVR architecture ensures easy application development and fast code execution combined with the lowest possible power consumption.
The well-defined I/O structure limits the need for external components and reduce development cost. A variety of timers, SPIs, UARTs, internal oscillators, pull-up resistors, pulse width modulation, Analog Comparators, ADCs and Watch-Dog Timers are some of the features available for engineers. It is interesting to note that most instructions only take a single clock cycle to execute and there is no internal clock division. Whether you program in C, Pascal or assembly language, the tuned AVR instructions decrease program size and development time. The AVR processor features a real life stack and its instruction set was designed and optimized for use with high level languages - it is easy to program these chips using C. AVR microcontrollers may be programmed using assembly or a higher level language. Learning to program it in assembly language is a good idea, as it gives you in depth understanding of the internal operations.
A comprehensive collection of application notes also kick-start problematic tasks. Since the introduction of the classic AT90S1200 device with on-chip in-system programmable Flash and EEPROM memory in 1997, today's large AVR microcontroller portfolio consists of devices sharing a single CPU architecture. This makes it easy to find the AVR microcontroller for almost any application.
Getting started with the AVR requires nothing more than the free assembler, a simple programmer such as the one by Jerry Meng, and a target board. The target board can be as simple as a few parts since the AVR is highly integrated. Since it is easy to reprogram the flash memory code space, you can develop code and test without the need for an expensive in-circuit emulator. Of course it is nice if you can afford it, but the AVR opens up the world of embedded control to those who could not afford the tools in the past. For under $20 you can be on your way.

Tuesday, June 22, 2010

What is a microcontroller....?

What is a microcontroller?

A micro consists of:

  • Flash ROM memory for holding your program, they call it non-volatile cause it will retain your program even when power goes off. Next time it powers up, your code will run again. However, it is electrically erasable so you may use your programmer to program it and re-program it and …
  • RAM memory for holding runtime data, say variables that change during execution and are not to be remembered forever, they will be lost when power goes off.
  • EEPROM non-volatile memory for those variables that are to be remembered when power goes off. You may access the micro's EEPROM either in advance when you program the micro or during runtime.
  • CPU/ALU the processing unit for doing arithmetic and logical operations amongst other things. Mainly these other things are controlling program flow (yes these ifs and fors you know from high level languages) but also for transferring data within the microcontroller.
  • Peripherals that are dedicated for various purposes, e.g the I/O ports are for turning pins on and off, USART is for communicating serially with another device (may be a PC), SPI is another serial protocol but for board level communication (short distance), interrupts are for getting external events asynchronously with our program flow, timers for measuring time, ADC for measuring analog quantities and the list goes on …
  • Registers hold 8-bit values and come into two flavors. Dedicated, which are used for configuring the operation of the micro and its peripherals. General purpose, working together with the ALU for storing temporarily results.
  • Clock is used by the micro for synchronizing all its operations. The clock is basically a train of square pulses at certain frequency, in our case 7.3728MHz. It is usually an external crystal, but one may use the internal clock.
AVRs are produced by ATMEL, you may go there and download the datasheet of a micro of AVR series, have a look at the application notes as well. Be careful not to be scared by the vast amount of information. We need only specific set of informations for each application.