Microcontrollers

The vast majority of computers in the world do not run Windows/Linux or execute word processing or multimedia applications. These are the computers that control appliances such as your television, VCR, microwave, and cell phone. These intelligent devices are known as embedded processors, microcontrollers or peripheral interface controllers (PICs). They are used to perform specific repetitive tasks that require little or no human intervention.

In contrast to the typical number crunching desktop computer, these devices excel in their ability to communicate with the world around them in real time. To this end, a microcontroller IC not only implements the basic arithmetic and logical functions of a typical microprocessor, but also includes a variety of programmable input/output ports, hardware timers, analog<->digital converters (ADC,DAC), and a fast and efficient means of interrupting the execution of the microcontroller program to service a variety of external or internal events.

A very capable example of a microcontroller is the Microchip PIC16F1778. This 28-pin IC includes an 8-bit reduced instruction set (RISC) processor with 49 instructions, 16k words of 14-bit re-writable (flash) program memory and 2048 8-bit file register data memory (RAM). With a 32MHz internal clock, most instructions execute in four clock cycles, or 0.125us.

There are 25 programmable input/output pins, a 10-bit ADCs and three 10-bit DACs, several 16-bit counters/timers, and a serial port that when connected to a PC running PICL1778 software, allows a user program to be downloaded to the PIC and executed. The internal structure of the PIC is described here. An overview of the PIC Integrated Development Environment (IDE) software can be found here.

As a quick and superficial introduction to PIC programming, you will interface a PIC1778 to a USB module, connect to the PICL1778 software and upload a program that flashes an LED, much like the mystery circuit. The timing of the on/off LED cycle can be adjusted precisely by analysing the PIC instruction timing and applying this knowledge to implement software delay loops.