Freescale Semiconductor
Technical Information Center, CH370
1300 N. Alma School Road
Chandler, Arizona 85224
(800) 521-6274
480-768-2130
support@freescale.com
Freescale Semiconductor Japan Ltd.
Headquarters
ARCO Tower 15F
1-8-1, Shimo-Meguro, Meguro-ku
Tokyo 153-0064, Japan
0120 191014
+81 2666 8080
support.japan@freescale.com
Asia/Pacific:
Freescale Semiconductor Hong Kong Ltd.
Technical Information Center
2 Dai King Street
Tai Po Industrial Estate,
Tai Po, N.T., Hong Kong
+800 2666 8080
support.asia@freescale.com
For Literature Requests Only:
Freescale Semiconductor
Literature Distribution Center
P.O. Box 5405
Denver, Colorado 80217
(800) 441-2447
303-675-2140
Fax: 303-675-2150
LDCForFreescaleSemiconductor
@hibbertgroup.com
Information in this document is provided solely to enable system and software
implementers to use Freescale Semiconductor products. There are no express or
implied copyright licenses granted hereunder to design or fabricate any integrated
circuits or integrated circuits based on the information in this document.
Freescale Semiconductor reserves the right to make changes without further notice to
any products herein. Freescale Semiconductor makes no warranty, representation or
guarantee regarding the suitability of its products for any particular purpose, nor does
Freescale Semiconductor assume any liability arising out of the application or use of
any product or circuit, and specifically disclaims any and all liability, including without
limitation consequential or incidental damages. “Typical” parameters which may be
provided in Freescale Semiconductor data sheets and/or specifications can and do
vary in different applications and actual performance may vary over time. All operating
parameters, including “Typicals” must be validated for each customer application by
customer’s technical experts. Freescale Semiconductor does not convey any license
under its patent rights nor the rights of others. Freescale Semiconductor pro ducts are
not designed, intended, or authorized for customer’s/MC[(v)Tc 0.0poo2s/Mbrd[(ondu)8(ctor pro)86 Tc 0.6s3504 Tc a0norifit9(fothni)9(ca(t9(f09lnoDd 7.02 90 641.10057 Tm47 59.76)9(sc0 TcsurgTd[(lidat)13( impl(ion)1t38 Tw [14(tmicone bodc 0.003du)10r3du)1090.0010( cha1 0 Td[(lidated )s38 Tw [1entati)9d)14(i[(gpp.0030tTw 7.02sp)10(staTd[n Td[fcts )9(f pro)86 Tc 0.6s3504 Tc a0(se)10(, )9(nor doe)17.02 90 641.10057 Tm47 76.6607Tf0 Tcw 7(ctoaw)13(a)1 per)9(i)8 7.021 0 con)Tm[(v)13(a)1(r7.0202 and )h24 Tmmiconescale )9fa.008(ng “Ty)13(p)1(ii)806(r d)9(oesur Tm[(tetmi(s)5.02 90 673.26044 Tmi)9(cal ex)13(pe0.004al ex(f pro)86 Tc 0.6s3504 Tc ali)8(c)-5(ation or use of ]TJET(f09l9/P <</MCID 6 >>BDC057 Tm47 68.6207 1 Tf0.oul0 649creaMbrdr )]T 43 TwtuTd[(she)9(e and )h7.0 pstomersont)13( injur per)9(perbrdatmi(ss)-491 per)9(ccu0030.0.000Smi(soul0Tm[Bu491 per)mer(f pro)86 Tc 0.6s3504 Tc aludin)10(g)1( w)13(ithout )TJETEMC /P <</MCID 12 >>BDC 057 Tm47 60.5807D 10 >>Burchaze)9(d fo13( )[(undut 13( F[(un031 Tc -0054 Tw ord[(cal ex)13(pe0.0w 7.02 se v)13(a)]To)9(r per)9suages. uns/Mb[(on 649.14ctor pro)86 Tc 0.6s3504 Tc 2 w)12(hich )9(may)12( of ]TJET(f09l9/P <</MCID 6 >>BDC057 Tm47 52to)082T0 1 Tf Tm[0030 ded cha1 0 030 cted )030,0.000Bs. ua)1 per)mer(shal)13( in99947m, )-8(in)95ET(f09l69p)1(ical806 d)9(oesnif5(ally)13(holtati) F(all.00121 Tcti) 02 90hni)9(cti)02 0uand do
RoHS-compliant and/or Pb- free versions of Freescale products have the functionality
and electrical characteristics of their non-RoHS-compliant and/or non-Pb- free
counterparts. For further information, see http://www.freescale.com or contact your
Freescale sales representative.
For information on Freescale.s Environmental Products program, go to
http://www.freescale.com/epp.
B-1 Device Ordering Information ...........................................................................B-3
C-1 MC68HC11F1 Development Tools.................................................................C-1
Freescale Semiconductor, I
For More Information On This Product,
Go to: www.freescale.com
TECHNICAL DATA
..
.
nc
Freescale Semiconductor, Inc.
SECTION 1INTRODUCTION
The MC68HC11F1 high-performance microcontroller unit (MCU) is an enhanced derivative of the M68HC11 family of microcontrollers and includes many advanced features. This MCU, with a nonmultiplexed expanded bus, is characterized by high speed
and low power consumption. The fully static design allows operation at frequencies
from 4 MHz to dc.
The MC68HC11F1 MCU is available in a 68-pin plastic leaded chip carrier (PLCC) and
an 80-pin plastic quad flat pack (QFP). Most pins on this MCU serve two or more functions, as described in the following paragraphs.
for the PLCC.
Figure 2-2 Pin Assignments for MC68HC11F1 80-Pin QFP
2.1 V
DD and
Power is supplied to the MCU through V
V
SS
V
SS
DD
and V
SS
. V
is the power supply, and
DD
is ground. The MCU operates from a single 5-volt (nominal) power supply. 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.
2-2TECHNICAL DATA
For More Information On This Product,
PIN DESCRIPTIONS
MC68HC11F1
Go to: www.freescale.com
Freescale Semiconductor, Inc.
2.2 Reset (RESET)
An active low bidirectional control signal, RESET, acts as an input to initialize the MCU
to a known start-up state. It also acts as an open-drain output to indicate that an internal failure has been detected in either the clock monitor or COP watchdog circuit. The
CPU distinguishes between internal and external reset conditions by sensing whether
the reset pin rises to a logic one in less than two E-clock cycles after a reset has occurred. It is not advisable to 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. Refer to
SECTION 5 RESETS AND INTERRUPTS for further information.
Figure 2-3 illustrates a reset circuit that uses an external switch. Other circuits can be
used, however, it is important to incorporate a low voltage interrupt (LVI) circuit to prevent operation at insufficient voltage levels which could result in erratic behavior or cor-
..
.
ruption of RAM.
nc
Freescale Semiconductor, I
V
DD
4.7 kΩ
1
TO RESET
OF M68HC11
MANUAL
RESET SWITCH
4.7 kΩ
OPTIONAL POWER-ON DELAY
AND MANUAL RESET SWITCH
V
DD
V
DD
4.7 kΩ
1.0 µF
MC34164
2
IN
RESET
GND
3
MC34064
1
2
IN
RESET
GND
3
Figure 2-3 External Reset Circuit
2.3 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 EXTAL pin. 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. The E clock can be turned off in
single-chip modes to reduce the effects of radio frequency interference (RFI). Refer to
SECTION 9 TIMING SYSTEM.
2.4 Crystal Driver and External Clock Input (XTAL, EXTAL)
These two pins provide the interface for either a crystal or a CMOS-compatible clock
to control the internal clock generator circuitry. Either a crystal oscillator or a CMOS
compatible clock can be used. The resulting E-clock rate is the input frequency divided
by four.
TECHNICAL DATA2-3
For More Information On This Product,
PIN DESCRIPTIONS
Go to: www.freescale.com
Ω
..
.
nc
Freescale Semiconductor, Inc.
The XTAL pin is normally left unterminated when an external CMOS compatible clock
is connected to the EXTAL pin. However, a 10 k
to 100 kΩ load resistor connected
from the XTAL output to ground can be used to reduce RFI noise emission.
The XTAL output is normally used to drive a crystal. The XTAL output can be buffered
with a high-impedance buffer, or it can be used to drive the EXTAL input of another
M68HC11 device. Refer to
Figure 2-6.
In all cases, use caution when designing circuitry associated with the oscillator pins.
Load capacitances shown in the oscillator circuits include all stray layout capacitances. Refer to Figure 2-4, Figure 2-5, and Figure 2-6.
25 pF*
EXTAL
MCU
10M
XTAL
4 x E
CRYSTAL
25 pF*
Values include all stray capacitances.
*
Figure 2-4 Common Crystal Connections
CMOS-COMPATIBLE
EXTERNAL
OSCILLATOR
MCU
EXTAL
XTAL
NC OR
10 k – 100 k
LOAD
Figure 2-5 External Oscillator Connections
Freescale Semiconductor, I
FIRST
MCU
EXTAL
XTAL
10M
25 pF*
4 x E
CRYSTAL
25 pF*
220
NC OR
10 k – 100 k
LOAD
EXTAL
SECOND
MCU
XTAL
Values include all stray capacitances.
*
Figure 2-6 One Crystal Driving Two MCUs
2-4TECHNICAL DATA
For More Information On This Product,
PIN DESCRIPTIONS
Go to: www.freescale.com
MC68HC11F1
Freescale Semiconductor, Inc.
2.5 Four Times E-Clock Frequency Output (4XOUT)
Although the circuit shown in Figure 2-6 will work for any M68HC11 MCU, the
MC68HC11F1 has an additional clock output that is four times the E-clock frequency.
This output (4XOUT) can be used to directly drive the EXTAL input of another
M68HC11 MCU. Refer to Figure 2-7. The 4XOUT output is enabled after reset and
can be disabled by clearing the CLK4X bit in the OPT2 register.
..
.
nc
Freescale Semiconductor, I
MC68HC11F1
4XOUT
EXTAL
XTAL
OSCILLATOR
CIRCUIT OR
CMOS-COMPATIBLE
CLOCK
NC OR
10 k – 100 k
LOAD
EXTAL
XTAL
SECOND
MCU
Figure 2-7 4XOUT Signal Driving a Second MCU
2.6 Interrupt Request (IRQ
)
The IRQ input provides a means of generating asynchronous interrupt requests for the
CPU. Either falling-edge triggering or low-level triggering is selected by the IRQE bit
in the OPTION register. IRQ
Connect an external pull-up resistor, typically 4.7 kΩ, to V
is always configured for level-sensitive triggering at reset.
when IRQ is used in a
DD
level-sensitive wired-OR configuration. Refer to SECTION 5 RESETS AND INTER-
RUPTS.
2.7 Non-Maskable Interrupt (XIRQ
)
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
input is level
sensitive, it can be connected to a multiple-source wired-OR network with an external
pull-up resistor to V
. XIRQ is often used as a power loss detect interrupt.
DD
Whenever XIRQ or IRQ are used with multiple interrupt sources (IRQ must be configured for level-sensitive operation if there is more than one source of IRQ
interrupt),
each source must drive the interrupt input with an open-drain type of driver to avoid
contention between outputs. There should be a single pull-up 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 condition
code register (CCR) is cleared (normally upon return from an interrupt). Refer to SEC-TION 5 RESETS AND INTERRUPTS.
TECHNICAL DATA2-5
For More Information On This Product,
PIN DESCRIPTIONS
Go to: www.freescale.com
Freescale Semiconductor, Inc.
..
.
nc
Freescale Semiconductor, I
2.8 MODA and MODB (MODA/LIRand MODB/V
During reset, MODA and MODB select one of the four operating modes. Refer to SEC-
TION 4 OPERATING MODES AND ON-CHIP MEMORY.
After the operating mode has been selected, the LIR
to indicate that execution of an instruction has begun. The LIR pin is configured for
wired-OR operation (only pulls low). A series of E-clock cycles occurs during execution
of each instruction. The LIR
of each instruction (opcode fetch). This output is provided for assistance in program
debugging.
The V
signal unless the difference between the level of V
V
DD
one MOS threshold (about 0.7 volts). When these voltages differ by more than 0.7
volts, the internal 768-byte RAM and part of the reset logic are powered from V
rather than VDD. This allows RAM contents to be retained without V
to the MCU.
until V
2.9 V
2.10 R/W
and V
RH
These pins provide the reference voltage for the analog-to-digital converter. Bypass
capacitors should be used to minimize noise on these signals. Any noise on V
will directly affect A/D accuracy.
V
RL
In expanded and test modes, R/W indicates the direction of transfers on the external
data bus. A logic level one on this pin indicates that a read cycle is in progress. A logic
zero on this pin indicates that a write cycle is in progress and that no external device
should drive the data bus.
The E-clock can be used to enable external devices to drive data onto the data bus
during the second half of a read bus cycle (E clock high). R/W
control the direction of data transfers. R/W
external data bus. R/W
as when a double-byte store occurs.
pin is used to input RAM standby power. The MCU is powered from the
STBY
Reset must be driven low before V
has been restored to a valid level.
DD
RL
signal is asserted (drives low) during the first E-clock cycle
drives low when data is being written to the
will remain low during consecutive data bus write cycles, such
)
STBY
pin provides an open-drain output
and Vdd is greater than
STBY
power applied
DD
is removed and must remain low
DD
can then be used to
STBY
RH
and
2.11 Port Signals
For the MC68HC11F1, 54 pins are arranged into six 8-bit ports: A, B, C, E, F, and G,
and one 6-bit port (D). Each of these seven ports serves a purpose other than I/O, depending on the operating mode or peripheral functions selected. Note that ports B, C,
and F are available for I/O functions only in single-chip and bootstrap modes. The pins
of ports A, C, D, and G are fully bidirectional. Ports B and F are output-only ports. Port
E is an input-only port. Refer to Table 2-1 for details about the 54 port signals’ functions within different operating modes.
Port A is an 8-bit general-purpose I/O port with a data register (PORTA) and a data
direction register (DDRA). Port A pins share functions with the 16-bit timer system.
PORTA can be read at any time. Inputs return the pin level; outputs return the pin driver input level. If written, PORTA stores the data in internal latches. It drives the pins
only if they are configured as outputs. Writes to PORTA do not change the pin state
when the pins are configured for timer output compares.
Out of reset, port A pins [7:0] are general-purpose high-impedance inputs. When the
timer functions associated with these pins are disabled, the bits in DDRA govern the
I/O state of the associated pin. For further information, refer to SECTION 6 PARAL-
LEL INPUT/OUTPUT.
NOTE
When using the information about port functions, do not confuse pin
function with the electrical state of the pin at reset. All general-purpose I/O pins configured as inputs at reset are in a high-impedance
state. Port data registers reflect the logic state of the port at reset.
The pin function is mode dependent.
TECHNICAL DATA2-7
For More Information On This Product,
PIN DESCRIPTIONS
Go to: www.freescale.com
Freescale Semiconductor, Inc.
2.11.2 Port B
Port B is an 8-bit output-only port. In single-chip modes, port B pins are general-purpose output pins (PB[7:0]). In expanded modes, port B pins act as the high-order address lines (ADDR[15:8]) of the address bus.
PORTB can be read at any time. Reads of PORTB return the pin driver input level. If
PORTB is written, the data is stored in internal latches. It drives the pins only in singlechip or bootstrap mode. In expanded operating modes, port B pins are the high-order
address outputs (ADDR[15:8]).
Refer to SECTION 6 PARALLEL INPUT/OUTPUT.
2.11.3 Port C
..
.
nc
Port C is an 8-bit general-purpose I/O port with a data register (PORTC) and a data
direction register (DDRC). In single-chip modes, port C pins are general-purpose I/O
pins (PC[7:0]). In expanded modes, port C pins are configured as data bus pins (DATA[7:0]).
PORTC can be read at any time. Inputs return the pin level; outputs return the pin driver input level. If PORTC is written, the data is stored in internal latches. It drives the
pins only if they are configured as outputs in single-chip or bootstrap mode. Port C pins
are general-purpose inputs out of reset in single-chip and bootstrap modes. In expanded and test modes, these pins are data bus lines out of reset.
The CWOM control bit in the OPT2 register disables port C’s P-channel output drivers.
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 wiredOR mode, (PORTC bits are at logic level zero), pins are actively driven low by the Nchannel driver. When a port C bit is at logic level one, the associated pin is in a highimpedance state, as neither the N-channel nor the P-channel devices are active. It is
customary to have an external pull-up 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 or bootstrap modes.
Refer to SECTION 6 PARALLEL INPUT/OUTPUT.
Freescale Semiconductor, I
2.11.4 Port D
Port D, a 6-bit general-purpose I/O port, has a data register (PORTD) and a data direction register (DDRD). The six port D lines (D[5:0]) can be used for general-purpose
I/O, for the serial communications interface (SCI) and serial peripheral interface (SPI)
subsystems.
PORTD can be read at any time. Inputs return the pin level; outputs return the pin driver input level. If PORTD is written, the data is stored in internal latches and can be driven only if port D is configured for general-purpose output.
The DWOM control bit in the SPCR register disables port D’s P-channel output drivers.
Because the N-channel driver is not affected by DWOM, setting DWOM causes port
D to become an open-drain-type output port suitable for wired-OR operation. In wired-
2-8TECHNICAL DATA
For More Information On This Product,
PIN DESCRIPTIONSMC68HC11F1
Go to: www.freescale.com
..
.
nc
Freescale Semiconductor, Inc.
OR mode, (PORTD bits are at logic level zero), pins are actively driven low by the Nchannel driver. When a port D bit is at logic level one, the associated pin is in a highimpedance state, as neither the N-channel nor the P-channel devices are active. It is
customary to have an external pull-up resistor on lines that are driven by open-drain
devices. Port D can be configured for wired-OR operation in any operating mode.
Refer to SECTION 6 PARALLEL INPUT/OUTPUT, SECTION 7 SERIAL COMMUNI-
CATIONS INTERFACE, and SECTION 8 SERIAL PERIPHERAL INTERFACE.
2.11.5 Port E
Port E is an 8-bit input-only port that is also used as the analog input port for the analog-to-digital converter. Port E pins that are not used for the A/D system can be used
as general-purpose inputs. However, PORTE should not be read during the sample
portion of an A/D conversion sequence.
Refer to SECTION 10 ANALOG-TO-DIGITAL CONVERTER.
2.11.6 Port F
Port F is an 8-bit output-only port. In single-chip mode, port F pins are general-purpose
output pins (PF[7:0]). In expanded mode, port F pins act as the low-order address outputs (ADDR[7:0]).
PORTF can be read at any time. Reads of PORTF return the pin driver input level. If
PORTF is written, the data is stored in internal latches. It drives the pins only in singlechip or bootstrap mode. In expanded operating modes, port F pins are the low-order
address outputs (ADDR[7:0]).
Refer to SECTION 6 PARALLEL INPUT/OUTPUT.
2.11.7 Port G
Port G is an 8-bit general-purpose I/O port. When enabled, four chip select signals are
alternate functions of port G bits [7:4].
PORTG can be read at any time. Inputs return the pin level; outputs return the pin driver input level. If PORTG is written, the data is stored in internal latches. It drives the
Freescale Semiconductor, I
pins only if they are configured as outputs.
The GWOM control bit in the OPT2 register disables port G's P-channel output drivers.
Because the N-channel driver is not affected by GWOM, setting GWOM causes port
G to become an open-drain-type output port suitable for wired-OR operation. In wiredOR mode, (PORTG bits are at logic level zero), pins are actively driven low by the Nchannel driver. When a port G bit is at logic level one, the associated pin is in a highimpedance state, as neither the N-channel nor the P-channel devices are active. It is
customary to have an external pull-up resistor on lines that are driven by open-drain
devices. Port G can be configured for wired-OR operation in any operating mode.
Refer to SECTION 6 PARALLEL INPUT/OUTPUT and SECTION 4 OPERATINGMODES AND ON-CHIP MEMORY.
TECHNICAL DATA2-9
For More Information On This Product,
PIN DESCRIPTIONS
Go to: www.freescale.com
..
.
nc
Freescale Semiconductor, Inc.
Freescale Semiconductor, I
2-10TECHNICAL DATA
For More Information On This Product,
PIN DESCRIPTIONSMC68HC11F1
Go to: www.freescale.com
Freescale Semiconductor, Inc.
SECTION 3 CENTRAL PROCESSING UNIT
This section presents information on M68HC11 central processing unit (CPU) architecture. Data types, addressing modes, the instruction set, and the extended addressing range required to support this MCU’s memory expansion feature are also included,
as are special operations such as subroutine calls and interrupts.
The CPU is designed to treat all peripheral, 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.
nc
Freescale Semiconductor, I
3.1 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 3-1.
CENTRAL PROCESSING UNIT
TECHNICAL DATA3-1
For More Information On This Product,
Go to: www.freescale.com
..
.
nc
Freescale Semiconductor, Inc.
15
DOUBLE ACCUMULATOR D
CONDITION CODE REGISTERXHINZVC
70
70
INDEX REGISTER X
INDEX REGISTER Y
STACK POINTER
PROGRAM COUNTER
70
S
ACCUMULATOR A
ACCUMULATOR B
A
B
0
D
015
IX
015
IY
015
SP
015
PC
123456
CCR
CARRY
OVERFLOW
ZERO
NEGATIVE
I INTERRUPT MASK
HALF-CARRY (FROM BIT 3)
X INTERRUPT MASK
STOP DISABLE
Figure 3-1 Programming Model
3.1.1 Accumulators A, B, and D
Accumulators A and B are general-purpose 8-bit registers that hold operands and results of arithmetic calculations or data manipulations. For some instructions, these two
accumulators are treated as a single double-byte (16-bit) accumulator called accumulator D. Although most instructions can use accumulators A or B interchangeably, the
Freescale Semiconductor, I
following exceptions apply:
The ABX and ABY instructions add the contents of 8-bit accumulator B to the contents
of 16-bit register X or Y, but there are no equivalent instructions that use A instead of B.
The TAP and TPA instructions transfer data from accumulator A to the condition code
register, or from the condition code register to accumulator A, however, there are no
equivalent instructions that use B rather than A.
The decimal adjust accumulator A (DAA) instruction is used after binary-coded decimal (BCD) arithmetic operations, but there is no equivalent BCD instruction to adjust
accumulator B.
CENTRAL PROCESSING UNITMC68HC11F1
3-2TECHNICAL DATA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
The add, subtract, and compare instructions associated with both A and B (ABA, SBA,
and CBA) only operate in one direction, making it important to plan ahead to ensure
that the correct operand is in the correct accumulator.
3.1.2 Index Register X (IX)
The IX register provides a 16-bit indexing value that can be added to the 8-bit offset
provided in an instruction to create an effective address. The IX register can also be
used as a counter or as a temporary storage register.
3.1.3 Index Register Y (IY)
The 16-bit IY register performs an indexed mode function similar to that of the IX register. However, most instructions using the IY register require an extra byte of machine
code and an extra cycle of execution time because of the way the opcode map is im-
..
.
plemented. Refer to 3.3 Opcodes and Operands for further information.
nc
Freescale Semiconductor, I
3.1.4 Stack Pointer (SP)
The M68HC11 CPU has an automatic program stack. This stack can be located anywhere in the address space and can be any size up to the amount of memory available
in the system. Normally the SP is initialized by one of the first instructions in an application program. The stack is configured as a data structure that grows downward from
high memory to low memory. Each time a new byte is pushed onto the stack, the SP
is decremented. Each time a byte is pulled from the stack, the SP is incremented. At
any given time, the SP holds the 16-bit address of the next free location in the stack.
Figure 3-2 is a summary of SP operations.
CENTRAL PROCESSING UNIT
TECHNICAL DATA3-3
For More Information On This Product,
Go to: www.freescale.com
JSR, JUMP TO SUBROUTINE
MAIN PROGRAM
PC
DIRECT
RTN
PC
INDXD,X
RTN
PC
INDXD,Y
RTN
PC
EXTEND
RTN
BSR, BRANCH TO SUBROUTINE
PC
RTN
$9D = JSR
dd
NEXT MAIN INSTR
MAIN PROGRAM
$AD = JSR
ff
NEXT MAIN INSTR
MAIN PROGRAM
$18 = PRE
$AD = JSR
ff
NEXT MAIN INSTR
MAIN PROGRAM
$BD = JSR
hh
NEXT MAIN INSTR
MAIN PROGRAM
$8D = BSR
rr
NEXT MAIN INSTR
RTI, RETURN FROM INTERRUPT
INTERRUPT PROGRAM
PC
STACK
SP-2
SP-1
SP
ll
SP-2
SP-1
SP
RTN
RTN
STACK
RTN
RTN
H
L
SWI, SOFTWARE INTERRUPT
PC
RTN
WAI, WAIT FOR INTERRUPT
PC
H
RTN
L
$3B = RTI
MAIN PROGRAM
$3F = SWI
MAIN PROGRAM
$3E = WAI
SP
SP+1
SP+2
SP+3
SP+4
SP+5
SP+6
SP+7
SP+8
SP+9
SP-9
SP-8
SP-7
SP-6
SP-5
SP-4
SP-3
SP-2
SP-1
STACK
CONDITION CODE
ACMLTR B
ACMLTR A
STACK
CONDITION CODE
ACMLTR B
ACMLTR A
INDEX REGISTER (X
INDEX REGISTER (X
INDEX REGISTER (YH)
INDEX REGISTER (Y
RTN
H
RTN
L
)
H
)
L
)
L
RTS, RETURN FROM SUBROUTINE
SUBROUTINE
PC
$39 = RTS
SP
SP+1
SP+2
STACK
RTN
LEGEND:
RTN
RTN
H
RTN
L
dd
ff
hh
ll
rr
Address of next instruction in main program to be
executed upon return from subroutine.
Most significant byte of return address.
Least significant byte of return address.
Shaded cells show stack pointer position after
operation is complete.
8-bit direct address ($0000-$00FF) (high byte
assumed to be $00).
8-bit positive offset $00 (0) to $FF (256) is added
to index.
High-order byte of 16-bit extended address.
Low-order byte of 16-bit extended address.
Signed-relative offset $80 (-128) to $7F (+127)
(offset relative to the address following the
machine code offset byte).
Figure 3-2 Stacking Operations
When a subroutine is called by a jump to subroutine (JSR) or branch to subroutine
(BSR) instruction, the address of the instruction after the JSR or BSR is automatically
pushed onto the stack, least significant byte first. When the subroutine is finished, a
return from subroutine (RTS) instruction is executed. The RTS pulls the previously
stacked return address from the stack, and loads it into the program counter. Execution then continues at this recovered return address.
CENTRAL PROCESSING UNITMC68HC11F1
3-4TECHNICAL DATA
Freescale Semiconductor, Inc.
When an interrupt is recognized, the current instruction finishes normally, the return
address (the current value in the program counter) is pushed onto the stack, all of the
CPU registers are pushed onto the stack, and execution continues at the address
specified by the vector for the interrupt. At the end of the interrupt service routine, an
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.
There are instructions that push and pull the A and B accumulators and the X and Y
index registers. These instructions 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.
..
.
nc
Freescale Semiconductor, I
3.1.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.
Table 3-1 Reset Vector Comparison
POR or RESET PinClock MonitorCOP Watchdog
Normal$FFFE, F$FFFC, D$FFFA, B
Test or Boot$BFFE, F$BFFC, D$BFFA, B
3.1.6 Condition Code Register (CCR)
This 8-bit register contains five condition code indicators (C, V, Z, N, and H), two interrupt masking bits, (I and X) and a stop disable bit (S). In the M68HC11 CPU, condition
codes are automatically updated 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
3-2, which shows what condition codes are affected by a particular instruction.
3.1.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.
3.1.6.2 Overflow (V)
The overflow bit is set if an operation causes an arithmetic overflow. Otherwise, the V
bit is cleared.
CENTRAL PROCESSING UNIT
TECHNICAL DATA3-5
For More Information On This Product,
Go to: www.freescale.com
..
.
nc
Freescale Semiconductor, Inc.
3.1.6.3 Zero (Z)
The Z bit is set if the result of an arithmetic, logic, or data manipulation operation is
zero. 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.
3.1.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 one. 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.
3.1.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 zero 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 SECTION 5 RESETS AND INTERRUPTS.
3.1.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.
3.1.6.7 X Interrupt Mask (X)
Freescale Semiconductor, I
The XIRQ
by default and must be cleared by a software instruction. When an XIRQ
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 zero; 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.
3-6TECHNICAL DATA
mask (X) bit disables interrupts from the XIRQ pin. After any reset, X is set
interrupt is
CENTRAL PROCESSING UNITMC68HC11F1
For More Information On This Product,
Go to: www.freescale.com
Loading...
+ 128 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.