This learning module is built around a micro-controller module called the MicroStamp11. The MicroStamp11 module is really a computer. So let's talk briefly about computers. A computer is a machine that computes. A micro-computer is a computer that has been integrated into a very large-scale integrated circuit (VLSIC). There are all sorts of micro-computers, but one important class of micro-computer is the micro-controller. A micro-controller is a micro-computer that has been specially designed to interact in a timely manner with different types of devices in the outside world.
All computer systems are characterized by the same basic elements. This is true of large computers like your lap-top as well as small embedded processors like the MicroStamp11. Figure 1 is a block diagram for a generic computer system. This figure shows that a computer consists of a central processing unit (CPU), a clock, memory, and peripheral or input/output (I/O) devices. All of these subsystems communicate over a CPU bus.
The CPU bus is, essentially, a pair of wires that all subsystems are connected to. In general, only one pair of devices can talk to each other at a time, so communication of the bus must be coordinated to prevent message collisions. This coordination is often handled by the CPU.
The central processing unit (CPU) executes instructions contained in memory. These instructions are executed at a rate specified by the computer's clock. Instructions contained in memory original in a computer program that has been loaded into the computer's memory.
Computational memory is arranged as bits. A bit is a single digital variable with a value of either zero or one. Bits are grouped into bytes consisting of eight bits. Bits are also arranged as words. The number of bits in a word is often dependent on the actual micro-computer, with common values being 16 or 32 bits per word.
The CPU needs to access two different types of memory in order to execute a program. There are two types of memories used in micro-controllers. These are read-only memory (ROM) and random access memory (RAM).
In a micro-controller, read-only memory (ROM) is used to store permanent programs and data. Many micro-controllers use erasable programmable read-only memory (EPROM) or electrically erasable programmable read-only memory (EEPROM) to store programs. EPROM and EEPROM are non-volatile memories. This means that once written into, the data stays in memory even if power is removed from the device. Therefore if you load a program into EEPROM and then remove the battery from your computer system, the program you loaded will still be there. In this way, the next time you power up your system, the program will already be there, ready to begin executing.
Random access memory or RAM is used to temporarily store data and instructions. RAM is like a scratchpad that stores variables than an executing program might generate. Unlike EEPROM, random access memory is volatile, so when power is removed from the module, everything stored in RAM is lost.
In general micro-controllers have a very limited amount of RAM and somewhat more ROM. As an example, the MicroStamp11 module has 256 bytes of RAM and 32 kilo-bytes of EEPROM. This mix of RAM and EEPROM is somewhat standard for 8-bit micro-controllers like the 68HC11.
In addition to CPU and memory, computers have peripheral or input/output (I/O) devices. These devices are used to get information into and out of the computer. There are a variety of I/O devices. Common input devices are keyboards, sesnors such as digital thermometers, position encoders, or potentiometers. Output devices include video displays, LCD (liquid crystal devices), servo-motors, or simply a single LED (light emitting diode).
The CPU can access the peripheral device by sending a request to the device over the CPU bus and then waiting for a response. In micro-controllers, however, I/O devices are directly mapped into RAM. This means that a micro-controller can access an I/O device by simply reading from or writing to a memory location in RAM. We often refer to this as memory-mapped I/O or direct memory access DMA. Memory-mapped I/O is a feature that distinguishes micro-controllers from generic micro-computers. Micro-controllers have a rich set of subsystems that facilitate communication with external modules. Certain micro-controllers have built in serial communication interfaces and many units have internal analog-to-digital converters. As a result, the generic computer architecture shown in figure 1 can be specialized for a micro-controller. This specialized micro-controller architecture is shown in figure 2. In this figure, we see that the micro-controller has more peripherals than the generic computer. Moreover, we see that the peripherals are connected by their own separate DMA bus to RAM. This architecture frees the CPU from having to coordinate bus traffic generated by peripheral devices.