What is the 68HC11?
Motorola, Inc.
manufactures the 68HC11
family of microcontrollers. A microcontroller is an entire computer system within a
single chip, usually containing the central processing unit (CPU), memory (RAM, ROM,
EPROM, and EEPROM), input and output (I/O) ports, timers and counters, analog to digital
(A/D) converters, and communications capabilities. Motorola offers many different families
of the 68HC11: A, E, D, F, K, L, G, and P. While my focus here is on the E family, the
other 68HC11 families have similar capabilities and all share the same programming
language.
Specifically, the 68HC11 E-series contains:
- The M68HC11 CPU
- Onboard read only memory (ROM)
- Onboard random access memory (RAM)
- 512 bytes for the 68HC11E1 chip
- 256 bytes for the 68HC811E2 chip
- Onboard electrically erasable memory (EEPROM)
- 512 bytes for the 68HC11E1 chip
- 2048 bytes for the 68HC811E2 chip
- 38 general-purpose I/O pins
- 16 bidiriection I/O pins
- 11 input-only pins
- 11 output-only pins
- A 16-bit timer system with:
- 4 output compare (OC) channels
- 3 input capture (IC) channels
- 1 additional channel which can be an IC or an OC channel
- An 8-channel 8-bit A/D
- Serial (RS-232) communications at various baud rates
- SPI (serial peripheral interface) communications
68HC11 E-Series Block Diagram
Here is a block diagram of the 68HC11 E-series microcontrollers.
There are all of the differect sections inside of the chip, and
also shows the input and output connections. In the bottom right
corner of the diagram is a table showing the amount of Random Access
Memory (RAM), Read Only Memory (ROM), Erasable Programmable Read
Only Memory (EPROM) and Electronically Erasable Programmable Read
Only Memory (EEPROM). The key is the amount of RAM and EEPROM in
the defivice; you need EEPROM to store the program(s) in the HC11,
and you need RAM for data, variables, and stack space while the
HC11 is running.
68HC11 E-Series Pinout
The typical E-series HC11 comes in a 52-pin (Plastic Leaded Chip
Carrier) PLCC socket (there are some older DIP versions, but they
are rarely used). The following image shows the mapping of the 52
pins on the device to the functional inputs and outputs in the
above image.
68HC11 Registers
All of the 68HC11 devices share the same internal register configuration.
The registers are the small areas inside of the CPU within the
microcontroller which can hold data which is to be processed. There
are only 2 working registers (A and B) and they are only 8-bits
each. They can be used as a single 16-bit register, which is then
refered to as the D register. The A and B registers are used to
manipulate data, such as adding, subtracting, etc. There are two
16-bit index registers (X and Y) which can hold data, and are
typically used for simple counters and also as index pointers into
memory (hence their name of index registers). There are addressing
modes which can use the X or Y register to find locations in memory
based on the current values in X or Y.
This is also a stack pointer, which MUST point to a location in RAM.
Whenever something is "pushed onto the stack" the data is put into
RAM where the stack point points (actually 1 is subtracted from the
stack pointer first). When data is retrived from the stack (pulled)
the data is copied from the RAM location where the stack point points,
then 1 is added to the stack pointer. You can do this directly
in your programs, and the stack is also used when you jump to a
subroutine (the return address is pushed onto the stack).
The last 2 registers inside of the HC11 CPU is the program counter
and the status register. The program counter points to the location
in memory for the code which is currently being run. The machine
instruction is loaded from memory where the program counter points,
then the program counter is incremented to the next instruction.
The status register is 8-bits which can be thought of as flags.
These flags indicate properties from the the last operation, such
as zero (true is the last operation resulted in a zero, otherwise
it is false), and others. The Branch-on-Condition commands look at
these flags and may branch to another part of the code depending on
the value of the flags (i.e. BQE is branch equal, branch if the zero
flag is true).
68HC11 Family Table
There are a variety of different HC11 devices in the HC11 family.
I primarily use the E-series; the 68HC11Ea1 (E1) and the 68HC811E2
(E2). The A series is pin-compatibly with the E-series (you can
pop put an E1 device and pop in an A1, for example). Other members
of the HC11 family have different configurations and even have
a different number of pins on the devices.
Uses for the 68HC11
Why get excited about the 68HC11? Being a low-cost single-chip computer system, it can
be used to solve many of today's control needs, anything from controlling the dashboard or
engine in a car to home thermostats, security systems, and even toys. In my opinion, the
68HC11 has been a strong factor in the current state of home robotics,
providing a powerful and easy-to-use brain for the robots. Most
of the robots I've built use the 68HC11 microcontroller.
In school, I use the 68HC11 in teaching an "Introduction to Microprocessors"
class, which provides the students a small computer system which they can carry in their
pocket and learn how to program. Many other instructors and schools also use the 68HC11.