Microcontrollers

Microcontrollers are single chip computers that slow, have very little memory, but are cheap and very easy to interface to real world devices. They are present in most electronics these days, from microwave ovens to televisions. They are typically programmed in either C or assembly language.

Interfacing is done through the microcontroller's I/O pins (input/output pins). A microcontroller can take actions in the world by changing the voltages of its output pins. Output pins typically take on two discrete voltages (usually 0 and 5 volts). Each output pin reflects the value of some bit in the microcontroller's memory. When the bit is set to 1, the pin goes to 5 volts, and when the bit is set to 0, the pin goes to 0 volts.

A microcontroller can sense the world through its input pins. Input pins are either digital or analog. Digital inputs are the opposite of digital outputs - they expect to be set to either 0 or 5 volts by some external device. For each digital input there is a bit in the microcontroller's memory that reflects its value.

Analog inputs are more flexible than digital inputs. They can be set to any voltage between 0 and 5 volts by some external device. Typically, an analog input has a byte in the microcontroller's memory that reflects its voltage - 0 volts maps to 0, 2.5 volts maps to 128, and 5 volts maps to 255 (since 255 is the maximum value a byte can take on.)

In this workshop we use the Microchip PIC16F84 microcontroller. For more information look at the iRX pages or go straight to the source, the PIC16F84 datasheet on the Microchip web.


Based on the 1997 REC workshop document by Pushpinder Singh <push@mit.edu>