MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAGeneral Description29
Page 30
General Description
1.2 Introduction
The MC68HC908AB32 is a member of the low-cost, high-performance
M68HC08 Family of 8-bit microcontroller units (MCUs) with embedded
EEPROM for user data storage. All MCUs in the family use the
enhanced M68HC08 central processor unit (CPU08) and are available
with a variety of modules, memory sizes and types, and package types.
1.3 Features
Features of the MC68HC908AB32 include the following:
•High-performance M68HC08 architecture
•Fully upward-compatible object code with M6805, M146805, and
M68HC05 Families
•Memory map and pin functions compatible with MC68HC08AB32
and MC68HC08AB16
•8-MHz internal bus frequency
•32K-bytes user program FLASH memory with security
1
feature
•512 bytes of on-chip EEPROM with security feature
•1K-byte of on-chip RAM
•Clock generator module (CGM)
•Two 16-bit, 4-channel timer interface modules (TIMA and TIMB)
with selectable input capture, output compare, and PWM
capability on each channel
•Low-power design (fully static with STOP and WAIT modes)
•Master reset pin and power-on reset
1. No security feature is absolutely secure. However, Motorola’s strategy is to make reading or
copying the FLASH difficult for unauthorized users.
Technical DataMC68HC908AB32 — Rev. 1.0
30General DescriptionMOTOROLA
Page 31
•51 general-purpose input/output (I/O) pins:
–30 shared-function I/O pins
–5-bit keyboard wakeup port
–Selectable pullups on inputs on port D and port F
•System protection features
–Optional computer operating properly (COP) reset
–Low-voltage detection with optional reset
–Illegal opcode detection with optional reset
–Illegal address detection with optional reset
•64-pin quad flat pack (QFP)
Features of the CPU08 include the following:
General Description
MCU Block Diagram
•Enhanced HC05 programming model
•Extensive loop control functions
•16 addressing modes (eight more than the HC05)
•16-bit Index register and stack pointer
•Memory-to-memory data transfers
•Fast 8 × 8 multiply instruction
•Fast 16/8 divide instruction
•Binary-coded decimal (BCD) instructions
•Optimization for controller applications
•Efficient C language support
1.4 MCU Block Diagram
Figure 1-1 shows the structure of the MC68HC908AB32.
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAGeneral Description31
Page 32
Technical DataMC68HC908AB32 — Rev. 1.0
32General DescriptionMOTOROLA
M68HC08 CPU
CPU
REGISTERS
ARITHMETIC/LOGIC
UNIT (ALU)
CONTROL AND STATUS REGISTERS — 80 BYTES
USER FLASH — 32,256 BYTES
USER RAM — 1024 BYTES
USER EEPROM — 512 BYTES
MONITOR ROM — 307 BYTES
USER FLASH VECTORS — 48 BYTES
CLOCK GENERATOR MODULE
OSC1
4.9125-MHz OSCILLATOR
OSC2
CGMXFC
* RST
* IRQ
PHASE-LOCKED LOOP
SYSTEM INTEGRATION
MODULE
SINGLE EXTERNAL IRQ
MODULE
V
REFH
A
VSS/VREFL
V
DDAREF
V
V
V
DD
V
SS
DDA
SSA
8-BIT ANALOG-TO-DIGITAL
CONVERTER MODULE
POWER
† Ports are software configurable with pullup device if input port.
‡ Higher current drive port pins
* Pin contains integrated pullup device
** Pullup enabled when configured as keyboard interrupt pin
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAGeneral Description33
Page 34
General Description
1.6 Pin Functions
Description of pin functions are provided here.
1.6.1 Power Supply Pins (V
and VSS)
DD
and VSS are the power supply and ground pins. The MCU operates
V
DD
from a single power supply.
Fast signal transitions on MCU pins place high, short-duration current
demands on the power supply. To prevent noise problems, take special
care to provide power supply bypassing at the MCU as Figure 1-3
shows. Place the C1 bypass capacitor as close to the MCU as possible.
Use a high-frequency-response ceramic capacitor for C1. C2 is an
optional bulk current bypass capacitor for use in applications that require
the port pins to source high current levels.
MCU
V
DD
C1
0.1 µF
V
SS
+
C2
V
DD
NOTE: Component values shown
represent typical applications.
Figure 1-3. Power Supply Bypassing
V
is also the ground for the port output buffers and the ground return
SS
for the serial clock in the serial peripheral interface module (SPI). See
Section 16. Serial Peripheral Interface Module (SPI).
V
must be grounded for proper MCU operation.
SS
Technical DataMC68HC908AB32 — Rev. 1.0
34General DescriptionMOTOROLA
Page 35
1.6.2 Oscillator Pins (OSC1 and OSC2)
The OSC1 and OSC2 pins are the connections for the on-chip oscillator
circuit. See Section 9. Clock Generator Module (CGM).
General Description
Pin Functions
1.6.3 External Reset Pin (RST
)
A logic 0 on the RST
is bidirectional, allowing a reset of the entire system. It is driven low when
any internal reset source is asserted. This pin contains an internal pullup
resistor. See Section 8. System Integration Module (SIM).
1.6.4 External Interrupt Pin (IRQ
is an asynchronous external interrupt pin. This pin contains an
IRQ
)
internal pullup resistor. See Section 18. External Interrupt (IRQ).
1.6.5 Analog Power Supply Pin (V
is the power supply pin for the clock generator module (CGM).
V
DDA
1.6.6 Analog Ground Pin (V
SSA
)
DDA
pin forces the MCU to a known start-up state. RST
)
The V
analog ground pin is used only for the ground connections for
SSA
the clock generator module (CGM) section of the circuit and should be
decoupled as per the V
digital ground pin. See Section 9. Clock
SS
Generator Module (CGM).
1.6.7 Analog Ground Pin (A
The A
/VREFL)
VSS
analog ground pin is used only for the ground connections for
VSS
the analog to digital convertor (ADC) and should be decoupled as per
the V
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAGeneral Description35
digital ground pin.
SS
Page 36
General Description
1.6.8 ADC Voltage Reference Pin (VREFH)
VREFH is the power supply for setting the reference voltage VREFH.
Connect this pin to a voltage such that 1.5V < VREFH ≤ V
DDAREF
.
1.6.9 Analog Supply Pin (V
The V
DDAREF
DDAREF
)
analog supply pin is used only for the supply connections
for the analog-to-digital convertor (ADC).
1.6.10 External Filter Capacitor Pin (CGMXFC)
CGMXFC is an external filter capacitor connection for the CGM. See
Section 9. Clock Generator Module (CGM).
1.6.11 Port A Input/Output (I/O) Pins (PTA7–PTA0)
PTA7–PTA0 are general-purpose bidirectional I/O port pins. See
Section 17. Input/Output (I/O) Ports.
1.6.12 Port B I/O Pins (PTB7/ATD7–PTB0/ATD0)
PTB7–PTB0 are special function, bidirectional port pins. PTB7–PTB0
are shared with the analog to digital convertor (ADC) input pins
ATD7–ATD0. See Section 14. Analog-to-Digital Converter (ADC) and
Section 17. Input/Output (I/O) Ports.
1.6.13 Port C I/O Pins (PTC5–PTC0)
PTC5–PTC0 are general-purpose bidirectional I/O port pins. PTC2 is a
special function port pin that is shared with the system clock output pin,
MCLK. See Section 17. Input/Output (I/O) Ports.
Technical DataMC68HC908AB32 — Rev. 1.0
36General DescriptionMOTOROLA
Page 37
1.6.14 Port D I/O Pins (PTD7–PTD0)
PTD7–PTD0 are general-purpose bidirectional I/O port pins. PTD6 and
PTD4 are special function port pins that are shared with the timer
interface modules (TIMA and TIMB). See Section 11. Timer Interface
Module A (TIMA) and Section 12. Timer Interface Module B (TIMB).
1.6.15 Port E I/O Pins (PTE7/SPSCK–PTE0/TxD)
PTE7–PTE0 are special function, bidirectional port pins. PTE7–PTE4
are shared with the serial peripheral interface mode (SPI), PTE3–PTE2
are shared with timer A (TIMA), and PTE1–PTE0 are shared with the
serial communications interface (SCI). See Section 15. Serial
Communications Interface Module (SCI), Section 16. Serial
Peripheral Interface Module (SPI), Section 11. Timer Interface
Module A (TIMA), and Section 17. Input/Output (I/O) Ports.
General Description
Pin Functions
1.6.16 Port F I/O Pins (PTF7–PTF0/TACH2)
PTF7–PTF6 are general-purpose bidirectional I/O port pins.
PTF5–PTF0 are special function, bidirectional port pins. PTF5–PTF2
are shared with timer B (TIMB), and PTF1–PTF0 are shared with timer
A (TIMA). See Section 11. Timer Interface Module A (TIMA), Section
12. Timer Interface Module B (TIMB), and Section 17. Input/Output
(I/O) Ports.
1.6.17 Port G I/O Pins (PTG2/KBD2–PTG0/KBD0)
PTG2–PTG0 are general-purpose bidirectional I/O pins with keyboard
wakeup function. See Section 19. Keyboard Interrupt Module (KBI)
and Section 17. Input/Output (I/O) Ports.
1.6.18 Port H I/O Pins (PTH1/KBD4–PTH0/KBD3)
PTH1–PTH0 are general-purpose bidirectional I/O pins with Keyboard
wakeup function. See Section 19. Keyboard Interrupt Module (KBI)
and Section 17. Input/Output (I/O) Ports.
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAGeneral Description37
Details of the clock connections to each of the modules on the
MC68HC908AB32 are shown in Table 1-2. A short description of each
clock source is also given in Table 1-3.
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAGeneral Description39
Page 40
General Description
1.8 Signal Name Conventions
Signal nameDescription
CGMXCLKBuffered version of OSC1 from clock generator module (CGM)
CGMOUTPLL-based or OSC1-based clock output from CGM module)
Bus clockCGMOUT divided by two
Table 1-2. Signal Name Conventions
1.9 Clock Source Summary
SPSCK
TACLK
TBCLK
SPI serial clock
(see 16.13.3 SPSCK (Serial Clock))
External clock input for TIMA
(see 11.9.1 TIMA Clock Pin)
External clock input for TIMB
(see 12.9.1 TIMB Clock Pin)
Table 1-3. Clock Source Summary
ModuleClock Source
ADCCGMXCLK or bus clock
COPCGMXCLK
CPUBus clock
EEPROMCGMXCLK or bus clock
ROMBus clock
RAMBus clock
SPISPSCK
SCICGMXCLK
TIMABus clock or PTD6/TACLK
TIMBBus clock or PTD4/TBCLK
The CPU08 can address 64K-bytes of memory space. The memory
map, shown in Figure 2-1, includes:
Section 2. Memory Map
•32, 256 bytes of user FLASH memory
•512 bytes of EEPROM
•1024 bytes of random-access memory (RAM)
•48 bytes of user-defined vectors
•307 bytes of monitor ROM
2.3 Unimplemented Memory Locations
Accessing an unimplemented location can cause an illegal address
reset if illegal address resets are enabled. In the memory map
(Figure 2-1) and in register figures in this document, unimplemented
locations are shaded.
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAMemory Map41
Page 42
Memory Map
2.4 Reserved Memory Locations
Accessing a reserved location can have unpredictable effects on MCU
operation. In the Figure 2-1 and in register figures in this document,
reserved locations are marked with the word Reserved or with the
letter R.
2.5 Input/Output (I/O) Section
Most of the control, status, and data registers are in the zero page
$0000–$004F. Additional I/O registers have the following addresses:
This section describes the 1024 bytes of RAM (random-access
memory).
3.3 Functional Description
Addresses $0050 through $044F are RAM locations. The location of the
stack RAM is programmable. The 16-bit stack pointer allows the stack to
be anywhere in the 64K-byte memory space.
NOTE:
For correct operation, the stack pointer must point only to RAM
locations.
Within page zero are 176 bytes of RAM. Because the location of the
stack RAM is programmable, all page zero RAM locations can be used
for I/O control and user data or code. When the stack pointer is moved
from its reset location at $00FF out of page zero, direct addressing mode
instructions can efficiently access all page zero RAM locations. Page
zero RAM, therefore, provides ideal locations for frequently accessed
global variables.
Before processing an interrupt, the CPU uses five bytes of the stack to
save the contents of the CPU registers.
NOTE:
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLARandom-Access Memory (RAM)57
For M6805 compatibility, the H register is not stacked.
Page 58
Random-Access Memory (RAM)
During a subroutine call, the CPU uses two bytes of the stack to store
the return address. The stack pointer decrements during pushes and
increments during pulls.
NOTE:
Be careful when using nested subroutines. The CPU may overwrite
data in the RAM during a subroutine or during the interrupt stacking
operation.
This section describes the operation of the embedded FLASH memory.
This memory can be read, programmed, and erased from a single
external supply. The program and erase operations are enabled through
the use of an internal charge pump.
4.3 Functional Description
The FLASH memory is an array of 32,256 bytes with an additional 48
bytes of user vectors and one byte of block protection.
reads as logic 1 and a programmed bit reads as a logic 0
FLASH array is organized into two rows per page basis. For the 32K
word by 8-Bit Embedded FLASH Memory, the page size is 128 bytes per
An erased bit
. Memory in the
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAFLASH Memory59
Page 60
FLASH Memory
page. Hence the minimum erase page size is 128 bytes. Program and
erase operations are facilitated through control bits in the FLASH Control
Register (FLCR). Details for these operations appear later in this
section. The address ranges for the user memory and vectors are:
•$8000–$FDFF; user memory.
•$FF7E; FLASH block protect register.
Programming tools are available from Motorola. Contact your local
Motorola representative for more information.
NOTE:
A security feature prevents viewing of the FLASH contents.
4.4 FLASH Control Register
The FLASH control register (FLCR) controls FLASH program and erase
operations.
Address:$FE08
Read:0000
Write:
Reset:00000000
•$FE08
;
FLASH control register.
•$FFDC–$FFFF; these locations are reserved for user-defined
interrupt and reset vectors.
1
Bit 7654321Bit 0
HVENMASSERASEPGM
Figure 4-1. FLASH Control Register (FLCR)
HVEN — High-Voltage Enable Bit
This read/write bit enables the charge pump to drive high voltages for
program and erase operations in the array. HVEN can only be set if
either PGM = 1 or ERASE = 1 and the proper sequence for program
or erase is followed.
1 = High voltage enabled to array and charge pump on
0 = High voltage disabled to array and charge pump off
1. No security feature is absolutely secure. However, Motorola’s strategy is to make reading or
copying the FLASH difficult for unauthorized users.
Technical DataMC68HC908AB32 — Rev. 1.0
60FLASH MemoryMOTOROLA
Page 61
FLASH Memory
FLASH Page Erase Operation
MASS — Mass Erase Control Bit
Setting this read/write bit configures the 32K-byte FLASH array for
mass erase operation.
1 = MASS erase operation selected
0 = MASS erase operation unselected
ERASE — Erase Control Bit
This read/write bit configures the memory for erase operation.
ERASE is interlocked with the PGM bit such that both bits cannot be
equal to 1 or set to 1 at the same time.
This read/write bit configures the memory for program operation.
PGM is interlocked with the ERASE bit such that both bits cannot be
equal to 1 or set to 1 at the same time.
1 = Program operation selected
0 = Program operation unselected
4.5 FLASH Page Erase Operation
Use this step-by-step procedure to erase a page (128 bytes) of FLASH
memory to read as logic 1:
1.Set the ERASE bit, and clear the MASS bit in the FLASH control
register.
2.Read the FLASH block protect register.
3.Write any data to any FLASH address within the page address
range desired.
4.Wait for a time, t
5.Set the HVEN bit.
6.Wait for a time, t
7.Clear the ERASE bit.
8.Wait for a time, t
(min. 10µs)
nvs
(min. 1ms)
Erase
(min. 5µs)
nvh
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAFLASH Memory61
Page 62
FLASH Memory
9.Clear the HVEN bit.
10.After a time, t
read mode.
NOTE:
While these operations must be performed in the order shown, other
unrelated operations may occur between the steps.
4.6 FLASH Mass Erase Operation
Use this step-by-step procedure to erase entire FLASH memory to read
as logic 1:
1.Set both the ERASE bit, and the MASS bit in the FLASH control
register.
2.Read from the FLASH block protect register.
3.Write any data to any FLASH address* within the FLASH memory
address range.
4.Wait for a time, t
(typ. 1µs), the memory can be accessed again in
rcv
(min. 10µs)
nvs
NOTE:
5.Set the HVEN bit.
6.Wait for a time, t
MErase
(min. 4ms)
7.Clear the ERASE bit.
8.Wait for a time, t
(min. 100µs)
nvhl
9.Clear the HVEN bit.
10.After a time, t
(min. 1µs), the memory can be accessed again in
rcv
read mode.
* When in Monitor mode, with security sequence failed (see 10.5 Security), write to the FLASH
block protect register instead of any FLASH address.
Programming and erasing of FLASH locations cannot be performed by
code being executed from the FLASH memory. While these operations
must be performed in the order shown, other unrelated operations may
occur between the steps.
Technical DataMC68HC908AB32 — Rev. 1.0
62FLASH MemoryMOTOROLA
Page 63
4.7 FLASH Program/Read Operation
Programming of the FLASH memory is done on a row basis. A row
consists of 64 consecutive bytes starting from addresses $XX00,
$XX40, $0080 and $XXC0. Use this step-by-step procedure to program
a row of FLASH memory (Figure 4-2 is a flowchart representation):
FLASH Memory
FLASH Program/Read Operation
NOTE:
In order to avoid program disturbs, the row must be erased before any
byte on that row is programmed.
1.Set the PGM bit. This configures the memory for program
operation and enables the latching of address and data for
programming.
2.Read from the FLASH block protect register.
3.Write any data to any FLASH address within the row address
range desired.
4.Wait for a time, t
(min. 10µs).
nvs
5.Set the HVEN bit.
6.Wait for a time, t
(min. 5µs).
pgs
7.Write data to the FLASH address to be programmed.*
8.Wait for a time, t
(min. 30µs).
PROG
9.Repeat step 7 and 8 until all the bytes within the row are
programmed.
10.Clear the PGM bit.*
11.Wait for a time, t
(min. 5µs).
nvh
12.Clear the HVEN bit.
13.After time, t
(min. 1µs), the memory can be accessed in read
rcv
mode again.
* The time between each FLASH address change, or the time between the last FLASH address
programmed to clearing PGM bit, must not exceed the maximum programming time, t
PROG
max.
This program sequence is repeated throughout the memory until all data
is programmed.
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAFLASH Memory63
Page 64
FLASH Memory
NOTE:
Programming and erasing of FLASH locations cannot be performed by
code being executed from the FLASH memory. While these operations
must be performed in the order shown, other unrelated operations may
occur between the steps. Do not exceed t
FLASH Memory Characteristics .
4.8 FLASH Block Protection
Due to the ability of the on-board charge pump to erase and program the
FLASH memory in the target application, provision is made for protecting
a block of memory from unintentional erase or program operations due
to system malfunction. This protection is done by using of a FLASH
Block Protect Register (FLBPR). The FLBPR determines the range of
the FLASH memory which is to be protected. The range of the protected
area starts from a location defined by FLBPR and ends at the bottom of
the FLASH memory ($FFFF). When the memory is protected, the HVEN
bit cannot be set in either ERASE or PROGRAM operations.
NOTE:
In performing a program or erase operation, the FLASH block protect
register must be read after setting the PGM or ERASE bit and before
asserting the HVEN bit
maximum. See 23.13
PROG
When the FLBPR is program with all 0’s, the entire memory is protected
from being programmed and erased. When all the bits are erased (all
1’s), the entire memory is accessible for program and erase.
When bits within the FLBPR are programmed, they lock a block of
memory, address ranges as shown in 4.8.1 FLASH Block Protect
Register . Once the FLBPR is programmed with a value other than $FF,
any erase or program of the FLBPR or the protected block of FLASH
memory is prohibited. The FLBPR itself can be erased or programmed
only with an external voltage, V
, present on the IRQ
TST
pin. This voltage
also allows entry from reset into the monitor mode.
Technical DataMC68HC908AB32
Rev. 1.0
—
64
FLASH MemoryMOTOROLA
Page 65
FLASH Memory
FLASH Block Protection
Algorithm for programming
a row (64 bytes) of FLASH memory
1
2
Read the FLASH block protect register
3
Write any data to any FLASH address
Set PGM bit
within the row address range desired
4
5
6
7
Wait for a time, t
nvs
Set HVEN bit
Wait for a time, t
pgs
Write data to the FLASH address
to be programmed
8
Wait for a time, t
PROG
Completed
programming
this row?
N
NOTE:
10
The time between each FLASH address change (step 7 to step 7), or
the time between the last FLASH address programmed
11
to clearing PGM bit (step 7 to step 10)
must not exceed the maximum programming
PROG
max.
12
time, t
This row program algorithm assumes the row/s
to be programmed are initially erased.
13
Y
Clear PGM bit
Wait for a time, t
Clear HVEN bit
Wait for a time, t
End of programming
nvh
rcv
Figure 4-2. FLASH Programming Flowchart
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAFLASH Memory65
Page 66
FLASH Memory
4.8.1 FLASH Block Protect Register
The FLASH block protect register (FLBPR) is implemented as a byte
within the FLASH memory, and therefore can only be written during a
programming sequence of the FLASH memory. The value in this register
determines the starting location of the protected range within the FLASH
memory.
Address:$FF7E
Bit 7654321Bit 0
Read:
BPR7BPR6BPR5BPR4BPR3BPR2BPR1BPR0
Write:
Reset:UUUUUUUU
U = Unaffected by reset. Initial value from factory is 1.
Write to this register is by a programming sequence to the FLASH memory.
Figure 4-3. FLASH Block Protect Register (FLBPR)
BPR[7:0] — FLASH Block Protect Bits
These eight bits represent bits [14:7] of a 16-bit memory address.
Bit-15 is logic 1 and bits [6:0] are logic 0s.
The resultant 16-bit address is used for specifying the start address
of the FLASH memory for block protection. The FLASH is protected
from this start address to the end of FLASH memory, at $FFFF. With
this mechanism, the protect start address can be XX00 and XX80
(128 bytes page boundaries) within the FLASH memory.
Note:
The end address of the protected range is always $FFFF.
4.10 Stop Mode
NOTE:
Putting the MCU into wait mode while the FLASH is in read mode does
not affect the operation of the FLASH memory directly, but there will not
be any memory activity since the CPU is inactive.
The WAIT instruction should not be executed while performing a
program or erase operation on the FLASH, otherwise the operation will
discontinue, and the FLASH will be on Standby Mode.
Putting the MCU into stop mode while the FLASH is in read mode does
not affect the operation of the FLASH memory directly, but there will not
be any memory activity since the CPU is inactive.
The STOP instruction should not be executed while performing a
program or erase operation on the FLASH, otherwise the operation will
discontinue, and the FLASH will be on Standby Mode
Standby Mode is the power saving mode of the FLASH module in which
all internal control signals to the FLASH are inactive and the current
consumption of the FLASH is at a minimum.
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAFLASH Memory67
The 512 bytes of EEPROM is located at $0800–$09FF, and can be
programmed or erased without an additional external high voltage
supply. The program and erase operations are enabled through the use
of an internal charge pump. For each byte of EEPROM, the write/erase
endurance is 10,000 cycles.
5.5 EEPROM Configuration
The 8-bit EEPROM non-volatile register (EENVR) and the 16-bit
EEPROM timebase divider non-volatile register (EEDIVNVR) contain
the default settings for the following EEPROM configurations:
•Security option
EEPROM
Functional Description
•Block protection
•EEPROM timebase reference
EENVR and EEDIVNVR are non-volatile, EEPROM registers. They are
programmed and erased in the same way as EEPROM bytes. The
contents of these registers are loaded into their respective volatile
registers during a MCU reset. The values in these read/write, volatile
registers define the EEPROM configurations.
For EENVR, the corresponding volatile register is the EEPROM array
configuration register (EEACR).
For the EEDIVNVR (two 8-bit registers: EEDIVHNVR and EEDIVLNVR),
the corresponding volatile register is the EEPROM timebase divider
register (EEDIV: EEDIVH and EEDIVL)
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAEEPROM71
Page 72
EEPROM
5.6 EEPROM Timebase Requirements
A 35µs timebase is required by the EEPROM control circuit for program
and erase of EEPROM content. This timebase is derived from dividing
the CGMXCLK or bus clock (selected by EEDIVCLK bit in CONFIG2
register) using a timebase divider circuit, controlled by the 16-bit
EEPROM timebase divider register (EEDIVH and EEDIVL).
As the CGMXCLK or bus clock is user selected, the EEPROM timebase
divider register must be configured with the appropriate value to obtain
the 35µs. The timebase divider is calculated using the following formula:
This value is written to the EEPROM timebase divider register (EEDIVH
and EEDIVL) or programmed into the EEPROM timebase divider nonvolatile register prior to any EEPROM program or erase operations (see
5.5 EEPROM Configuration and 5.11.3.1 EEPROM Timebase Divider
Non-Volatile Register).
5.7 EEPROM Security Options
The EEPROM has a special security option, enabled by programming
the EEPRTCT bit to 0 in the EEPROM non-volatile register (EENVR).
Once security is enabled, the following limitations apply to the EEPROM:
•The 16-byte EEPROM locations from $08F0 to $08FF are
•The block erase and bulk erase modes are disabled. Byte erase
EEDIV = INT
protected from erase and program operations.
can be used for all EEPROM locations except $08F0 to $08FF.
[Reference frequency (Hz) × 35 × 10
–6
+ 0.5]
•The EENVR is protected from further erase or program
operations.
5.8 EEPROM Block Protection
The 512 bytes of EEPROM is divided into four 128-byte blocks. Each of
these blocks can be protected from erase/program operations by setting
the EEBPx bit in the EENVR. Table 5-1 shows the address ranges for
the blocks.
These bits are effective after a reset or a read to EENVR register. The
block protect configuration can be modified by erasing/programming the
corresponding bits in the EENVR register and then reading the EENVR
register.
5.9 EEPROM Programming and Erasing
EEPROM
EEPROM Programming and Erasing
NOTE:
The unprogrammed or erased state of an EEPROM bit is a logic 1. The
factory default for the EEPROM array is $FF for all bytes.
The programming operation changes an EEPROM bit from logic 1 to
logic 0 (programming cannot change a bit from logic 0 to a logic 1). In a
single programming operation, the minimum EEPROM programming
size is zero bits; the maximum is eight bits (one byte).
The erase operation changes an EEPROM bit from logic 0 to logic 1. In
a single erase operation, the minimum EEPROM erase size is one byte;
the maximum is the entire EEPROM array.
For each EEPROM byte, the write/erase endurance is 10,000 cycles.
One write/erase cycle is defined as:
a maximum of eight programming
operations on the same byte followed by an erase operation of the that
byte
. Therefore, it is possible to program a byte, bit by bit to logic 0
before requiring an erase on that byte.
Although programming a bit (from 0 or 1) with a logic 1 does not change
the state of that bit, it is still regarded as a programming operation. That
is, if the same byte is programmed eight times (with any value), that byte
must be erased before it can be successfully programmed again.
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAEEPROM73
Page 74
EEPROM
5.9.1 EEPROM Programming
The unprogrammed or erased state of an EEPROM bit is a logic 1.
Programming changes the state to a logic 0. Only EEPROM bytes in the
non-protected blocks and the EENVR register can be programmed.
Use the following procedure to program a byte of EEPROM:
1.Clear EERAS1 and EERAS0, and set EELAT in the EECR.
2.Write the desired data to the desired EEPROM address.
3.Set the EEPGM bit.
(C)
(A)
(B)
Go to step 7 if AUTO is set.
4.Wait for a time, t
EEPGM
, to program the byte.
5.Clear EEPGM bit.
6.Wait for a time, t
EEFPV
, for the programming voltage to fall.
Go to step 8.
7.Poll the EEPGM bit until it is cleared by the internal timer.
NOTE:
8.Clear EELAT bit.
A. EERAS1 and EERAS0 must be cleared for programming. Setting the
(E)
(D)
EELAT bit configures the address and data buses to latch data for
programming the array. Only data with a valid EEPROM address will be
latched. If EELAT is set, other writes to the EECR will be allowed after a
valid EEPROM write.
B. If more than one valid EEPROM writes occur, the last address and
data will be latched, overriding the previous address and data. Once
written data to the desired address, do not read EEPROM locations
other than the written location. (Reading an EEPROM location returns
the latched data, and causes the read address to be latched.)
C. The EEPGM bit cannot be set if the EELAT bit is cleared or a nonvalid EEPROM address is latched. This is to ensure proper
programming sequence. Once EEPGM is set, do not read any EEPROM
locations, otherwise the current program cycle will be unsuccessful.
When EEPGM is set, the on-board programming sequence will be
activated.
Technical DataMC68HC908AB32 — Rev. 1.0
74EEPROMMOTOROLA
Page 75
5.9.2 EEPROM Erasing
EEPROM
EEPROM Programming and Erasing
D. The delay time for the EEPGM bit to be cleared in AUTO mode is less
than t
EEPGM
. However, on other MCUs, this delay time may be different.
For forward compatibility, software should not make any dependency on
this delay time.
E. Any attempt to clear both EEPGM and EELAT bits with a single
instruction will only clear EEPGM. This is to allow time for removal of
high voltage from the EEPROM array.
The programmed state of an EEPROM bit is logic 0. Erasing changes
the state to a logic 1. Only EEPROM bytes in the non-protected blocks
and EENVR register can be erased.
Use the following procedure to erase a byte, block, or the entire
EEPROM:
1.Configure EERAS1 and EERAS0 for byte, block, or bulk erase; set
EELAT in EECR.
2.Byte erase: write any data to the desired address.
(A)
(B)
Block erase: write any data to an address within the desired
block.
Bulk erase: write any data to an address within the array.
3.Set the EEPGM bit.
(B)
(B)
(C)
Go to step 7 if AUTO is set.
4.Wait for a time: t
t
EBULK
for bulk erase.
EBYTE
for byte erase; t
EBLOCK
for block erase;
5.Clear EEPGM bit.
6.Wait for a time, t
EEFPV
, for the erasing voltage to fall.
Go to step 8.
7.Poll the EEPGM bit until it is cleared by the internal timer.
8.Clear EELAT bits.
(E)
(D)
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAEEPROM75
Page 76
EEPROM
NOTE:
A. Setting the EELAT bit configures the address and data buses to latch
data for erasing the array. Only valid EEPROM addresses will be
latched. If EELAT is set, other writes to the EECR will be allowed after a
valid EEPROM write.
B. If more than one valid EEPROM writes occur, the last address and
data will be latched, overriding the previous address and data. Once
written data to the desired address, do not read EEPROM locations
other than the written location. (Reading an EEPROM location returns
the latched data, and causes the read address to be latched.)
EENVR is not affected by block or bulk erase.
C. The EEPGM bit cannot be set if the EELAT bit is cleared or a nonvalid EEPROM address is latched. This is to ensure proper
programming sequence. Once EEPGM is set, do not read any EEPROM
locations, otherwise the current erase cycle will be unsuccessful. When
EEPGM is set, the erase mode cannot be changed, and the on-board
erasing sequence will be activated.
D. The delay time for the EEPGM bit to be cleared in AUTO mode is less
than t
EBYTE
/ t
EBLOCK
/ t
EBULK
. However, on other MCUs, this delay time
may be different. For forward compatibility, software should not make
any dependency on this delay time.
E. Any attempt to clear both EEPGM and EELAT bits with a single
instruction will only clear EEPGM. This is to allow time for removal of
high voltage from the EEPROM array.
5.10 Low Power Modes
The WAIT and STOP instructions can put the MCU in low power
consumption standby modes.
5.10.1 Wait Mode
The WAIT instruction does not affect the EEPROM. It is possible to start
the program or erase sequence on the EEPROM and put the MCU in
wait mode.
Technical DataMC68HC908AB32 — Rev. 1.0
76EEPROMMOTOROLA
Page 77
5.10.2 Stop Mode
EEPROM
EEPROM Registers
The STOP instruction reduces the EEPROM power consumption to a
minimum. The STOP instruction should not be executed while the
programming and erasing sequence is in progress.
If stop mode is entered while EELAT and EEPGM is set, the
programming sequence will be stopped and the programming voltage to
the EEPROM array removed. The programming sequence will be
restarted after leaving stop mode; access to the EEPROM is only
possible after the programming sequence has completed.
If stop mode is entered while EELAT and EEPGM is cleared, the
programming sequence will be terminated abruptly.
In either case, the data integrity of the EEPROM is not guaranteed.
5.11 EEPROM Registers
Four I/O registers and three non-volatile registers control program,
erase, and options of the EEPROM array.
5.11.1 EEPROM Control Register
This read/write register controls programming/erasing of the EEPROM
array.
Address:$FE1D
Bit 7654321Bit 0
Read:
EEDUM
Write:
Reset:00000000
EEDUM — Dummy Bit
0
EEOFFEERAS1EERAS0EELATAUTOEEPGM
Figure 5-2. EEPROM Control Register (EECR)
This read/write bit has no function.
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAEEPROM77
Page 78
EEPROM
EEOFF — EEPROM Power-Off
This read/write bit disables the EEPROM module for lower power
consumption. Any attempts to access the array will give unpredictable
results. Reset clears this bit.
1 = Disable EEPROM array
0 = Enable EEPROM array
EERAS[1:0] — Erase/Program Mode Select Bits
These read/write bits set the erase modes. Reset clears these bits.
Table 5-2. EEPROM Program/Erase Mode Select
EEBPx EERAS1 EERAS0 Mode
0 0 0 Byte Program
0 0 1 Byte Erase
0 1 0 Block Erase
0 1 1 Bulk Erase
1 X X No Erase/Program
X = don’t care
EELAT — EEPROM Latch Control
This read/write bit latches the address and data buses for
programming the EEPROM array. EELAT can not be cleared if
EEPGM is still set. Reset clears this bit.
1 = Buses configured for EEPROM program or erase operation
0 = Buses configured for normal operation
AUTO — Automatic termination of program/erase cycle
When AUTO is set, EEPGM is cleared automatically after the
program/erase cycle is terminated by the internal timer.
(See note D for 5.9.1 EEPROM Programming and 5.9.2 EEPROM
Erasing.)
0 = Automatic clear of EEPGM is disabled
1 = Automatic clear of EEPGM is enabled
Technical Data MC68HC908AB32 — Rev. 1.0
78 EEPROM MOTOROLA
Page 79
EEPROM
EEPROM Registers
EEPGM — EEPROM Program/Erase Enable
This read/write bit enables the internal charge pump and applies the
programming/erasing voltage to the EEPROM array if the EELAT bit
is set and a write to a valid EEPROM location has occurred. Reset
clears the EEPGM bit.
1 = EEPROM programming/erasing power switched on
0 = EEPROM programming/erasing power switched off
NOTE:
Writing 0s to both the EELAT and EEPGM bits with a single instruction
will only clear EEPGM. This is to allow time for the removal of high
voltage.
5.11.2 EEPROM Array Configuration Register
The EEPROM array configuration register configures EEPROM security
and EEPROM block protection.
This read-only register is loaded with the contents of the EEPROM nonvolatile register (EENVR) after a reset.
This register is erased and programmed in the same way as an
EEPROM byte.
Address:$FE1C
Bit 7654321Bit 0
Read:
CON3CON2CON1
Write:
Reset:Unaffected by reset; $FF when blank; factory programmed $10
Note: Non-volatile EEPROM register; write by programming.
Figure 5-4. EEPROM Non-Volatile Register (EENVR)
NOTE:
The EENVR is factory programmed with $10.
5.11.3 EEPROM Timebase Divider Register
The 16-bit EEPROM timebase divider register consists of two 8-bit
registers: EEDIVH and EEDIVL. The 11-bit value in this register is used
to configure the timebase divider circuit to obtain the 35µs timebase for
EEPROM control.
EEPRTCT
EEBP3EEBP2EEBP1EEBP0
Technical DataMC68HC908AB32 — Rev. 1.0
80EEPROMMOTOROLA
Page 81
EEPROM
EEPROM Registers
These two read/write registers are respectively loaded with the contents
of the EEPROM timebase divider non-volatile registers (EEDIVHNVR
and EEDIVLNVR) after a reset.
Address:$FE1A
Bit 7654321Bit 0
Read:
EEDIVSECD
Write:
Reset:Contents of EEDIVHNVR ($FE10)
RRRREEDIV10EEDIV9EEDIV8
Figure 5-5. EEPROM Divider Register High (EEDIVH)
Address:$FE1B
Bit 7654321Bit 0
Read:
EEDIV7EEDIV6EEDIV5EEDIV4EEDIV3EEDIV2EEDIV1EEDIV0
Write:
Reset:Contents of EEDIVLNVR ($FE11)
Figure 5-6. EEPROM Divider Register Low (EEDIVL)
EEDIVSECD — EEPROM Divider Security Disable
This bit enables/disables the security feature of the EEDIV registers.
When EEDIV security feature is enabled, the state of the registers
EEDIVH and EEDIVL are locked (including this EEDIVSECD bit). The
EEDIVHNVR and EEDIVLNVR non-volatile memory registers are
also protected from being erased/programmed.
These prescaler bits store the value of EEDIV which is used as the
divisor to derive a timebase of 35µs from the selected reference clock
source (CGMXCLK or bus clock, see 6.5 Configuration Register 2)
for the EEPROM related internal timer and circuits. EEDIV[10:0] bits
are readable at any time. They are writable when EELAT=0 and
EEDIVSECD=1.
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAEEPROM81
Page 82
EEPROM
The EEDIV value is calculated by the following formula:
EEDIV = INT
[Reference frequency (Hz) × 35 × 10
Where the result inside the bracket is rounded down to the nearest
integer value.
For example, if the reference frequency is 4.9152MHz, the EEDIV
value is 172.
NOTE:
Programming/erasing the EEPROM with an improper EEDIV value may
result in data lost and reduce endurance of the EEPROM device.
The 16-bit EEPROM timebase divider non-volatile register consists of
two 8-bit registers: EEDIVHNVR and EEDIVLNVR. The contents of
these two registers are respectively loaded into the EEPROM timebase
divider registers, EEDIVH and EEDIVL, after a reset.
These two registers are erased and programmed in the same way as an
EEPROM byte.
These two registers are protected from erase and program operations if
the EEDIVSECD is set to logic 1 in the EEDIVH (see 5.11.3 EEPROM
Timebase Divider Register), or programmed to a logic 1 in the
EEDIVHNVR.
NOTE:
Once EEDIVSECD in the EEDIVHNVR is programmed to 0 and after a
system reset, the EEDIV security feature is permanently enabled
because the EEDIVSECD bit in the EEDIVH is always loaded with a 0
thereafter. Once this security feature is armed, erase and program
operations are disabled for EEDIVHNVR and EEDIVLNVR.
Modifications to the EEDIVH and EEDIVL registers are also disabled.
Therefore, care should be taken before programming a value into the
EEDIVHNVR.
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAEEPROM83
This section describes the configuration registers, CONFIG1 and
CONFIG2. The configuration registers enable or disable these options:
•Low-voltage inhibit (LVI) in stop mode
•LVI reset
•LVI module power
•Stop mode recovery time (32 CGMXCLK cycles or 4096
CGMXCLK cycles)
•COP timeout period (2
•STOP instruction
•Computer operating properly module (COP)
•EEPROM reference clock source (CPU bus clock or CGMXCLK)
18
– 24 or 213 – 24 CGMXCLK cycles)
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAConfiguration Register (CONFIG)85
Page 86
Configuration Register (CONFIG)
6.3 Functional description
The configuration registers are used in the initialization of various
options. The configuration registers can be written once after each reset.
All of the configuration register bits are cleared during reset. Since the
various options affect the operation of the MCU, it is recommended that
these registers be written immediately after reset. The configuration
registers are located at $001F and $003F. The configuration register
may be read at anytime.
6.4 Configuration Register 1
Address:$001F
Bit 7654321Bit 0
Read:
LVISTOPRLVIRSTDLVIPWRDSSRECCOPRSSTOPCOPD
Write:
Reset:00000000
R = Reserved
Figure 6-1. Configuration Register 1 (CONFIG1)
LVISTOP — LVI Enable in Stop Mode Bit
When the LVIPWRD bit is clear, setting the LVISTOP bit enables the
LVI to operate in stop mode. Reset clears LVISTOP. (See Section
21. Low-Voltage Inhibit (LVI).)
1 = LVI enabled during stop mode
0 = LVI disabled during stop mode
LVIRSTD — LVI Reset Disable Bit
LVIRSTD disables the reset signal from the LVI module. (See
COPD disables the COP module. (See Section 20. Computer
Operating Properly (COP).)
1 = COP module disabled
0 = COP module enabled
Extra care should be exercised when using this emulation part for
development of code to be run in ROM AB, AS or AZ parts that the
options selected by setting the CONFIG1 register match exactly the
options selected on any ROM code request submitted. The
enable/disable logic is not necessarily identical in all parts of the
AB, AS, and AZ families. If in doubt, check with your local field
applications representative.
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLAConfiguration Register (CONFIG)87
Page 88
Configuration Register (CONFIG)
6.5 Configuration Register 2
Address:$003F
Bit 7654321Bit 0
Read:
Write:
Reset:0
EEDIVCLK
R
R = Reserved
RRRRRR
Figure 6-2. Configuration Register 2 (CONFIG2)
EEDIVCLK — EEPROM Timebase Divider Clock Select Bit
EEDIVCLK selects the reference clock source for the EEPROM
timebase divider. (See Section 5. EEPROM.)
1 = CPU bus clock drives the EEPROM timebase divider
0 = CGMXCLK drives the EEPROM timebase divider
Extra care should be exercised when using this emulation part for
development of code to be run in ROM AB, AS or AZ parts that the
options selected by setting the CONFIG2 register match exactly the
options selected on any ROM code request submitted. The
enable/disable logic is not necessarily identical in all parts of the
AB, AS, and AZ families. If in doubt, check with your local field
applications representative.
The M68HC08 CPU (central processor unit) is an enhanced and fully
object-code-compatible version of the M68HC05 CPU. The
Reference Manual
contains a description of the CPU instruction set, addressing modes,
and architecture.
(Motorola document order number CPU08RM/AD)
CPU08
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLACentral Processor Unit (CPU)89
Page 90
Central Processor Unit (CPU)
7.3 Features
•Object code fully upward-compatible with M68HC05 Family
•16-bit stack pointer with stack manipulation instructions
•16-bit index register with x-register manipulation instructions
•8-MHz CPU internal bus frequency
•64K-byte program/data memory space
•16 addressing modes
•Memory-to-memory data moves without using accumulator
•Fast 8-bit by 8-bit multiply and 16-bit by 8-bit divide instructions
•Enhanced binary-coded decimal (BCD) data handling
•Modular architecture with expandable internal bus definition for
extension of addressing range beyond 64K-bytes
7.4 CPU Registers
•Low-power stop and wait modes
Figure 7-1 shows the five CPU registers. CPU registers are not part of
the memory map.
Technical DataMC68HC908AB32 — Rev. 1.0
90Central Processor Unit (CPU)MOTOROLA
Page 91
Central Processor Unit (CPU)
CPU Registers
7.4.1 Accumulator
7
15
HX
15
15
70
V11H I NZC
0
ACCUMULATOR (A)
0
INDEX REGISTER (H:X)
0
STACK POINTER (SP)
0
PROGRAM COUNTER (PC)
CONDITION CODE REGISTER (CCR)
CARRY/BORROW FLAG
ZERO FLAG
NEGATIVE FLAG
INTERRUPT MASK
HALF-CARRY FLAG
TWO’S COMPLEMENT OVERFLOW FLAG
Figure 7-1. CPU Registers
The accumulator is a general-purpose 8-bit register. The CPU uses the
accumulator to hold operands and the results of arithmetic/logic
operations.
Bit 7654321Bit 0
Read:
Write:
Reset:Unaffected by reset
Figure 7-2. Accumulator (A)
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLACentral Processor Unit (CPU)91
Page 92
Central Processor Unit (CPU)
7.4.2 Index Register
The 16-bit index register allows indexed addressing of a 64K-byte
memory space. H is the upper byte of the index register, and X is the
lower byte. H:X is the concatenated 16-bit index register.
In the indexed addressing modes, the CPU uses the contents of the
index register to determine the conditional address of the operand.
The index register can serve also as a temporary data storage location.
7.4.3 Stack Pointer
Bit
1413121110987654321
15
Read:
Write:
Reset:00000000XXXXXXXX
X = Indeterminate
Bit
0
Figure 7-3. Index Register (H:X)
The stack pointer is a 16-bit register that contains the address of the next
location on the stack. During a reset, the stack pointer is preset to
$00FF. The reset stack pointer (RSP) instruction sets the least
significant byte to $FF and does not affect the most significant byte. The
stack pointer decrements as data is pushed onto the stack and
increments as data is pulled from the stack.
In the stack pointer 8-bit offset and 16-bit offset addressing modes, the
stack pointer can function as an index register to access data on the
stack. The CPU uses the contents of the stack pointer to determine the
conditional address of the operand.
Technical DataMC68HC908AB32 — Rev. 1.0
92Central Processor Unit (CPU)MOTOROLA
Page 93
Central Processor Unit (CPU)
CPU Registers
NOTE:
7.4.4 Program Counter
Bit
1413121110987654321
15
Read:
Write:
Reset:0000000011111111
Bit
0
Figure 7-4. Stack Pointer (SP)
The location of the stack is arbitrary and may be relocated anywhere in
RAM. Moving the SP out of page 0 ($0000 to $00FF) frees direct
address (page 0) space. For correct operation, the stack pointer must
point only to RAM locations.
The program counter is a 16-bit register that contains the address of the
next instruction or operand to be fetched.
Normally, the program counter automatically increments to the next
sequential memory location every time an instruction or operand is
fetched. Jump, branch, and interrupt operations load the program
counter with an address other than that of the next sequential location.
During reset, the program counter is loaded with the reset vector
address located at $FFFE and $FFFF. The vector address is the
address of the first instruction to be executed after exiting the reset state.
Bit
1413121110987654321
15
Read:
Write:
Reset:Loaded with Vector from $FFFE and $FFFF
Bit
0
Figure 7-5. Program Counter (PC)
7.4.5 Condition Code Register
The 8-bit condition code register contains the interrupt mask and five
flags that indicate the results of the instruction just executed. Bits 6 and
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLACentral Processor Unit (CPU)93
Page 94
Central Processor Unit (CPU)
5 are set permanently to logic 1. The following paragraphs describe the
functions of the condition code register.
Bit 7654321Bit 0
Read:
Write:
Reset:X11X1XXX
V11H I NZC
X = Indeterminate
Figure 7-6. Condition Code Register (CCR)
V — Overflow Flag
The CPU sets the overflow flag when a two's complement overflow
occurs. The signed branch instructions BGT, BGE, BLE, and BLT use
the overflow flag.
1 = Overflow
0 = No overflow
H — Half-Carry Flag
The CPU sets the half-carry flag when a carry occurs between
accumulator bits 3 and 4 during an add-without-carry (ADD) or addwith-carry (ADC) operation. The half-carry flag is required for binarycoded decimal (BCD) arithmetic operations. The DAA instruction uses
the states of the H and C flags to determine the appropriate correction
factor.
1 = Carry between bits 3 and 4
0 = No carry between bits 3 and 4
Technical DataMC68HC908AB32 — Rev. 1.0
94Central Processor Unit (CPU)MOTOROLA
Page 95
Central Processor Unit (CPU)
CPU Registers
I — Interrupt Mask
When the interrupt mask is set, all maskable CPU interrupts are
disabled. CPU interrupts are enabled when the interrupt mask is
cleared. When a CPU interrupt occurs, the interrupt mask is set
automatically after the CPU registers are saved on the stack, but
before the interrupt vector is fetched.
1 = Interrupts disabled
0 = Interrupts enabled
NOTE:
To maintain M6805 Family compatibility, the upper byte of the index
register (H) is not stacked automatically. If the interrupt service routine
modifies H, then the user must stack and unstack H using the PSHH and
PULH instructions.
After the I bit is cleared, the highest-priority interrupt request is
serviced first.
A return-from-interrupt (RTI) instruction pulls the CPU registers from
the stack and restores the interrupt mask from the stack. After any
reset, the interrupt mask is set and can be cleared only by the clear
interrupt mask software instruction (CLI).
N — Negative flag
The CPU sets the negative flag when an arithmetic operation, logic
operation, or data manipulation produces a negative result, setting bit
7 of the result.
1 = Negative result
0 = Non-negative result
Z — Zero flag
The CPU sets the zero flag when an arithmetic operation, logic
operation, or data manipulation produces a result of $00.
1 = Zero result
0 = Non-zero result
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLACentral Processor Unit (CPU)95
Page 96
Central Processor Unit (CPU)
C — Carry/Borrow Flag
The CPU sets the carry/borrow flag when an addition operation
produces a carry out of bit 7 of the accumulator or when a subtraction
operation requires a borrow. Some instructions — such as bit test and
branch, shift, and rotate — also clear or set the carry/borrow flag.
1 = Carry out of bit 7
0 = No carry out of bit 7
7.5 Arithmetic/Logic Unit (ALU)
The ALU performs the arithmetic and logic operations defined by the
instruction set.
7.6 Low-Power Modes
7.6.1 Wait Mode
Refer to the
number CPU08RM/AD) for a description of the instructions and
addressing modes and more detail about the architecture of the CPU.
The WAIT and STOP instructions put the MCU in low power-consumption
standby modes.
The WAIT instruction:
•Clears the interrupt mask (I bit) in the condition code register,
enabling interrupts. After exit from wait mode by interrupt, the I bit
remains clear. After exit by reset, the I bit is set.
•Disables the CPU clock
CPU08 Reference Manual
(Motorola document order
Technical DataMC68HC908AB32 — Rev. 1.0
96Central Processor Unit (CPU)MOTOROLA
Page 97
7.6.2 Stop Mode
The STOP instruction:
•Clears the interrupt mask (I bit) in the condition code register,
enabling external interrupts. After exit from stop mode by external
interrupt, the I bit remains clear. After exit by reset, the I bit is set.
•Disables the CPU clock
After exiting stop mode, the CPU clock begins running after the oscillator
stabilization delay.
7.7 CPU During Break Interrupts
If a break module is present on the MCU, the CPU starts a break
interrupt by:
Central Processor Unit (CPU)
CPU During Break Interrupts
•Loading the instruction register with the SWI instruction
•Loading the program counter with $FFFC:$FFFD or with
$FEFC:$FEFD in monitor mode
The break interrupt begins after completion of the CPU instruction in
progress. If the break address register match occurs on the last cycle of
a CPU instruction, the break interrupt begins immediately.
A return-from-interrupt instruction (RTI) in the break routine ends the
break interrupt and returns the MCU to normal operation if the break
interrupt has been deasserted.
7.8 Instruction Set Summary
7.9 Opcode Map
See Table 7-2.
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLACentral Processor Unit (CPU)97
Page 98
Central Processor Unit (CPU)
Table 7-1. Instruction Set Summary
Source
ADC #
ADC
ADC
ADC
ADC
ADC ,X
ADC
ADC
ADD #
ADD
ADD
ADD
ADD
ADD ,X
ADD
ADD
Form
opr
opr
opr
opr
opr
opr
opr
opr
opr
opr
opr
opr
opr
opr
,X
,X
,SP
,SP
,X
,X
,SP
,SP
Add with Carry A ← (A) + (M) + (C)↕↕– ↕↕↕
Add without CarryA ← (A) + (M)↕↕– ↕↕↕
OperationDescription
Effect on
CCR
VHINZC
IMM
DIR
EXT
IX2
IX1
IX
SP1
SP2
IMM
DIR
EXT
IX2
IX1
IX
SP1
SP2
Address
Mode
A9
B9
C9
D9
E9
F9
9EE9
9ED9
AB
BB
CB
DB
EB
FB
9EEB
9EDB
Opcode
ii
dd
hh ll
ee ff
ff
ff
ee ff
ii
dd
hh ll
ee ff
ff
ff
ee ff
Operand
Cycles
2
3
4
4
3
2
4
5
2
3
4
4
3
2
4
5
AIS #
opr
AIX #
opr
AND #
opr
AND
opr
AND
opr
AND
opr
AND
opr
AND ,X
opr
AND
AND
opr
opr
ASL
ASLA
ASLX
ASL
opr
ASL ,X
ASL
opr
ASR
opr
ASRA
ASRX
ASR
opr
ASR
opr
ASR
opr
BCC
rel
BCLR n,
,X
,X
,SP
,SP
,X
,SP
,X
,X
,SP
opr
Add Immediate Value (Signed) to SPSP ← (SP) + (16 « M)––––––IMM A7 ii 2
Add Immediate V alue (Signed) to H:XH:X ← (H:X) + (16 « M)––––––IMMAF ii2
IMM
DIR
EXT
Logical ANDA ← (A) & (M)0 – – ↕↕–
Arithmetic Shift Left
(Same as LSL)
Arithmetic Shift Right↕ ––↕↕↕
Branch if Carry Bit ClearPC ← (PC) + 2 + rel ? (C) = 0––––––REL24 rr3
Clear Bit n in MMn ← 0––––––
C
b7
b7
0
b0
C
b0
↕ ––↕↕↕
IX2
IX1
IX
SP1
SP2
DIR
INH
INH
IX1
IX
SP1
DIR
INH
INH
IX1
IX
SP1
DIR (b0)
DIR (b1)
DIR (b2)
DIR (b3)
DIR (b4)
DIR (b5)
DIR (b6)
DIR (b7)
A4
B4
C4
D4
E4
F4
9EE4
9ED4
38
48
58
68
78
9E68
37
47
57
67
77
9E67
11
13
15
17
19
1B
1D
1F
ii
dd
hh ll
ee ff
ff
ff
ee ff
dd
ff
ff
dd
ff
ff
dd
dd
dd
dd
dd
dd
dd
dd
2
3
4
4
3
2
4
5
4
1
1
4
3
5
4
1
1
4
3
5
4
4
4
4
4
4
4
4
Technical DataMC68HC908AB32 — Rev. 1.0
98Central Processor Unit (CPU)MOTOROLA
Page 99
BCS
BEQ
Source
Form
rel
rel
Table 7-1. Instruction Set Summary (Continued)
OperationDescription
Branch if Carry Bit Set (Same as BLO)PC ← (PC) + 2 +
Branch if EqualPC ← (PC) + 2 +
Central Processor Unit (CPU)
Opcode Map
Effect on
CCR
VHINZC
rel
? (C) = 1––––––REL25 rr3
rel
? (Z) = 1––––––REL27 rr3
Address
Mode
Opcode
Operand
Cycles
BGE
BGT
BHCC
BHCS
BHI
rel
BHS
BIH
rel
BIL
rel
BIT #
BIT
opr
BIT
opr
BIT
opr
BIT
opr
BIT ,X
BIT
opr
BIT
opr
BLE
BLO
opr
opr
rel
opr
opr
rel
rel
rel
,X
,X
,SP
,SP
Branch if Greater Than or Equal To
(Signed Operands)
Branch if Greater Than (Signed
Operands)
Branch if Half Carry Bit ClearPC ← (PC) + 2 +
Branch if Half Carry Bit SetPC ← (PC) + 2 +
Branch if HigherPC ← (PC) + 2 +
Branch if Higher or Same
(Same as BCC)
Branch if IRQ Pin HighPC ← (PC) + 2 +
Branch if IRQ Pin LowPC ← (PC) + 2 +
Bit Test (A) & (M)0 – – ↕↕–
Branch if Less Than or Equal To
(Signed Operands)
Branch if Lower (Same as BCS)PC ← (PC) + 2 +
PC ← (PC) + 2 +
PC ← (PC) + 2 +
PC ← (PC) + 2 +
PC ← (PC) + 2 +
rel
? (N ⊕ V) = 0––––––REL90 rr3
rel
? (Z) | (N ⊕ V) =
0
rel
? (H) = 0––––––REL28 rr3
rel
? (H) = 1––––––REL29 rr3
rel
? (C) | (Z) = 0––––––REL22 rr3
rel
? (C) = 0––––––REL24 rr3
rel
? IRQ = 1––––––REL2F rr3
rel
? IRQ = 0––––––REL2E rr3
rel
? (Z) | (N ⊕ V) =
1
rel
? (C) = 1––––––REL25 rr3
––––––REL92 rr3
––––––REL93 rr3
IMM
DIR
EXT
IX2
IX1
IX
SP1
SP2
A5
B5
C5
D5
E5
F5
9EE5
9ED5
ii
dd
hh ll
ee ff
ff
ff
ee ff
2
3
4
4
3
2
4
5
BLS
BLT
BMC
BMI
BMS
BNE
BPL
BRA
rel
opr
rel
rel
rel
rel
rel
rel
Branch if Lower or SamePC ← (PC) + 2 +
Branch if Less Than (Signed Operands)PC ← (PC) + 2 +
Branch if Interrupt Mask ClearPC ← (PC) + 2 +
Branch if MinusPC ← (PC) + 2 +
Branch if Interrupt Mask SetPC ← (PC) + 2 +
Branch if Not EqualPC ← (PC) + 2 +
Branch if PlusPC ← (PC) + 2 +
Branch AlwaysPC ← (PC) + 2 +
rel
? (C) | (Z) = 1––––––REL23 rr3
rel
? (N ⊕ V) =1 ––––––REL91 rr3
rel
rel
? (N) = 1––––––REL2B rr3
rel
rel
rel
? (N) = 0––––––REL2A rr3
? (I) = 0––––––REL2C rr3
? (I) = 1––––––REL2D rr3
? (Z) = 0––––––REL26 rr3
rel
––––––REL20 rr3
MC68HC908AB32 — Rev. 1.0Technical Data
MOTOROLACentral Processor Unit (CPU)99
Page 100
Central Processor Unit (CPU)
Table 7-1. Instruction Set Summary (Continued)
Source
Form
BRCLR n,
BRN
rel
opr,rel
Branch if Bit n in M ClearPC ← (PC) + 3 +
Branch NeverPC ← (PC) + 2––––––REL21 rr3
OperationDescription
Effect on
CCR
VHINZC
rel
? (Mn) = 0–––––↕
Address
Mode
DIR (b0)
DIR (b1)
DIR (b2)
DIR (b3)
DIR (b4)
DIR (b5)
DIR (b6)
DIR (b7)