Microcontroller

From Wiki

Jump to: navigation, search

What's a Microcontroller?

A microcontroller is a class of extremely small, specialized computers. In general, they're about as powerful as the original IBM PC, with speeds ranging from 1MHz to 100Mhz at the high end, and RAM from a few hundred bytes to 65KB. Programs are stored in Flash, which is only writable during the programming process, and ranges in sizes equal to that of the RAM. A "small" chip will be about 1cm square. They can be run directly from batteries, and use a very small amount of electricity, so they can run for quite a long time on regular AA or AAA batteries.

They differ from "regular" computers in that they don't need a lot of extra hardware to get them running. Most microcontrollers are on single chip, containing all of the RAM, Flash (program storage) and some EEPROM (non-volatile storage) all in a single package. Package sizes range from 10 pins at the low end to over 100 pins on the high end. Most of the pins on a microcontroller's chip are "GPIO" (General Purpose Input/Output) pins at CMOS levels. But, there are exceptions for the microcontrollers that run on less than 5 Volts. Obviously, their outputs aren't going to be 5 Volts.

The AVR is a specific type of 8-bit microcontroller, made by Atmel Corporation. There chips are fast, cheap, and easily programmable. Internally, they use 8-bit logic for most of their operations, although registers and address space is 16-bit. This means that they're limited to 65 kilobytes of directly addressable RAM and Flash. But, they can be programmed to access much larger storage, but it can't be addressed directly. For example, one could read and write to a 1 GB Compact Flash card using an AVR.

The other way that AVR 8-bit microcontrollers differ from "regular" computers is that they don't have any operating system at all. The code that you write runs directly on the chip and not inside a "process" or "task". This is a very different style of programming, but it means that you have very precise control over the instructions being executed, and of particular interest is the ability to rely on instruction execution times.

Atmel has recently released a line of 32-bit microcontrollers that run Linux. I have no experience with these chips, but they look interesting.

Personal tools