To provide the most up-to-date information, the revision of our documents on the World Wide Web will be
the most current. Your printed copy may be an earlier revision. To verify you have the latest information
available, refer to:
http://freescale.com/
The following revision history table summarizes changes contained in this document. For your
convenience, the page number designators have been linked to the appropriate location.
This document contains a detailed description of the M68HC11 E series of 8-bit microcontroller units
(MCUs). These MCUs all combine the M68HC11 central processor unit (CPU) with high-performance,
on-chip peripherals.
The E series is comprised of many devices with various configurations of:
With the exception of a few minor differences, the operation of all E-series MCUs is identical. A fully static
design and high-density complementary metal-oxide semiconductor (HCMOS) fabrication process allow
the E-series devices to operate at frequencies from 3 MHz to dc with very low power consumption.
1.2 Features
Features of the E-series devices include:
•M68HC11 CPU
•Power-saving stop and wait modes
•Low-voltage devices available (3.0–5.5 Vdc)
•0, 256, 512, or 768 bytes of on-chip RAM, data retained during standby
•0, 12, or 20 Kbytes of on-chip ROM or EPROM
•0, 512, or 2048 bytes of on-chip EEPROM with block protect for security
•2048 bytes of EEPROM with selectable base address in the MC68HC811E2
•Asynchronous non-return-to-zero (NRZ) serial communications interface (SCI)
•Additional baud rates available on MC68HC(7)11E20
•52-pin plastic thin quad flat pack, 10 mm x 10 mm (TQFP)
•64-pin quad flat pack (QFP)
•48-pin plastic dual in-line package (DIP), MC68HC811E2 only
•56-pin plastic shrink dual in-line package, .070-inch lead spacing (SDIP)
Most pins on these MCUs serve two or more functions, as described in the following paragraphs. Refer
to Figure 1-2, Figure 1-3, Figure 1-4, Figure 1-5, and Figure 1-6 which show the M68HC11 E-series pin
assignments for the PLCC/CLCC, QFP, TQFP, SDIP, and DIP packages.
Figure 1-2. Pin Assignments for 52-Pin PLCC and CLCC
M68HC11E Family Data Sheet, Rev. 5.1
16Freescale Semiconductor
Pin Descriptions
PA1/IC2
PA2/IC1
PA0/IC3
NC
NC
NC
PB7/ADDR15
PB6/ADDR14
PB5/ADDR13
PB4/ADDR12
PB3/ADDR11
PB2/ADDR10
PB1/ADDR9
PB0/ADDR8
PE0/AN0
PE4/AN4
PE1/AN1
PE5/AN5
PA3/OC5/IC4/OC1NCNC
64
63626160595857
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
PA4/OC4/OC1
PA5/OC3/OC1
M68HC11 E SERIES
17181920212223
RL
RH
V
VSSV
V
PE2/AN2
PE6/AN6
PE3/AN3
PE7/AN7
1. V
applies only to devices with EPROM/OTPROM.
PPE
Figure 1-3. Pin Assignments for 64-Pin QFP
PA6/OC2/OC1
PA7/PAI/OC1
PD5/SS
VDDPD4/SCK
55
56
54
26
25
STBY
MODB/V
27
NC
MODA/LIR
24
SS
PD3/MOSI
PD2/MISO
PD1/TxD
V
5352515049
2829303132
E
STRA/AS
EXTAL
STRB/R/W
SS
NC
48
PD0/RxD
47
IRQ
46
45
XIRQ/V
NC
44
RESET
43
PC7/ADDR7/DATA7
42
PC6/ADDR6/DATA6
41
PC5/ADDR5/DATA5
40
PC4/ADDR4/DATA4
39
PC3/ADDR3/DATA3
38
37
PC2/ADDR2/DATA2
36
PC1/ADDR1/DATA1
35
NC
34
PC0/ADDR0/DATA0
33
XTAL
NC
PPE
(1)
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor17
General Description
PA0/IC3
PB7/ADDR15
PB6/ADDR14
PB5/ADDR13
PB4/ADDR12
PB3/ADDR11
PB2/ADDR10
PB1/ADDR9
PB0/ADDR8
PE0/AN0
PE4/AN4
PE1/AN1
PE5/AN5
PA1/IC2
PA2/IC1
PA3/OC5/IC4/OC1
PA4/OC4/OC1
PA5/OC3/OC1
PA6/OC2/OC1
PA7/PAI/OC1
52
51504948474645
1
2
3
4
5
6
7
M68HC11 E SERIES
8
9
10
11
12
13
1415161718192021222423
PD5/SS
VDDPD4/SCK
44
PD3/MOSI
PD2/MISO
PD1/TxD
42
43
41
40
PD0/RxD
39
IRQ
38
XIRQ/V
37
36
RESET
35
PC7/ADDR7/DATA7
PC6/ADDR6/DATA6
34
PC5/ADDR5/DATA5
33
32
PC4/ADDR4/DATA4
31
PC3/ADDR3/DATA3
PC2/ADDR2/DATA2
30
PC1/ADDR1/DATA1
29
28
PC0/ADDR0/DATA0
27
25
XTAL
26
PPE
(1)
RL
SS
RH
V
V
V
PE2/AN2
PE6/AN6
PE3/AN3
PE7/AN7
1. V
applies only to devices with EPROM/OTPROM.
PPE
STBY
MODB/V
E
STRA/AS
MODA/LIR
EXTAL
STRB/R/W
Figure 1-4. Pin Assignments for 52-Pin TQFP
M68HC11E Family Data Sheet, Rev. 5.1
18Freescale Semiconductor
Pin Descriptions
V
MODB/V
STBY
MODA/LIR
STRA/AS
STRB/R/W
EXTAL
XTAL
PC0/ADDR0/DATA0
PC1/ADDR1/DATA1
PC2/ADDR2/DATA2
PC3/ADDR3/DATA3
PC4/ADDR4/DATA4
PC5/ADDR5/DATA5
PC6/ADDR6/DATA6
PC7/ADDR7/DATA7
RESET
* XIRQ/V
PPE
IRQ
PD0/RxD
EV
SS
PD1/TxD
PD2/MISO
PD3/MOSI
PD4/SCK
PD5/SS
V
DD
V
SS
SS
1
2
3
4
E
5
6
7
8
9
10
11
12
13
14
15
M68HC11 E SERIES
16
17
18
19
20
21
22
23
24
25
26
27
28
EV
56
SS
V
RH
55
V
54
RL
PE7/AN7
53
PE3/AN3
52
PE6/AN6
51
PE2/AN2
50
PE5/AN5
49
PE1/AN1
48
PE4/AN4
47
PE0/AN0
46
PB0/ADDR8
45
PB1/ADDR9
44
PB2/ADDR10
43
PB3/ADDR11
42
PB4/ADDR12
41
PB5/ADDR13
40
PB6/ADDR14
39
PB7/ADDR15
38
PA0/IC3
37
PA1/IC2
36
PA2/IC1
35
PA3/OC5/IC4/OC1
34
PA4/OC4/OC1
33
PA5/OC3/OC1
32
PA6/OC2/OC1
31
PA7/PAI/OC1
30
EV
29
DD
* V
applies only to devices with EPROM/OTPROM.
PPE
Figure 1-5. Pin Assignments for 56-Pin SDIP
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor19
General Description
PA7/PAI/OC1
PA6/OC2/OC1
PA5/OC3/OC1
PA4/OC4/OC1
PA3/OC5/IC4/OC1
PA2/IC1
PA1/IC2
PA0/IC3
PB7/ADDR15
PB6/ADDR14
PB5/ADDR13
PB4/ADDR12
PB3/ADDR11
PB2/ADDR10
PB1/ADDR9
PB0/ADDR8
PE0/AN0
PE1/AN1
PE2/AN2
PE3/AN3
V
V
RH
V
SS
MODB/V
STBY
V
1
2
3
4
5
6
7
8
9
10
11
MC68HC811E2
12
13
14
15
16
17
18
19
20
21
RL
22
23
24
48
DD
PD5/SS
47
PD4/SCK46
PD3/MOSI
45
PD2/MISO44
PD1/TxD
43
PD0/RxD42
IRQ
41
XIRQ
40
RESET
39
PC7/ADDR7/DATA7
38
PC6/ADDR6/DATA6
37
PC5/ADDR5/DATA5
36
PC4/ADDR4/DATA4
35
PC3/ADDR3/DATA3
34
PC2/ADDR2/DATA2
33
PC1/ADDR1/DATA1
32
PC0/ADDR0/DATA0
31
XTAL
30
EXTAL
29
STRB/R/W
28
E27
STRA/AS26
25
MODA/LIR
Figure 1-6. Pin Assignments for 48-Pin DIP (MC68HC811E2)
M68HC11E Family Data Sheet, Rev. 5.1
20Freescale Semiconductor
Pin Descriptions
1.4.1 VDD and VSS
Power is supplied to the MCU through VDD and VSS. VDD is the power supply, VSS is ground. The MCU
operates from a single 5-volt (nominal) power supply. Low-voltage devices in the E series operate at
3.0–5.5 volts.
Very fast signal transitions occur on the MCU pins. The short rise and fall times place high, short duration
current demands on the power supply. To prevent noise problems, provide good power supply bypassing
at the MCU. Also, use bypass capacitors that have good
high-frequency characteristics and situate them as close to the MCU as possible. Bypass requirements
vary, depending on how heavily the MCU pins are loaded.
MANUAL
RESET SWITCH
4.7 kΩ
V
DD
2
IN
RESET
MC34(0/1)64
GND
3
V
DD
4.7 kΩ
1
TO RESET
OF M68HC11
Figure 1-7. External Reset Circuit
V
DD
IN
RESET
V
DD
4.7 kΩ
MC34064
GND
V
DD
4.7 kΩ
TO RESET
OF M68HC11
1.0 µF
IN
RESET
MC34164
GND
OPTIONAL POWER-ON DELAY AND MANUAL RESET SWITCH
Figure 1-8. External Reset Circuit with Delay
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor21
General Description
1.4.2 RESET
A bidirectional control signal, RESET, acts as an input to initialize the MCU to a known startup state. It
also acts as an open-drain output to indicate that an internal failure has been detected in either the clock
monitor or computer operating properly (COP) watchdog circuit. The CPU distinguishes between internal
and external reset conditions by sensing whether the reset pin rises to a logic 1 in less than two E-clock
cycles after a reset has occurred. See Figure 1-7 and Figure 1-8.
CAUTION
Do not connect an external resistor capacitor (RC) power-up delay circuit
to the reset pin of M68HC11 devices because the circuit charge time
constant can cause the device to misinterpret the type of reset that
occurred.
Because the CPU is not able to fetch and execute instructions properly when V
falls below the minimum
DD
operating voltage level, reset must be controlled. A low-voltage inhibit (LVI) circuit is required primarily for
protection of EEPROM contents. However, since the configuration register (CONFIG) value is read from
the EEPROM, protection is required even if the EEPROM array is not being used.
Presently, there are several economical ways to solve this problem. For example, two good external
components for LVI reset are:
1.The Seiko S0854HN (or other S805 series devices):
a.Extremely low power (2 µA)
a.TO-92 package
a.Limited temperature range, –20°C to +70°C
a.Available in various trip-point voltage ranges
2.The Freescale MC34064:
a.TO-92 or SO-8 package
a.Draws about 300 µA
a.Temperature range –40°C to 85°C
a.Well controlled trip point
a.Inexpensive
Refer to Chapter 5 Resets and Interrupts for further information.
1.4.3 Crystal Driver and External Clock Input (XTAL and EXTAL)
These two pins provide the interface for either a crystal or a CMOS- compatible clock to control the
internal clock generator circuitry. The frequency applied to these pins is four times higher than the desired
E-clock rate.
The XTAL pin must be left unterminated when an external CMOS- compatible clock input is connected to
the EXTAL pin. The XTAL output is normally intended to drive only a crystal. Refer to Figure 1-9 and
Figure 1-10.
CAUTION
In all cases, use caution around the oscillator pins. Load capacitances
shown in the oscillator circuit are specified by the crystal manufacturer and
should include all stray layout capacitances.
M68HC11E Family Data Sheet, Rev. 5.1
22Freescale Semiconductor
EXTAL
Pin Descriptions
C
L
MCU
10 MΩ
XTAL
4 x E
CRYSTAL
C
L
Figure 1-9. Common Parallel Resonant Crystal Connections
4 x E
CMOS-COMPATIBLE
MCU
EXTAL
XTAL
EXTERNAL OSCILLATOR
NC
Figure 1-10. External Oscillator Connections
1.4.4 E-Clock Output (E)
E is the output connection for the internally generated E clock. The signal from E is used as a timing
reference. The frequency of the E-clock output is one fourth that of the input frequency at the XTAL and
EXTAL pins. When E-clock output is low, an internal process is taking place. When it is high, data is being
accessed.
All clocks, including the E clock, are halted when the MCU is in stop mode. To reduce RFI emissions, the
E-clock output of most E-series devices can be disabled while operating in single-chip modes.
The E-clock signal is always enabled on the MC68HC811E2.
1.4.5 Interrupt Request (IRQ)
The IRQ input provides a means of applying asynchronous interrupt requests to the MCU. Either negative
edge-sensitive triggering or level-sensitive triggering is program selectable (OPTION register). IRQ
always configured to level-sensitive triggering at reset. When using IRQ
configuration, connect an external pullup resistor, typically 4.7 kΩ, to V
1.4.6 Non-Maskable Interrupt (XIRQ/V
PPE
)
in a level-sensitive wired-OR
.
DD
The XIRQ input provides a means of requesting a non-maskable interrupt after reset initialization. During
reset, the X bit in the condition code register (CCR) is set and any interrupt is masked until MCU software
enables it. Because the XIRQ
network with an external pullup resistor to V
Whenever XIRQ
or IRQ is used with multiple interrupt sources each source must drive the interrupt input
input is level-sensitive, it can be connected to a multiple-source wired-OR
. XIRQ is often used as a power loss detect interrupt.
DD
with an open-drain type of driver to avoid contention between outputs.
is
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor23
General Description
NOTE
must be configured for level-sensitive operation if there is more than
IRQ
one source of IRQ
interrupt.
There should be a single pullup resistor near the MCU interrupt input pin (typically 4.7 kΩ). There must
also be an interlock mechanism at each interrupt source so that the source holds the interrupt line low
until the MCU recognizes and acknowledges the interrupt request. If one or more interrupt sources are
still pending after the MCU services a request, the interrupt line will still be held low and the MCU will be
interrupted again as soon as the interrupt mask bit in the MCU is cleared (normally upon return from an
interrupt). Refer to Chapter 5 Resets and Interrupts.
V
is the input for the 12-volt nominal programming voltage required for EPROM/OTPROM
PPE
programming. On devices without EPROM/OTPROM, this pin is only an XIRQ
input.
CAUTION
During EPROM programming of the MC68HC711E9 device, the V
PPE
pin
circuitry may latch-up and be damaged if the input current is not limited to
10 mA. For more information please refer to MC68HC711E9 8-Bit
Microcontroller Unit Mask Set Errata 3 (Freescale document order number
68HC711E9MSE3.
1.4.7 MODA and MODB (MODA/LIR and MODB/V
STBY
)
During reset, MODA and MODB select one of the four operating modes:
•Single-chip mode
•Expanded mode
•Test mode
•Bootstrap mode
Refer to Chapter 2 Operating Modes and On-Chip Memory.
After the operating mode has been selected, the load instruction register (LIR
) pin provides an open-drain
output to indicate that execution of an instruction has begun. A series of E-clock cycles occurs during
execution of each instruction. The LIR
signal goes low during the first E-clock cycle of each instruction
(opcode fetch). This output is provided for assistance in program debugging.
The V
pin is more than one MOS threshold (about 0.7 volts) above the V
of the reset logic are powered from this signal rather than the V
retained without V
must remain low until V
pin is used to input random-access memory (RAM) standby power. When the voltage on this
STBY
voltage, the internal RAM and part
DD
input. This allows RAM contents to be
DD
power applied to the MCU. Reset must be driven low before VDD is removed and
DD
has been restored to a valid level.
DD
1.4.8 VRL and VRH
These two inputs provide the reference voltages for the analog-to-digital (A/D) converter circuitry:
•V
•V
For proper A/D converter operation:
•V
•V
is the low reference, typically 0 Vdc.
RL
is the high reference.
RH
should be at least 3 Vdc greater than VRL.
RH
and VRH should be between VSS and VDD.
RL
M68HC11E Family Data Sheet, Rev. 5.1
24Freescale Semiconductor
Pin Descriptions
1.4.9 STRA/AS
The strobe A (STRA) and address strobe (AS) pin performs either of two separate functions, depending
on the operating mode:
•In the expanded multiplexed mode, AS provides an address strobe function.
AS can be used to demultiplex the address and data signals at port C. Refer to Chapter 2 Operating
Modes and On-Chip Memory.
1.4.10 STRB/R/W
The strobe B (STRB) and read/write (R/W) pin act as either an output strobe or as a data bus direction
indicator, depending on the operating mode.
In single-chip operating mode, STRB acts as a programmable strobe for handshake with other parallel
devices. Refer to Chapter 6 Parallel Input/Output (I/O) Ports for further information.
In expanded multiplexed operating mode, R/W
data bus. A low on the R/W
pin indicates data is being written to the external data bus. A high on this pin
indicates that a read cycle is in progress. R/W
is used to indicate the direction of transfers on the external
stays low during consecutive data bus write cycles, such
as a double-byte store. It is possible for data to be driven out of port C, if internal read visibility (IRV) is
enabled and an internal address is read, even though R/W
is in a high-impedance state. Refer to
Chapter 2 Operating Modes and On-Chip Memory for more information about IRVNE (internal read
visibility not E).
1.4.11 Port Signals
Port pins have different functions in different operating modes. Pin functions for port A, port D, and port
E are independent of operating modes. Port B and port C, however, are affected by operating mode. Port
B provides eight general-purpose output signals in single-chip operating modes. When the microcontroller
is in expanded multiplexed operating mode, port B pins are the eight high-order address lines.
Port C provides eight general-purpose input/output signals when the MCU is in the single-chip operating
mode. When the microcontroller is in the expanded multiplexed operating mode, port C pins are a
multiplexed address/data bus.
Refer to Table 1-1 for a functional description of the 40 port signals within different operating modes.
Terminate unused inputs and input/output (I/O) pins configured as inputs high or low.
1.4.12 Port A
In all operating modes, port A can be configured for three timer input capture (IC) functions and four timer
output compare (OC) functions. An additional pin can be configured as either the fourth IC or the fifth OC.
Any port A pin that is not currently being used for a timer function can be used as either a general-purpose
input or output line. Only port A pins PA7 and PA3 have an associated data direction control bit that allows
the pin to be selectively configured as input or output. Bits DDRA7 and DDRA3 located in PACTL register
control data direction for PA7 and PA3, respectively. All other port A pins are fixed as either input or
output.
PA7 can function as general-purpose I/O or as timer output compare for OC1. PA7 is also the input to the
pulse accumulator, even while functioning as a general-purpose I/O or an OC1 output.
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor25
General Description
Table 1-1. Port Signal Functions
Port/Bit
PA 0PA 0/ I C3
PA 1PA 1/ I C2
PA 2PA 2/ I C1
PA3PA3/OC5/IC4/OC1
PA4PA4/OC4/OC1
PA5PA5/OC3/OC1
PA6PA6/OC2/OC1
PA7PA7/PAI/OC1
PB0PB0ADDR8
PB1PB1ADDR9
PB2PB2ADDR10
PB3PB3ADDR11
PB4PB4ADDR12
PB5PB5ADDR13
PB6PB6ADDR14
PB7PB7ADDR15
PC0PC0ADDR0/DATA0
PC1PC1ADDR1/DATA1
PC2PC2ADDR2/DATA2
PC3PC3ADDR3/DATA3
PC4PC4ADDR4/DATA4
PC5PC5ADDR5/DATA5
PC6PC6ADDR6/DATA6
PC7PC7ADDR7/DATA7
PD0PD0/RxD
PD1PD1/TxD
PD2PD2/MISO
PD3PD3/MOSI
PD4PD4/SCK
PD5PD5/SS
—STRAAS
—STRBR/W
PE0PE0/AN0
PE1PE1/AN1
PE2PE3/AN2
PE3PE3/AN3
PE4PE4/AN4
PE5PE5/AN5
PE6PE6/AN6
PE7PE7/AN7
Single-Chip and
Bootstrap Modes
Expanded and
Test Modes
M68HC11E Family Data Sheet, Rev. 5.1
26Freescale Semiconductor
Pin Descriptions
PA6–PA4 serve as either general-purpose outputs, timer input captures, or timer output compare 2–4. In
addition, PA6–PA4 can be controlled by OC1.
PA3 can be a general-purpose I/O pin or a timer IC/OC pin. Timer functions associated with this pin
include OC1 and IC4/OC5. IC4/OC5 is software selectable as either a fourth input capture or a fifth output
compare. PA3 can also be configured to allow OC1 edges to trigger IC4 captures.
PA2–PA0 serve as general-purpose inputs or as IC1–IC3.
PORTA can be read at any time. Reads of pins configured as inputs return the logic level present on the
pin. Pins configured as outputs return the logic level present at the pin driver input. If written, PORTA
stores the data in an internal latch, bits 7 and 3. It drives the pins only if they are configured as outputs.
Writes to PORTA do not change the pin state when pins are configured for timer input captures or output
compares. Refer to Chapter 6 Parallel Input/Output (I/O) Ports.
1.4.13 Port B
During single-chip operating modes, all port B pins are general-purpose output pins. During MCU reads
of this port, the level sensed at the input side of the port B output drivers is read. Port B can also be used
in simple strobed output mode. In this mode, an output pulse appears at the STRB signal each time data
is written to port B.
In expanded multiplexed operating modes, all of the port B pins act as high order address output signals.
During each MCU cycle, bits 15–8 of the address bus are output on the PB7–PB0 pins. The PORTB
register is treated as an external address in expanded modes.
1.4.14 Port C
While in single-chip operating modes, all port C pins are general-purpose I/O pins. Port C inputs can be
latched into an alternate PORTCL register by providing an input transition to the STRA signal. Port C can
also be used in full handshake modes of parallel I/O where the STRA input and STRB output act as
handshake control lines.
When in expanded multiplexed modes, all port C pins are configured as multiplexed address/data signals.
During the address portion of each MCU cycle, bits 7–0 of the address are output on the PC7–PC0 pins.
During the data portion of each MCU cycle (E high), PC7–PC0 are bidirectional data signals,
DATA7–DATA0. The direction of data at the port C pins is indicated by the R/W
The CWOM control bit in the PIOC register disables the port C P-channel output driver. CWOM
simultaneously affects all eight bits of port C. Because the N-channel driver is not affected by CWOM,
setting CWOM causes port C to become an open-drain type output port suitable for wired-OR operation.
In wired-OR mode:
•When a port C bit is at logic level 0, it is driven low by the N-channel driver.
•When a port C bit is at logic level 1, the associated pin has high-impedance, as neither the
N-channel nor the P-channel devices are active.
It is customary to have an external pullup resistor on lines that are driven by open-drain devices. Port C
can only be configured for wired-OR operation when the MCU is in single-chip mode. Refer to Chapter 6
Parallel Input/Output (I/O) Ports for additional information about port C functions.
signal.
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor27
General Description
1.4.15 Port D
Pins PD5–PD0 can be used for general-purpose I/O signals. These pins alternately serve as the serial
communication interface (SCI) and serial peripheral interface (SPI) signals when those subsystems are
enabled.
•PD0 is the receive data input (RxD) signal for the SCI.
•PD1 is the transmit data output (TxD) signal for the SCI.
•PD5–PD2 are dedicated to the SPI:
–PD2 is the master in/slave out (MISO) signal.
–PD3 is the master out/slave in (MOSI) signal.
–PD4 is the serial clock (SCK) signal.
–PD5 is the slave select (SS
) input.
1.4.16 Port E
Use port E for general-purpose or analog-to-digital (A/D) inputs.
CAUTION
If high accuracy is required for A/D conversions, avoid reading port E during
sampling, as small disturbances can reduce the accuracy of that result.
M68HC11E Family Data Sheet, Rev. 5.1
28Freescale Semiconductor
Chapter 2
Operating Modes and On-Chip Memory
2.1 Introduction
This section contains information about the operating modes and the on-chip memory for M68HC11
E-series MCUs. Except for a few minor differences, operation is identical for all devices in the E series.
Differences are noted where necessary.
2.2 Operating Modes
The values of the mode select inputs MODB and MODA during reset determine the operating mode.
Single-chip and expanded multiplexed are the normal modes.
•In single-chip mode only on-chip memory is available.
•Expanded mode, however, allows access to external memory.
Each of the two normal modes is paired with a special mode:
•Bootstrap, a variation of the single-chip mode, is a special mode that executes a bootloader
program in an internal bootstrap ROM.
•Test is a special mode that allows privileged access to internal resources.
2.2.1 Single-Chip Mode
In single-chip mode, ports B and C and strobe pins A (STRA) and B (STRB) are available for
general-purpose parallel input/output (I/O). In this mode, all software needed to control the MCU is
contained in internal resources. If present, read-only memory (ROM) and/or erasable, programmable
read-only memory (EPROM) will always be enabled out of reset, ensuring that the reset and interrupt
vectors will be available at locations $FFC0–$FFFF.
NOTE
For the MC68HC811E2, the vector locations are the same; however, they
are contained in the 2048-byte EEPROM array.
2.2.2 Expanded Mode
In expanded operating mode, the MCU can access the full 64-Kbyte address space. The space includes:
•The same on-chip memory addresses used for single-chip mode
•Addresses for external peripherals and memory devices
The expansion bus is made up of ports B and C, and control signals AS (address strobe) and R/W
(read/write). R/W
same pins. During the first half of each bus cycle address information is present. During the second half
of each bus cycle the pins become the bidirectional data bus. AS is an active-high latch enable signal for
an external address latch. Address information is allowed through the transparent latch while AS is high
and is latched when AS drives low.
and AS allow the low-order address and the 8-bit data bus to be multiplexed on the
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor29
Operating Modes and On-Chip Memory
The address, R/W, and AS signals are active and valid for all bus cycles, including accesses to internal
memory locations. The E clock is used to enable external devices to drive data onto the internal data bus
during the second half of a read bus cycle (E clock high). R/W
drives low when data is being written to the internal data bus. R/W
controls the direction of data transfers. R/W
will remain low during consecutive data
bus write cycles, such as when a double-byte store occurs.
Refer to Figure 2-1.
NOTE
The write enable signal for an external memory is the NAND of the E clock
and the inverted R/W
Test mode, a variation of the expanded mode, is primarily used during Freescale’s internal production
testing; however, it is accessible for programming the configuration (CONFIG) register, programming
calibration data into electrically erasable, programmable read-only memory (EEPROM), and supporting
emulation and debugging during development.
2.2.4 Bootstrap Mode
When the MCU is reset in special bootstrap mode, a small on-chip read-only memory (ROM) is enabled
at address $BF00–$BFFF. The ROM contains a bootloader program and a special set of interrupt and
reset vectors. The MCU fetches the reset vector, then executes the bootloader.
Bootstrap mode is a special variation of the single-chip mode. Bootstrap mode allows special-purpose
programs to be entered into internal random-access memory (RAM). When bootstrap mode is selected
at reset, a small bootstrap ROM becomes present in the memory map. Reset and interrupt vectors are
M68HC11E Family Data Sheet, Rev. 5.1
30Freescale Semiconductor
Memory Map
located in this ROM at $BFC0–$BFFF. The bootstrap ROM contains a small program which initializes the
serial communications interface (SCI) and allows the user to download a program into on-chip RAM. The
size of the downloaded program can be as large as the size of the on-chip RAM. After a 4-character delay,
or after receiving the character for the highest address in RAM, control passes to the loaded program at
$0000. Refer to Figure 2-2, Figure 2-3, Figure 2-4, Figure 2-5, and Figure 2-6.
Use of an external pullup resistor is required when using the SCI transmitter pin because port D pins are
configured for wired-OR operation by the bootloader. In bootstrap mode, the interrupt vectors are directed
to RAM. This allows the use of interrupts through a jump table. Refer to the application note AN1060
entitled M68HC11 Bootstrap Mode, that is included in this data book.
2.3 Memory Map
The operating mode determines memory mapping and whether external addresses can be accessed.
Refer to Figure 2-2, Figure 2-3, Figure 2-4, Figure 2-5, and Figure 2-6, which illustrate the memory maps
for each of the three families comprising the M68HC11 E series of MCUs.
Memory locations for on-chip resources are the same for both expanded and single-chip modes. Control
bits in the configuration (CONFIG) register allow EPROM and EEPROM (if present) to be disabled from
the memory map. The RAM is mapped to $0000 after reset. It can be placed at any 4-Kbyte boundary
($x000) by writing an appropriate value to the RAM and I/O map register (INIT). The 64-byte register block
is mapped to $1000 after reset and also can be placed at any 4-Kbyte boundary ($x000) by writing an
appropriate value to the INIT register. If RAM and registers are mapped to the same boundary, the first
64 bytes of RAM will be inaccessible.
Refer to Figure 2-7, which details the MCU register and control bit assignments. Reset states shown are
for single-chip mode only.
$0000
$1000
$B600
$D000
$FFFF
EXT
EXTEXT
EXPANDED
BOOTSTRAPSPECIAL
EXT
TEST
0000
512 BYTES RAM
01FF
1000
64-BYTE REGISTER BLOCK
103F
BOOT
BF00
ROM
BFFF
NORMAL
FFC0
MODES
INTERRUPT
FFFF
VECTORS
BFC0
BFFF
SPECIAL MODES
INTERRUPT
VECTORS
Figure 2-2. Memory Map for MC68HC11E0
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor31
Operating Modes and On-Chip Memory
$0000
$1000
$B600
$D000
$FFFF
EXT
EXTEXT
EXT
EXPANDED
BOOTSTRAPSPECIAL
Figure 2-3. Memory Map for MC68HC11E1
EXT
EXT
TEST
0000
512 BYTES RAM
01FF
1000
64-BYTE REGISTER BLOCK
103F
B600
512 BYTES EEPROM
B7FF
BOOT
BF00
ROM
BFFF
NORMAL
FFC0
MODES
INTERRUPT
FFFF
VECTORS
BFC0
BFFF
SPECIAL MODES
INTERRUPT
VECTORS
$0000
$1000
$B600
$D000
$FFFF
SINGLE
CHIP
EXT
EXTEXT
EXT
EXPANDED
BOOTSTRAPSPECIAL
EXT
EXT
BFFF
TEST
Figure 2-4. Memory Map for MC68HC(7)11E9
0000
512 BYTES RAM
01FF
1000
64-BYTE REGISTER BLOCK
103F
B600
512 BYTES EEPROM
B7FF
BOOT
BF00
ROM
12 KBYTES ROM/EPROM
D000
FFFF
BFC0
BFFF
FFC0
FFFF
SPECIAL MODES
INTERRUPT
VECTORS
NORMAL
MODES
INTERRUPT
VECTORS
M68HC11E Family Data Sheet, Rev. 5.1
32Freescale Semiconductor
Memory Map
$0000
EXT
$1000
EXT
$9000
EXT
$B600
EXT
$D000
$FFFF
SINGLE
CHIP
* 20 Kbytes ROM/EPROM are contained in two segments of 8 Kbytes and 12 Kbytes each.
EXPANDED
BOOTSTRAPSPECIAL
EXT
EXT
EXT
EXT
TEST
0000
768 BYTES RAM
02FF
1000
64-BYTE REGISTER BLOCK
103F
9000
8 KBYTES ROM/EPROM *
AFFF
B600
512 BYTES EEPROM
B7FF
BOOT
BF00
ROM
BFFF
12 KBYTES ROM/EPROM *
D000
FFFF
Figure 2-5. Memory Map for MC68HC(7)11E20
BFC0
BFFF
FFC0
FFFF
SPECIAL MODES
INTERRUPT
VECTORS
NORMAL
MODES
INTERRUPT
VECTORS
$0000
$1000
$F800
$FFFF
SINGLE
CHIP
EXT
EXTEXT
EXPANDED
BOOTSTRAPSPECIAL
Figure 2-6. Memory Map for MC68HC811E2
EXT
TEST
0000
256 BYTES RAM
00FF
1000
64-BYTE REGISTER BLOCK
103F
BOOT
BF00
ROM
BFFF
2048 BYTES EEPROM
F800
FFFF
BFC0
BFFF
FFC0
FFFF
SPECIAL MODES
INTERRUPT
VECTORS
NORMAL
MODES
INTERRUPT
VECTORS
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor33
Operating Modes and On-Chip Memory
Addr.Register NameBit 7654321Bit 0
Port A Data Register
$1000
$1001ReservedRRRRRRRR
(PORTA)
See page 98.
Read:
Write:
Reset:I000IIII
PA7PA6PA5PA4PA3PA2PA1PA0
Parallel I/O Control Register
$1002
Port C Data Register
$1003
Port B Data Register
$1004
Port C Latched Register
$1005
$1006ReservedRRRRRRRR
Port C Data Direction Register
$1007
Port D Data Register
$1008
Port D Data Direction Register
$1009
Port E Data Register
$100A
Timer Compare Force Register
$100B
Output Compare 1 Mask Register
$100C
(PIOC)
See page 102.
(PORTC)
See page 99.
(PORTB)
See page 99.
(PORTCL)
See page 99.
(DDRC)
See page 100.
(PORTD)
See page 100.
(DDRD)
See page 100.
(PORTE)
See page 101.
(CFORC)
See page 135.
(OC1M)
See page 136.
Read:
Write:
Reset:00000U11
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:00000000
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:00000000
Read:
Write:
Reset:UUIIIIII
Read:
Write:
Reset:00000000
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
STAFSTAICWOMHNDSOINPLSEGAINVB
PC7PC6PC5PC4PC3PC2PC1PC0
PB7PB6PB5PB4PB3PB2PB1PB0
PCL7PCL6PCL5PCL4PCL3PCL2PCL1PCL0
DDRC7DDRC6DDRC5DDRC4DDRC3DDRC2DDRC1DDRC0
00PD5PD4PD3PD2PD1PD0
DDRD5DDRD4DDRD3DDRD2DDRD1DDRD0
PE7PE6PE5PE4PE3PE2PE1PE0
FOC1FOC2FOC3FOC4FOC5
OC1M7OC1M6OC1M5OC1M4OC1M3
= UnimplementedR= ReservedU = Unaffected
I = Indeterminate after reset
Figure 2-7. Register and Control Bit Assignments (Sheet 1 of 6)
M68HC11E Family Data Sheet, Rev. 5.1
34Freescale Semiconductor
Memory Map
Addr.Register NameBit 7654321Bit 0
Output Compare 1 Data Register
$100D
Timer Counter Register High
$100E
Timer Counter Register Low
$100F
Timer Input Capture 1 Register
$1010
Timer Input Capture 1 Register
$1011
Timer Input Capture 2 Register
$1012
TImer Input Capture 2 Register
$1013
Timer Input Capture 3 Register
$1014
Timer Input Capture 3 Register
$1015
Timer Output Compare 1 Register
$1016
Timer Output Compare 1 Register
$1017
Timer Output Compare 2 Register
$1018
(OC1D)
See page 136.
(TCNTH)
See page 137.
(TCNTL)
See page 137.
High (TIC1H)
See page 132.
Low (TIC1L)
See page 132.
High (TIC2H)
See page 132.
Low (TIC2L)
See page 132.
High (TIC3H)
See page 132.
Low (TIC3L)
See page 132.
High (TOC1H)
See page 134.
Low (TOC1L)
See page 134.
High (TOC2H)
See page 134.
Read:
OC1D7OC1D6OC1D5OC1D4OC1D3
Write:
Reset:00000000
Read: Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Write:
Reset:00000000
Read:Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:
Reset:00000000
Read:
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:11 1 1 1 1 11
Read:
Write:
Reset:11 1 1 1 1 11
Read:
Write:
Reset:11 1 1 1 1 11
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
= UnimplementedR= ReservedU = Unaffected
I = Indeterminate after reset
Figure 2-7. Register and Control Bit Assignments (Sheet 2 of 6)
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor35
Operating Modes and On-Chip Memory
Addr.Register NameBit 7654321Bit 0
Timer Output Compare 2 Register
$1019
Timer Output Compare 3 Register
$101A
Timer Output Compare 3 Register
$101B
Timer Output Compare 4 Register
$101C
Timer Output Compare 4 Register
$101D
Timer Input Capture 4/Output
$101E
$101F
$1020
$1021
$1022
$1023
$1024
Compare 5 Register High
(TI4/O5) See page 133.
Timer Input Capture 4/Output
Compare 5 Register Low
(TI4/O5) See page 133.
Timer Control Register 1
Timer Control Register 2
Timer Interrupt Mask 1 Register
Timer Interrupt Flag 1
Timer Interrupt Mask 2 Register
Low (TOC2L)
See page 134.
High (TOC3H)
See page 135.
Low (TOC3L)
See page 135.
High (TOC4H)
See page 135.
Low (TOC4L)
See page 135.
(TCTL1)
See page 137.
(TCTL2)
See page 131.
(TMSK1)
See page 138.
(TFLG1)
See page 138.
(TMSK2)
See page 139.
Read:
Write:
Reset:11 1 1 1 1 11
Read:
Write:
Reset:11 1 1 1 1 11
Read:
Write:
Reset:11 1 1 1 1 11
Read:
Write:
Reset:11 1 1 1 1 11
Read:
Write:
Reset:11 1 1 1 1 11
Read:
Write:
Reset:11 1 1 1 1 11
Read:
Write:
Reset:11 1 1 1 1 11
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
OM2OL2OM3OL3OM4OL4OM5OL5
EDG4BEDG4AEDG1BEDG1AEDG2BEDG2AEDG3BEDG3A
OC1IOC2IOC3IOC4II4/O5IIC1IIC2IIC3I
OC1FOC2FOC3FOC4FI4/O5FIC1FIC2FIC3F
TOIRTIIPAOVIPAII
= UnimplementedR= ReservedU = Unaffected
I = Indeterminate after reset
PR1PR0
Figure 2-7. Register and Control Bit Assignments (Sheet 3 of 6)
M68HC11E Family Data Sheet, Rev. 5.1
36Freescale Semiconductor
Memory Map
Addr.Register NameBit 7654321Bit 0
Timer Interrupt Flag 2
$1025
Pulse Accumulator Control Regis-
$1026
Pulse Accumulator Count Regis-
$1027
Serial Peripheral Control Register
$1028
Serial Peripheral Status Register
$1029
Serial Peripheral Data I/O Regis-
$102A
Baud Rate Register
$102B
Serial Communications Control
$102C
Serial Communications Control
$102D
Serial Communications Status
$102E
1. SCP2 adds ÷39 to SCI prescaler and is present only in MC68HC(7)11E20.
Serial Communications Data Reg-
$102F
Analog-to-Digital Control Status
$1030
Register 1 (SCCR1)
Register 2 (SCCR2)
Register (ADCTL)
(TFLG2)
See page 142.
ter (PACTL)
See page 142.
ter (PACNT)
See page 146.
(SPCR)
See page 123.
(SPSR)
See page 124.
ter (SPDR)
See page 125.
(BAUD)
See page 113.
See page 110.
See page 111.
Register (SCSR)
See page 112.
ister (SCDR)
See page 110.
See page 62.
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:000001UU
Read:
Write:
Reset:00000000
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:00000UUU
Read:
Write:
Reset:II000000
Read:
Write:
Reset:00000000
Read:
Write:
Reset:11000000
Read:
Write:
Reset:Indeterminate after reset
Read:CCF
Write:
Reset:00Indeterminate after reset
TOFRTIFPAOVFPAIF
DDRA7PAENPAMODPEDGEDDRA3I4/O5RTR1RTR0
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
SPIESPEDWOMMSTRCPOLCPHASPR1SPR0
SPIFWCOL
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
TCLRSCP2
R8T8
TIETCIERIEILIETERERWUSBK
TDRETCRDRFIDLEORNFFE
R7/T7R6/T6R5/T5R4/T4R3/T3R2/T2R1/T1R0/T0
I = Indeterminate after reset
(1)
SCP1SCP0RCKBSCR2SCR1SCR0
SCANMULTCDCCCBCA
= UnimplementedR= ReservedU = Unaffected
MODF
MWAKE
Figure 2-7. Register and Control Bit Assignments (Sheet 4 of 6)
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor37
Operating Modes and On-Chip Memory
Addr.Register NameBit 7654321Bit 0
Read:Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:
Reset:Indeterminate after reset
Read:Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:
Reset:Indeterminate after reset
Read:Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:
Reset:Indeterminate after reset
Read:Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:
Reset:Indeterminate after reset
Read:
Write:
PTCONBPRT3BPRT2BPRT1BPRT0
Reset:00011111
Read:
(1)
Write:
MBE
ELATEXCOLEXROWT1T0PGM
Reset:00000000
$1031
$1032
$1033
$1034
$1035
$1036
Analog-to-Digital Results
Register 1 (ADR1)
See page 64.
Analog-to-Digital Results
Register 2 (ADR2)
See page 64.
Analog-to-Digital Results
Register 3 (ADR3)
See page 64.
Analog-to-Digital Results
Register 4 (ADR4)
See page 64.
Block Protect Register
(BPROT)
See page 52.
EPROM Programming Control
Register (EPROG)
See page 53.
$1037ReservedRRRRRRRR
1. MC68HC711E20 only
$1038ReservedRRRRRRRR
$1039
$103A
$103B
$103C
$103D
System Configuration Options
Register (OPTION)
See page 46.
Arm/Reset COP Timer Circuitry
Register (COPRST)
See page 81.
EPROM and EEPROM Program-
ming Control Register (PPROG)
See page 49.
Highest Priority I Bit Interrupt and
Miscellaneous Register (HPRIO)
See page 41.
RAM and I/O Mapping Register
(INIT)
See page 45.
Read:
ADPUCSELIRQE
Write:
Reset:00010000
Read:
Write:
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Reset:00000000
Read:
Write:
ODDEVENELAT
Reset:00000000
Read:
RBOOTSMODMDAIRV(NE)PSEL3PSEL2PSEL1PSEL0
Write:
Reset:00000110
Read:
RAM3RAM2RAM1RAM0REG3REG2REG1REG0
Write:
Reset:00000001
(1)
(2)
(1)
DLY
CMECR1
BYTEROWERASEEELATEPGM
(1)
CR0
= UnimplementedR= ReservedU = Unaffected
I = Indeterminate after reset
(1)
Figure 2-7. Register and Control Bit Assignments (Sheet 5 of 6)
M68HC11E Family Data Sheet, Rev. 5.1
38Freescale Semiconductor
Memory Map
Addr.Register NameBit 7654321Bit 0
$103EReservedRRRRRRRR
System Configuration Register
$103F
System Configuration Register
$103F
1. Can be written only once in first 64 cycles out of reset in normal modes or at any time during special modes.
2. MC68HC711E9 only
3. MC68HC811E2 only
(CONFIG)
See page 43.
(CONFIG)
See page 43.
Read:
Write:
Reset:0000UU1U
Read:
(3)
Write:
Reset:1111UU11
EE3EE2EE1EE0NOSECNOCOP
= UnimplementedR= ReservedU = Unaffected
I = Indeterminate after reset
NOSECNOCOPROMONEEON
EEON
Figure 2-7. Register and Control Bit Assignments (Sheet 6 of 6)
2.3.1 RAM and Input/Output Mapping
Hardware priority is built into RAM and I/O mapping. Registers have priority over RAM and RAM has
priority over ROM. When a lower priority resource is mapped at the same location as a higher priority
resource, a read/write of a location results in a read/write of the higher priority resource only. For example,
if both the register block and the RAM are mapped to the same location, only the register block will be
accessed. If RAM and ROM are located at the same position, RAM has priority.
The fully static RAM can be used to store instructions, variables, and temporary data. The direct
addressing mode can access RAM locations using a 1-byte address operand, saving program memory
space and execution time, depending on the application.
RAM contents can be preserved during periods of processor inactivity by two methods, both of which
reduce power consumption. They are:
1.In the software-based stop mode, the clocks are stopped while V
powers the MCU. Because
DD
power supply current is directly related to operating frequency in CMOS integrated circuits, only a
very small amount of leakage exists when the clocks are stopped.
2.In the second method, the MODB/V
pin can supply RAM power from a battery backup or from
STBY
a second power supply. Figure 2-8 shows a typical standby voltage circuit for a standard 5-volt
device. Adjustments to the circuit must be made for devices that operate at lower voltages. Using
the MODB/V
of external circuitry is operating from V
be held low whenever V
pin may require external hardware, but can be justified when a significant amount
STBY
. If V
DD
is below normal operating level. Refer to Chapter 5 Resets and
DD
is used to maintain RAM contents, reset must
STBY
Interrupts.
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor39
Operating Modes and On-Chip Memory
4.8-V
NiCd
V
DD
MAX
690
V
DD
V
OUT
V
BATT
+
4.7 k
TO MODB/V
OF M68HC11
STBY
Figure 2-8. RAM Standby MODB/V
Connections
STBY
The bootloader program is contained in the internal bootstrap ROM. This ROM, which appears as internal
memory space at locations $BF00–$BFFF, is enabled only if the MCU is reset in special bootstrap mode.
In expanded modes, the ROM/EPROM/OTPROM (if present) is enabled out of reset and located at the
top of the memory map if the ROMON bit in the CONFIG register is set. ROM or EPROM is enabled out
of reset in single-chip and bootstrap modes, regardless of the state of ROMON.
For devices with 512 bytes of EEPROM, the EEPROM is located at $B600–$B7FF and has the same read
cycle time as the internal ROM. The 512 bytes of EEPROM cannot be remapped to other locations.
For the MC68HC811E2, EEPROM is located at $F800–$FFFF and can be remapped to any 4-Kbyte
boundary. EEPROM mapping control bits (EE[3:0] in CONFIG) determine the location of the 2048 bytes
of EEPROM and are present only on the MC68HC811E2. Refer to 2.3.3.1 System Configuration Register
for a description of the MC68HC811E2 CONFIG register.
EEPROM can be programmed or erased by software and an on-chip charge pump, allowing EEPROM
changes using the single V
supply.
DD
2.3.2 Mode Selection
The four mode variations are selected by the logic states of the MODA and MODB pins during reset. The
MODA and MODB logic levels determine the logic state of SMOD and the MDA control bits in the highest
priority I-bit interrupt and miscellaneous (HPRIO) register.
After reset is released, the mode select pins no longer influence the MCU operating mode. In single-chip
operating mode, the MODA pin is connected to a logic level 0. In expanded mode, MODA is normally
connected to V
register LIR
the first E cycle of each instruction. The MODB pin also functions as standby power input (V
allows RAM contents to be maintained in absence of V
through a pullup resistor of 4.7 kΩ. The MODA pin also functions as the load instruction
DD
pin when the MCU is not in reset. The open-drain active low LIR output pin drives low during
), which
STBY
.
DD
Refer to Table 2-1, which is a summary of mode pin operation, the mode control bits, and the four
operating modes.
M68HC11E Family Data Sheet, Rev. 5.1
40Freescale Semiconductor
Table 2-1. Hardware Mode Select Summary
Memory Map
Input Levels
at Reset
MODBMODARBOOTSMOD MDA
10Single chip000
11Expanded001
00Bootstrap110
01Special test011
Mode
Control Bits in HPRIO
(Latched at Reset)
A normal mode is selected when MODB is logic 1 during reset. One of three reset vectors is fetched from
address $FFFA–$FFFF, and program execution begins from the address indicated by this vector. If
MODB is logic 0 during reset, the special mode reset vector is fetched from addresses $BFFA–$BFFF,
and software has access to special test features. Refer to Chapter 5 Resets and Interrupts.
Address:$103C
Bit 7654321Bit 0
Read:
Write:
Resets:
Single chip:0000 0110
Expanded:0010 0110
Bootstrap:1100 0110
Test:0111 0110
1. The reset values depend on the mode selected at the RESET pin rising edge.
RBOOT
(1)
SMOD
(1)
MDA
(1)
IRV(NE)
(1)
PSEL3PSEL2PSEL1PSEL0
Figure 2-9. Highest Priority I-Bit Interrupt and Miscellaneous
Register (HPRIO)
RBOOT — Read Bootstrap ROM Bit
Valid only when SMOD is set (bootstrap or special test mode); can be written only in special modes
0 = Bootloader ROM disabled and not in map
1 = Bootloader ROM enabled and in map at $BE00–$BFFF
SMOD and MDA — Special Mode Select and Mode Select A Bits
The initial value of SMOD is the inverse of the logic level present on the MODB pin at the rising edge
of reset. The initial value of MDA equals the logic level present on the MODA pin at the rising edge of
reset. These two bits can be read at any time. They can be written anytime in special modes. MDA can
be written only once in normal modes. SMOD cannot be set once it has been cleared.
Input
Mode
MODBMODASMODMDA
10Single chip00
11Expanded01
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor41
Latched at Reset
Operating Modes and On-Chip Memory
00Bootstrap10
01Special test11
IRV(NE) — Internal Read Visibility (Not E) Bit
IRVNE can be written once in any mode. In expanded modes, IRVNE determines whether IRV is on
or off. In special test mode, IRVNE is reset to 1. In all other modes, IRVNE is reset to 0. For the
MC68HC811E2, this bit is IRV and only controls the internal read visibility function.
0 = No internal read visibility on external bus
1 = Data from internal reads is driven out the external data bus.
In single-chip modes this bit determines whether the E clock drives out from the chip. For the
MC68HC811E2, this bit has no meaning or effect in single-chip and bootstrap modes.
0 = E is driven out from the chip.
1 = E pin is driven low. Refer to the following table.
Mode
Single chip0OnOffEOnce
Expanded0OnOffIRVOnce
Bootstrap0OnOffEOnce
Special test1OnOnIRVOnce
IRVNE Out
of Reset
E Clock Out
of Reset
IRV Out
of Reset
IRVNE
Affects Only
IRVNE Can
Be Written
PSEL[3:0] — Priority Select Bits
Refer to Chapter 5 Resets and Interrupts.
2.3.3 System Initialization
Registers and bits that control initialization and the basic operation of the MCU are protected against
writes except under special circumstances. Table 2-2 lists registers that can be written only once after
reset or that must be written within the first 64 cycles after reset.
SMOD = 1$x024Timer interrupt mask 2 (TMSK2)—All, set or clear
Register
Address
$x035Block protect register (BPROT)Clear bits, once onlySet bits only
$x039System configuration options (OPTION)Bits [5:4], bits [2:0], once onlyBits [7:6], bit 3
$x03C
$x03DRAM and I/O map register (INIT)Yes, once only —
$x035Block protect register (BPROT)—All, set or clear
$x039System configuration options (OPTION)—All, set or clear
$x03C
$x03DRAM and I/O map register (INIT)—All, set or clear
Highest priority I-bit interrupt
and miscellaneous (HPRIO)
Highest priority I-bit interrupt and
miscellaneous (HPRIO)
Register Name
Must be Written
in First 64 Cycles
See HPRIO descriptionSee HPRIO description
See HPRIO descriptionSee HPRIO description
Write
Anytime
M68HC11E Family Data Sheet, Rev. 5.1
42Freescale Semiconductor
Memory Map
2.3.3.1 System Configuration Register
The system configuration register (CONFIG) consists of an EEPROM byte and static latches that control
the startup configuration of the MCU. The contents of the EEPROM byte are transferred into static
working latches during reset sequences. The operation of the MCU is controlled directly by these latches
and not by CONFIG itself. In normal modes, changes to CONFIG do not affect operation of the MCU until
after the next reset sequence. When programming, the CONFIG register itself is accessed. When the
CONFIG register is read, the static latches are accessed. See 2.5.1 EEPROM and CONFIG
Programming and Erasure for information on modifying CONFIG.
To take full advantage of the MCU’s functionality, customers can program the CONFIG register in
bootstrap mode. This can be accomplished by setting the mode pins to logic 0 and downloading a small
program to internal RAM. For more information, Freescale application note AN1060 entitled M68HC11
Bootstrap Mode has been included at the back of this document. The downloadable talker will consist of:
•Bulk erase
•Byte programming
•Communication server
All of this functionality is provided by PCbug11 which can be found on the Freescale Web site at
http://www.freescale.com. For more information on using PCbug11 to program an E-series device,
Freescale engineering bulletin EB296 entitled Programming MC68HC711E9 Devices with PCbug11 and
the M68HC11EVBU has been included at the back of this document.
NOTE
The CONFIG register on the 68HC11 is an EEPROM cell and must be
programmed accordingly.
Operation of the CONFIG register in the MC68HC811E2 differs from other devices in the M68HC11 E
series. See Figure 2-10 and Figure 2-11.
Address: $103F
Bit 7654321Bit 0
Read:
Write:
Resets:
Single chip:
Bootstrap:
Expanded:
Test:
U indicates a previously programmed bit. U(L) indicates that the bit resets to the logic level held in the latch prior to reset,
but the function of COP is controlled by the DISR bit in TEST1 register.
0
0
0
0
0
0
0
0
= Unimplemented
0
0
0
0
0
0
0
0
NOSECNOCOPROMONEEON
U
U
1
1
U
U(L)
U
U(L)
1
U
U
U
U
U
U
U
Figure 2-10. System Configuration Register (CONFIG)
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor43
Operating Modes and On-Chip Memory
Address:$103F
Bit 7654321Bit 0
Read:
Write:
Resets:
Single chip:
Bootstrap:
Expanded:
Test:
U indicates a previously programmed bit. U(L) indicates that the bit resets to the logic level held in the latch prior to reset,
but the function of COP is controlled by the DISR bit in TEST1 register.
EE3EE2EE1EE0NOSECNOCOP
1
1
U
U
1
1
U
U
= Unimplemented
1
1
U
U
1
1
U
U
U
U
1
1
U
U(L)
U
U(L)
1
1
1
1
EEON
1
1
U
0
Figure 2-11. MC68HC811E2 System Configuration Register (CONFIG)
EE[3:0] — EEPROM Mapping Bits
EE[3:0] apply only to MC68HC811E2 and allow the 2048 bytes of EEPROM to be remapped to any
4-Kbyte boundary. See Table 2-3.
Table 2-3. EEPROM Mapping
EE[3:0]EEPROM Location
0 0 0 0$0800–$0FFF
0 0 0 1$1800–$1FFF
0 0 1 0$2800–$2FFF
0 0 1 1$3800–$3FFF
0 1 0 0$4800–$4FFF
0 1 0 1$5800–$5FFF
0 1 1 0$6800–$6FFF
0 1 1 1$7800–$7FFF
1 0 0 0$8800–$8FFF
1 0 0 1$9800–$9FFF
1 0 1 0$A800–$AFFF
1 0 1 1$B800–$BFFF
1 1 0 0$C800–$CFFF
1 1 0 1$D800–$DFFF
1 1 1 0$E800–$EFFF
1 1 1 1$F800–$FFFF
M68HC11E Family Data Sheet, Rev. 5.1
44Freescale Semiconductor
Memory Map
NOSEC — Security Disable Bit
NOSEC is invalid unless the security mask option is specified before the MCU is manufactured. If the
security mask option is omitted NOSEC always reads 1. The enhanced security feature is available in
the MC68S711E9 MCU. The enhancement to the standard security feature protects the EPROM as
well as RAM and EEPROM.
0 = Security enabled
1 = Security disabled
NOCOP — COP System Disable Bit
Refer to Chapter 5 Resets and Interrupts.
1 = COP disabled
0 = COP enabled
ROMON — ROM/EPROM/OTPROM Enable Bit
When this bit is 0, the ROM or EPROM is disabled and that memory space becomes externally
addressed. In single-chip mode, ROMON is forced to 1 to enable ROM/EPROM regardless of the state
of the ROMON bit.
0 = ROM disabled from the memory map
1 = ROM present in the memory map
EEON — EEPROM Enable Bit
When this bit is 0, the EEPROM is disabled and that memory space becomes externally addressed.
0 = EEPROM removed from the memory map
1 = EEPROM present in the memory map
2.3.3.2 RAM and I/O Mapping Register
The internal registers used to control the operation of the MCU can be relocated on 4-Kbyte boundaries
within the memory space with the use of the RAM and I/O mapping register (INIT). This 8-bit
special-purpose register can change the default locations of the RAM and control registers within the
MCU memory map. It can be written only once within the first 64 E-clock cycles after a reset in normal
modes, and then it becomes a read-only register.
Address: $103D
Bit 7654321Bit 0
Read:
Write:
Reset:00000001
RAM3RAM2RAM1RAM0REG3REG2REG1REG0
Figure 2-12. RAM and I/O Mapping Register (INIT)
RAM[3:0] — RAM Map Position Bits
These four bits, which specify the upper hexadecimal digit of the RAM address, control position of RAM
in the memory map. RAM can be positioned at the beginning of any 4-Kbyte page in the memory map.
It is initialized to address $0000 out of reset. Refer to Table 2-4.
REG[3:0] — 64-Byte Register Block Position
These four bits specify the upper hexadecimal digit of the address for the 64-byte block of internal
registers. The register block, positioned at the beginning of any 4-Kbyte page in the memory map, is
initialized to address $1000 out of reset. Refer to Table 2-5.
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor45
Operating Modes and On-Chip Memory
Table 2-4. RAM MappingTable 2-5. Register Mapping
RAM[3:0]AddressREG[3:0]Address
0000$0000–$0xFF0000$0000–$003F
0001$1000–$1xFF0001$1000–$103F
0010$2000–$2xFF0010$2000–$203F
0011$3000–$3xFF0011$3000–$303F
0100$4000–$4xFF0100$4000–$403F
0101$5000–$5xFF0101$5000–$503F
0110$6000–$6xFF0110$6000–$603F
0111$7000–$7xFF0111$7000–$703F
1000$8000–$8xFF1000$8000–$803F
1001$9000–$9xFF1001$9000–$903F
1010$A000–$AxFF1010$A000–$A03F
1011$B000–$BxFF1011$B000–$B03F
1100$C000–$CxFF1100$C000–$C03F
1101$D000–$DxFF1101$D000–$D03F
1110$E000–$ExFF1110$E000–$E03F
1111$F000–$FxFF1111$F000–$F03F
2.3.3.3 System Configuration Options Register
The 8-bit, special-purpose system configuration options register (OPTION) sets internal system
configuration options during initialization. The time protected control bits, IRQE, DLY, and CR[1:0], can
be written only once after a reset and then they become read-only. This minimizes the possibility of any
accidental changes to the system configuration.
Address: $1039
Bit 7654321Bit 0
Read:
Write:
Reset:00010000
1. Can be written only once in first 64 cycles out of reset in normal modes or at any time during
special modes.
ADPUCSELIRQE
= Unimplemented
(1)
DLY
(1)
CMECR1
(1)
CR0
(1)
Figure 2-13. System Configuration Options Register (OPTION)
ADPU — Analog-to-Digital Converter Power-Up Bit
Refer to Chapter 3 Analog-to-Digital (A/D) Converter.
CSEL — Clock Select Bit
Selects alternate clock source for on-chip EEPROM charge pump. Refer to 2.5.1 EEPROM and
CONFIG Programming and Erasure for more information on EEPROM use.
CSEL also selects the clock source for the A/D converter, a function discussed in Chapter 3
Analog-to-Digital (A/D) Converter.
M68HC11E Family Data Sheet, Rev. 5.1
46Freescale Semiconductor
EPROM/OTPROM
IRQE — Configure IRQ for Edge-Sensitive Only Operation Bit
Refer to Chapter 5 Resets and Interrupts.
DLY — Enable Oscillator Startup Delay Bit
0 = The oscillator startup delay coming out of stop mode is bypassed and the MCU resumes
processing within about four bus cycles.
1 = A delay of approximately 4000 E-clock cycles is imposed as the MCU is started up from the stop
power-saving mode. This delay allows the crystal oscillator to stabilize.
CME — Clock Monitor Enable Bit
Refer to Chapter 5 Resets and Interrupts.
Bit 2 — Not implemented
Always reads 0
CR[1:0] — COP Timer Rate Select Bits
The internal E clock is divided by 2
15
before it enters the COP watchdog system. These control bits
determine a scaling factor for the watchdog timer. Refer to Chapter 5 Resets and Interrupts.
2.4 EPROM/OTPROM
Certain devices in the M68HC11 E series include on-chip EPROM/OTPROM. For instance:
•The MC68HC711E9 devices contain 12 Kbytes of on-chip EPROM (OTPROM in non-windowed
package).
•The MC68HC711E20 has 20 Kbytes of EPROM (OTPROM in non-windowed package).
•The MC68HC711E32 has 32 Kbytes of EPROM (OTPROM in non-windowed package).
Standard MC68HC71E9 and MC68HC711E20 devices are shipped with the EPROM/OTPROM contents
erased (all 1s). The programming operation programs zeros. Windowed devices must be erased using a
suitable ultraviolet light source before reprogramming. Depending on the light source, erasing can take
from 15 to 45 minutes.
Using the on-chip EPROM/OTPROM programming feature requires an external 12-volt nominal power
supply (V
). Normal programming is accomplished using the EPROM/OTPROM programming register
PPE
(PPROG).
PPROG is the combined EPROM/OTPROM and EEPROM programming register on all devices with
EPROM/OTPROM except the MC68HC711E20. For the MC68HC711E20, there is a separate register for
EPROM/OTPROM programming called the EPROG register.
As described in the following subsections, these two methods of programming and verifying EPROM are
possible:
1.Programming an individual EPROM address
2.Programming the EPROM with downloaded data
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor47
Operating Modes and On-Chip Memory
2.4.1 Programming an Individual EPROM Address
•In this method, the MCU programs its own EPROM by controlling the PPROG register (EPROG in
MC68HC711E20). Use these procedures to program the EPROM through the MCU with:
•The ROMON bit set in the CONFIG register
•The 12-volt nominal programming voltage present on the XIRQ
•The IRQ
pin must be pulled high.
NOTE
Any operating mode can be used.
This example applies to all devices with EPROM/OTPROM except for the MC68HC711E20.
/V
PPE
pin
EPROGLDAB #$20
STAB$103BSet ELAT bit in (EPGM = 0) to enable
EPROM latches.
STAA$0,XStore data to EPROM address
LDAB#$21
STAB$103BSet EPGM bit with ELAT = 1 to enable
EPROM programming voltage
JSRDLYEPDelay 2–4 ms
CLR$103BTurn off programming voltage and set
to READ mode
This example applies only to MC68HC711E20.
EPROGLDAB#$20
STAB$1036Set ELAT bit (EPGM = 0) to enable
STAA$0,XStore data to EPROM address
LDAB#$21
STAB$1036Set EPGM bit with ELAT = 1 to enable
JSRDLYEPDelay 2–4 ms
CLR$1036Turn off programming voltage and set
EPROM latches.
EPROM programming voltage
to READ mode
2.4.2 Programming the EPROM with Downloaded Data
When using this method, the EPROM is programmed by software while in the special test or bootstrap
modes. User-developed software can be uploaded through the SCI or a ROM-resident EPROM
programming utility can be used. The 12-volt nominal programming voltage must be present on the
XIRQ
/V
pin. To use the resident utility, bootload a 3-byte program consisting of a single jump
PPE
instruction to $BF00. $BF00 is the starting address of a resident EPROM programming utility. The utility
program sets the X and Y index registers to default values, then receives programming data from an
external host, and puts it in EPROM. The value in IX determines programming delay time. The value in
IY is a pointer to the first address in EPROM to be programmed (default = $D000).
When the utility program is ready to receive programming data, it sends the host the $FF character. Then
it waits. When the host sees the $FF character, the EPROM programming data is sent, starting with the
first location in the EPROM array. After the last byte to be programmed is sent and the corresponding
verification data is returned, the programming operation is terminated by resetting the MCU.
For more information, Freescale application note AN1060 entitled M68HC11 Bootstrap Mode has been
included at the back of this document.
M68HC11E Family Data Sheet, Rev. 5.1
48Freescale Semiconductor
EPROM/OTPROM
2.4.3 EPROM and EEPROM Programming Control Register
The EPROM and EEPROM programming control register (PPROG) enables the EPROM programming
voltage and controls the latching of data to be programmed.
•For MC68HC711E9, PPROG is also the EEPROM programming control register.
•For the MC68HC711E20, EPROM programming is controlled by the EPROG register and
EEPROM programming is controlled by the PPROG register.
Address: $103B
Bit 7654321Bit 0
Read:
Write:
Reset:00000000
1. MC68HC711E9 only
ODDEVENELAT
Figure 2-14. EPROM and EEPROM Programming
Control Register (PPROG)
ODD — Program Odd Rows in Half of EEPROM (Test) Bit
Refer to 2.5 EEPROM.
(1)
BYTEROWERASEEELATEPGM
EVEN — Program Even Rows in Half of EEPROM (Test) Bit
Refer to 2.5 EEPROM.
ELAT — EPROM/OTPROM Latch Control Bit
When ELAT = 1, writes to EPROM cause address and data to be latched and the EPROM/OTPROM
cannot be read. ELAT can be read any time. ELAT can be written any time except when EPGM = 1;
then the write to ELAT is disabled.
0 = EPROM address and data bus configured for normal reads
1 = EPROM address and data bus configured for programming
For the MC68HC711E9:
a.EPGM enables the high voltage necessary for both EEPROM and EPROM/OTPROM
programming.
b.ELAT and EELAT are mutually exclusive and cannot both equal 1.
BYTE — Byte/Other EEPROM Erase Mode Bit
Refer to 2.5 EEPROM.
ROW — Row/All EEPROM Erase Mode Bit
Refer to 2.5 EEPROM.
ERASE — Erase Mode Select Bit
Refer to 2.5 EEPROM.
EELAT — EEPROM Latch Control Bit
Refer to 2.5 EEPROM.
EPGM —EPROM/OTPROM/EEPROM Programming Voltage Enable Bit
EPGM can be read any time and can be written only when ELAT = 1 (for EPROM/OTPROM
programming) or when EELAT = 1 (for EEPROM programming).
0 = Programming voltage to EPROM/OTPROM/EEPROM array disconnected
1 = Programming voltage to EPROM/OTPROM/EEPROM array connected
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor49
Operating Modes and On-Chip Memory
Address: $1036
Bit 7654321Bit 0
Read:
Write:
Reset:00000000
MBE
= Unimplemented
ELATEXCOLEXROWT1T0PGM
Figure 2-15. MC68HC711E20 EPROM Programming
Control Register (EPROG)
MBE — Multiple-Byte Programming Enable Bit
When multiple-byte programming is enabled, address bit 5 is considered a don’t care so that bytes with
address bit 5 = 0 and address bit 5 = 1 both get programmed. MBE can be read in any mode and
always reads 0 in normal modes. MBE can be written only in special modes.
0 = EPROM array configured for normal programming
1 = Program two bytes with the same data
Bit 6 — Unimplemented
Always reads 0
ELAT — EPROM/OTPROM Latch Control Bit
When ELAT = 1, writes to EPROM cause address and data to be latched and the EPROM/OTPROM
cannot be read. ELAT can be read any time. ELAT can be written any time except when PGM = 1; then
the write to ELAT is disabled.
0 = EPROM/OTPROM address and data bus configured for normal reads
1 = EPROM/OTPROM address and data bus configured for programming
EXCOL — Select Extra Columns Bit
0 = User array selected
1 = User array is disabled and extra columns are accessed at bits [7:0]. Addresses use bits [13:5]
and bits [4:0] are don’t care. EXCOL can be read and written only in special modes and always
returns 0 in normal modes.
EXROW — Select Extra Rows Bit
0 = User array selected
1 = User array is disabled and two extra rows are available. Addresses use bits [7:0] and bits [13:8]
are don’t care. EXROW can be read and written only in special modes and always returns 0 in
normal modes.
T[1:0] — EPROM Test Mode Select Bits
These bits allow selection of either gate stress or drain stress test modes. They can be read and written
only in special modes and always read 0 in normal modes.
T1T0Function Selected
00Normal mode
01Reserved
10Gate stress
11Drain stress
M68HC11E Family Data Sheet, Rev. 5.1
50Freescale Semiconductor
EEPROM
PGM — EPROM Programming Voltage Enable Bit
PGM can be read any time and can be written only when ELAT = 1.
0 = Programming voltage to EPROM array disconnected
1 = Programming voltage to EPROM array connected
2.5 EEPROM
Some E-series devices contain 512 bytes of on-chip EEPROM. The MC68HC811E2 contains 2048 bytes
of EEPROM with selectable base address. All E-series devices contain the EEPROM-based CONFIG
register.
2.5.1 EEPROM and CONFIG Programming and Erasure
The erased state of an EEPROM bit is 1. During a read operation, bit lines are precharged to 1. The
floating gate devices of programmed bits conduct and pull the bit lines to 0. Unprogrammed bits remain
at the precharged level and are read as ones. Programming a bit to 1 causes no change. Programming
a bit to 0 changes the bit so that subsequent reads return 0.
When appropriate bits in the BPROT register are cleared, the PPROG register controls programming and
erasing the EEPROM. The PPROG register can be read or written at any time, but logic enforces defined
programming and erasing sequences to prevent unintentional changes to EEPROM data. When the
EELAT bit in the PPROG register is cleared, the EEPROM can be read as if it were a ROM.
The on-chip charge pump that generates the EEPROM programming voltage from V
uses MOS
DD
capacitors, which are relatively small in value. The efficiency of this charge pump and its drive capability
are affected by the level of V
and the frequency of the driving clock. The load depends on the number
DD
of bits being programmed or erased and capacitances in the EEPROM array.
The clock source driving the charge pump is software selectable. When the clock select (CSEL) bit in the
OPTION register is 0, the E clock is used; when CSEL is 1, an on-chip resistor-capacitor (RC) oscillator
is used.
The EEPROM programming voltage power supply voltage to the EEPROM array is not enabled until there
has been a write to PPROG with EELAT set and PGM cleared. This must be followed by a write to a valid
EEPROM location or to the CONFIG address, and then a write to PPROG with both the EELAT and
EPGM bits set. Any attempt to set both EELAT and EPGM during the same write operation results in
neither bit being set.
2.5.1.1 Block Protect Register
This register prevents inadvertent writes to both the CONFIG register and EEPROM. The active bits in
this register are initialized to 1 out of reset and can be cleared only during the first 64 E-clock cycles after
reset in the normal modes. When these bits are cleared, the associated EEPROM section and the
CONFIG register can be programmed or erased. EEPROM is only visible if the EEON bit in the CONFIG
register is set. The bits in the BPROT register can be written to 1 at any time to protect EEPROM and the
CONFIG register. In test or bootstrap modes, write protection is inhibited and BPROT can be written
repeatedly. Address ranges for protected areas of EEPROM differ significantly for the MC68HC811E2.
Refer to Figure 2-16.
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor51
Operating Modes and On-Chip Memory
Address: $1035
Bit 7654321Bit 0
Read:
Write:
Reset:00011111
= Unimplemented
PTCONBPRT3BPRT2BPRT1BPRT0
Figure 2-16. Block Protect Register (BPROT)
Bits [7:5] — Unimplemented
Always read 0
PTCON — Protect CONFIG Register Bit
0 = CONFIG register can be programmed or erased normally.
1 = CONFIG register cannot be programmed or erased.
BPRT[3:0] — Block Protect Bits for EEPROM
When set, these bits protect a block of EEPROM from being programmed or electronically erased.
Ultraviolet light, however, can erase the entire EEPROM contents regardless of BPRT[3:0] (windowed
packages only). Refer to Table 2-6 and Table 2-7.
When cleared, BPRT[3:0] allow programming and erasure of the associated block.
Table 2-6. EEPROM Block Protect
Bit NameBlock ProtectedBlock Size
BPRT0$B600–$B61F32 bytes
BPRT1$B620–$B65F64 bytes
BPRT2$B660–$B6DF128 bytes
BPRT3$B6E0–$B7FF288 bytes
Table 2-7. EEPROM Block Protect in MC68HC811E2 MCUs
Bit NameBlock ProtectedBlock Size
BPRT0
BPRT1
BPRT2
BPRT3
1. x is determined by the value of EE[3:0] in CONFIG register. Refer to Figure
2-13.
$x800–$x9FF
$xA00–$xBFF
$xC00–$xDFF
$xE00–$xFFF
(1)
(1)
(1)
(1)
512 bytes
512 bytes
512 bytes
512 bytes
M68HC11E Family Data Sheet, Rev. 5.1
52Freescale Semiconductor
EEPROM
2.5.1.2 EPROM and EEPROM Programming Control Register
The EPROM and EEPROM programming control register (PPROG) selects and controls the EEPROM
programming function. Bits in PPROG enable the programming voltage, control the latching of data to be
programmed, and select the method of erasure (for example, byte, row, etc.).
Address: $103B
Bit 7654321Bit 0
Read:
Write:
Reset:0
1. MC68HC711E9 only
ODDEVENELAT
0000000
(1)
BYTEROWERASEEELATEPGM
Figure 2-17. EPROM and EEPROM Programming
Control Register (PPROG)
ODD — Program Odd Rows in Half of EEPROM (Test) Bit
EVEN — Program Even Rows in Half of EEPROM (Test) Bit
ELAT — EPROM/OTPROM Latch Control Bit
For the MC68HC711E9, EPGM enables the high voltage necessary for both EPROM/OTPROM and
EEPROM programming.
For MC68HC711E9, ELAT and EELAT are mutually exclusive and cannot both equal 1.
0 = EPROM address and data bus configured for normal reads
1 = EPROM address and data bus configured for programming
BYTE — Byte/Other EEPROM Erase Mode Bit
This bit overrides the ROW bit.
0 = Row or bulk erase
1 = Erase only one byte
ROW — Row/All EEPROM Erase Mode Bit
If BYTE is 1, ROW has no meaning.
0 = Bulk erase
1 = Row erase
Table 2-8. EEPROM Erase
BYTEROWAction
00Bulk erase (entire array)
01Row erase (16 bytes)
10Byte erase
11Byte erase
ERASE — Erase Mode Select Bit
0 = Normal read or program mode
1 = Erase mode
EELAT — EEPROM Latch Control Bit
0 = EEPROM address and data bus configured for normal reads and cannot be programmed
1 = EEPROM address and data bus configured for programming or erasing and cannot be read
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor53
Operating Modes and On-Chip Memory
EPGM — EPROM/OTPROM/EEPROM Programming Voltage Enable Bit
0 = Programming voltage to EEPROM array switched off
1 = Programming voltage to EEPROM array switched on
During EEPROM programming, the ROW and BYTE bits of PPROG are not used. If the frequency of the
E clock is 1 MHz or less, set the CSEL bit in the OPTION register. Recall that 0s must be erased by a
separate erase operation before programming. The following examples of how to program an EEPROM
byte assume that the appropriate bits in BPROT are cleared.
PROG LDAB#$02EELAT = 1
STAB$103BSet EELAT bit
STAA$XXXXStore data to EEPROM address
LDAB#$03EELAT = 1, EPGM = 1
STAB$103BTurn on programming voltage
JSRDLY10Delay 10 ms
CLR$103BTurn off high voltage and set
(for valid EEPROM address see memory
map for each device)
to READ mode
2.5.1.3 EEPROM Bulk Erase
This is an example of how to bulk erase the entire EEPROM. The CONFIG register is not affected in this
example.
BULKELDAB#$06EELAT = 1, ERASE = 1
STAB$103BSet to BULK erase mode
STAA$XXXXStore data to any EEPROM address (for
valid EEPROM address see memory map
LDAB#$07EELAT = 1, EPGM = 1, ERASE = 1
STAB$103BTurn on high voltage
JSRDLY10Delay 10 ms
CLR$103BTurn off high voltage and set
for each device)
to READ mode
2.5.1.4 EEPROM Row Erase
This example shows how to perform a fast erase of large sections of EEPROM.
ROWELDAB#$0EROW = 1, ERASE = 1, EELAT = 1
STAB$103BSet to ROW erase mode
STAB0,XWrite any data to any address in ROW
LDAB#$0FROW = 1, ERASE = 1, EELAT = 1, EPGM = 1
STAB$103BTurn on high voltage
JSRDLY10Delay 10 ms
CLR$103BTurn off high voltage and set
to READ mode
M68HC11E Family Data Sheet, Rev. 5.1
54Freescale Semiconductor
EEPROM
2.5.1.5 EEPROM Byte Erase
This is an example of how to erase a single byte of EEPROM.
BYTEE LDAB#$16BYTE = 1, ERASE = 1, EELAT = 1
STAB$103BSet to BYTE erase mode
STAB0,XWrite any data to address to be erased
LDAB#$17BYTE = 1, ERASE = 1, EELAT = 1,
STAB$103BTurn on high voltage
JSRDLY10Delay 10 ms
CLR$103BTurn off high voltage and set
EPGM = 1
to READ mode
2.5.1.6 CONFIG Register Programming
Because the CONFIG register is implemented with EEPROM cells, use EEPROM procedures to erase
and program this register. The procedure for programming is the same as for programming a byte in the
EEPROM array, except that the CONFIG register address is used. CONFIG can be programmed or
erased (including byte erase) while the MCU is operating in any mode, provided that PTCON in BPROT
is clear.
To change the value in the CONFIG register, complete this procedure.
1.Erase the CONFIG register.
2.Program the new value to the CONFIG address.
3.Initiate reset.
NOTE
Do not initiate a reset until the procedure is complete.
2.5.2 EEPROM Security
The optional security feature, available only on ROM-based MCUs, protects the EEPROM and RAM
contents from unauthorized access. A program, or a key portion of a program, can be protected against
unauthorized duplication. To accomplish this, the protection mechanism restricts operation of protected
devices to the single-chip modes. This prevents the memory locations from being monitored externally
because single-chip modes do not allow visibility of the internal address and data buses. Resident
programs, however, have unlimited access to the internal EEPROM and RAM and can read, write, or
transfer the contents of these memories.
An enhanced security feature which protects EPROM contents, RAM, and EEPROM from unauthorized
accesses is available in MC68S711E9. Refer to Chapter 11 Ordering Information and Mechanical
Specifications for the exact part number.
For further information, these engineering bulletins have been included at the back of this data book:
•EB183 — Enabling the Security Feature on the MC68HC711E9 Devices with PCbug11 on the
M68HC711E9PGMR
•EB188 — Enabling the Security Feature on M68HC811E2 Devices with PCbug11 on the
M68HC711E9PGMR
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor55
Operating Modes and On-Chip Memory
M68HC11E Family Data Sheet, Rev. 5.1
56Freescale Semiconductor
Chapter 3
Analog-to-Digital (A/D) Converter
3.1 Introduction
The analog-to-digital (A/D) system, a successive approximation converter, uses an all-capacitive charge
redistribution technique to convert analog signals to digital values.
3.2 Overview
The A/D system is an 8-channel, 8-bit, multiplexed-input converter. The converter does not require
external sample and hold circuits because of the type of charge redistribution technique used. A/D
converter timing can be synchronized to the system E clock or to an internal resistor capacitor (RC)
oscillator.
The A/D converter system consists of four functional blocks: multiplexer, analog converter, digital control,
and result storage. Refer to Figure 3-1.
3.2.1 Multiplexer
The multiplexer selects one of 16 inputs for conversion. Input selection is controlled by the value of bits
CD:CA in the ADCTL register. The eight port E pins are fixed-direction analog inputs to the multiplexer,
and additional internal analog signal lines are routed to it.
Port E pins also can be used as digital inputs. Digital reads of port E pins are not recommended during
the sample portion of an A/D conversion cycle, when the gate signal to the N-channel input gate is on.
Because no P-channel devices are directly connected to either input pins or reference voltage pins,
voltages above V
maximum ratings. Refer to Figure 3-2, which is a functional diagram of an input pin.
do not cause a latchup problem, although current should be limited according to
DD
3.2.2 Analog Converter
Conversion of an analog input selected by the multiplexer occurs in this block. It contains a
digital-to-analog capacitor (DAC) array, a comparator, and a successive approximation register (SAR).
Each conversion is a sequence of eight comparison operations, beginning with the most significant bit
(MSB). Each comparison determines the value of a bit in the successive approximation register.
The DAC array performs two functions. It acts as a sample and hold circuit during the entire conversion
sequence and provides comparison voltage to the comparator during each successive comparison.
The result of each successive comparison is stored in the SAR. When a conversion sequence is
complete, the contents of the SAR are transferred to the appropriate result register.
A charge pump provides switching voltage to the gates of analog switches in the multiplexer. Charge
pump output must stabilize between 7 and 8 volts within up to 100 µs before the converter can be used.
The charge pump is enabled by the ADPU bit in the OPTION register.
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor57
Analog-to-Digital (A/D) Converter
PE0
AN0
PE1
AN1
PE2
AN2
PE3
AN3
PE4
AN4
PE5
AN5
PE6
AN6
PE7
AN7
ANALOG
MUX
8-BIT CAPACITIVE DAC
WITH SAMPLE AND HOLD
SUCCESSIVE APPROXIMATION
REGISTER AND CONTROL
RESULT
RESULT REGISTER INTERFACE
CCF
SCAN
MULTCDCCCBCA
ADCTL A/D CONTROL
V
RH
V
Rl
INTERNAL
DATA BUS
ADR1 A/D RESULT 1ADR2 A/D RESULT 2ADR3 A/D RESULT 3ADR4 A/D RESULT 4
Figure 3-1. A/D Converter Block Diagram
ANALOG
INPUT
PIN
< 2 pF
INPUT
PROTECTION
DEVICE
+ ~20 V
– ~0.7 V
+ ~12V
– ~0.7V
DUMMY N-CHANNEL
OUTPUT DEVICE
* THIS ANALOG SWITCH IS CLOSED ONLY DURING THE 12-CYCLE SAMPLE TIME.
Figure 3-2. Electrical Model of an A/D Input Pin (Sample Mode)
DIFFUSION/POLY
COUPLER
ð 4 kΩ
400 nA
JUNCTION
LEAKAGE
*
~ 20 pF
DAC
CAPACITANCE
V
RL
M68HC11E Family Data Sheet, Rev. 5.1
58Freescale Semiconductor
Overview
3.2.3 Digital Control
All A/D converter operations are controlled by bits in register ADCTL. In addition to selecting the analog
input to be converted, ADCTL bits indicate conversion status and control whether single or continuous
conversions are performed. Finally, the ADCTL bits determine whether conversions are performed on
single or multiple channels.
3.2.4 Result Registers
Four 8-bit registers ADR[4:1] store conversion results. Each of these registers can be accessed by the
processor in the CPU. The conversion complete flag (CCF) indicates when valid data is present in the
result registers. The result registers are written during a portion of the system clock cycle when reads do
not occur, so there is no conflict.
3.2.5 A/D Converter Clocks
The CSEL bit in the OPTION register selects whether the A/D converter uses the system E clock or an
internal RC oscillator for synchronization. When E-clock frequency is below 750 kHz, charge leakage in
the capacitor array can cause errors, and the internal oscillator should be used. When the RC clock is
used, additional errors can occur because the comparator is sensitive to the additional system clock
noise.
3.2.6 Conversion Sequence
A/D converter operations are performed in sequences of four conversions each. A conversion sequence
can repeat continuously or stop after one iteration. The conversion complete flag (CCF) is set after the
fourth conversion in a sequence to show the availability of data in the result registers. Figure 3-3 shows
the timing of a typical sequence. Synchronization is referenced to the system E clock.
E CLOCK
12 E CYCLES
SAMPLE ANALOG INPUTSUCCESSIVE APPROXIMATION SEQUENCE
WRITE TO ADCTL
CONVERT FIRST
CHANNEL, UPDATE
0326496128 — E CYCLES
ADR1
CONVERT SECOND
CHANNEL, UPDATE
MSB
CYCLES
ADR2
Figure 3-3. A/D Conversion Sequence
BIT 6
BIT 5
BIT 4
BIT 3
BIT 2
BIT 1
LSB
4
2
2
CYC
CYC
CONVERT THIRD
CHANNEL, UPDATE
2
CYC
ADR3
CYC
2
2
2
CYC
CYC
CONVERT FOURTH
CHANNEL, UPDATE
2
CYC
ADR4
CYC
END
2
REPEAT SEQUENCE, SCAN = 1
SET CC FLAG
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor59
Analog-to-Digital (A/D) Converter
3.3 A/D Converter Power-Up and Clock Select
Bit 7 of the OPTION register controls A/D converter power-up. Clearing ADPU removes power from and
disables the A/D converter system. Setting ADPU enables the A/D converter system. Stabilization of the
analog bias voltages requires a delay of as much as 100 µs after turning on the A/D converter. When the
A/D converter system is operating with the MCU E clock, all switching and comparator operations are
inherently synchronized to the main MCU clocks. This allows the comparator output to be sampled at
relatively quiet times during MCU clock cycles. Since the internal RC oscillator is asynchronous to the
MCU clock, there is more error attributable to internal system clock noise. A/D converter accuracy is
reduced slightly while the internal RC oscillator is being used (CSEL = 1).
Address: $1039
Bit 7654321Bit 0
Read:
Write:
Reset:00010000
1. Can be written only once in first 64 cycles out of reset in normal modes or at any time in special modes
ADPUCSELIRQE
= Unimplemented
Figure 3-4. System Configuration Options Register (OPTION)
(1)
DLY
(1)
CMECR1
(1)
CR0
(1)
ADPU — A/D Power-Up Bit
0 = A/D powered down
1 = A/D powered up
CSEL — Clock Select Bit
0 = A/D and EEPROM use system E clock.
1 = A/D and EEPROM use internal RC clock.
IRQE — Configure IRQ
for Edge-Sensitive Only Operation
Refer to Chapter 5 Resets and Interrupts.
DLY — Enable Oscillator Startup Delay Bit
0 = The oscillator startup delay coming out of stop is bypassed and the MCU resumes processing
within about four bus cycles.
1 = A delay of approximately 4000 E-clock cycles is imposed as the MCU is started up from the stop
power-saving mode. This delay allows the crystal oscillator to stabilize.
CME — Clock Monitor Enable Bit
Refer to Chapter 5 Resets and Interrupts.
Bit 2 — Not implemented
Always reads 0
CR[1:0] — COP Timer Rate Select Bits
Refer to Chapter 5 Resets and Interrupts and Chapter 9 Timing Systems.
M68HC11E Family Data Sheet, Rev. 5.1
60Freescale Semiconductor
Conversion Process
3.4 Conversion Process
The A/D conversion sequence begins one E-clock cycle after a write to the A/D control/status register,
ADCTL. The bits in ADCTL select the channel and the mode of conversion.
An input voltage equal to V
converts to $00 and an input voltage equal to VRH converts to $FF (full
RL
scale), with no overflow indication. For ratiometric conversions of this type, the source of each analog
input should use V
as the supply voltage and be referenced to VRL.
RH
3.5 Channel Assignments
The multiplexer allows the A/D converter to select one of 16 analog signals. Eight of these channels
correspond to port E input lines to the MCU, four of the channels are internal reference points or test
functions, and four channels are reserved. Refer to Table 3-1.
Table 3-1. Converter Channel Assignments
Channel
Number
1AN0ADR1
2AN1ADR2
3AN2ADR3
4AN3ADR4
5AN4ADR1
6AN5ADR2
7AN6ADR3
8AN7ADR4
9 – 12Reserved—
13
14
15
16
1. Used for factory testing
Channel
Signal
(1)
V
RH
(1)
V
RL
)/2
(V
RH
Reserved
(1)
(1)
Result in ADRx
if MULT = 1
ADR1
ADR2
ADR3
ADR4
3.6 Single-Channel Operation
The two types of single-channel operation are:
1.When SCAN = 0, the single selected channel is converted four consecutive times. The first result
is stored in A/D result register 1 (ADR1), and the fourth result is stored in ADR4. After the fourth
conversion is complete, all conversion activity is halted until a new conversion command is written
to the ADCTL register.
2.When SCAN = 1, conversions continue to be performed on the selected channel with the fifth
conversion being stored in register ADR1 (overwriting the first conversion result), the sixth
conversion overwriting ADR2, and so on.
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor61
Analog-to-Digital (A/D) Converter
3.7 Multiple-Channel Operation
The two types of multiple-channel operation are:
1.When SCAN = 0, a selected group of four channels is converted one time each. The first result is
stored in A/D result register 1 (ADR1), and the fourth result is stored in ADR4. After the fourth
conversion is complete, all conversion activity is halted until a new conversion command is written
to the ADCTL register.
2.When SCAN = 1, conversions continue to be performed on the selected group of channels with the
fifth conversion being stored in register ADR1 (replacing the earlier conversion result for the first
channel in the group), the sixth conversion overwriting ADR2, and so on.
3.8 Operation in Stop and Wait Modes
If a conversion sequence is in progress when either the stop or wait mode is entered, the conversion of
the current channel is suspended. When the MCU resumes normal operation, that channel is resampled
and the conversion sequence is resumed. As the MCU exits wait mode, the A/D circuits are stable and
valid results can be obtained on the first conversion. However, in stop mode, all analog bias currents are
disabled and it is necessary to allow a stabilization period when leaving stop mode. If stop mode is exited
with a delay (DLY = 1), there is enough time for these circuits to stabilize before the first conversion. If
stop mode is exited with no delay (DLY bit in OPTION register = 0), allow 10 ms for the A/D circuitry to
stabilize to avoid invalid results.
3.9 A/D Control/Status Register
All bits in this register can be read or written, except bit 7, which is a read-only status indicator, and bit 6,
which always reads as 0. Write to ADCTL to initiate a conversion. To quit a conversion in progress, write
to this register and a new conversion sequence begins immediately.
Address: $1030
Bit 7654321Bit 0
Read:CCF
Write:
Reset:00Indeterminate after reset
= Unimplemented
Figure 3-5. A/D Control/Status Register (ADCTL)
CCF — Conversion Complete Flag
A read-only status indicator, this bit is set when all four A/D result registers contain valid conversion
results. Each time the ADCTL register is overwritten, this bit is automatically cleared to 0 and a
conversion sequence is started. In the continuous mode, CCF is set at the end of the first conversion
sequence.
Bit 6 — Unimplemented
Always reads 0
SCANMULTCDCCCBCA
SCAN — Continuous Scan Control Bit
M68HC11E Family Data Sheet, Rev. 5.1
62Freescale Semiconductor
A/D Control/Status Register
When this control bit is clear, the four requested conversions are performed once to fill the four result
registers. When this control bit is set, conversions are performed continuously with the result registers
updated as data becomes available.
MULT — Multiple Channel/Single Channel Control Bit
When this bit is clear, the A/D converter system is configured to perform four consecutive conversions
on the single channel specified by the four channel select bits CD:CA (bits [3:0] of the ADCTL register).
When this bit is set, the A/D system is configured to perform a conversion on each of four channels
where each result register corresponds to one channel.
NOTE
When the multiple-channel continuous scan mode is used, extra care is
needed in the design of circuitry driving the A/D inputs. The charge on the
capacitive DAC array before the sample time is related to the voltage on the
previously converted channel. A charge share situation exists between the
internal DAC capacitance and the external circuit capacitance. Although
the amount of charge involved is small, the rate at which it is repeated is
every 64 µs for an E clock of 2 MHz. The RC charging rate of the external
circuit must be balanced against this charge sharing effect to avoid errors
in accuracy. Refer to M68HC11 Reference Manual, Freescale document
order number M68HC11RM/AD, for further information.
CD:CA — Channel Selects D:A Bits
Refer to Table 3-2. When a multiple channel mode is selected (MULT = 1), the two least significant
channel select bits (CB and CA) have no meaning and the CD and CC bits specify which group of four
channels is to be converted.
Table 3-2. A/D Converter Channel Selection
Channel Select
Control Bits
CD:CC:CB:CA
0000AN0ADR1
0001AN1ADR2
0010AN2ADR3
0011AN3ADR4
0100AN4ADR1
0101AN5ADR2
0110AN6ADR3
0111AN7ADR4
10XXReserved—
1100
1101
1110
1111
1. Used for factory testing
Channel Signal
(1)
V
RH
(1)
V
RL
RH
)/2
(1)
(1)
(V
Reserved
Result in ADRx
if MULT = 1
ADR1
ADR2
ADR3
ADR4
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor63
Analog-to-Digital (A/D) Converter
3.10 A/D Converter Result Registers
These read-only registers hold an 8-bit conversion result. Writes to these registers have no effect. Data
in the A/D converter result registers is valid when the CCF flag in the ADCTL register is set, indicating a
conversion sequence is complete. If conversion results are needed sooner, refer to Figure 3-3, which
shows the A/D conversion sequence diagram.
Register name: Analog-to-Digital Converter Result Register 1Address: $1031
Bit 7654321Bit 0
Read:Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:
Reset:Indeterminate after reset
Register name: Analog-to-Digital Converter Result Register 2Address: $1032
Bit 7654321Bit 0
Read:Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:
Reset:Indeterminate after reset
Register name: Analog-to-Digital Converter Result Register 3Address: $1033
Bit 7654321Bit 0
Read:Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:
Reset:Indeterminate after reset
Register name: Analog-to-Digital Converter Result Register 4Address: $1034
Bit 7654321Bit 0
Read:Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:
Reset:Indeterminate after reset
= Unimplemented
Figure 3-6. Analog-to-Digital Converter
Result Registers (ADR1–ADR4)
M68HC11E Family Data Sheet, Rev. 5.1
64Freescale Semiconductor
Chapter 4
Central Processor Unit (CPU)
4.1 Introduction
Features of the M68HC11 Family include:
•Central processor unit (CPU) architecture
•Data types
•Addressing modes
•Instruction set
•Special operations such as subroutine calls and interrupts
The CPU is designed to treat all peripheral, input/output (I/O), and memory locations identically as
addresses in the 64-Kbyte memory map. This is referred to as memory-mapped I/O. There are no special
instructions for I/O that are separate from those used for memory. This architecture also allows accessing
an operand from an external memory location with no execution time penalty.
4.2 CPU Registers
M68HC11 CPU registers are an integral part of the CPU and are not addressed as if they were memory
locations. The seven registers, discussed in the following paragraphs, are shown in Figure 4-1.
7070
150
AB
D
IX
IY
SP
PC
70
8-BIT ACCUMULATORS A & B
OR 16-BIT DOUBLE ACCUMULATOR D
INDEX REGISTER X
INDEX REGISTER Y
STACK POINTER
PROGRAM COUNTER
CVZNIHXS
CONDITION CODES
CARRY/BORROW FROM MSB
OVERFLOW
ZERO
NEGATIVE
I-INTERRUPT MASK
HALF CARRY (FROM BIT 3)
X-INTERRUPT MASK
STOP DISABLE
Figure 4-1. Programming Model
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor65
Central Processor Unit (CPU)
CPU Registers
At the end of the interrupt service routine, an return-from interrupt (RTI) instruction is executed. The RTI
instruction causes the saved registers to be pulled off the stack in reverse order. Program execution
resumes at the return address.
Certain instructions push and pull the A and B accumulators and the X and Y index registers and are often
used to preserve program context. For example, pushing accumulator A onto the stack when entering a
subroutine that uses accumulator A and then pulling accumulator A off the stack just before leaving the
subroutine ensures that the contents of a register will be the same after returning from the subroutine as
it was before starting the subroutine.
JSR, JUMP TO SUBROUTINE
MAIN PROGRAM
PC
$9D = JSR
DIRECT
RTN
dd
NEXT MAIN INSTR.
MAIN PROGRAM
PC
$AD = JSR
INDEXED, X
RTN
ff
NEXT MAIN INSTR.
MAIN PROGRAM
PC
$18 = PRE
INDEXED, Y
RTN
$AD = JSR
ff
NEXT MAIN INSTR.
MAIN PROGRAM
PC
$BD = PRE
INDEXED, Y
RTN
hh
ll
NEXT MAIN INSTR.
BSR, BRANCH TO SUBROUTINE
MAIN PROGRAM
PC
$8D = BSR
RTS, RETURN FROM
SUBROUTINE
MAIN PROGRAM
PC
$39 = RTS
STACK
70
È SP–2
SP–1
SP
STACK
70
È SP–2
SP–1
SP
SP
SP+1
È SP+2
RTN
H
RTN
L
STACK
70
RTN
H
RTN
L
RTN
RTN
RTI, RETURN FROM INTERRUPT
STACK
INTERRUPT ROUTINE
PC
$3B = RTI
H
L
70
SP
SP+1
SP+2
SP+3
SP+4
SP+5
SP+6
SP+7
SP+8
È SP+9
CCR
ACCB
ACCA
IX
IX
IY
IY
RTN
RTN
H
L
H
L
H
L
SWI, SOFTWARE INTERRUPT
STACK
MAIN PROGRAM
PC
$3F = SWI
WAI, WAIT FOR INTERRUPT
MAIN PROGRAM
PC
$3E = WAI
70
È SP–9
SP–8
SP–7
SP–6
SP–5
SP–4
SP–3
SP–2
SP–1
SP
CCR
ACCB
ACCA
IX
IX
IY
IY
RTN
RTN
H
L
H
L
H
L
LEGEND:
RTN = ADDRESS OF NEXT INSTRUCTION IN MAIN PROGRAM TO
BE EXECUTED UPON RETURN FROM SUBROUTINE
= MOST SIGNIFICANT BYTE OF RETURN ADDRESS
RTN
H
= LEAST SIGNIFICANT BYTE OF RETURN ADDRESS
RTN
L
È = STACK POINTER POSITION AFTER OPERATION IS COMPLETE
dd = 8-BIT DIRECT ADDRESS ($0000–$00FF) (HIGH BYTE ASSUMED
TO BE $00)
ff = 8-BIT POSITIVE OFFSET $00 (0) TO $FF (255) IS ADDED TO INDEX
hh = HIGH-ORDER BYTE OF 16-BIT EXTENDED ADDRESS
ll = LOW-ORDER BYTE OF 16-BIT EXTENDED ADDRESS
rr= SIGNED RELATIVE OFFSET $80 (–128) TO $7F (+127) (OFFSET
RELATIVE TO THE ADDRESS FOLLOWING THE MACHINE CODE
OFFSET BYTE)
Figure 4-2. Stacking Operations
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor67
Central Processor Unit (CPU)
4.2.5 Program Counter (PC)
The program counter, a 16-bit register, contains the address of the next instruction to be executed. After
reset, the program counter is initialized from one of six possible vectors, depending on operating mode
and the cause of reset. See Table 4-1.
Table 4-1. Reset Vector Comparison
ModePOR or RESET PinClock MonitorCOP Watchdog
Normal$FFFE, F$FFFC, D$FFFA, B
Test or Boot$BFFE, F$BFFC, D$BFFA, B
4.2.6 Condition Code Register (CCR)
This 8-bit register contains:
•Five condition code indicators (C, V, Z, N, and H),
•Two interrupt masking bits (IRQ
•A stop disable bit (S)
In the M68HC11 CPU, condition codes are updated automatically by most instructions. For example, load
accumulator A (LDAA) and store accumulator A (STAA) instructions automatically set or clear the N, Z,
and V condition code flags. Pushes, pulls, add B to X (ABX), add B to Y (ABY), and transfer/exchange
instructions do not affect the condition codes. Refer to Table 4-2, which shows what condition codes are
affected by a particular instruction.
and XIRQ)
4.2.6.1 Carry/Borrow (C)
The C bit is set if the arithmetic logic unit (ALU) performs a carry or borrow during an arithmetic operation.
The C bit also acts as an error flag for multiply and divide operations. Shift and rotate instructions operate
with and through the carry bit to facilitate multiple-word shift operations.
4.2.6.2 Overflow (V)
The overflow bit is set if an operation causes an arithmetic overflow. Otherwise, the V bit is cleared.
4.2.6.3 Zero (Z)
The Z bit is set if the result of an arithmetic, logic, or data manipulation operation is 0. Otherwise, the Z
bit is cleared. Compare instructions do an internal implied subtraction and the condition codes, including
Z, reflect the results of that subtraction. A few operations (INX, DEX, INY, and DEY) affect the Z bit and
no other condition flags. For these operations, only = and ≠ conditions can be determined.
4.2.6.4 Negative (N)
The N bit is set if the result of an arithmetic, logic, or data manipulation operation is negative (MSB = 1).
Otherwise, the N bit is cleared. A result is said to be negative if its most significant bit (MSB) is a 1. A quick
way to test whether the contents of a memory location has the MSB set is to load it into an accumulator
and then check the status of the N bit.
M68HC11E Family Data Sheet, Rev. 5.1
68Freescale Semiconductor
Data Types
4.2.6.5 Interrupt Mask (I)
The interrupt request (IRQ) mask (I bit) is a global mask that disables all maskable interrupt sources.
While the I bit is set, interrupts can become pending, but the operation of the CPU continues uninterrupted
until the I bit is cleared. After any reset, the I bit is set by default and can only be cleared by a software
instruction. When an interrupt is recognized, the I bit is set after the registers are stacked, but before the
interrupt vector is fetched. After the interrupt has been serviced, a return-from-interrupt instruction is
normally executed, restoring the registers to the values that were present before the interrupt occurred.
Normally, the I bit is 0 after a return from interrupt is executed. Although the I bit can be cleared within an
interrupt service routine, "nesting" interrupts in this way should only be done when there is a clear
understanding of latency and of the arbitration mechanism. Refer to Chapter 5 Resets and Interrupts.
4.2.6.6 Half Carry (H)
The H bit is set when a carry occurs between bits 3 and 4 of the arithmetic logic unit during an ADD, ABA,
or ADC instruction. Otherwise, the H bit is cleared. Half carry is used during BCD operations.
4.2.6.7 X Interrupt Mask (X)
The XIRQ mask (X) bit disables interrupts from the XIRQ
be cleared by a software instruction. When an XIRQ
pin. After any reset, X is set by default and must
interrupt is recognized, the X and I bits are set after
the registers are stacked, but before the interrupt vector is fetched. After the interrupt has been serviced,
an RTI instruction is normally executed, causing the registers to be restored to the values that were
present before the interrupt occurred. The X interrupt mask bit is set only by hardware (RESET
or XIRQ
acknowledge). X is cleared only by program instruction (TAP, where the associated bit of A is 0; or RTI,
where bit 6 of the value loaded into the CCR from the stack has been cleared). There is no hardware
action for clearing X.
4.2.6.8 STOP Disable (S)
Setting the STOP disable (S) bit prevents the STOP instruction from putting the M68HC11 into a
low-power stop condition. If the STOP instruction is encountered by the CPU while the S bit is set, it is
treated as a no-operation (NOP) instruction, and processing continues to the next instruction. S is set by
reset; STOP is disabled by default.
4.3 Data Types
The M68HC11 CPU supports four data types:
1.Bit data
2.8-bit and 16-bit signed and unsigned integers
3.16-bit unsigned fractions
4.16-bit addresses
A byte is eight bits wide and can be accessed at any byte location. A word is composed of two consecutive
bytes with the most significant byte at the lower value address. Because the M68HC11 is an 8-bit CPU,
there are no special requirements for alignment of instructions or operands.
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor69
Central Processor Unit (CPU)
4.4 Opcodes and Operands
The M68HC11 Family of microcontrollers uses 8-bit opcodes. Each opcode identifies a particular
instruction and associated addressing mode to the CPU. Several opcodes are required to provide each
instruction with a range of addressing capabilities. Only 256 opcodes would be available if the range of
values were restricted to the number able to be expressed in 8-bit binary numbers.
A 4-page opcode map has been implemented to expand the number of instructions. An additional byte,
called a prebyte, directs the processor from page 0 of the opcode map to one of the other three pages.
As its name implies, the additional byte precedes the opcode.
A complete instruction consists of a prebyte, if any, an opcode, and zero, one, two, or three operands.
The operands contain information the CPU needs for executing the instruction. Complete instructions can
be from one to five bytes long.
4.5 Addressing Modes
Six addressing modes can be used to access memory:
•Immediate
•Direct
•Extended
•Indexed
•Inherent
•Relative
These modes are detailed in the following paragraphs. All modes except inherent mode use an effective
address. The effective address is the memory address from which the argument is fetched or stored or
the address from which execution is to proceed. The effective address can be specified within an
instruction, or it can be calculated.
4.5.1 Immediate
In the immediate addressing mode, an argument is contained in the byte(s) immediately following the
opcode. The number of bytes following the opcode matches the size of the register or memory location
being operated on. There are 2-, 3-, and 4- (if prebyte is required) byte immediate instructions. The
effective address is the address of the byte following the instruction.
4.5.2 Direct
In the direct addressing mode, the low-order byte of the operand address is contained in a single byte
following the opcode, and the high-order byte of the address is assumed to be $00. Addresses $00–$FF
are thus accessed directly, using 2-byte instructions. Execution time is reduced by eliminating the
additional memory access required for the high-order address byte. In most applications, this
256-byte area is reserved for frequently referenced data. In M68HC11 MCUs, the memory map can be
configured for combinations of internal registers, RAM, or external memory to occupy these addresses.
M68HC11E Family Data Sheet, Rev. 5.1
70Freescale Semiconductor
Instruction Set
4.5.3 Extended
In the extended addressing mode, the effective address of the argument is contained in two bytes
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor71
Central Processor Unit (CPU)
Table 4-2. Instruction Set (Sheet 1 of 7)
MnemonicOperationDescription
ABAAdd
Accumulators
A + B ⇒ AINH1B—2——∆—∆∆∆∆
ABXAdd B to XIX + (00 : B) ⇒ IXINH3A—3 ————————
ABYAdd B to YIY + (00 : B) ⇒ IYINH18 3A—4 ————————
ADCA (opr)Add with Carry
A + M + C ⇒ AA IMM
to A
ADCB (opr)Add with Carry
ADDA (opr) Add Memory to
to B
A
ADDB (opr) Add Memory to
B + M + C ⇒ BB IMM
A + M ⇒ AAIMM
B + M ⇒ BBIMM
B
ADDD (opr) Add 16-Bit to D D + (M : M + 1) ⇒ DIMM
ANDA (opr) AND A with
Memory
ANDB (opr) AND B with
A • M ⇒ AA IMM
B • M ⇒ BBIMM
Memory
ASL (opr)Arithmetic Shift
Left
b7b0
C
ASLAArithmetic Shift
Left A
ASLBArithmetic Shift
ASLDArithmetic Shift
ASR Arithmetic Shift
Left B
Left D
Right
C
C
b7b0ABb7
C
b7b0
b7b0
b0
b0
b7
ASRAArithmetic Shift
Right A
ASRBArithmetic Shift
BCC (rel)Branch if Carry
BCLR (opr)
Right B
Clear
Clear Bit(s) M • (mm
b7b0
b7b0
? C = 0REL24rr3 ————————
) ⇒ MDIR
(msk)
BCS (rel)Branch if Carry
? C = 1REL25rr3 ————————
Set
BEQ (rel)Branch if = Zero? Z = 1REL27rr3————————
BGE (rel)Branch if ∆ Zero? N ⊕ V = 0REL2Crr3 ————————
AddressingInstructionCondition Codes
Mode OpcodeOperand CyclesSXHINZVC
89
ADIR
AEXT
AIND,X
AIND,Y
BDIR
BEXT
BIND,X
BIND,Y
ADIR
AEXT
AIND,X
AIND,Y
BDIR
BEXT
BIND,X
BIND,Y
DIR
EXT
IND,X
IND,Y
A DIR
A EXT
AIND,X
AIND,Y
BDIR
BEXT
BIND,X
BIND,Y
EXT
0
IND,X
IND,Y
99
B9
A9
18A9
C9
D9
F9
E9
18E9
8B
9B
BB
AB
18AB
CB
DB
FB
EB
18EB
C3
D3
F3
E3
18 E3
84
94
B4
A4
18 A4
C4
D4
F4
E4
18E4
78
68
1868
dd
hh ll
ff
ff
ii
dd
hh ll
ff
ff
ii
dd
hh ll
ff
ff
ii
dd
hh ll
ff
ff
jj kk
dd
hh ll
ff
ff
ii
dd
hh ll
ff
ff
ii
dd
hh ll
ff
ff
hh ll
ff
ff
A INH48—2 ————
0
ii
2
—— ∆—∆∆∆∆
3
4
4
5
2
—— ∆—∆∆∆∆
3
4
4
5
2
—— ∆—∆∆∆∆
3
4
4
5
2
—— ∆—∆∆∆∆
3
4
4
5
4
———— ∆∆∆∆
5
6
6
7
2
———— ∆∆0—
3
4
4
5
2
———— ∆∆0—
3
4
4
5
6
———— ∆∆∆∆
6
7
∆∆∆∆
B INH58—2 ———— ∆∆∆∆
0
INH05—3————∆∆∆∆
0
EXT
IND,X
C
IND,Y
1867
77
hh ll
67
ff
ff
6
———— ∆∆∆∆
6
7
A INH47—2 ———— ∆∆∆∆
C
B INH57—2 ———— ∆∆∆∆
C
15
IND,X
IND,Y
1D
181D
dd mm
ff mm
ff mm
6
———— ∆∆0—
7
8
M68HC11E Family Data Sheet, Rev. 5.1
72Freescale Semiconductor
Instruction Set
Table 4-2. Instruction Set (Sheet 2 of 7)
MnemonicOperationDescription
BGT (rel)Branch if > Zero? Z + (N ⊕ V) = 0REL2Err3 ————————
BHI (rel)Branch if
BHS (rel)Branch if
BITA (opr) Bit(s) Test A
BITB (opr)Bit(s) Test B
BLE (rel)Branch if ∆ Zero? Z + (N ⊕ V) = 1REL2Frr3 ————————
BLO (rel)Branch if Lower? C = 1REL25rr3 ————————
BLS (rel)Branch if Lower
BLT (rel)Branch if < Zero? N ⊕ V = 1REL2Drr3 ————————
BMI (rel)Branch if Minus? N = 1REL2Brr3 ————————
BNE (rel)Branch if not =
BPL (rel)Branch if Plus? N = 0REL2Arr3 ————————
BRA (rel)Branch Always? 1 = 1REL20rr3 ————————
BRCLR(opr)
(msk)
(rel)
BRN (rel)Branch Never? 1 = 0REL21rr3 ————————
BRSET(opr)
(msk)
(rel)
BSET (opr)
(msk)
BSR (rel)Branch to
BVC (rel)Branch if
BVS (rel)Branch if
CBACompare A to BA – BINH11—2————∆∆∆∆
CLCClear Carry Bit0 ⇒ CINH0C—2 ——————— 0
CLIClear Interrupt
CLR (opr)Clear Memory
CLRAClear
CLRBClear
CLVClear Overflow
CMPA (opr)Compare A to
Higher
Higher or Same
with Memory
with Memory
or Same
Zero
Branch if
Bit(s) Clear
Branch if Bit(s)
Set
Set Bit(s)M + mm ⇒ MDIR
Subroutine
Overflow Clear
Overflow Set
Mask
Byte
Accumulator A
Accumulator B
Flag
Memory
? C + Z = 0REL22rr3 ————————
? C = 0REL24rr3 ————————
A • MAIMM
B • MBIMM
? C + Z = 1REL23rr3 ————————
? Z = 0REL26rr3 ————————
? M • mm = 0DIR
) • mm = 0DIR
? (M
See Figure 3–2REL8Drr6 ————————
? V = 0REL28rr3 ————————
? V = 1REL29rr3 ————————
0 ⇒ IINH0E—2 ——— 0 ————
0 ⇒ MEXT
0 ⇒ AAINH4F—2————0100
0 ⇒ BBINH5F—2————0100
0 ⇒ VINH0A—2 —————— 0 —
A – MAIMM
AddressingInstructionCondition Codes
Mode OpcodeOperand CyclesSXHINZVC
85
ADIR
AEXT
AIND,X
AIND,Y
BDIR
BEXT
BIND,X
BIND,Y
IND,X
IND,Y
IND,X
IND,Y
IND,X
IND,Y
IND,X
IND,Y
ADIR
AEXT
AIND,X
AIND,Y
95
B5
A5
18A5
C5
D5
F5
E5
18E5
13
1F
181F
12
1E
181E
14
1C
181C
7F
6F
186F
81
91
B1
A1
18A1
ii
dd
hh ll
ff
ff
ii
dd
hh ll
ff
ff
dd mm
rr
ff mm
rr
ff mm
rr
dd mm
rr
ff mm
rr
ff mm
rr
dd mm
ff mm
ff mm
hh ll
ff
ff
ii
dd
hh ll
ff
ff
2
———— ∆∆0—
3
4
4
5
2
———— ∆∆0—
3
4
4
5
6
————————
7
8
6
————————
7
8
6
———— ∆∆0—
7
8
6
———— 0 1 0 0
6
7
2
———— ∆∆∆∆
3
4
4
5
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor73
Central Processor Unit (CPU)
Table 4-2. Instruction Set (Sheet 3 of 7)
MnemonicOperationDescription
CMPB (opr)Compare B to
COM (opr)Ones
COMAOnes
COMBOnes
CPD (opr)Compare D to
CPX (opr)Compare X to
CPY (opr)Compare Y to
DAADecimal Adjust AAdjust Sum to BCDINH19—2————∆∆∆∆
Memory
Complement
Memory Byte
Complement
A
Complement
B
Memory 16-Bit
Memory 16-Bit
Memory 16-Bit
B – MBIMM
$FF – M ⇒ MEXT
$FF – A ⇒ AA INH43 —2————∆∆01
$FF – B ⇒ BB INH53 —2————∆∆01
D – M : M + 1IMM
IX – M : M + 1IMM
IY – M : M + 1IMM
AddressingInstructionCondition Codes
Mode OpcodeOperand CyclesSXHINZVC
BDIR
BEXT
BIND,X
BIND,Y
IND,X
IND,Y
DIR
EXT
IND,X
IND,Y
DIR
EXT
IND,X
IND,Y
DIR
EXT
IND,X
IND,Y
C1
D1
F1
E1
18E1
73
63
1863
1A83
1A93
1AB3
1AA3
CDA3
8C
9C
BC
AC
CDAC
188C
189C
18BC
1AAC
18AC
ii
dd
hh ll
ff
ff
hh ll
ff
ff
jj kk
dd
hh ll
ff
ff
jj kk
dd
hh ll
ff
ff
jj kk
dd
hh ll
ff
ff
2
———— ∆∆∆∆
3
4
4
5
6
———— ∆∆01
6
7
5
———— ∆∆∆∆
6
7
7
7
4
———— ∆∆∆∆
5
6
6
7
5
———— ∆∆∆∆
6
7
7
7
DEC (opr)Decrement
DECADecrement
DECBDecrement
DESDecrement
DEXDecrement
DEYDecrement
EORA (opr) Exclusive OR A
EORB (opr)Exclusive OR B
FDIVFractional
IDIVInteger Divide
INC (opr)Increment
INCAIncrement
Memory Byte
Accumulator
A
Accumulator
B
Stack Pointer
Index Register
X
Index Register
Y
with Memory
with Memory
Divide 16 by 16
16 by 16
Memory Byte
Accumulator
A
M – 1 ⇒ MEXT
A – 1 ⇒ AAINH4A — 2————∆∆∆—
B – 1 ⇒ BBINH5A — 2————∆∆∆—
SP – 1 ⇒ SPINH34—3 ————————
IX – 1 ⇒ IXINH09—3—————∆——
IY – 1 ⇒ IYINH1809—4—————∆——
A ⊕ M ⇒ AAIMM
B ⊕ M ⇒ BBIMM
D / IX ⇒ IX; r ⇒ DINH03—41 ————— ∆∆∆
D / IX ⇒ IX; r ⇒ DINH02—41 ————— ∆0∆
M + 1 ⇒ MEXT
A + 1 ⇒ AAINH4C—2————∆∆∆—
IND,X
IND,Y
ADIR
AEXT
AIND,X
AIND,Y
BDIR
BEXT
BIND,X
BIND,Y
IND,X
IND,Y
7A
6A
186A
88
98
B8
A8
18A8
C8
D8
F8
E8
18E8
7C
6C
186C
hh ll
ff
ff
ii
dd
hh ll
ff
ff
ii
dd
hh ll
ff
ff
hh ll
ff
ff
6
———— ∆∆∆—
6
7
2
————
3
4
4
5
2
———— ∆∆0—
3
4
4
5
6
———— ∆∆∆—
6
7
∆∆0—
M68HC11E Family Data Sheet, Rev. 5.1
74Freescale Semiconductor
Table 4-2. Instruction Set (Sheet 4 of 7)
MnemonicOperationDescription
INCBIncrement
INSIncrement
Accumulator
B
Stack Pointer
INXIncrement
Index Register
X
INYIncrement
Index Register
Y
B + 1 ⇒ BBINH5C—2————∆∆∆—
SP + 1 ⇒ SPINH31—3 ————————
IX + 1 ⇒ IXINH08—3 ————— ∆——
IY + 1 ⇒ IYINH18 08—4 ————— ∆——
JMP (opr)JumpSee Figure 3–2EXT
JSR (opr)Jump to
See Figure 3–2DIR
Subroutine
LDAA (opr)Load
Accumulator
A
LDAB (opr)Load
Accumulator
B
LDD (opr)Load Double
Accumulator
M ⇒ AAIMM
M ⇒ BBIMM
M ⇒ A,M + 1 ⇒ BIMM
D
LDS (opr)Load Stack
Pointer
LDX (opr)Load Index
Register
X
LDY (opr)Load Index
Register
M : M + 1 ⇒ SPIMM
M : M + 1 ⇒ IXIMM
M : M + 1 ⇒ IYIMM
Y
LSL (opr)Logical Shift
Left
b7b0
C
LSLA Logical Shift
Left A
b7b0
LSLBLogical Shift
LSLDLogical Shift
Left B
Left Double
C
b7b0
C
b0
b7b0
ABb7
C
LSR (opr)Logical Shift
Right
LSRALogical Shift
LSRBLogical Shift
Right A
Right B
0
b7b0
0
b7b0
0
b7b0
AddressingInstructionCondition Codes
Mode OpcodeOperand CyclesSXHINZVC
IND,X
IND,Y
EXT
IND,X
IND,Y
A DIR
A EXT
A IND,X
A IND,Y
B DIR
B EXT
B IND,X
B IND,Y
DIR
EXT
IND,X
IND,Y
DIR
EXT
IND,X
IND,Y
DIR
EXT
IND,X
IND,Y
DIR
EXT
IND,X
IND,Y
EXT
0
IND,X
IND,Y
A INH48—2 ———— ∆∆∆∆
0
B INH58—2 ———— ∆∆∆∆
0
INH05—3————∆∆∆∆
0
EXT
IND,X
C
IND,Y
A INH44—2 ———— 0 ∆∆∆
C
B INH54—2 ———— 0 ∆∆∆
C
7E
6E
186E
9D
BD
AD
18 AD
86
96
B6
A6
18A6
C6
D6
F6
E6
18E6
CC
DC
FC
EC
18EC
8E
9E
BE
AE
18AE
CE
DE
FE
EE
CDEE
18CE
18DE
18FE
1AEE
18EE
78
68
1868
74
64
1864
hh ll
ff
ff
dd
hh ll
ff
ff
ii
dd
hh ll
ff
ff
ii
dd
hh ll
ff
ff
jj kk
dd
hh ll
ff
ff
jj kk
dd
hh ll
ff
ff
jj kk
dd
hh ll
ff
ff
jj kk
dd
hh ll
ff
ff
hh ll
ff
ff
hh ll
ff
ff
Instruction Set
3
————————
3
4
5
————————
6
6
7
2
———— ∆∆0—
3
4
4
5
———— ∆∆0—
2
3
4
4
5
3
———— ∆∆0—
4
5
5
6
3
———— ∆∆0—
4
5
5
6
3
———— ∆∆0—
4
5
5
6
———— ∆∆0—
4
5
6
6
6
6
———— ∆∆∆∆
6
7
6
———— 0 ∆∆∆
6
7
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor75
Central Processor Unit (CPU)
Table 4-2. Instruction Set (Sheet 5 of 7)
MnemonicOperationDescription
LSRDLogical Shift
Right Double
0
b7b0ABb7
b0
MULMultiply 8 by 8A ∗ B ⇒ DINH3D—10 ——————— ∆
NEG (opr)Two’s
NEGATwo’s
NEGBTwo’s
Complement
Memory Byte
Complement
A
Complement
B
0 – M ⇒ MEXT
0 – A ⇒ AAINH40 — 2————∆∆∆∆
0 – B ⇒ BBINH50 — 2————∆∆∆∆
NOPNo operationNo OperationINH01—2————————
ORAA (opr)OR
Accumulator
A + M ⇒ AAIMM
A (Inclusive)
ORAB (opr)OR
Accumulator
B (Inclusive)
PSHAPush A onto
B + M ⇒ BBIMM
A ⇒ Stk,SP = SP – 1 AINH36—3————————
Stack
PSHBPush B onto
B ⇒ Stk,SP = SP – 1 BINH37—3————————
Stack
PSHXPush X onto
Stack (Lo
IX ⇒ Stk,SP = SP – 2 INH3C—4 ————————
First)
PSHYPush Y onto
Stack (Lo
IY ⇒ Stk,SP = SP – 2 INH18 3C—5 ————————
First)
PULAPull A from
PULBPull B from
Stack
Stack
PULXPull X From
Stack (Hi
First)
PULYPull Y from
Stack (Hi
First)
SP = SP + 1, A ⇐ StkA INH32—4 ————————
SP = SP + 1, B ⇐ StkB INH33—4 ————————
SP = SP + 2, IX ⇐ StkINH38—5 ————————
SP = SP + 2, IY ⇐ StkINH18 38—6 ————————
ROL (opr)Rotate Left EXT
b7b0
C
ROLARotate Left AAINH49—2————∆∆∆∆
b7b0
C
ROLBRotate Left BBINH59—2————∆∆∆∆
b7b0
C
ROR (opr)Rotate Right EXT
b7b0
C
RORARotate Right AAINH46—2————∆∆∆∆
b7b0
C
RORBRotate Right BBINH56—2————∆∆∆∆
RTIReturn from
RTSReturn from
Interrupt
Subroutine
SBASubtract B from
b7b0
See Figure 3–2INH3B—12∆↓∆∆∆∆∆∆
See Figure 3–2INH39—5————————
A – B ⇒ AINH10—2 ———— ∆∆∆∆
C
A
AddressingInstructionCondition Codes
Mode OpcodeOperand CyclesSXHINZVC
INH04—3————0∆∆∆
C
70
IND,X
IND,Y
ADIR
AEXT
AIND,X
AIND,Y
BDIR
BEXT
BIND,X
BIND,Y
IND,X
IND,Y
IND,X
IND,Y
60
1860
8A
9A
BA
AA
18AA
CA
DA
FA
EA
18EA
79
69
1869
76
66
1866
hh ll
ff
ff
ii
dd
hh ll
ff
ff
ii
dd
hh ll
ff
ff
hh ll
ff
ff
hh ll
ff
ff
6
———— ∆∆∆∆
6
7
2
———— ∆∆0—
3
4
4
5
2
———— ∆∆0—
3
4
4
5
6
———— ∆∆∆∆
6
7
6
———— ∆∆∆∆
6
7
M68HC11E Family Data Sheet, Rev. 5.1
76Freescale Semiconductor
Instruction Set
Table 4-2. Instruction Set (Sheet 6 of 7)
MnemonicOperationDescription
SBCA (opr)Subtract with
SBCB (opr)Subtract with
SECSet Carry1 ⇒ CINH0D—2 ——————— 1
SEISet Interrupt
SEVSet Overflow
STAA (opr)Store
STAB (opr)Store
STD (opr)Store
STOPStop Internal
STS (opr)Store Stack
STX (opr)Store Index
STY (opr)Store Index
SUBA (opr)Subtract
SUBB (opr)Subtract
SUBD (opr)Subtract
SWISoftware
TABTransfer A to BA ⇒ BINH16—2 ———— ∆∆0—
TAPTransfer A to
TBATransfer B to AB ⇒ AINH17—2 ———— ∆∆0—
TESTTEST (Only in
TPATransfer CC
TST (opr)Test for Zero or
Carry from A
Carry from B
Mask
Flag
Accumulator
A
Accumulator
B
Accumulator
D
Clocks
Pointer
Register X
Register Y
Memory from
A
Memory from
B
Memory from
D
Interrupt
CC Register
Test Modes)
Register to A
Minus
A – M – C ⇒ AA IMM
B – M – C ⇒ BB IMM
1 ⇒ IINH0F—2 ——— 1 ————
1 ⇒ VINH0B—2 —————— 1 —
A ⇒ MADIR
B ⇒ MBDIR
A ⇒ M, B ⇒ M + 1DIR
—INHCF—2 ————————
SP ⇒ M : M + 1DIR
IX ⇒ M : M + 1DIR
IY ⇒ M : M + 1DIR
A – M ⇒ AAIMM
B – M ⇒ BAIMM
D – M : M + 1 ⇒ DIMM
See Figure 3–2INH3F—14———1————
A ⇒ CCR INH06—2∆↓∆∆∆∆∆∆
Address Bus CountsINH00—*————————
CCR ⇒ AINH07—2 ————————
M – 0 EXT
AddressingInstructionCondition Codes
Mode OpcodeOperand CyclesSXHINZVC
ADIR
AEXT
AIND,X
AIND,Y
BDIR
BEXT
BIND,X
BIND,Y
AEXT
AIND,X
AIND,Y
BEXT
BIND,X
BIND,Y
EXT
IND,X
IND,Y
EXT
IND,X
IND,Y
EXT
IND,X
IND,Y
EXT
IND,X
IND,Y
ADIR
AEXT
AIND,X
AIND,Y
ADIR
AEXT
AIND,X
AIND,Y
DIR
EXT
IND,X
IND,Y
IND,X
IND,Y
82
92
B2
A2
18A2
C2
D2
F2
E2
18E2
97
B7
A7
18 A7
D7
F7
E7
18 E7
DD
FD
ED
18 ED
9F
BF
AF
18 AF
DF
FF
EF
CD EF
18DF
18FF
1AEF
18EF
80
90
B0
A0
18A0
C0
D0
F0
E0
18E0
83
93
B3
A3
18A3
7D
6D
186D
ii
dd
hh ll
ff
ff
ii
dd
hh ll
ff
ff
dd
hh ll
ff
ff
dd
hh ll
ff
ff
dd
hh ll
ff
ff
dd
hh ll
ff
ff
dd
hh ll
ff
ff
dd
hh ll
ff
ff
ii
dd
hh ll
ff
ff
ii
dd
hh ll
ff
ff
jj kk
dd
hh ll
ff
ff
hh ll
ff
ff
2
———— ∆∆∆∆
3
4
4
5
2
———— ∆∆∆∆
3
4
4
5
3
———— ∆∆0—
4
4
5
3
———— ∆∆
4
4
5
4
———— ∆∆0—
5
5
6
4
———— ∆∆0—
5
5
6
4
———— ∆∆0—
5
5
6
5
———— ∆∆0—
6
6
6
2
———— ∆∆∆∆
3
4
4
5
2
———— ∆∆∆∆
3
4
4
5
4
———— ∆∆∆∆
5
6
6
7
6
————
6
7
∆∆00
0—
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor77
Central Processor Unit (CPU)
Table 4-2. Instruction Set (Sheet 7 of 7)
MnemonicOperationDescription
TSTATest A for Zero
TSTBTest B for Zero
TSXTransfer Stack
TSYTransfer Stack
TXSTransfer X to
TYSTransfer Y to
WAIWait for
XGDXExchange D
XGDYExchange D
Cycle
* Infinity or until reset occurs
**12 cycles are used beginning with the opcode fetch. A wait state is entered which remains in effect for an integer number of MPU E-clock
Operands
dd= 8-bit direct address ($0000–$00FF) (high byte assumed to be $00)
ff= 8-bit positive offset $00 (0) to $FF (255) (is added to index)
hh= High-order byte of 16-bit extended address
ii= One byte of immediate data
jj= High-order byte of 16-bit immediate data
kk= Low-order byte of 16-bit immediate data
ll= Low-order byte of 16-bit extended address
mm= 8-bit mask (set bits to be affected)
rr= Signed relative offset $80 (–128) to $7F (+127)
Operators
( )Contents of register shown inside parentheses
⇐Is transferred to
⇑Is pulled from stack
⇓Is pushed onto stack
•Boolean AND
+Arithmetic addition symbol except where used as inclusive-OR symbol
⊕Exclusive-OR
∗Multiply
:Concatenation
–Arithmetic subtraction symbol or negation symbol (two’s complement)
or Minus
or Minus
Pointer to X
Pointer to Y
Stack Pointer
Stack Pointer
Interrupt
with X
with Y
cycles (n) until an interrupt is recognized. Finally, two additional cycles are used to fetch the appropriate interrupt vector (14 + n total).
(offset relative to address following machine code offset byte))
in Boolean formula
A – 0AINH4D—2————∆∆00
B – 0BINH5D—2————∆∆00
SP + 1 ⇒ IXINH30—3 ————————
SP + 1 ⇒ IYINH18 30—4 ————————
IX – 1 ⇒ SPINH35—3 ————————
IY – 1 ⇒ SPINH18 35—4 ————————
Stack Regs & WAITINH3E—**————————
IX ⇒ D, D ⇒ IX INH8F—3 ————————
IY ⇒ D, D ⇒ IYINH18 8F—4 ————————
AddressingInstructionCondition Codes
Mode OpcodeOperand CyclesSXHINZVC
Condition Codes
—Bit not changed
0Bit always cleared
1Bit always set
∆Bit cleared or set, depending on operation
↓Bit can be cleared, cannot become set
M68HC11E Family Data Sheet, Rev. 5.1
78Freescale Semiconductor
Chapter 5
Resets and Interrupts
5.1 Introduction
Resets and interrupt operations load the program counter with a vector that points to a new location from
which instructions are to be fetched. A reset immediately stops execution of the current instruction and
forces the program counter to a known starting address. Internal registers and control bits are initialized
so the MCU can resume executing instructions. An interrupt temporarily suspends normal program
execution while an interrupt service routine is being executed. After an interrupt has been serviced, the
main program resumes as if there had been no interruption.
5.2 Resets
The four possible sources of reset are:
•Power-on reset (POR)
•External reset (RESET
•Computer operating properly (COP) reset
•Clock monitor reset
)
POR and RESET
vector.
share the normal reset vector. COP reset and the clock monitor reset each has its own
5.2.1 Power-On Reset (POR)
A positive transition on VDD generates a power-on reset (POR), which is used only for power-up
conditions. POR cannot be used to detect drops in power supply voltages. A 4064 t
cycle) delay after the oscillator becomes active allows the clock generator to stabilize. If RESET
logical 0 at the end of 4064 t
The POR circuit only initializes internal circuitry during cold starts. Refer to
Figure 1-7. External Reset Circuit.
It is important to protect the MCU during power transitions. Most M68HC11
systems need an external circuit that holds the RESET
is below the minimum operating level. This external voltage level
V
DD
detector, or other external reset circuits, are the usual source of reset in a
system.
, the CPU remains in the reset condition until RESET goes to logical 1.
CYC
NOTE
pin low whenever
(internal clock
CYC
is at
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor79
Resets and Interrupts
5.2.2 External Reset (RESET)
The CPU distinguishes between internal and external reset conditions by sensing whether the reset pin
rises to a logic 1 in less than two E-clock cycles after an internal device releases reset. When a reset
condition is sensed, the RESET
pin is driven low by an internal device for four E-clock cycles, then
released. Two E-clock cycles later it is sampled. If the pin is still held low, the CPU assumes that an
external reset has occurred. If the pin is high, it indicates that the reset was initiated internally by either
the COP system or the clock monitor.
CAUTION
Do not connect an external resistor capacitor (RC) power-up delay circuit to the reset pin of M68HC11
devices because the circuit charge time constant can cause the device to misinterpret the type of reset
that occurred.
5.2.3 Computer Operating Properly (COP) Reset
The MCU includes a COP system to help protect against software failures. When the COP is enabled, the
software is responsible for keeping a free-running watchdog timer from timing out. When the software is
no longer being executed in the intended sequence, a system reset is initiated.
The state of the NOCOP bit in the CONFIG register determines whether the COP system is enabled or
disabled. To change the enable status of the COP system, change the contents of the CONFIG register
and then perform a system reset. In the special test and bootstrap operating modes, the COP system is
initially inhibited by the disable resets (DISR) control bit in the TEST1 register. The DISR bit can
subsequently be written to 0 to enable COP resets.
The COP timer rate control bits CR[1:0] in the OPTION register determine the COP timeout period. The
system E clock is divided by 2
15
and then further scaled by a factor shown in Table 5-1. After reset, these
bits are 0, which selects the fastest timeout period. In normal operating modes, these bits can be written
only once within 64 bus cycles after reset.
Complete this 2-step reset sequence to service the COP timer:
1.Write $55 to COPRST to arm the COP timer clearing mechanism.
2.Write $AA to COPRST to clear the COP timer.
Performing instructions between these two steps is possible as long
as both steps are completed in the correct sequence before the timer times out.
5.2.4 Clock Monitor Reset
The clock monitor circuit is based on an internal resistor capacitor (RC) time delay. If no MCU clock edges
are detected within this RC time delay, the clock monitor can optionally generate a system reset. The
clock monitor function is enabled or disabled by the CME control bit in the OPTION register. The presence
of a timeout is determined by the RC delay, which allows the clock monitor to operate without any MCU
clocks.
Clock monitor is used as a backup for the COP system. Because the COP needs a clock to function, it is
disabled when the clock stops. Therefore, the clock monitor system can detect clock failures not detected
by the COP system.
Semiconductor wafer processing causes variations of the RC timeout values between individual devices.
An E-clock frequency below 10 kHz is detected as a clock monitor error. An E-clock frequency of 200 kHz
or more prevents clock monitor errors. Using the clock monitor function when the E-clock is below 200
kHz is not recommended.
Special considerations are needed when a STOP instruction is executed and the clock monitor is enabled.
Because the STOP function causes the clocks to be halted, the clock monitor function generates a reset
sequence if it is enabled at the time the stop mode was initiated. Before executing a STOP instruction,
clear the CME bit in the OPTION register to 0 to disable the clock monitor. After recovery from STOP, set
the CME bit to logic 1 to enable the clock monitor. Alternatively, executing a STOP instruction with the
CME bit set to logic 1 can be used as a software initiated reset.
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor81
Resets and Interrupts
5.2.5 System Configuration Options Register
Address:$1039
Bit 7654321Bit 0
Read:
Write:
Reset:0
1. Can be written only once in first 64 cycles out of reset in normal mode or at any time in special modes
ADPUCSELIRQE
0010000
= Unimplemented
Figure 5-2. System Configuration Options Register (OPTION)
ADPU — Analog-to-Digital Converter Power-Up Bit
Refer to Chapter 3 Analog-to-Digital (A/D) Converter.
CSEL — Clock Select Bit
Refer to Chapter 3 Analog-to-Digital (A/D) Converter.
(1)
DLY
(1)
CMECR1
(1)
CR0
(1)
IRQE — Configure IRQ
0 = IRQ
1 = IRQ
is configured for level-sensitive operation.
is configured for edge-sensitive-only operation.
for Edge-Sensitive-Only Operation Bit
DLY — Enable Oscillator Startup Delay Bit
Refer to Chapter 2 Operating Modes and On-Chip Memory and Chapter 3 Analog-to-Digital (A/D)
Converter.
CME — Clock Monitor Enable Bit
This control bit can be read or written at any time and controls whether or not the internal clock monitor
circuit triggers a reset sequence when the system clock is slow or absent. When it is clear, the clock
monitor circuit is disabled, and when it is set, the clock monitor circuit is enabled. Reset clears the CME
bit.
0 = Clock monitor circuit disabled
1 = Slow or stopped clocks cause reset
Bit 2 — Unimplemented
Always reads 0
CR[1:0] — COP Timer Rate Select Bit
The internal E clock is first divided by 2
15
before it enters the COP watchdog system. These control
bits determine a scaling factor for the watchdog timer. See Table 5-1 for specific timeout settings.
M68HC11E Family Data Sheet, Rev. 5.1
82Freescale Semiconductor
Effects of Reset
5.2.6 Configuration Control Register
Address:$103F
Bit 7654321Bit 0
Read:
Write:
Reset:0
EE[3:0] — EEPROM Mapping Bits
EE[3:0] apply only to MC68HC811E2. Refer to Chapter 2 Operating Modes and On-Chip Memory.
NOSEC — Security Mode Disable Bit
Refer to Chapter 2 Operating Modes and On-Chip Memory.
NOCOP — COP System Disable Bit
0 = COP enabled (forces reset on timeout)
1 = COP disabled (does not force reset on timeout)
ROMON — ROM (EPROM) Enable Bit
Refer to Chapter 2 Operating Modes and On-Chip Memory.
EE3EE2EE1EE0NOSECNOCOPROMONEEON
0001111
Figure 5-3. Configuration Control Register (CONFIG)
EEON — EEPROM Enable Bit
Refer to Chapter 2 Operating Modes and On-Chip Memory.
5.3 Effects of Reset
When a reset condition is recognized, the internal registers and control bits are forced to an initial state.
Depending on the cause of the reset and the operating mode, the reset vector can be fetched from any
of six possible locations. Refer to Table 5-2.
Table 5-2. Reset Cause, Reset Vector, and Operating Mode
Cause of Reset
POR or RESET
Clock monitor failure$FFFC, FFFD$BFFC, $BFFD
COP Watchdog Timeout$FFFA, FFFB$BFFA, $BFFB
pin$FFFE, FFFF$BFFE, $BFFF
Normal Mode
Vector
These initial states then control on-chip peripheral systems to force them to known startup states, as
described in the following subsections.
5.3.1 Central Processor Unit (CPU)
Special Test
or Bootstrap
After reset, the central processor unit (CPU) fetches the restart vector from the appropriate address during
the first three cycles and begins executing instructions. The stack pointer and other CPU registers are
indeterminate immediately after reset; however, the X and I interrupt mask bits in the condition code
register (CCR) are set to mask any interrupt requests. Also, the S bit in the CCR is set to inhibit stop mode.
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor83
Resets and Interrupts
5.3.2 Memory Map
After reset, the INIT register is initialized to $01, mapping the RAM at $00 and the control registers at
$1000.
For the MC68HC811E2, the CONFIG register resets to $FF. EEPROM mapping bits (EE[3:0]) place the
EEPROM at $F800. Refer to the memory map diagram for MC68HC811E2 in
M68HC11E Family Data Sheet, Rev. 5.1
84Freescale Semiconductor
Reset and Interrupt Priority
5.3.9 Analog-to-Digital (A/D) Converter
The analog-to-digital (A/D) converter configuration is indeterminate after reset. The ADPU bit is cleared
by reset, which disables the A/D system. The conversion complete flag is indeterminate.
5.3.10 System
The EEPROM programming controls are disabled, so the memory system is configured for normal read
operation. PSEL[3:0] are initialized with the value %0110, causing the external IRQ
highest I-bit interrupt priority. The IRQ
pin is configured for level-sensitive operation (for wired-OR
pin to have the
systems). The RBOOT, SMOD, and MDA bits in the HPRIO register reflect the status of the MODB and
MODA inputs at the rising edge of reset. MODA and MODB inputs select one of the four operating modes.
After reset, writing SMOD and MDA in special modes causes the MCU to change operating modes. Refer
to the description of HPRIO register in Chapter 2 Operating Modes and On-Chip Memory for a detailed
description of SMOD and MDA. The DLY control bit is set to specify that an oscillator startup delay is
imposed upon recovery from stop mode. The clock monitor system is disabled because CME is cleared.
5.4 Reset and Interrupt Priority
Resets and interrupts have a hardware priority that determines which reset or interrupt is serviced first
when simultaneous requests occur. Any maskable interrupt can be given priority over other maskable
interrupts.
The first six interrupt sources are not maskable. The priority arrangement for these sources is:
1.POR or RESET
pin
2.Clock monitor reset
3.COP watchdog reset
4.XIRQ
interrupt
5.Illegal opcode interrupt
6.Software interrupt (SWI)
The maskable interrupt sources have this priority arrangement:
1.IRQ
2.Real-time interrupt
3.Timer input capture 1
4.Timer input capture 2
5.Timer input capture 3
6.Timer output compare 1
7.Timer output compare 2
8.Timer output compare 3
9.Timer output compare 4
10.Timer input capture 4/output compare 5
11.Timer overflow
12.Pulse accumulator overflow
13.Pulse accumulator input edge
14.SPI transfer complete
15.SCI system (refer to Figure 5-7)
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor85
Resets and Interrupts
Any one of these interrupts can be assigned the highest maskable interrupt priority by writing the
appropriate value to the PSEL bits in the HPRIO register. Otherwise, the priority arrangement remains the
same. An interrupt that is assigned highest priority is still subject to global masking by the I bit in the CCR,
or by any associated local bits. Interrupt vectors are not affected by priority assignment. To avoid race
conditions, HPRIO can be written only while I-bit interrupts are inhibited.
5.4.1 Highest Priority Interrupt and Miscellaneous Register
Address:$103C
Bit 7654321Bit 0
Read:
Write:
Reset:
Single chip:00000110
Expanded:00100110
Bootstrap:11000110
Special test:01110110
1. The values of the RBOOT, SMOD, and MDA reset bits depend on the mode selected at the
RESET pin rising edge. Refer to Table 2-1. Hardware Mode Select Summary.
RBOOT
(1)
SMOD
(1)
MDA
(1)
IRVNEPSEL2PSEL2PSEL1PSEL0
Figure 5-4. Highest Priority I-Bit Interrupt
and Miscellaneous Register (HPRIO)
RBOOT — Read Bootstrap ROM Bit
Has meaning only when the SMOD bit is a 1 (bootstrap mode or special test mode). At all other times
this bit is clear and cannot be written. Refer to Chapter 2 Operating Modes and On-Chip Memory for
more information.
SMOD — Special Mode Select Bit
This bit reflects the inverse of the MODB input pin at the rising edge of reset. Refer to Chapter 2
Operating Modes and On-Chip Memory for more information.
MDA — Mode Select A Bit
The mode select A bit reflects the status of the MODA input pin at the rising edge of reset. Refer to
Chapter 2 Operating Modes and On-Chip Memory for more information.
IRVNE — Internal Read Visibility/Not E Bit
The IRVNE control bit allows internal read accesses to be available on the external data bus during
operation in expanded modes. In single-chip and bootstrap modes, IRVNE determines whether the E
clock is driven out an external pin. For the MC68HC811E2, this bit is IRV and only controls internal
read visibility. Refer to Chapter 2 Operating Modes and On-Chip Memory for more information.
PSEL[3:0] — Priority Select Bits
These bits select one interrupt source to be elevated above all other I-bit-related sources and can be
written only while the I bit in the CCR is set (interrupts disabled).
M68HC11E Family Data Sheet, Rev. 5.1
86Freescale Semiconductor
Table 5-3. Highest Priority Interrupt Selection
PSEL[3:0]Interrupt Source Promoted
0 0 0 0Timer overflow
0 0 0 1Pulse accumulator overflow
0 0 1 0Pulse accumulator input edge
0 0 1 1SPI serial transfer complete
0 1 0 0SCI serial system
0 1 0 1Reserved (default to IRQ
0 1 1 0IRQ
0 1 1 1Real-time interrupt
1 0 0 0Timer input capture 1
1 0 0 1Timer input capture 2
1 0 1 0Timer input capture 3
1 0 1 1Timer output compare 1
1 1 0 0Timer output compare 2
1 1 0 1Timer output compare 3
1 1 1 0Timer output compare 4
1 1 1 1Timer input capture 4/output compare 5
(external pin or parallel I/O)
)
Interrupts
5.5 Interrupts
The MCU has 18 interrupt vectors that support 22 interrupt sources. The 15 maskable interrupts are
generated by on-chip peripheral systems. These interrupts are recognized when the global interrupt mask
bit (I) in the condition code register (CCR) is clear. The three non-maskable interrupt sources are illegal
opcode trap, software interrupt, and XIRQ
vector assignments for each source.
For some interrupt sources, such as the SCI interrupts, the flags are automatically cleared during the
normal course of responding to the interrupt requests. For example, the RDRF flag in the SCI system is
cleared by the automatic clearing mechanism consisting of a read of the SCI status register while RDRF
is set, followed by a read of the SCI data register. The normal response to an RDRF interrupt request
would be to read the SCI status register to check for receive errors, then to read the received data from
the SCI data register. These steps satisfy the automatic clearing mechanism without requiring special
instructions.
pin. Refer to Table 5-4, which shows the interrupt sources and
An interrupt can be recognized at any time after it is enabled by its local mask, if any, and by the global
mask bit in the CCR. Once an interrupt source is recognized, the CPU responds at the completion of the
instruction being executed. Interrupt latency varies according to the number of cycles required to
complete the current instruction. When the CPU begins to service an interrupt, the contents of the CPU
registers are pushed onto the stack in the order shown in Table 5-5. After the CCR value is stacked, the
I bit and the X bit, if XIRQ
priority pending source is fetched and execution continues at the address specified by the vector. At the
is pending, are set to inhibit further interrupts. The interrupt vector for the highest
M68HC11E Family Data Sheet, Rev. 5.1
88Freescale Semiconductor
Interrupts
end of the interrupt service routine, the return-from-interrupt instruction is executed and the saved
registers are pulled from the stack in reverse order so that normal program execution can resume. Refer
to Chapter 4 Central Processor Unit (CPU).
Table 5-5. Stacking Order on Entry to Interrupts
Memory LocationCPU Registers
SPPCL
SP–1PCH
SP–2IYL
SP–3IYH
SP–4IXL
SP–5IXH
SP–6ACCA
SP–7ACCB
SP–8CCR
5.5.2 Non-Maskable Interrupt Request (XIRQ)
Non-maskable interrupts are useful because they can always interrupt CPU operations. The most
common use for such an interrupt is for serious system problems, such as program runaway or power
failure. The XIRQ
input is an updated version of the NMI (non-maskable interrupt) input of earlier MCUs.
Upon reset, both the X bit and I bit of the CCR are set to inhibit all maskable interrupts and XIRQ
minimum system initialization, software can clear the X bit by a TAP instruction, enabling XIRQ
Thereafter, software cannot set the X bit. Thus, an XIRQ
interrupt is a non-maskable interrupt. Because
the operation of the I-bit-related interrupt structure has no effect on the X bit, the internal XIRQ
unmasked. In the interrupt priority logic, the XIRQ
interrupt has a higher priority than any source that is
. After
interrupts.
pin remains
maskable by the I bit. All I-bit-related interrupts operate normally with their own priority relationship.
When an I-bit-related interrupt occurs, the I bit is automatically set by hardware after stacking the CCR
byte. The X bit is not affected. When an X-bit-related interrupt occurs, both the X and I bits are
automatically set by hardware after stacking the CCR. A return-from-interrupt instruction restores the X
and I bits to their pre-interrupt request state.
5.5.3 Illegal Opcode Trap
Because not all possible opcodes or opcode sequences are defined, the MCU includes an illegal opcode
detection circuit, which generates an interrupt request. When an illegal opcode is detected and the
interrupt is recognized, the current value of the program counter is stacked. After interrupt service is
complete, reinitialize the stack pointer so repeated execution of illegal opcodes does not cause stack
underflow. Left uninitialized, the illegal opcode vector can point to a memory location that contains an
illegal opcode. This condition causes an infinite loop that causes stack underflow. The stack grows until
the system crashes.
The illegal opcode trap mechanism works for all unimplemented opcodes on all four opcode map pages.
The address stacked as the return address for the illegal opcode interrupt is the address of the first byte
of the illegal opcode. Otherwise, it would be almost impossible to determine whether the illegal opcode
had been one or two bytes. The stacked return address can be used as a pointer to the illegal opcode so
the illegal opcode service routine can evaluate the offending opcode.
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor89
Resets and Interrupts
5.5.4 Software Interrupt (SWI)
SWI is an instruction, and thus cannot be interrupted until complete. SWI is not inhibited by the global
mask bits in the CCR. Because execution of SWI sets the I mask bit, once an SWI interrupt begins, other
interrupts are inhibited until SWI is complete, or until user software clears the I bit in the CCR.
5.5.5 Maskable Interrupts
The maskable interrupt structure of the MCU can be extended to include additional external interrupt
sources through the IRQ
network. When an event triggers an interrupt, a software accessible interrupt flag is set. When enabled,
this flag causes a constant request for interrupt service. After the flag is cleared, the service request is
released.
pin. The default configuration of this pin is a low-level sensitive wired-OR
5.5.6 Reset and Interrupt Processing
Figure 5-5 and Figure 5-6 illustrate the reset and interrupt process. Figure 5-5 illustrates how the CPU
begins from a reset and how interrupt detection relates to normal opcode fetches. Figure 5-6 is an
expansion of a block in Figure 5-5 and illustrates interrupt priorities. Figure 5-7 shows the resolution of
interrupt sources within the SCI subsystem.
5.6 Low-Power Operation
Both stop mode and wait mode suspend CPU operation until a reset or interrupt occurs. Wait mode
suspends processing and reduces power consumption to an intermediate level. Stop mode turns off all
on-chip clocks and reduces power consumption to an absolute minimum while retaining the contents of
the entire RAM array.
5.6.1 Wait Mode
The WAI opcode places the MCU in wait mode, during which the CPU registers are stacked and CPU
processing is suspended until a qualified interrupt is detected. The interrupt can be an external IRQ
, or any of the internally generated interrupts, such as the timer or serial interrupts. The on-chip
XIRQ
crystal oscillator remains active throughout the wait standby period.
The reduction of power in the wait condition depends on how many internal clock signals driving on-chip
peripheral functions can be shut down. The CPU is always shut down during wait. While in the wait state,
the address/data bus repeatedly runs read cycles to the address where the CCR contents were stacked.
The MCU leaves the wait state when it senses any interrupt that has not been masked.
The free-running timer system is shut down only if the I bit is set to 1 and the COP system is disabled by
NOCOP being set to 1. Several other systems also can be in a reduced power-consumption state
depending on the state of software-controlled configuration control bits. Power consumption by the
analog-to-digital (A/D) converter is not affected significantly by the wait condition. However, the A/D
converter current can be eliminated by writing the ADPU bit to 0. The SPI system is enabled or disabled
by the SPE control bit. The SCI transmitter is enabled or disabled by the TE bit, and the SCI receiver is
enabled or disabled by the RE bit. Therefore, the power consumption in wait is dependent on the
particular application.
, an
M68HC11E Family Data Sheet, Rev. 5.1
90Freescale Semiconductor
POWER-ON RESET
(POR)
DELAY 4064 E CYCLES
HIGHEST
PRIORITY
EXTERNAL RESET
CLOCK MONITOR FAIL
(WITH CME = 1)
Low-Power Operation
LOWEST
PRIORITY
COP WATCHDOG
TIMEOUT
(WITH NOCOP = 0)
LOAD PROGRAM COUNTER
WITH CONTENTS OF
$FFFE, $FFFF
(VECTOR FETCH)
1A
LOAD PROGRAM COUNTER
SET BITS S, I, AND X
RESET MCU
HARDWARE
BEGIN INSTRUCTION
SEQUENCE
BIT X IN
Y
CCR = 1?
N
XIRQ
PIN LOW?
N
WITH CONTENTS OF
$FFFC, $FFFD
(VECTOR FETCH)
Y
STACK CPU
REGISTERS
SET BITS I AND X
LOAD PROGRAM COUNTER
WITH CONTENTS OF
$FFFA, $FFFB
(VECTOR FETCH)
FETCH VECTOR
2A
$FFF4, $FFF5
Figure 5-5. Processing Flow Out of Reset (Sheet 1 of 2)
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor91
Resets and Interrupts
2A
Y
BIT I IN
CCR = 1?
N
STACK CPU
REGISTERS
SET BIT I IN CCR
FETCH VECTOR
$FFF8, $FFF9
STACK CPU
REGISTERS
SET BIT I IN CCR
FETCH VECTOR
$FFF6, $FFF7
RESTORE CPU
REGISTERS
FROM STACK
ANY I-BIT
INTERRUPT
PENDING?
FETCH OPCODE
Y
ILLEGAL
OPCODE?
INSTRUCTION?
Y
INSTRUCTION?
Y
INSTRUCTION?
EXECUTE THIS
INSTRUCTION
WAI
SWI
RTI
Y
N
N
Y
N
N
N
STACK CPU
REGISTERS
N
ANY
INTERRUPT
PENDING?
Y
SET BIT I IN CCR
RESOLVE INTERRUPT
PRIORITY AND FETCH
VECTOR FOR HIGHEST
PENDING SOURCE
SEE FIGURE 5–2
STACK CPU
REGISTERS
1A
Figure 5-5. Processing Flow Out of Reset (Sheet 2 of 2)
M68HC11E Family Data Sheet, Rev. 5.1
92Freescale Semiconductor
BEGIN
Low-Power Operation
X BIT
IN CCR
SET ?
NO
HIGHEST
PRIORITY
INTERRUPT
?
NO
IRQ
?
NO
RTII = 1 ?
NO
IC1I = 1 ?
NO
YES
YES
YES
YES
YES
XIRQ
PIN
LOW ?
NO
REAL-TIME
INTERRUPT
?
NO
TIMER
IC1F ?
NO
YES
YES
YES
SET X BIT IN CCR
FETCH VECTOR
$FFF4, FFF5
FETCH VECTOR
FETCH VECTOR
$FFF2, FFF3
FETCH VECTOR
$FFF0, FFF1
FETCH VECTOR
$FFEE, FFEF
IC2I = 1 ?
NO
IC3I = 1 ?
NO
OC1I = 1 ?
NO
2A
YES
YES
YES
TIMER
IC2F ?
TIMER
IC3F ?
TIMER
OC1F ?
NO
NO
NO
YES
YES
YES
FETCH VECTOR
$FFEC, FFED
FETCH VECTOR
$FFEA, FFEB
FETCH VECTOR
$FFE8, FFE9
Figure 5-6. Interrupt Priority Resolution (Sheet 1 of 2)
M68HC11E Family Data Sheet, Rev. 5.1
2B
Freescale Semiconductor93
Resets and Interrupts
2A2B
OC2I = 1?
N
OC3I = 1?
N
OC4I = 1?
N
I4/O5I = 1?
N
TOI = 1?
N
PAOVI = 1?
Y
Y
Y
Y
Y
Y
FLAG
OC2F = 1?
FLAG
OC3F = 1
FLAG
OC4F = 1?
FLAG
I4/O5IF = 1?
FLAG
TOF = 1?
FLAG
PAOVF = 1
Y
N
Y
N
Y
N
Y
N
Y
N
Y
FETCH VECTOR
$FFE6, $FFE7
FETCH VECTOR
$FFE4, $FFE5
FETCH VECTOR
$FFE2, $FFE3
FETCH VECTOR
$FFE0, $FFE1
FETCH VECTOR
$FFDE, $FFDF
FETCH VECTOR
$FFDC, $FFDD
N
PAII = 1?
N
SPIE = 1?
N
SCI
INTERRUPT?
SEE FIGURE
5–3
N
Y
Y
Y
N
FLAG
PAIF = 1?
N
FLAGS
SPIF = 1? OR
MODF = 1?
N
Y
Y
FETCH VECTOR
$FFDA, $FFDB
FETCH VECTOR
$FFD8, $FFD9
FETCH VECTOR
$FFD6, $FFD7
FETCH VECTOR
$FFF2, $FFF3
Figure 5-6. Interrupt Priority Resolution (Sheet 2 of 2)
END
M68HC11E Family Data Sheet, Rev. 5.1
94Freescale Semiconductor
Low-Power Operation
Figure 5-7. Interrupt Source Resolution Within SCI
5.6.2 Stop Mode
Executing the STOP instruction while the S bit in the CCR is equal to 0 places the MCU in stop mode. If
the S bit is not 0, the stop opcode is treated as a no-op (NOP). Stop mode offers minimum power
consumption because all clocks, including the crystal oscillator, are stopped while in this mode. To exit
stop and resume normal processing, a logic low level must be applied to one of the external interrupts
(IRQ
or XIRQ) or to the RESET pin. A pending edge-triggered IRQ can also bring the CPU out of stop.
Because all clocks are stopped in this mode, all internal peripheral functions also stop. The data in the
internal RAM is retained as long as V
and are unchanged by stop. Therefore, when an interrupt comes to restart the system, the MCU resumes
processing as if there were no interruption. If reset is used to restart the system, a normal reset sequence
results in which all I/O pins and functions are also restored to their initial states.
To use the IRQ
masked). The XIRQ
pin as a means of recovering from stop, the I bit in the CCR must be clear (IRQ not
pin can be used to wake up the MCU from stop regardless of the state of the X bit in
the CCR, although the recovery sequence depends on the state of the X bit. If X is set to 0 (XIRQ
Freescale Semiconductor95
power is maintained. The CPU state and I/O pin levels are static
masked), the MCU starts up, beginning with the stacking sequence leading to normal service of the XIRQ
request. If X is set to 1 (XIRQ
immediately follows the STOP instruction, and no XIRQ
masked or inhibited), then processing continues with the instruction that
interrupt service is requested or pending.
Because the oscillator is stopped in stop mode, a restart delay may be imposed to allow oscillator
stabilization upon leaving stop. If the internal oscillator is being used, this delay is required; however, if a
stable external oscillator is being used, the DLY control bit can be used to bypass this startup delay. The
DLY control bit is set by reset and can be optionally cleared during initialization. If the DLY equal to 0
option is used to avoid startup delay on recovery from stop, then reset should not be used as the means
of recovering from stop, as this causes DLY to be set again by reset, imposing the restart delay. This same
delay also applies to power-on reset, regardless of the state of the DLY control bit, but does not apply to
a reset while the clocks are running.
M68HC11E Family Data Sheet, Rev. 5.1
96Freescale Semiconductor
Chapter 6
Parallel Input/Output (I/O) Ports
6.1 Introduction
All M68HC11 E-series MCUs have five input/output (I/O) ports and up to 38 I/O lines, depending on the
operating mode. Refer to Table 6-1 for a summary of the ports and their shared functions.
Table 6-1. Input/Output Ports
Port
Port A332Timer
Port B—8—High-order address
Port C——8Low-order address and data bus
Por t D——6
Port E8——Analog-to-digital (A/D) converter
Input
Pins
Output
Pins
Bidirectional
Pins
Shared Functions
Serial communications interface (SCI)
and serial peripheral interface (SPI)
Port pin function is mode dependent. Do not confuse pin function with the electrical state of the pin at
reset. Port pins are either driven to a specified logic level or are configured as high-impedance inputs. I/O
pins configured as high-impedance inputs have port data that is indeterminate.
In port descriptions, an I indicates this condition. Port pins that are driven to a known logic level during
reset are shown with a value of either 1 or 0. Some control bits are unaffected by reset. Reset states for
these bits are indicated with a U.
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor97
Parallel Input/Output (I/O) Ports
6.2 Port A
Port A shares functions with the timer system and has:
•Three input-only pins
•Three output-only pins
•Two bidirectional I/O pins
Address:$1000
Bit 7654321Bit 0
Read:
Write:
Reset:I000IIII
Alternate function:PAIOC2OC3OC4IC4/OC5IC1IC2IC3
And/or:OC1OC1OC1OC1OC1———
Address:$1026
Read:
Write:
Reset:00000000
PA7PA6PA5PA4PA3PA2PA1PA0
I = Indeterminate after reset
Figure 6-1. Port A Data Register (PORTA)
Bit 7654321Bit 0
DDRA7PAEWNPAMODPEDGEDDRA3I4/O5RTR1RTR0
Figure 6-2. Pulse Accumulator Control Register (PACTL)
DDRA7 — Data Direction for Port A Bit 7
Overridden if an output compare function is configured to control the PA7 pin
0 = Input
1 = Output
The pulse accumulator uses port A bit 7 as the PAI input, but the pin can also be used as
general-purpose I/O or as an output compare.
NOTE
Even when port A bit 7 is configured as an output, the pin still drives the
input to the pulse accumulator.
PAEN — Pulse Accumulator System Enable Bit
Refer to Chapter 9 Timing Systems.
PAMOD — Pulse Accumulator Mode Bit
Refer to Chapter 9 Timing Systems.
PEDGE — Pulse Accumulator Edge Control Bit
Refer to Chapter 9 Timing Systems.
DDRA3 — Data Direction for Port A Bit 3
This bit is overridden if an output compare function is configured to control the PA3 pin.
0 = Input
1 = Output
I4/O5 — Input Capture 4/Output Compare 5 Bit
Refer to Chapter 9 Timing Systems.
RTR[1:0] — RTI Interrupt Rate Select Bits
Refer to Chapter 9 Timing Systems.
M68HC11E Family Data Sheet, Rev. 5.1
98Freescale Semiconductor
Port B
6.3 Port B
In single-chip or bootstrap modes, port B pins are general-purpose outputs. In expanded or special test
modes, port B pins are high-order address outputs.
Address:$1004
Bit 7654321Bit 0
Single-chip or bootstrap modes:
Read:
Write:
Reset:00000000
Expanded or special test modes:
Read:
Write:
Reset:00000000
PB7PB6PB5PB4PB3PB2PB1PB0
ADDR15ADDR14ADDR13ADDR12ADDR11ADDR10ADDR9ADDR8
Figure 6-3. Port B Data Register (PORTB)
6.4 Port C
In single-chip and bootstrap modes, port C pins reset to high-impedance inputs. (DDRC bits are set to 0.)
In expanded and special test modes, port C pins are multiplexed address/data bus and the port C register
address is treated as an external memory location.
Address:$1003
Bit 7654321Bit 0
Single-chip or bootstrap modes:
Read:
Write:
Reset:Indeterminate after reset
Expanded or special test modes:
Read:
Write:
Reset:Indeterminate after reset
PC7PC6PC5PC4PC3PC2PC1PC0
ADDR7
DATA7
ADDR6
DATA6
ADDR5
DATA5
ADDR4
DATA4
ADDR3
DATA3
ADDR2
DATA2
ADDR1
DATA1
ADDR0
DATA0
Figure 6-4. Port C Data Register (PORTC)
Address:$1005
Bit 7654321Bit 0
Read:
Write:
Reset:Indeterminate after reset
PCL7PCL6PCL5PCL4PCL3PCL2PCL1PCL0
Figure 6-5. Port C Latched Register (PORTCL)
M68HC11E Family Data Sheet, Rev. 5.1
Freescale Semiconductor99
Parallel Input/Output (I/O) Ports
PORTCL is used in the handshake clearing mechanism. When an active edge occurs on the STRA pin,
port C data is latched into the PORTCL register. Reads of this register return the last value latched into
PORTCL and clear STAF flag (following a read of PIOC with STAF set).
Address:$1007
Bit 7654321Bit 0
Read:
Write:
Reset:00000000
DDRC7DDRC6DDRC5DDRC4DDRC3DDRC2DDRC1DDRC0
Figure 6-6. Port C Data Direction Register (DDRC)
DDRC[7:0] — Port C Data Direction Bits
In the 3-state variation of output handshake mode, clear the corresponding DDRC bits. Refer to Figure
In all modes, port D bits [5:0] can be used either for general-purpose I/O or with the serial communications
interface (SCI) and serial peripheral interface (SPI) subsystems. During reset, port D pins PD[5:0] are
configured as high-impedance inputs (DDRD bits cleared).
Address:$1008
Bit 7654321Bit 0
Read:
Write:
Reset:——IIIIII
Alternate Function:——
00PD5PD4PD3PD2PD1PD0
PD5
SS
I = Indeterminate after reset
Figure 6-7. Port D Data Register (PORTD)
Address:$1009
Bit 7654321Bit 0
Read:
Write:
Reset:00000000
= Unimplemented
DDRD5DDRD4DDRD3DDRD2DDRD1DDRD0
Figure 6-8. Port D Data Direction Register (DDRD)
Bits [7:6] — Unimplemented
Always read 0
DDRD[5:0] — Port D Data Direction Bits
When DDRD bit 5 is 1 and MSTR = 1 in SPCR, PD5/SS
logic is disabled.
0 = Input
1 = Output
PD4
SCK
PD3
MOSI
PD2
MISO
PD1
Tx
PD0
RxD
is a general-purpose output and mode fault
M68HC11E Family Data Sheet, Rev. 5.1
100Freescale Semiconductor
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.