Next:Introducing the MicroStamp11 Module
The second edition of MC68HC11 An Introduction: Software and Hardware Interfacing is a comprehensive book about the 68HC11 microcontroller from Freescale (Motorola). It is unique in that it uses both the assembly language (for better hardware control and execution time) and the C language (for faster projection completion) to instruct.
Up:Introduction to the MicroStamp Previous:Computer ArchitectureMotorola 68HC11 Architecture
The MicroStamp11 module is built around the Motorola 68HC11micro-controller IC. In order to program theMicroStamp11, you'll need to have a closer look at the68HC11's architecture. The 68HC11's basic architecturalblocks are shown in figure 3. Thisfigure explicitly shows the peripheral subsystems in theMotorola 68HC11 micro-controller and it shows which pinsthose subsystems are tied to.
From figure 3, we see that the 68HC11has a number of pins. Some of these pins are used tocontrol the micro-controller's operating mode, clock logic,special interrupts, or power. The majority of the pins,however, have been organized into four 8-bit input/outputports. These ports have the logical names
PORTA
,PORTB
, PORTC
, and PORTD
. It isthrough these four ports that the 68HC11 channels most ofits interactions with the outside world.As mentioned earlier, a micro-controller is oftendistinguished by the fact that its input/output devices aredirectly mapped into RAM. This is also true of the I/Oports in the 68HC11. The logical names for the I/O portsare associated with absolute addresses in RAM and theseaddresses are in turn tied to hardware registers. When aninput pin, for example, is set to a high logical level,then that logic level directly sets the value in the port'shardware register. Since that hardware register is mappeddirectly into the micro-controller's address space, aprogram can then directly read that register's value byaccessing memory.
The I/O ports and other device pins are connected tospecial subsystems in the 68HC11. The subsystems shown infigure 3 are briefly described below:
- EPROM: Some versions of the 68HC11 have asmuch as 4 kilo-bytes of internal EEPROM. If your programis sufficiently small, then your micro-controller systemwould not need external memory chips and could be operatedin single-chip mode.
- RAM: The version of the 68HC11 in yourMicroStamp11 has 256 bytes of internal RAM. As mentionedabove, some of these bytes are mapped into hardwareregisters that are used to control the micro-controller. Inreality the MicroStamp11 programmer only has 192 bytes ofRAM that can be used for program variables.
- Serial Peripheral Interface (SPI): Thissubsystem allows the 68HC11 to communicate with synchronousserial devices such as serial/parallel slave devices.
- Serial Communication Interface (SCI): Thissubsystem allows the 68HC11 to communicate withasynchronous serial devices. The SCI interface is used tocommunicate with laptop computers.
- Parallel I/O Interface: This subsystem isgenerally used to provide the 68HC11 with a way of writingdigital data in parallel to an external device. The usualparallel device is a memory device. Recall that the 68HC11has a very limited amount of internal program memory. Ifwe need to augment the EEPROM in the micro-controller withadditional memory, we use the parallel I/O interface toaddress, read, and write data to this external memory chip.When we do this we usually operate the chip in so-calledexpanded mode. Running the chip in expanded modegreatly reduces the number of I/O Ports available to thesystem. This is because PORTB and PORTC are connected tothe memory chip and hence are unavailable for otherexternal devices. Since the MicroStamp11 uses an externalmemory chip, it is running the 68HC11 in expanded mode andhence only PORTA and PORTD can be used by the programmerfor interfacing with the external world.
- Mode Selection System: This subsystem selectswhether the 68HC11 runs in expanded or single-chip mode. Insingle chip mode, the 68HC11 allows the user to havecomplete control over all four I/O ports. In expandedmode, the 68HC11 uses ports B and C to address, read, andwrite to external memory, hence the programmer can only usePORTA and PORTD. In the MicroStamp11 module, the chip isusually in expanded mode.
- Clock logic: An important feature ofmicro-controllers is that they work in real-time. Byreal-time, we mean that instruction executions arecompleted by specified time deadlines. This means that themicro-controller needs a clock. The clock logic subsystemprovides the real-time clock for the 68HC11. The rate ofthe clock is determined by a crystal that is connected tothe clock logic pins. The MicroStamp11 has a crystal onthe module, so these pins are not available to theprogrammer.
- Interrupt Logic: Micro-controllers must beable to respond quickly to asynchronous events. Theinterrupt logic subsystems provides three pins that can beused to trigger hardware interrupts. A hardware interruptautomatically transfers software execution to a specifiedmemory address in response to the hardware event (such asthe pin's logic state going low). We say that thisinterrupt is generated asynchronously because theevent can occur between ticks of the system's real-timeclock. Hardware interrupts provide a means for assuringthat micro-controllers respond in a timely manner toexternal events.
- Timer Interrupts: This subsystem generatesinterrupts that are associated with an internal timer.Remember that the 68HC11 executes instructions in step witha clock tick provided by the clock logic subsystem. Witheach tick of the clock, an internal register called a timeris incremented. This timer is memory mapped to an addressin RAM with the logical name
TCNT
. SO at anyinstant you can fetch the current count (time) on the timerby simply readingTCNT
.There are two types of interrupts associated with TCNT. Aninput-compare (IC) interrupt is generated with aspecified input pin changes state. When the IC interruptoccurs, then the value in TCNT is stored in aninput-compare register. This register is also memorymapped so the programmer can easily read the clock tickwhen the input event occurred. Input compare events areoften used to make very precise timing measurements.The other type of timer interrupt is called an outputcompare (OC) interrupt. The output compare event occurswhen TCNT matches the value stored in an output compareregister. The output compar register is also memorymapped, so its value can be easily set by the programmer.Output compare events are often used to force themicro-controller to respond to timed events.
Next:Introducing the MicroStamp11 Module Up:Introduction to the MicroStamp Previous:Computer ArchitectureBill Goodwine2002-09-29