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://www.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.
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.
This product incorporates SuperFlash® technology licensed from SST.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor15
Table of Contents
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
16Freescale Semiconductor
Chapter 1
General Description
1.1 Introduction
The MC68HC908JL8 is a member of the low-cost, high-performance M68HC08 Family of 8-bit
microcontroller units (MCUs). 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.
Table 1-1. Summary of Devices
Generic PartDescriptionPin Count
MC68HC908JL8FLASH part28 or 32
MC68HC908JK8FLASH part20
MC68HC08JL8ROM part for MC68HC908JL828 or 32
MC68HC08JK8ROM part for MC68HC908JK820
MC68HC908KL8ADC-less MC68HC908JL828 or 32
1.2 Features
Features of the MC68HC908JL8 include the following:
•High-performance M68HC08 architecture
•Fully upward-compatible object code with M6805, M146805, and M68HC05 Families
•Low-power design; fully static with stop and wait modes
•Maximum internal bus frequency:
–8-MHz at 5V operating voltage
–4-MHz at 3V operating voltage
•Oscillator options:
–Crystal or resonator
–RC oscillator
•8,192 bytes user program FLASH memory with security
(1)
feature
•256 bytes of on-chip RAM
•Two 16-bit, 2-channel timer interface modules (TIM1 and TIM2) with selectable input capture,
output compare, and PWM capability on each channel; external clock input option on TIM2
1. No security feature is absolutely secure. However, Motorola’s strategy is to make reading or copying the FLASH difficult for
unauthorized users.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor17
General Description
–11 LED drivers (sink)
–2 × 25mA open-drain I/O with pull-up
•Resident routines for in-circuit programming and EEPROM emulation
•System protection features:
–Optional computer operating properly (COP) reset, driven by internal RC oscillator
–Optional low-voltage detection with reset and selectable trip points for 3V and 5 V operation
–Illegal opcode detection with reset
–Illegal address detection with reset
•Master reset pin with internal pull-up and power-on reset
•IRQ
with schmitt-trigger input and programmable pull-up
•Specific features of the MC68HC908JL8 in 28-pin packages are:
–23 general-purpose I/Os only
–7 keyboard interrupt with internal pull-up
–10 LED drivers (sink)
–12-channel ADC
–Timer I/O pins on TIM1 only
•Specific features of the MC68HC908JL8 in 20-pin packages are:
–15 general-purpose I/Os only
–1 keyboard interrupt with internal pull-up
–4 LED drivers (sink)
–10-channel ADC
–Timer I/O pins on TIM1 only
Features of the CPU08 include the following:
•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.3 MCU Block Diagram
Figure 1-1 shows the structure of the MC68HC908JL8.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
18Freescale Semiconductor
INTERNAL BUS
MCU Block Diagram
M68HC08 CPU
CPU
REGISTERS
ARITHMETIC/LOGIC
UNIT (ALU)
CONTROL AND STATUS REGISTERS — 64 BYTES
USER FLASH — 8,192 BYTES
USER RAM — 256 BYTES
MONITOR ROM — 959 BYTES
USER FLASH VECTORS — 36 BYTES
OSC1
¥
OSC2/RCCLK
CRYSTAL OSCILLATOR
RC OSCILLATOR
INTERNAL OSCILLATOR
* RST
SYSTEM INTEGRATION
MODULE
KEYBOARD INTERRUPT
MODULE
8-BIT ANALOG-TO-DIGITAL
CONVERTER MODULE
2-CHANNEL TIMER INTERFACE
MODULE 1
2-CHANNEL TIMER INTERFACE
MODULE 2
BREAK
MODULE
SERIAL COMMUNICATIONS
INTERFACE MODULE
POWER-ON RESET
MODULE
LOW-VOLTAGE INHIBIT
MODULE
DDRA
DDRB
DDRD
PORTA
PORTB
PORTD
PTA7/KBI7**
PTA6/KBI6**
PTA5/KBI5**
PTA4/KBI4**
PTA3/KBI3**
PTA2/KBI2**
PTA1/KBI1**
PTA0/KBI0**
PTB7/ADC7
PTB6/ADC6
PTB5/ADC5
PTB4/ADC4
PTB3/ADC3
PTB2/ADC2
PTB1/ADC1
PTB0/ADC0
ADC12/T2CLK
PTD7/RxD**
PTD6/TxD**
PTD5/T1CH1
PTD4/T1CH0
PTD3/ADC8
PTD2/ADC9
PTD1/ADC10
PTD0/ADC11
‡
#
¥
‡
‡
‡
##
‡
‡
‡
#
†‡
†‡
‡
‡
##
* IRQ
VDD
VSS
EXTERNAL INTERRUPT
MODULE
POWER
ADC REFERENCE
Figure 1-1. MC68HC908JL8 Block Diagram
COMPUTER OPERATING
PROPERLY MODULE
* Pin contains integrated pull-up device.
** Pin contains programmable pull-up device.
† 25mA open-drain if output pin.
‡ LED direct sink pin.
¥ Shared pin: OSC2/RCCLK/PTA6/KBI6.
# Pins available on 32-pin packages only.
## Pins available on 28-pin and 32-pin packages only.
DDRE
PTE
PTE1/T2CH1
PTE0/T2CH0
#
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor19
General Description
1.4 Pin Assignments
OSC2/RCCLK/PTA6/KBI6
OSC1
PTA1/KBI1
VDD
PTA2/KBI2
PTA3/KBI3
PTB7/ADC7
PTB6/ADC6
PTA0/KBI0
VSS
32
1
2
3
4
5
6
7
8
9
IRQ
ADC12/T2CLK
PTA7/KBI7
RST
PTA5/KBI5
PTD4/T1CH0
25
27
31
30
29
28
10
11
12
13
26
24
PTD5/T1CH1
23
PTD2/ADC9
22
PTA4/KBI4
21
PTD3/ADC8
20
PTB0/ADC0
19
PTB1/ADC1
18
PTD1/ADC10
17
14
15
PTB2/ADC2
16
PTB5/ADC5
PTE0/T2CH0
PTB4/ADC4
PTE1/T2CH1
PTD0/ADC11
PTB3/ADC3
PTD6/TxD
PTD7/RxD
Figure 1-2. 32-Pin LQFP Pin Assignment
IRQ
PTA0/KBI0
VSS
OSC1
OSC2/RCCLK/PTA6/KBI6
PTA1/KBI1
VDD
PTA2/KBI2
PTA3/KBI3
PTB7/ADC7
PTB6/ADC6
PTB5/ADC5
PTD7/RxD
PTD6/TxD
PTE0/T2CH0
PTE1/T2CH1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
ADC12/T2CLK
PTA7/KBI7
RST
PTA5/KBI5
PTD4/T1CH0
PTD5/T1CH1
PTD2/ADC9
PTA4/KBI4
PTD3/ADC8
PTB0/ADC0
PTB1/ADC1
PTD1/ADC10
PTB2/ADC2
PTB3/ADC3
PTD0/ADC11
PTB4/ADC4
Figure 1-3. 32-Pin SDIP Pin Assignment
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
20Freescale Semiconductor
IRQ
PTA0/KBI0
VSS
OSC1
OSC2/RCCLK/PTA6/KBI6
PTA1/KBI1
VDD
PTA2/KBI2
PTA3/KBI3
PTB7/ADC7
PTB6/ADC6
PTB5/ADC5
PTD7/RxD
PTD6/TxD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
28
27
26
25
24
23
22
21
20
19
18
17
16
15
RST
PTA5/KBI5
PTD4/T1CH0
PTD5/T1CH1
PTD2/ADC9
PTA4/KBI4
PTD3/ADC8
PTB0/ADC0
PTB1/ADC1
PTD1/ADC10
PTB2/ADC2
PTB3/ADC3
PTD0/ADC11
PTB4/ADC4
Pins not available on 28-pin packages
PTE0/T2CH0
PTE1/T2CH1
ADC12/T2CLK
PTA7/KBI7
Internal pads are unconnected.
Set these unused port I/Os to output low.
Pin Functions
OSC2/RCCLK/PTA6/KBI6
PTB7/ADC7
PTB6/ADC6
PTB5/ADC5
The 20-pin MC68HC908JL8 is designated MC68HC908JK8.
1.5 Pin Functions
Figure 1-4. 28-Pin PDIP/SOIC Pin Assignment
IRQ
VSS
OSC1
VDD
PTD7/RxD
PTD6/TxD
1
2
3
4
5
6
7
8
9
10
20
19
18
17
16
15
14
13
12
11
RST
PTD4/T1CH0
PTD5/T1CH1
PTD2/ADC9
PTD3/ADC8
PTB0/ADC0
PTB1/ADC1
PTB2/ADC2
PTB3/ADC3
PTB4/ADC4
Pins not available on 20-pin packages
PTA0/KBI0PTD0/ADC11
PTA1/KBI1PTD1/ADC10
PTA2/KBI2
PTA3/KBI3PTE0/T2CH0
PTA4/KBI4PTE1/T2CH1
PTA5/KBI5
PTA7/KBI7
Internal pads are unconnected.
Set these unused port I/Os to output low.
Figure 1-5. 20-Pin PDIP/SOIC Pin Assignment
ADC12/T2CLK
Description of the pin functions are provided in Table 1-2.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor21
General Description
Table 1-2. Pin Functions
PIN NAMEPIN DESCRIPTIONIN/OUT
VDDPower supply.In5V or 3V
VSSPower supply ground.Out0V
RST
IRQ
OSC1Crystal or RC oscillator input.InVDD
OSC2/RCCLK
ADC12/T2CLK
PTA0–PTA7
Reset input, active low;
with internal pull-up and schmitt trigger input.
External IRQ pin; with programmable internal pull-up and schmitt
trigger input.
Each pin has programmable internal pull-up when configured as
input.
Pins as keyboard interrupts, KBI0–KBI7.InVDD
In/OutVDD
InVDD
InVDD
VOLTAGE
LEVEL
VDD to V
TST
PTB0–PTB7
PTD0–PTD7
PTA0–PTA5 and PTA7 have LED direct sink capability.OutVSS
PTA6 as OSC2/RCCLK.OutVDD
8-bit general purpose I/O port.In/OutVDD
Pins as ADC input channels, ADC0–ADC7.InVSS to VDD
8-bit general purpose I/O port;
with programmable internal pull-ups on PTD6–PTD7.
PTD0–PTD3 as ADC input channels, ADC11–ADC8.InputVSS to VDD
PTD2–PTD3 and PTD6–PTD7 have LED direct sink capabilityOutVSS
PTD4 as T1CH0 of TIM1.In/OutVDD
PTD5 as T1CH1 of TIM1.In/OutVDD
PTD6–PTD7 have configurable 25mA open-drain output. OutVSS
PTD6 as TxD of SCI.OutVDD
PTD7 as RxD of SCI.InVDD
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
In/OutVDD
22Freescale Semiconductor
Table 1-2. Pin Functions (Continued)
Pin Functions
PIN NAMEPIN DESCRIPTIONIN/OUT
2-bit general purpose I/O port.In/OutVDD
PTE0–PTE1
PTE0 as T2CH0 of TIM2.In/OutVDD
PTE1 as T2CH1 of TIM2.In/OutVDD
NOTE
Devices in 28-pin packages, the following pins are not available:
PTA7/KBI7, PTE0/T2CH0, PTE1/T2CH1, and ADC12/T2CLK.
Devices in 20-pin packages, the following pins are not available:
PTA0/KBI0–PTA5/KBI5, PTD0/ADC11, PTD1/ADC10,
PTA7/KBI7, PTE0/T2CH0, PTE1/T2CH1, and ADC12/T2CLK.
VOLTAGE
LEVEL
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor23
General Description
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
24Freescale Semiconductor
Chapter 2
Memory
2.1 Introduction
The CPU08 can address 64-kbytes of memory space. The memory map, shown in Figure 2-1, includes:
•8,192 bytes of user FLASH memory
•36 bytes of user-defined vectors
•959 bytes of monitor ROM
2.2 I/O Section
Addresses $0000–$003F, shown in Figure 2-2, contain most of the control, status, and data registers.
Additional I/O registers have the following addresses:
•$FFD0; Mask Option Register, MOR (FLASH register)
•$FFFF; COP Control Register, COPCTL
2.3 Monitor ROM
The 959 bytes at addresses $FC00–$FDFF and $FE10–$FFCE are reserved ROM addresses that
contain the instructions for the monitor functions. (See Chapter 7 Monitor ROM (MON).)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Figure 2-2. Control, Status, and Data Registers (Sheet 1 of 5)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor27
Memory
Addr.Register NameBit 7654321Bit 0
$0013
$0014
$0015
$0016 SCI Status Register 1 (SCS1)
$0017 SCI Status Register 2 (SCS2)
$0018
$0019
SCI Control Register 1
(SCC1)
SCI Control Register 2
(SCC2)
SCI Control Register 3
(SCC3)
SCI Data Register
(SCDR)
SCI Baud Rate Register
(SCBR)
Keyboard Status and
$001A
Control Register
(KBSCR)
Keyboard Interrupt
$001B
Enable Register
(KBIER)
$001C
Unimplemented
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Read:R8
Write:
Reset:UU000000
Read:SCTETCSCRFIDLEORNFFEPE
Write:
Reset:11000000
Read:
Write:
Reset:00000000
Read:R7R6R5R4R3R2R1R0
Write:T7T6T5T4T3T2T1T0
Reset:Unaffected by reset
Read:
Write:
Reset:00000000
Read:0000KEYF0
Write:
Reset:
Read:
Write:
Reset:
Read:
Write:
LOOPSENSCITXINVMWAKEILTYPENPTY
SCTIETCIESCRIEILIETERERWUSBK
T8DMAREDMATEORIENEIEFEIEPEIE
BKFRPF
SCP1SCP0RSCR2SCR1SCR0
ACKK
00000000
IMASKKMODEK
KBIE7KBIE6KBIE5KBIE4KBIE3KBIE2KBIE1KBIE0
00000000
IRQ Status and Control
$001D
$001E
$001F
† One-time writable register after each reset. * LVIT1 and LVIT0 reset to logic 0 by a power-on reset (POR) only.
Configuration Register 2
Configuration Register 1
Register
(INTSCR)
(CONFIG2)
(CONFIG1)
TIM1 Status and Control
$0020
Register
(T1SC)
TIM1 Counter Register
$0021
(T1CNTH)
U = UnaffectedX = Indeterminate
Read:0000IRQF0
Write:
Reset:00000000
Read:
IRQPUDRRLVIT1LVIT0RR
Write:
†
Reset:0000*0*000
Read:
Write:
†
Reset:00000000
Read:TOF
Write:0TRST
Reset:
COPRSRRLVIDRSSRECSTOPCOPD
TOIETSTOP
00100000
00
Read:Bit15Bit14Bit13Bit12Bit11Bit10Bit9Bit8
High
Write:
Reset:
00000000
= UnimplementedR= Reserved
Figure 2-2. Control, Status, and Data Registers (Sheet 2 of 5)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
ACK
IMASKMODE
STOP_
ICLKDIS
PS2PS1PS0
28Freescale Semiconductor
Monitor ROM
Addr.Register NameBit 7654321Bit 0
TIM1 Counter Register
$0022
(T1CNTL)
TIM Counter Modulo
$0023
Register High
(TMODH)
TIM1 Counter Modulo
$0024
Register Low
(T1MODL)
TIM1 Channel 0 Status
$0025
and Control Register
(T1SC0)
TIM1 Channel 0
$0026
Register High
(T1CH0H)
TIM1 Channel 0
$0027
Register Low
(T1CH0L)
TIM1 Channel 1 Status
$0028
and Control Register
(T1SC1)
TIM1 Channel 1
$0029
Register High
(T1CH1H)
TIM1 Channel 1
$002A
Register Low
(T1CH1L)
$002B
↓
$002F
Unimplemented
TIM2 Status and Control
$0030
Register
(T2SC)
TIM2 Counter Register
$0031
(T2CNTH)
TIM2 Counter Register
$0032
(T2CNTL)
TIM2 Counter Modulo
$0033
Register High
(T2MODH)
TIM2 Counter Modulo
$0034
Register Low
(T2MODL)
U = UnaffectedX = Indeterminate
Read:Bit7Bit6Bit5Bit4Bit3Bit2Bit1Bit0
Write:
Low
Reset:
Read:
Write:
Reset:
Read:
Write:
Reset:
Read:CH0F
Write:0
Reset:
Read:
Write:
Reset:
Read:
Write:
Reset:
Read:CH1F
Write:0
Reset:
Read:
Write:
Reset:
Read:
Write:
Reset:
Read:
Write:
Read:TOF
Write:0TRST
Reset:
00000000
Bit15Bit14Bit13Bit12Bit11Bit10Bit9Bit8
11111111
Bit7Bit6Bit5Bit4Bit3Bit2Bit1Bit0
11111111
CH0IEMS0BMS0AELS0BELS0ATOV0CH0MAX
00000000
Bit15Bit14Bit13Bit12Bit11Bit10Bit9Bit8
Indeterminate after reset
Bit7Bit6Bit5Bit4Bit3Bit2Bit1Bit0
Indeterminate after reset
CH1IE
00000000
0
MS1AELS1BELS1ATOV1CH1MAX
Bit15Bit14Bit13Bit12Bit11Bit10Bit9Bit8
Indeterminate after reset
Bit7Bit6Bit5Bit4Bit3Bit2Bit1Bit0
Indeterminate after reset
TOIETSTOP
00100000
00
PS2PS1PS0
Read:Bit15Bit14Bit13Bit12Bit11Bit10Bit9Bit8
High
Write:
Reset:
00000000
Read:Bit7Bit6Bit5Bit4Bit3Bit2Bit1Bit0
Low
Write:
Reset:
Read:
Write:
Reset:
Read:
Write:
Reset:
00000000
Bit15Bit14Bit13Bit12Bit11Bit10Bit9Bit8
11111111
Bit7Bit6Bit5Bit4Bit3Bit2Bit1Bit0
11111111
= UnimplementedR= Reserved
Figure 2-2. Control, Status, and Data Registers (Sheet 3 of 5)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor29
Memory
Addr.Register NameBit 7654321Bit 0
Read:CH0F
Write:0
Reset:
Read:
Write:
00000000
Bit15Bit14Bit13Bit12Bit11Bit10Bit9Bit8
Reset:
Read:
Write:
Bit7Bit6Bit5Bit4Bit3Bit2Bit1Bit0
Reset:
Read:CH1F
Write:0
Reset:
Read:
Write:
00000000
Bit15Bit14Bit13Bit12Bit11Bit10Bit9Bit8
Reset:
Read:
Write:
Bit7Bit6Bit5Bit4Bit3Bit2Bit1Bit0
Reset:
Read:
Write:
CH0IEMS0BMS0AELS0BELS0ATOV0CH0MAX
Indeterminate after reset
Indeterminate after reset
CH1IE
0
MS1AELS1BELS1ATOV1CH1MAX
Indeterminate after reset
Indeterminate after reset
$0035
$0036
$0037
$0038
$0039
$003A
$003B
TIM2 Channel 0 Status
and Control Register
(T2SC0)
TIM2 Channel 0
Register High
(T2CH0H)
TIM2 Channel 0
Register Low
(T2CH0L)
TIM2 Channel 1 Status
and Control Register
(T2SC1)
TIM2 Channel 1
Register High
(T2CH1H)
TIM2 Channel 1
Register Low
(T2CH1L)
Unimplemented
ADC Status and Control
$003C
$003D
$003E
$003F
$FE00 Break Status Register (BSR)
$FE01 Reset Status Register (RSR)
$FE02Reserved
$FE03
U = UnaffectedX = Indeterminate
ADC Data Register
ADC Input Clock Register
Note: Writing a logic 0 clears SBSW.
Break Flag Control
Register
(ADSCR)
(ADICLK)
Unimplemented
Register
(BFCR)
Read:COCO
Write:
Reset:00011111
Read:AD7AD6AD5AD4AD3AD2AD1AD0
Write:
(ADR)
Reset:Indeterminate after reset
Read:
Write:
Reset:00000000
Read:
Write:
Read:
Write:See note
Reset:0
Read:PORPINCOPILOPILADMODRSTLVI0
Write:
POR:10000000
Read:
Write:
Read:
Write:
Reset:0
ADIV2ADIV1ADIV0
BCFERRRRRRR
AIENADCOADCH4ADCH3ADCH2ADCH1ADCH0
00000
RRRRRR
RRRRRRRR
= UnimplementedR= Reserved
SBSW
R
Figure 2-2. Control, Status, and Data Registers (Sheet 4 of 5)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
30Freescale Semiconductor
Monitor ROM
Addr.Register NameBit 7654321Bit 0
$FE04
$FE05
$FE06
Interrupt Status Register 1
Interrupt Status Register 2
Interrupt Status Register 3
$FE07Reserved
Read:IF6IF5IF4IF30IF100
Write:RRRRRRRR
(INT1)
Reset:00000000
Read:IF14IF13IF12IF1100IF8IF7
Write:RRRRRRRR
(INT2)
Reset:00000000
Read:0000000IF15
Write:RRRRRRRR
(INT3)
Reset:00000000
Read:
Write:
RRRRRRRR
Read:0000
Write:
Reset:00000000
Read:
Write:
$FE08
$FE09
FLASH Control Register
↓
(FLCR)
Reserved
$FE0B
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Read:
Write:
BRKEBRKA
Reset:00000000
Read:
Write:
#
Reset:Unaffected by reset; $FF when blank
Read:
Write:
#
BPR7BPR6BPR5BPR4BPR3BPR2BPR1BPR0
OSCSELRRRRRRR
Reset:Unaffected by reset; $FF when blank
$FE0C
$FE0D
$FE0E
$FFCF
$FFD0
Break Address High
Register
(BRKH)
Break Address low
Register
(BRKL)
Break Status and Control
Register
(BRKSCR)
FLASH Block Protect
Register
(FLBPR)
Mask Option Register
(MOR)
# Non-volatile FLASH registers; write by programming.
Read:Low byte of reset vector
Write:Writing clears COP counter (any value)
Reset:Unaffected by reset
$FFFF
COP Control Register
(COPCTL)
U = UnaffectedX = Indeterminate
HVENMASSERASEPGM
RRRRRRRR
Bit15Bit14Bit13Bit12Bit11Bit10Bit9Bit8
Bit7Bit6Bit5Bit4Bit3Bit2Bit1Bit0
000000
= UnimplementedR= Reserved
Figure 2-2. Control, Status, and Data Registers (Sheet 5 of 5)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor31
Memory
Table 2-1. Vector Addresses
.
Vector PriorityINT FlagAddressVector
Lowest
—
$FFD0
↓
Not Used
$FFDD
$FFDEADC Conversion Complete Vector (High)
IF15
IF14
IF13
$FFDFADC Conversion Complete Vector (Low)
$FFE0Keyboard Interrupt Vector (High)
$FFE1Keyboard Interrupt Vector (Low)
$FFE2SCI Transmit Vector (High)
$FFE3SCI Transmit Vector (Low)
$FFE4SCI Receive Vector (High)
IF12
IF11
$FFE5SCI Receive Vector (Low)
$FFE6SCI Error Vector (High)
$FFE7SCI Error Vector (Low)
IF10
↓
—Not Used
IF9
$FFECTIM2 Overflow Vector (High)
IF8
IF7
IF6
$FFEDTIM2 Overflow Vector (Low)
$FFEETIM2 Channel 1 Vector (High)
$FFEFTIM2 Channel 1 Vector (Low)
$FFF0TIM2 Channel 0 Vector (High)
$FFF1TIM2 Channel 0 Vector (Low)
$FFF2TIM1 Overflow Vector (High)
IF5
IF4
IF3
$FFF3TIM1 Overflow Vector (Low)
$FFF4TIM1 Channel 1 Vector (High)
$FFF5TIM1 Channel 1 Vector (Low)
$FFF6TIM1 Channel 0 Vector (High)
$FFF7TIM1 Channel 0 Vector (Low)
IF2—Not Used
IF1
$FFFAIRQ
Vector (High)
$FFFBIRQ Vector (Low)
$FFFCSWI Vector (High)
—
$FFFDSWI Vector (Low)
$FFFEReset Vector (High)
—
$FFFFReset Vector (Low)
Highest
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
32Freescale Semiconductor
Random-Access Memory (RAM)
2.4 Random-Access Memory (RAM)
Addresses $0060 through $015F are RAM locations. The location of the stack RAM is programmable.
The 16-bit stack pointer allows the stack to be anywhere in the 64-Kbyte memory space.
NOTE
For correct operation, the stack pointer must point only to RAM locations.
Within page zero are 160 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, direct addressing mode instructions can access efficiently 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
For M6805 compatibility, the H register is not stacked.
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.
2.5 FLASH Memory
This sub-section describes the operation of the embedded FLASH memory. The FLASH 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.
2.6 Functional Description
The FLASH memory consists of an array of 8,192 bytes for user memory plus a block of 36 bytes for user
interrupt vectors. An erased bit reads as logic 1 and a programmed bit reads as a logic 0. The FLASH
memory page size is defined as 64 bytes, and is the minimum size that can be erased in a page erase
operation. Program and erase operations are facilitated through control bits in FLASH control register
(FLCR).
The address ranges for the FLASH memory are:
•$DC00–$FBFF; user memory; 12,288 bytes
•$FFDC–$FFFF; user interrupt vectors; 36 bytes
Programming tools are available from Motorola. Contact your local Motorola representative for more
information.
NOTE
A security feature prevents viewing of the FLASH contents.
(1)
1. No security feature is absolutely secure. However, Motorola’s strategy is to make reading or copying the FLASH difficult for
unauthorized users.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor33
Memory
2.7 FLASH Control Register
The FLASH control register (FCLR) controls FLASH program and erase operations.
Address:$FE08
Bit 7654321Bit 0
Read:0000
Write:
Reset:00000000
Figure 2-3. 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
MASS — Mass Erase Control Bit
This read/write bit configures the memory for mass erase operation or page erase operation when the
ERASE bit is set.
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 not selected
2.8 FLASH Page Erase Operation
Use the following procedure to erase a page of FLASH memory. A page consists of 64 consecutive bytes
starting from addresses $XX00, $XX40, $XX80 or $XXC0. The 36-byte user interrupt vectors area also
forms a page. Any page within the 8,192 bytes user memory area ($DC00–$FBFF) can be erased alone.
The 36-byte user interrupt vectors cannot be erased by the page erase operation because of security
reasons. Mass erase is required to erase this page.
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
nvs
erase
(10µs).
(4ms).
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
34Freescale Semiconductor
FLASH Mass Erase Operation
7.Clear the ERASE bit.
8.Wait for a time, t
nvh
(5µs).
9.Clear the HVEN bit.
10.After time, t
(1µs), the memory can be accessed in read mode again.
rcv
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 as shown, but other unrelated operations
may occur between the steps.
2.9 FLASH Mass Erase Operation
Use the following procedure to erase the entire FLASH memory:
1.Set both the ERASE bit and the MASS bit in the FLASH control register.
2.Read the FLASH block protect register.
3.Write any data to any FLASH location within the FLASH memory address range.
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
9.Clear the HVEN bit.
10.After time, t
rcv
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 as shown, but other unrelated operations
may occur between the steps.
(10µs).
nvs
(4ms).
merase
(100µs).
nvh1
(1µs), the memory can be accessed in read mode again.
NOTE
2.10 FLASH Program Operation
Programming of the FLASH memory is done on a row basis. A row consists of 32 consecutive bytes
starting from addresses $XX00, $XX20, $XX40, $XX60, $XX80, $XXA0, $XXC0 or $XXE0. Use this
step-by-step procedure to program a row of FLASH memory:
(Figure 2-4 shows a flowchart of the programming algorithm.)
1.Set the PGM bit. This configures the memory for program operation and enables the latching of
address and data for programming.
2.Read the FLASH block protect register.
3.Write any data to any FLASH location within the address range of the row to be programmed.
4.Wait for a time, t
5.Set the HVEN bit.
6.Wait for a time, t
7.Write data to the FLASH address to be programmed.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor35
(10µs).
nvs
(5µs).
pgs
Memory
8.Wait for time, t
prog
(30µs).
9.Repeat steps 7 and 8 until all bytes within the row are programmed.
10.Clear the PGM bit.
11.Wait for time, t
nvh
(5µs).
12.Clear the HVEN bit.
13.After time, t
(1µs), the memory can be accessed in read mode again.
rcv
This program sequence is repeated throughout the memory until all data is programmed.
NOTE
The time between each FLASH address change (step 7 to step 7), or the
time between the last FLASH addressed programmed to clearing the PGM
bit (step 7 to step 10), must not exceed the maximum programming time,
t
max.
prog
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.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
36Freescale Semiconductor
FLASH Program Operation
Algorithm for programming
a row (32 bytes) of FLASH memory
1
2
Read the FLASH block protect register
3
Write any data to any FLASH location
Set PGM bit
within the address range of the row to
be programmed
4
5
6
7
Wait for a time, t
Set HVEN bit
Wait for a time, t
Write data to the FLASH address
to be programmed
nvs
pgs
8
Wait for a time, t
Completed
programming
this row?
NOTE:
The time between each FLASH address change (step 7 to step 7), or
the time between the last FLASH address programmed
to clearing PGM bit (step 7 to step 10)
must not exceed the maximum programming
time, t
prog
max.
This row program algorithm assumes the row/s
to be programmed are initially erased.
prog
Y
N
10
11
12
13
Clear PGM bit
Wait for a time, t
Clear HVEN bit
Wait for a time, t
nvh
rcv
End of programming
Figure 2-4. FLASH Programming Flowchart
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor37
Memory
2.11 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 to protect blocks of memory from unintentional erase or program operations
due to system malfunction. This protection is done by use 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 to 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
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
2.12 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
also allows entry from reset into the monitor mode.
, present on the IRQ pin. This voltage
TST
2.12 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:$FFCF
Bit 7654321Bit 0
Read:
Write:
Reset:Unaffected by reset; $FF when blank
Non-volatile FLASH register; write by programming.
BPR[7:0] — FLASH Block Protect Bits
BPR[7:0] represent bits [13:6] of a 16-bit memory address. Bits [15:14] are logic 1’s and bits [5:0] are
logic 0’s.
Start address of FLASH block protect1 1000000
BPR7BPR6BPR5BPR4BPR3BPR2BPR1BPR0
Figure 2-5. FLASH Block Protect Register (FLBPR)
16-bit memory address
BPR[7:0]
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
38Freescale Semiconductor
FLASH Block Protect Register
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, XX40, XX80, or XXC0 (at page
boundaries — 64 bytes) within the FLASH memory.
Examples of protect start address:
BPR[7:0]
$00–$70The entire FLASH memory is protected.
$71
(0111 0001)
$72
(0111 0010)
$73
(0111 0011)
and so on...
$FD
(1111 1101)
$FE
(1111 1110)
$FFThe entire FLASH memory is not protected.
1. The end address of the protected range is always $FFFF.
Start of Address of Protect Range
$DC40 (1101 1100 0100 0000)
$DC80 (1101 1100 1000 0000)
$DCC0 (1101 1100 1100 0000)
$FF40 (1111 1111 0100 0000)
$FF80 (1111 1111 1000 0000)
(1)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor39
Memory
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
40Freescale Semiconductor
Chapter 3
Configuration and Mask Option Registers (CONFIG & MOR)
3.1 Introduction
This section describes the configuration registers, CONFIG1 and CONFIG2; and the mask option register
(MOR).
The configuration registers enable or disable these options:
•Computer operating properly module (COP)
•COP timeout period (2
•Internal oscillator during stop mode
•Low voltage inhibit (LVI) module
•LVI module voltage trip point selection
•STOP instruction
•Stop mode recovery time (32 or 4096 ICLK cycles)
•Pull-up on IRQ
The mask option register selects the oscillator option:
•Crystal or RC
pin
13–24
or 218–24 ICLK cycles)
3.2 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 $001E and $001F. The configuration
registers may be read at anytime.
NOTE
The options except LVIT[1:0] are one-time writable by the user after each
reset. The LVIT[1:0] bits are one-time writable by the user only after each
POR (power-on reset). The CONFIG registers are not in the FLASH
memory but are special registers containing one-time writable latches after
each reset. Upon a reset, the CONFIG registers default to predetermined
settings as shown in Figure 3-1 and Figure 3-2.
The mask option register (MOR) is used to select the oscillator option for the MCU: crystal oscillator or
RC oscillator. The MOR is implemented as a byte in FLASH memory. Hence, writing to the MOR requires
programming the byte.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor41
Configuration and Mask Option Registers (CONFIG & MOR)
3.3 Configuration Register 1 (CONFIG1)
Address:$001F
Bit 7654321Bit 0
Read:
Write:
Reset:00000000
COPRS — COP Rate Select Bit
COPRS selects the COP time-out period. Reset clears COPRS.
(See Chapter 14 Computer Operating Properly (COP).)
1 = COP timeout period is (2
0 = COP timeout period is (2
LVID — Low Voltage Inhibit Disable Bit
LVID disables the LVI module. Reset clears LVID.
(See Chapter 15 Low Voltage Inhibit (LVI).)
1 = Low voltage inhibit disabled
0 = Low voltage inhibit enabled
COPRSRRLVIDRSSRECSTOPCOPD
R=Reserved
Figure 3-1. Configuration Register 1 (CONFIG1)
13
– 24) ICLK cycles
18
– 24) ICLK cycles
SSREC — Short Stop Recovery Bit
SSREC enables the CPU to exit stop mode with a delay of
32 ICLK cycles instead of a 4096 ICLK cycle delay.
1 = Stop mode recovery after 32 ICLK cycles
0 = Stop mode recovery after 4096 ICLK cycles
NOTE
Exiting stop mode by pulling reset will result in the long stop recovery.
If using an external crystal, do not set the SSREC bit.
COPD disables the COP module. Reset clears COPD.
(See Chapter 14 Computer Operating Properly (COP).)
1 = COP module disabled
0 = COP module enabled
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
42Freescale Semiconductor
Configuration Register 2 (CONFIG2)
3.4 Configuration Register 2 (CONFIG2)
Address:$001E
Bit 7654321Bit 0
Read:
IRQPUDRRLVIT1LVIT0RR
Write:
Reset:000
POR:00000000
R=Reserved
One-time writable register after each reset. LVIT1 and LVIT0 reset to logic 0 by a power-on reset (POR) only.
Not affected Not affected
000
Figure 3-2. Configuration Register 2 (CONFIG2)
IRQPUD — IRQ Pin Pull-Up Disable Bit
IRQPUD disconnects the internal pull-up on the IRQ
pin.
1 = Internal pull-up is disconnected
0 = Internal pull-up is connected between IRQ
pin and V
DD
LVIT1, LVIT0 — LVI Trip Voltage Selection Bits
Detail description of trip voltage selection is given in Chapter 15 Low Voltage Inhibit (LVI).
STOP_ICLKDIS — Internal Oscillator Stop Mode Disable Bit
Setting STOP_ICLKDIS disables the internal oscillator during stop mode. When this bit is cleared, the
internal oscillator continues to operate in stop mode. Reset clears this bit.
1 = Internal oscillator disabled during stop mode
0 = Internal oscillator enabled during stop mode
STOP_
ICLKDIS
3.5 Mask Option Register (MOR)
The mask option register (MOR) is implemented as a byte within the FLASH memory, and therefore can
only be written during a programming sequence of the FLASH memory. This register is read after a
power-on reset to determine the type of oscillator selected. (See Chapter 6 Oscillator (OSC).)
Address:$FFD0
Bit 7654321Bit 0
Read:
OSCSELRRRRRRR
Write:
Erased:11111111
Reset:Unaffected by reset
Non-volatile FLASH register; write by programming.
R=Reserved
Figure 3-3. Mask Option Register (MOR)
OSCSEL — Oscillator Select Bit
OSCSEL selects the oscillator type for the MCU. The erased or unprogrammed state of this bit is
logic 1, selecting the crystal oscillator option. This bit is unaffected by reset.
1 = Crystal oscillator
0 = RC oscillator
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor43
Configuration and Mask Option Registers (CONFIG & MOR)
Bits 6–0 — Should be left as logic 1’s.
NOTE
When Crystal oscillator is selected, the OSC2/RCCLK/PTA6/KBI6 pin is
used as OSC2; other functions such as PTA6/KBI6 will not be available.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
44Freescale Semiconductor
Chapter 4
Central Processor Unit (CPU)
4.1 Introduction
The M68HC08 CPU (central processor unit) is an enhanced and fully object-code-compatible version of
the M68HC05 CPU. The CPU08 Reference Manual (Motorola document order number CPU08RM/AD)
contains a description of the CPU instruction set, addressing modes, and architecture.
4.2 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
•64-Kbyte 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 64 Kbytes
•Low-Power Stop and Wait Modes
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor45
Central Processor Unit (CPU)
4.3 CPU Registers
Figure 4-1 shows the five CPU registers. CPU registers are not part of the memory map.
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 4-1. CPU Registers
4.3.1 Accumulator
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 4-2. Accumulator (A)
4.3.2 Index Register
The 16-bit index register allows indexed addressing of a 64-Kbyte 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.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
46Freescale Semiconductor
CPU Registers
Bit
1413121110987654321Bit 0
15
Read:
Write:
Reset:00000000XXXXXXXX
X = Indeterminate
Figure 4-3. Index Register (H:X)
4.3.3 Stack Pointer
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.
Bit
1413121110987654321Bit 0
15
Read:
Write:
Reset:0000000011111111
Figure 4-4. Stack Pointer (SP)
NOTE
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.
4.3.4 Program Counter
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.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor47
Central Processor Unit (CPU)
Bit
1413121110987654321Bit 0
15
Read:
Write:
Reset:Loaded with Vector from $FFFE and $FFFF
Figure 4-5. Program Counter (PC)
4.3.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 5 are set permanently to logic 1. The following paragraphs describe
the functions of the condition code register.
Bit 7654321Bit 0
Read:
Write:
Reset:X1 1X1XXX
V11H I NZC
X = Indeterminate
Figure 4-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 add-with-carry (ADC) operation. The half-carry flag is required for
binary-coded 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
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.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
48Freescale Semiconductor
Arithmetic/Logic Unit (ALU)
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
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
4.4 Arithmetic/Logic Unit (ALU)
The ALU performs the arithmetic and logic operations defined by the instruction set.
Refer to the CPU08 Reference Manual (Motorola document order number CPU08RM/AD) for a
description of the instructions and addressing modes and more detail about the architecture of the CPU.
4.5 Low-Power Modes
The WAIT and STOP instructions put the MCU in low power-consumption standby modes.
4.5.1 Wait Mode
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
4.5.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.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor49
Central Processor Unit (CPU)
4.6 CPU During Break Interrupts
If a break module is present on the MCU, the CPU starts a break interrupt by:
•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.
4.7 Instruction Set Summary
Table 4-1 provides a summary of the M68HC08 instruction set.
Test for Negative or Zero(A) – $00 or (X) – $00 or (M) – $00 0 – – RR–
DIR
INH
INH
IX1
IX
SP1
3D
4D
5D
6D
7D
9E6D
3
1
1
3
ff
2
4
ff
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor57
Central Processor Unit (CPU)
Table 4-1. Instruction Set Summary
Source
Form
AAccumulatornAny bit
CCarry/borrow bitoprOperand (one or two bytes)
CCR Condition code registerPCProgram counter
ddDirect address of operandPCH Program counter high byte
dd rrDirect address of operand and relative offset of branch instructionPCL Program counter low byte
DDDirect to direct addressing modeREL Relative addressing mode
DIRDirect addressing moderelRelative program counter offset byte
DIX+ Direct to indexed with post increment addressing moderrRelative program counter offset byte
ee ffHigh and low bytes of offset in indexed, 16-bit offset addressingSP1 Stack pointer, 8-bit offset addressing mode
EXTExtended addressing modeSP2 Stack pointer 16-bit offset addressing mode
ffOffset byte in indexed, 8-bit offset addressingSPStack pointer
HHalf-carry bitUUndefined
HIndex register high byteVOverflow bit
hh llHigh and low bytes of operand address in extended addressingXIndex register low byte
IInterrupt maskZZero bit
iiImmediate operand byte&Logical AND
IMDImmediate source to direct destination addressing mode|Logical OR
IMMImmediate addressing mode
INHInherent addressing mode( )Contents of
IXIndexed, no offset addressing mode–( )Negation (two’s complement)
IX+Indexed, no offset, post increment addressing mode#Immediate value
IX+D Indexed with post increment to direct addressing mode
IX1Indexed, 8-bit offset addressing mode←Loaded with
IX1+Indexed, 8-bit offset, post increment addressing mode?If
IX2Indexed, 16-bit offset addressing mode:Concatenated with
MMemory locationRSet or cleared
NNegative bit—Not affected
OperationDescription
⊕Logical EXCLUSIVE OR
«Sign extend
CCR
VH I NZC
Address
Mode
Opcode
Effect on
Cycles
Operand
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
58Freescale Semiconductor
Freescale Semiconductor59
Bit Manipulation BranchRead-Modify-WriteControlRegister/Memory
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
05BRSET0
3DIR
15BRCLR0
3DIR
25BRSET1
3DIR
35BRCLR1
3DIR
45BRSET2
3DIR
55BRCLR2
3DIR
65BRSET3
3DIR
75BRCLR3
3DIR
85BRSET4
3DIR
95BRCLR4
3DIR
A5BRSET5
3DIR
B5BRCLR5
3DIR
C5BRSET6
3DIR
D5BRCLR6
3DIR
E5BRSET7
3DIR
F5BRCLR7
3DIR
INH InherentREL RelativeSP1 Stack Pointer, 8-Bit Offset
IMM ImmediateIXIndexed, No OffsetSP2 Stack Pointer, 16-Bit Offset
DIR DirectIX1 Indexed, 8-Bit OffsetIX+ Indexed, No Offset with
EXT ExtendedIX2 Indexed, 16-Bit OffsetPost Increment
DD Direct-DirectIMD Immediate-DirectIX1+ Indexed, 1-Byte Offset with
IX+D Indexed-Direct DIX+ Direct-IndexedPost Increment
4
BSET0
2DIR
4
BCLR0
2DIR
4
BSET1
2DIR
4
BCLR1
2DIR
4
BSET2
2DIR
4
BCLR2
2DIR
4
BSET3
2DIR
4
BCLR3
2DIR
4
BSET4
2DIR
4
BCLR4
2DIR
4
BSET5
2DIR
4
BCLR5
2DIR
4
BSET6
2DIR
4
BCLR6
2DIR
4
BSET7
2DIR
4
BCLR7
2DIR
3
BRA
2REL
3
BRN
2REL
3
BHI
2REL
3
BLS
2REL
3
BCC
2REL
3
BCS
2REL
3
BNE
2REL
3
BEQ
2REL
3
BHCC
2REL
3
BHCS
2REL
3
BPL
2REL
3
BMI
2REL
3
BMC
2REL
3
BMS
2REL
3
BIL
2REL
3
BIH
2REL
4
NEG
2DIR
5
CBEQ
3DIR
4
COM
2DIR
4
LSR
2DIR
4
STHX
2DIR
4
ROR
2DIR
4
ASR
2DIR
4
LSL
2DIR
4
ROL
2DIR
4
DEC
2DIR
5
DBNZ
3DIR
4
INC
2DIR
3
TST
2DIR
3
CLR
2DIR
1
NEGA
1INH
4
CBEQA
3IMM
5
MUL
1INH
1
COMA
1INH
1
LSRA
1INH
3
LDHX
3IMM
1
RORA
1INH
1
ASRA
1INH
1
LSLA
1INH
1
ROLA
1INH
1
DECA
1INH
3
DBNZA
2INH
1
INCA
1INH
1
TSTA
1INH
5
MOV
3DD
1
CLRA
1INH
1
NEGX
1INH
4
CBEQX
3IMM
7
DIV
1INH
1
COMX
1INH
1
LSRX
1INH
4
LDHX
2DIR
1
RORX
1INH
1
ASRX
1INH
1
LSLX
1INH
1
ROLX
1INH
1
DECX
1INH
3
DBNZX
2INH
1
INCX
1INH
1
TSTX
1INH
4
MOV
2DIX+
1
CLRX
1INH
*Pre-byte for stack pointer indexed instructions
4
NEG
2IX1
3IX1+
1INH
2IX1
2IX1
3IMM
2IX1
2IX1
2IX1
2IX1
2IX1
3IX1
2IX1
2IX1
3IMD
2IX1
5
CBEQ
3
NSA
4
COM
4
LSR
3
CPHX
4
ROR
4
ASR
4
LSL
4
ROL
4
DEC
5
DBNZ
4
INC
3
TST
4
MOV
3
CLR
3SP1
4SP1
3SP1
3SP1
3SP1
3SP1
3SP1
3SP1
3SP1
4SP1
3SP1
3SP1
3SP1
Table 4-2. Opcode Map
5
NEG
6
CBEQ
5
COM
5
LSR
ROR
5
ASR
5
LSL
5
ROL
5
DEC
6
DBNZ
5
INC
4
TST
4
CLR
3
NEG
1IX
4
CBEQ
2IX+
2
DAA
1INH
3
COM
1IX
3
LSR
1IX
4
CPHX
2DIR
5
3
ROR
1IX
3
ASR
1IX
3
LSL
1IX
3
ROL
1IX
3
DEC
1IX
4
DBNZ
2IX
3
INC
1IX
2
TST
1IX
4
MOV
2IX+D
2
CLR
1IX
Low Byte of Opcode in Hexadecimal05BRSET0
7
RTI
1INH
4
RTS
1INH
9
SWI
1INH
2
TA P
1INH
1
TPA
1INH
2
PULA
1INH
2
PSHA
1INH
2
PULX
1INH
2
PSHX
1INH
2
PULH
1INH
2
PSHH
1INH
1
CLRH
1INH
1
STOP
1INH
1
WAIT
1INH
3
BGE
2REL
3
BLT
2REL
3
BGT
2REL
3
BLE
2REL
2
TXS
1INH
2
TSX
1INH
1
TA X
1INH
1
CLC
1INH
1
SEC
1INH
2
CLI
1INH
2
SEI
1INH
1
RSP
1INH
1
NOP
1INH
*
1
TXA
1INH
2
SUB
2IMM
2
CMP
2IMM
2
SBC
2IMM
2
CPX
2IMM
2
AND
2IMM
2
BIT
2IMM
2
LDA
2IMM
2
AIS
2IMM
2
EOR
2IMM
2
ADC
2IMM
2
ORA
2IMM
2
ADD
2IMM
4
BSR
2REL
2
LDX
2IMM
2
AIX
2IMM
3
SUB
2DIR
3
CMP
2DIR
3
SBC
2DIR
3
CPX
2DIR
3
AND
2DIR
3
BIT
2DIR
3
LDA
2DIR
3
STA
2DIR
3
EOR
2DIR
3
ADC
2DIR
3
ORA
2DIR
3
ADD
2DIR
2
JMP
2DIR
4
JSR
2DIR
3
LDX
2DIR
3
STX
2DIR
4
SUB
3EXT
4
CMP
3EXT
4
SBC
3EXT
4
CPX
3EXT
4
AND
3EXT
4
BIT
3EXT
4
LDA
3EXT
4
STA
3EXT
4
EOR
3EXT
4
ADC
3EXT
4
ORA
3EXT
4
ADD
3EXT
3
JMP
3EXT
5
JSR
3EXT
4
LDX
3EXT
4
STX
3EXT
0High Byte of Opcode in Hexadecimal
3DIR
4
SUB
3IX2
4
CMP
3IX2
4
SBC
3IX2
4
CPX
3IX2
4
AND
3IX2
4
BIT
3IX2
4
LDA
3IX2
4
STA
3IX2
4
EOR
3IX2
4
ADC
3IX2
4
ORA
3IX2
4
ADD
3IX2
4
JMP
3IX2
6
JSR
3IX2
4
LDX
3IX2
4
STX
3IX2
Cycles
5
SUB
4SP2
5
CMP
4SP2
5
SBC
4SP2
5
CPX
4SP2
5
AND
4SP2
5
BIT
4SP2
5
LDA
4SP2
5
STA
4SP2
5
EOR
4SP2
5
ADC
4SP2
5
ORA
4SP2
5
ADD
4SP2
5
LDX
4SP2
5
STX
4SP2
3
SUB
2IX1
3
CMP
2IX1
3
SBC
2IX1
3
CPX
2IX1
3
AND
2IX1
3
BIT
2IX1
3
LDA
2IX1
3
STA
2IX1
3
EOR
2IX1
3
ADC
2IX1
3
ORA
2IX1
3
ADD
2IX1
3
JMP
2IX1
5
JSR
2IX1
3
LDX
2IX1
3
STX
2IX1
4
SUB
3SP1
4
CMP
3SP1
4
SBC
3SP1
4
CPX
3SP1
4
AND
3SP1
4
BIT
3SP1
4
LDA
3SP1
4
STA
3SP1
4
EOR
3SP1
4
ADC
3SP1
4
ORA
3SP1
4
ADD
3SP1
4
LDX
3SP1
4
STX
3SP1
2
SUB
1IX
2
CMP
1IX
2
SBC
1IX
2
CPX
1IX
2
AND
1IX
2
BIT
1IX
2
LDA
1IX
2
STA
1IX
2
EOR
1IX
2
ADC
1IX
2
ORA
1IX
2
ADD
1IX
2
JMP
1IX
4
JSR
1IX
2
LDX
1IX
2
STX
1IX
Opcode Map
Central Processor Unit (CPU)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
60Freescale Semiconductor
Chapter 5
System Integration Module (SIM)
5.1 Introduction
This section describes the system integration module (SIM), which supports up to 24 external and/or
internal interrupts. Together with the CPU, the SIM controls all MCU activities. A block diagram of the SIM
is shown in Figure 5-1. Figure 5-2 is a summary of the SIM I/O registers. The SIM is a system state
controller that coordinates CPU and exception timing.
The SIM is responsible for:
•Bus clock generation and control for CPU and peripherals
–Stop/wait/reset/break entry and recovery
–Internal clock control
•Master reset control, including power-on reset (POR) and COP timeout
•Interrupt control:
–Acknowledge timing
–Arbitration control timing
–Vector address generation
•CPU enable/disable timing
•Modular architecture expandable to 128 interrupt sources
Table 5-1 shows the internal signal names used in this section.
Table 5-1. Signal Name Conventions
Signal NameDescription
ICLKInternal oscillator clock
OSCOUT
IABInternal address bus
IDBInternal data bus
PORRSTSignal from the power-on reset module to the SIM
IRSTInternal reset signal
R/W
The XTAL or RC frequency divided by two. This signal is again divided by two in the SIM
to generate the internal bus clocks. (Bus clock = OSCOUT ÷ 2)
Read/write signal
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
62Freescale Semiconductor
SIM Bus Clock Control and Generation
Read:IF6IF5IF4IF30IF100
Write:RRRRRRRR
(INT1)
Reset:00000000
Read:IF14IF13IF12IF1100IF8IF7
Write:RRRRRRRR
(INT2)
Reset:00000000
Read:0000000IF15
Write:RRRRRRRR
(INT3)
Reset:00000000
= UnimplementedR= Reserved
$FE04
$FE05
$FE06
Interrupt Status Register 1
Interrupt Status Register 2
Interrupt Status Register 3
Figure 5-2. SIM I/O Register Summary
5.2 SIM Bus Clock Control and Generation
The bus clock generator provides system clock signals for the CPU and peripherals on the MCU. The
system clocks are generated from an incoming clock, OSCOUT, as shown in Figure 5-3.
From
OSCILLATOR
From
OSCILLATOR
ICLK
OSCOUT
SIM COUNTER
÷ 2
GENERATORS
BUS CLOCK
OSCOUT is OSC frequency divided by 2
SIM
Figure 5-3. SIM Clock Signals
5.2.1 Bus Timing
In user mode, the internal bus frequency is the oscillator frequency divided by four.
5.2.2 Clock Start-Up from POR or LVI Reset
When the power-on reset module or the low-voltage inhibit module generates a reset, the clocks to the
CPU and peripherals are inactive and held in an inactive phase until after the 4096 ICLK cycle POR
timeout has completed. The RST
pin is driven low by the SIM during this entire period. The IBUS clocks
start upon completion of the timeout.
5.2.3 Clocks in Stop Mode and Wait Mode
Upon exit from stop mode by an interrupt, break, or reset, the SIM allows ICLK to clock the SIM counter.
The CPU and peripheral clocks do not become active until after the stop delay time-out. This time-out is
selectable as 4096 or 32 ICLK cycles. (See 5.6.2 Stop Mode.)
In wait mode, the CPU clocks are inactive. The SIM also produces two sets of clocks for other modules.
Refer to the wait mode subsection of each module to see if the module is active or inactive in wait mode.
Some modules can be programmed to be active in wait mode.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor63
System Integration Module (SIM)
5.3 Reset and System Initialization
The MCU has these reset sources:
•Power-on reset module (POR)
•External reset pin (RST
•Computer operating properly module (COP)
•Low-voltage inhibit module (LVI)
•Illegal opcode
•Illegal address
All of these resets produce the vector $FFFE–$FFFF ($FEFE–$FEFF in Monitor mode) and assert the
internal reset signal (IRST). IRST causes all registers to be returned to their default values and all
modules to be returned to their reset states.
An internal reset clears the SIM counter (see 5.4 SIM Counter), but an external reset does not. Each of
the resets sets a corresponding bit in the reset status register (RSR). (See 5.7 SIM Registers.)
5.3.1 External Pin Reset
The RST pin circuits include an internal pull-up device. Pulling the asynchronous RST pin low halts all
processing. The PIN bit of the reset status register (RSR) is set as long as RST
of 67 ICLK cycles, assuming that the POR was not the source of the reset. See Table 5-2 for details.
Figure 5-4 shows the relative timing.
)
is held low for a minimum
Table 5-2. PIN Bit Set Timing
Reset TypeNumber of Cycles Required to Set PIN
POR4163 (4096 + 64 + 3)
All others67 (64 + 3)
RST
IAB
PC
VECT HVECT L
Figure 5-4. External Reset Timing
5.3.2 Active Resets from Internal Sources
All internal reset sources actively pull the RST pin low for 32 ICLK cycles to allow resetting of external
peripherals. The internal reset signal IRST continues to be asserted for an additional 32 cycles
(Figure 5-5). An internal reset can be caused by an illegal address, illegal opcode, COP time-out, or POR.
(See Figure 5-6 . Sources of Internal Reset.) Note that for POR resets, the SIM cycles through 4096 ICLK
cycles during which the SIM forces the RST
from the falling edge of RST
shown in Figure 5-5.
pin low. The internal reset signal then follows the sequence
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
64Freescale Semiconductor
IRST
Reset and System Initialization
RST
ICLK
IAB
RST PULLED LOW BY MCU
32 CYCLES32 CYCLES
VECTOR HIGH
Figure 5-5. Internal Reset Timing
The COP reset is asynchronous to the bus clock.
ILLEGAL ADDRESS RST
ILLEGAL OPCODE RST
COPRST
POR
LVI
INTERNAL RESET
Figure 5-6. Sources of Internal Reset
The active reset feature allows the part to issue a reset to peripherals and other chips within a system
built around the MCU.
5.3.2.1 Power-On Reset
When power is first applied to the MCU, the power-on reset module (POR) generates a pulse to indicate
that power-on has occurred. The external reset pin (RST
) is held low while the SIM counter counts out
4096 ICLK cycles. Sixty-four ICLK cycles later, the CPU and memories are released from reset to allow
the reset vector sequence to occur.
At power-on, the following events occur:
•A POR pulse is generated.
•The internal reset signal is asserted.
•The SIM enables OSCOUT.
•Internal clocks to the CPU and modules are held inactive for 4096 ICLK cycles to allow stabilization
of the oscillator.
•The RST
pin is driven low during the oscillator stabilization time.
•The POR bit of the reset status register (RSR) is set and all other bits in the register are cleared.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor65
System Integration Module (SIM)
OSC1
PORRST
4096
CYCLES
ICLK
OSCOUT
RST
IAB
32
CYCLES
32
CYCLES
$FFFE$FFFF
Figure 5-7. POR Recovery
5.3.2.2 Computer Operating Properly (COP) Reset
An input to the SIM is reserved for the COP reset signal. The overflow of the COP counter causes an
internal reset and sets the COP bit in the reset status register (RSR). The SIM actively pulls down the
RST
pin for all internal reset sources.
To prevent a COP module time-out, write any value to location $FFFF. Writing to location $FFFF clears
the COP counter and stages 12 through 5 of the SIM counter. The SIM counter output, which occurs at
least every (2
12
– 24) ICLK cycles, drives the COP counter. The COP should be serviced as soon as
possible out of reset to guarantee the maximum amount of time before the first time-out.
The COP module is disabled if the RST
pin or the IRQ pin is held at V
while the MCU is in monitor
TST
mode. The COP module can be disabled only through combinational logic conditioned with the high
voltage signal on the RST
external noise. During a break state, V
or the IRQ pin. This prevents the COP from becoming disabled as a result of
on the RST pin disables the COP module.
TST
5.3.2.3 Illegal Opcode Reset
The SIM decodes signals from the CPU to detect illegal instructions. An illegal instruction sets the ILOP
bit in the reset status register (RSR) and causes a reset.
If the stop enable bit, STOP, in the mask option register is logic zero, the SIM treats the STOP instruction
as an illegal opcode and causes an illegal opcode reset. The SIM actively pulls down the RST
pin for all
internal reset sources.
5.3.2.4 Illegal Address Reset
An opcode fetch from an unmapped address generates an illegal address reset. The SIM verifies that the
CPU is fetching an opcode prior to asserting the ILAD bit in the reset status register (RSR) and resetting
the MCU. A data fetch from an unmapped address does not generate a reset. The SIM actively pulls down
the RST
pin for all internal reset sources.
5.3.2.5 Low-Voltage Inhibit (LVI) Reset
The low-voltage inhibit module (LVI) asserts its output to the SIM when the V
trip voltage V
66Freescale Semiconductor
. The LVI bit in the reset status register (RSR) is set, and the external reset pin (RST) is
TRIP
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
voltage falls to the LVI
DD
SIM Counter
held low while the SIM counter counts out 4096 ICLK cycles. Sixty-four ICLK cycles later, the CPU and
memories are released from reset to allow the reset vector sequence to occur. The SIM actively pulls
down the RST
pin for all internal reset sources.
5.4 SIM Counter
The SIM counter is used by the power-on reset module (POR) and in stop mode recovery to allow the
oscillator time to stabilize before enabling the internal bus (IBUS) clocks. The SIM counter also serves as
a prescaler for the computer operating properly module (COP). The SIM counter uses 12 stages for
counting, followed by a 13th stage that triggers a reset of SIM counters and supplies the clock for the COP
module. The SIM counter is clocked by the falling edge of ICLK.
5.4.1 SIM Counter During Power-On Reset
The power-on reset module (POR) detects power applied to the MCU. At power-on, the POR circuit
asserts the signal PORRST. Once the SIM is initialized, it enables the oscillator to drive the bus clock
state machine.
5.4.2 SIM Counter During Stop Mode Recovery
The SIM counter also is used for stop mode recovery. The STOP instruction clears the SIM counter. After
an interrupt, break, or reset, the SIM senses the state of the short stop recovery bit, SSREC, in the mask
option register. If the SSREC bit is a logic one, then the stop recovery is reduced from the normal delay
of 4096 ICLK cycles down to 32 ICLK cycles. This is ideal for applications using canned oscillators that
do not require long start-up times from stop mode. External crystal applications should use the full stop
recovery time, that is, with SSREC cleared in the configuration register 1 (CONFIG1).
5.4.3 SIM Counter and Reset States
External reset has no effect on the SIM counter. (See 5.6.2 Stop Mode for details.) The SIM counter is
free-running after all reset states. (See 5.3.2 Active Resets from Internal Sources for counter control and
internal reset recovery sequences.)
5.5 Exception Control
Normal, sequential program execution can be changed in three different ways:
•Interrupts
–Maskable hardware CPU interrupts
–Non-maskable software interrupt instruction (SWI)
•Reset
•Break interrupts
5.5.1 Interrupts
An interrupt temporarily changes the sequence of program execution to respond to a particular event.
Figure 5-8 flow charts the handling of system interrupts.
Interrupts are latched, and arbitration is performed in the SIM at the start of interrupt processing. The
arbitration result is a constant that the CPU uses to determine which vector to fetch. Once an interrupt is
latched by the SIM, no other interrupt can take precedence, regardless of priority, until the latched
interrupt is serviced (or the I bit is cleared).
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor67
System Integration Module (SIM)
FROM RESET
BREAK INTERRUPT?
YES
INTERRUPT?
INTERRUPT?
(As many interrupts as exist on chip)
I BIT SET?
NO
I BIT SET?
NO
IRQ
NO
TIMER 1
NO
YES
YES
YES
STACK CPU REGISTERS.
LOAD PC WITH INTERRUPT VECTOR.
SET I BIT.
FETCH NEXT
INSTRUCTION
SWI
INSTRUCTION?
NO
RTI
INSTRUCTION?
NO
YES
YES
UNSTACK CPU REGISTERS.
EXECUTE INSTRUCTION.
Figure 5-8. Interrupt Processing
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
68Freescale Semiconductor
Exception Control
At the beginning of an interrupt, the CPU saves the CPU register contents on the stack and sets the
interrupt mask (I bit) to prevent additional interrupts. At the end of an interrupt, the RTI instruction recovers
the CPU register contents from the stack so that normal processing can resume. Figure 5-9 shows
interrupt entry timing.
Figure 5-10 shows interrupt recovery timing.
MODULE
INTERRUPT
I BIT
IAB
IDB
R/W
MODULE
INTERRUPT
I BIT
IAB
IDB
R/W
DUMMY
SPSP – 1SP – 2SP – 3SP – 4VECT HVECT LSTART ADDR
DUMMYPC – 1[7:0] PC – 1[15:8]XACCRV DATA H V DATA LOPCODE
Figure 5-9
SP – 4SP – 3SP – 2SP – 1SPPCPC + 1
CCRAXPC – 1[15:8] PC – 1[7:0] OPCODEOPERAND
. Interrupt Entry
Figure 5-10. Interrupt Recovery
5.5.1.1 Hardware Interrupts
A hardware interrupt does not stop the current instruction. Processing of a hardware interrupt begins after
completion of the current instruction. When the current instruction is complete, the SIM checks all pending
hardware interrupts. If interrupts are not masked (I bit clear in the condition code register), and if the
corresponding interrupt enable bit is set, the SIM proceeds with interrupt processing; otherwise, the next
instruction is fetched and executed.
If more than one interrupt is pending at the end of an instruction execution, the highest priority interrupt is
serviced first. Figure 5-11 demonstrates what happens when two interrupts are pending. If an interrupt is
pending upon exit from the original interrupt service routine, the pending interrupt is serviced before the
LDA instruction is executed.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor69
System Integration Module (SIM)
CLI
BACKGROUND ROUTINE#$FF
INT1
INT2
LDA
PSHH
INT1 INTERRUPT SERVICE ROUTINE
PULH
RTI
PSHH
INT2 INTERRUPT SERVICE ROUTINE
PULH
RTI
Figure 5-11. Interrupt Recognition Example
The LDA opcode is prefetched by both the INT1 and INT2 RTI instructions. However, in the case of the
INT1 RTI prefetch, this is a redundant operation.
NOTE
To maintain compatibility with the M6805 Family, the H register is not
pushed on the stack during interrupt entry. If the interrupt service routine
modifies the H register or uses the indexed addressing mode, software
should save the H register and then restore it prior to exiting the routine.
5.5.1.2 SWI Instruction
The SWI instruction is a non-maskable instruction that causes an interrupt regardless of the state of the
interrupt mask (I bit) in the condition code register.
NOTE
A software interrupt pushes PC onto the stack. A software interrupt does
not push PC – 1, as a hardware interrupt does.
5.5.2 Interrupt Status Registers
The flags in the interrupt status registers identify maskable interrupt sources. Table 5-3 summarizes the
interrupt sources and the interrupt status register flags that they set. The interrupt status registers can be
useful for debugging.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
All reset sources always have equal and highest priority and cannot be arbitrated.
5.5.4 Break Interrupts
The break module can stop normal program flow at a software-programmable break point by asserting its
break interrupt output. (See Chapter 16 Break Module (BREAK).) The SIM puts the CPU into the break
state by forcing it to the SWI vector location. Refer to the break interrupt subsection of each module to
see how each module is affected by the break state.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
72Freescale Semiconductor
Low-Power Modes
5.5.5 Status Flag Protection in Break Mode
The SIM controls whether status flags contained in other modules can be cleared during break mode. The
user can select whether flags are protected from being cleared by properly initializing the break clear flag
enable bit (BCFE) in the break flag control register (BFCR).
Protecting flags in break mode ensures that set flags will not be cleared while in break mode. This
protection allows registers to be freely read and written during break mode without losing status flag
information.
Setting the BCFE bit enables the clearing mechanisms. Once cleared in break mode, a flag remains
cleared even when break mode is exited. Status flags with a two-step clearing mechanism — for example,
a read of one register followed by the read or write of another — are protected, even when the first step
is accomplished prior to entering break mode. Upon leaving break mode, execution of the second step
will clear the flag as normal.
5.6 Low-Power Modes
Executing the WAIT or STOP instruction puts the MCU in a low-power-consumption mode for standby
situations. The SIM holds the CPU in a non-clocked state. The operation of each of these modes is
described below. Both STOP and WAIT clear the interrupt mask (I) in the condition code register, allowing
interrupts to occur.
5.6.1 Wait Mode
In wait mode, the CPU clocks are inactive while the peripheral clocks continue to run. Figure 5-15 shows
the timing for wait mode entry.
A module that is active during wait mode can wake up the CPU with an interrupt if the interrupt is enabled.
Stacking for the interrupt begins one cycle after the WAIT instruction during which the interrupt occurred.
In wait mode, the CPU clocks are inactive. Refer to the wait mode subsection of each module to see if the
module is active or inactive in wait mode. Some modules can be programmed to be active in wait mode.
Wait mode can also be exited by a reset or break. A break interrupt during wait mode sets the SIM break
stop/wait bit, SBSW, in the break status register (BSR). If the COP disable bit, COPD, in the mask option
register is logic zero, then the computer operating properly module (COP) is enabled and remains active
in wait mode.
WAIT ADDR
IDB
R/W
NOTE: Previous data can be operand data or the WAIT opcode, depending on the
PREVIOUS DATANEXT OPCODESAME
last instruction.
Figure 5-15. Wait Mode Entry Timing
WAIT ADDR + 1SAMESAMEIAB
SAME
Figure 5-16 and Figure 5-17 show the timing for WAIT recovery.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor73
System Integration Module (SIM)
IAB
IDB
EXITSTOPWAIT
NOTE: EXITSTOPWAIT =
Figure 5-16. Wait Recovery from Interrupt or Break
IAB
IDB
RST
ICLK
$A6
$6E0B
$A6$A6
Figure 5-17. Wait Recovery from Internal Reset
$6E0C$6E0B$00FF$00FE$00FD$00FC
$A6$A6$01$0B$6E$A6
RST pin OR CPU interrupt OR break interrupt
32
Cycles
32
Cycles
RST VCT HRST VCT L
5.6.2 Stop Mode
In stop mode, the SIM counter is reset and the system clocks are disabled. An interrupt request from a
module can cause an exit from stop mode. Stacking for interrupts begins after the selected stop recovery
time has elapsed. Reset or break also causes an exit from stop mode.
The SIM disables the oscillator signals (OSCOUT) in stop mode, stopping the CPU and peripherals. Stop
recovery time is selectable using the SSREC bit in the configuration register 1 (CONFIG1). If SSREC is
set, stop recovery is reduced from the normal delay of 4096 ICLK cycles down to 32. This is ideal for
applications using canned oscillators that do not require long start-up times from stop mode.
NOTE
External crystal applications should use the full stop recovery time by
clearing the SSREC bit.
A break interrupt during stop mode sets the SIM break stop/wait bit (SBSW) in the break status register
(BSR).
The SIM counter is held in reset from the execution of the STOP instruction until the beginning of stop
recovery. It is then used to time the recovery period. Figure 5-18 shows stop mode entry timing.
NOTE
To minimize stop current, all pins configured as inputs should be driven to
a logic 1 or logic 0.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
74Freescale Semiconductor
CPUSTOP
SIM Registers
ICLK
INT/BREAK
IAB
STOP ADDR
IDB
R/W
NOTE: Previous data can be operand data or the STOP opcode, depending on the last
instruction.
PREVIOUS DATANEXT OPCODESAME
STOP ADDR + 1SAMESAMEIAB
SAME
Figure 5-18. Stop Mode Entry Timing
STOP RECOVERY PERIOD
STOP +1
STOP + 2STOP + 2SPSP – 1SP – 2SP – 3
Figure 5-19. Stop Mode Recovery from Interrupt or Break
5.7 SIM Registers
The SIM has three memory mapped registers.
•Break Status Register (BSR)
•Reset Status Register (RSR)
•Break Flag Control Register (BFCR)
5.7.1 Break Status Register (BSR)
The break status register contains a flag to indicate that a break caused an exit from stop or wait mode.
Address:$FE00
Bit 7654321Bit 0
Read:
Write:Note
Reset:00000000
RRRRRR
R= Reserved1. Writing a logic zero clears SBSW.
Figure 5-20. Break Status Register (BSR)
SBSW
(1)
R
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor75
System Integration Module (SIM)
SBSW — SIM Break Stop/Wait
This status bit is useful in applications requiring a return to wait or stop mode after exiting from a break
interrupt. Clear SBSW by writing a logic zero to it. Reset clears SBSW.
1 = Stop mode or wait mode was exited by break interrupt
0 = Stop mode or wait mode was not exited by break interrupt
SBSW can be read within the break state SWI routine. The user can modify the return address on the
stack by subtracting one from it. The following code is an example of this. Writing zero to the SBSW bit
clears it.
;
This code works if the H register has been pushed onto the stack in the break
;
service routine software. This code should be executed at the end of the
;
break service routine software.
HIBYTEEQU5
LOBYTEEQU6
;If not SBSW, do RTI
BRCLRSBSW,BSR, RETURN;;See if wait mode or stop mode was exited
by break.
TSTLOBYTE,SP; If RETURNLO is not zero,
BNEDOLO; then just decrement low byte.
DECHIBYTE,SP; Else deal with high byte, too.
DOLODECLOBYTE,SP; Point to WAIT/STOP opcode.
RETURNPULH
RTI
; Restore H register.
5.7.2 Reset Status Register (RSR)
This register contains six flags that show the source of the last reset. Clear the SIM reset status register
by reading it. A power-on reset sets the POR bit and clears all other bits in the register.
Address:$FE01
Bit 7654321Bit 0
Read:PORPINCOPILOPILADMODRSTLVI0
Write:
POR:10000000
= Unimplemented
Figure 5-21. Reset Status Register (RSR)
POR — Power-On Reset Bit
1 = Last reset caused by POR circuit
0 = Read of RSR
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
76Freescale Semiconductor
PIN — External Reset Bit
1 = Last reset caused by external reset pin (RST
)
0 = POR or read of RSR
COP — Computer Operating Properly Reset Bit
1 = Last reset caused by COP counter
0 = POR or read of RSR
ILOP — Illegal Opcode Reset Bit
1 = Last reset caused by an illegal opcode
0 = POR or read of RSR
ILAD — Illegal Address Reset Bit (opcode fetches only)
1 = Last reset caused by an opcode fetch from an illegal address
0 = POR or read of RSR
MODRST — Monitor Mode Entry Module Reset bit
1 = Last reset caused by monitor mode entry when vector locations $FFFE and $FFFF are $FF after
POR while IRQ
= V
DD
0 = POR or read of RSR
LVI — Low Voltage Inhibit Reset bit
1 = Last reset caused by LVI circuit
0 = POR or read of RSR
SIM Registers
5.7.3 Break Flag Control Register (BFCR)
The break control register contains a bit that enables software to clear status bits while the MCU is in a
break state.
Address:$FE03
Bit 7654321Bit 0
Read:
Write:
Reset:0
BCFE — Break Clear Flag Enable Bit
This read/write bit enables software to clear status bits by accessing status registers while the MCU is
in a break state. To clear status bits during the break state, the BCFE bit must be set.
1 = Status bits clearable during break
0 = Status bits not clearable during break
BCFERRRRRRR
R= Reserved
Figure 5-22. Break Flag Control Register (BFCR)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor77
System Integration Module (SIM)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
78Freescale Semiconductor
Chapter 6
Oscillator (OSC)
6.1 Introduction
The oscillator module provides the reference clocks for the MCU system and bus. Two oscillators are
running on the device:
Selectable oscillator — for bus clock
•Crystal oscillator (XTAL) — built-in oscillator that requires an external crystal or ceramic-resonator.
This option also allows an external clock that can be driven directly into OSC1.
•RC oscillator (RC) — built-in oscillator that requires an external resistor-capacitor connection only.
The selected oscillator is used to drive the bus clock, the SIM, and other modules on the MCU. The
oscillator type is selected by programming a bit FLASH memory. The RC and crystal oscillator cannot run
concurrently; one is disabled while the other is selected; because the RC and XTAL circuits share the
same OSC1 pin.
Non-selectable oscillator — for COP
•Internal oscillator — built-in RC oscillator that requires no external components.
This internal oscillator is used to drive the computer operating properly (COP) module and the SIM. The
internal oscillator runs continuously after a POR or reset, and is always available.
6.2 Oscillator Selection
The oscillator type is selected by programming a bit in a FLASH memory location; the mask option register
(MOR), at $FFD0.
(See 3.5 Mask Option Register (MOR).)
NOTE
On the ROM device, the oscillator is selected by a ROM-mask layer at
factory.
Address:$FFD0
Bit 7654321Bit 0
Read:
OSCSELRRRRRRR
Write:
Erased:11111111
Reset:Unaffected by reset
Non-volatile FLASH register; write by programming.
R=Reserved
Figure 6-1. Mask Option Register (MOR)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor79
Oscillator (OSC)
OSCSEL — Oscillator Select Bit
OSCSEL selects the oscillator type for the MCU. The erased or unprogrammed state of this bit is
logic 1, selecting the crystal oscillator option. This bit is unaffected by reset.
1 = Crystal oscillator
0 = RC oscillator
Bits 6–0 — Should be left as logic 1’s.
NOTE
When Crystal oscillator is selected, the OSC2/RCCLK/PTA6/KBI6 pin is
used as OSC2; other functions such as PTA6/KBI6 will not be available.
6.2.1 XTAL Oscillator
The XTAL oscillator circuit is designed for use with an external crystal or ceramic resonator to provide
accurate clock source.
In its typical configuration, the XTAL oscillator is connected in a Pierce oscillator configuration, as shown
in Figure 6-2. This figure shows only the logical representation of the internal components and may not
represent actual circuitry. The oscillator configuration uses five components:
•Crystal, X
•Fixed capacitor, C
•Tuning capacitor, C2 (can also be a fixed capacitor)
•Feedback resistor, R
•Series resistor, RS (optional)
1
1
B
From SIM
XTALCLK
SIMOSCEN
To SIMTo SIM
OSCOUT2OSCOUT
÷ 2
MCU
R
B
X
1
C
1
OSC2OSC1
RS*
*RS can be zero (shorted) when used with higher-frequency crystals.
Refer to manufacturer’s data.
See Chapter 17 for component value requirements.
C
2
Figure 6-2. XTAL Oscillator External Connections
The series resistor (R
) is included in the diagram to follow strict Pierce oscillator guidelines and may not
S
be required for all ranges of operation, especially with high frequency crystals. Refer to the crystal
manufacturer’s data for more information.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
80Freescale Semiconductor
Internal Oscillator
6.2.2 RC Oscillator
The RC oscillator circuit is designed for use with external resistor and capacitor to provide a clock source
with tolerance less than 10%.
In its typical configuration, the RC oscillator requires two external components, one R and one C.
Component values should have a tolerance of 1% or less, to obtain a clock source with less than 10%
tolerance. The oscillator configuration uses two components:
•C
EXT
•R
EXT
To SIM
To SIMFrom SIM
OSCOUT2OSCOUT
SIMOSCEN
MCU
V
DD
EN
OSCILLATOR
OSC1
R
EXT
EXT-RC
RCCLK
C
EXT
÷ 2
0
1
RCCLK/PTA6 (OSC2)
See Chapter 17 for component value requirements.
PTA6
I/O
PTA6
PTA6EN
Figure 6-3. RC Oscillator External Connections
6.3 Internal Oscillator
The internal oscillator clock (ICLK) is a free running 50-kHz clock that requires no external components.
It is used as the reference clock input to the computer operating properly (COP) module and the SIM.
The internal oscillator by default is always available and is free running after POR or reset. It can be
stopped in stop mode by setting the STOP_ICLKDIS bit before executing the STOP instruction.
Figure 6-4 shows the logical representation of components of the internal oscillator circuitry.
INTERNAL
Figure 6-4. Internal Oscillator
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor81
Oscillator (OSC)
NOTE
The internal oscillator is a free running oscillator and is available after each
POR or reset. It is turned-off in stop mode by setting the STOP_ICLKDIS
bit in CONFIG2 (see 3.4 Configuration Register 2 (CONFIG2)).
6.4 I/O Signals
The following paragraphs describe the oscillator I/O signals.
6.4.1 Crystal Amplifier Input Pin (OSC1)
OSC1 pin is an input to the crystal oscillator amplifier or the input to the RC oscillator circuit.
For the XTAL oscillator, OSC2 pin is the output of the crystal oscillator inverting amplifier.
For the RC oscillator, OSC2 pin can be configured as a general purpose I/O pin PTA6, or the output of
the RC oscillator, RCCLK.
Oscillator OSC2 pin function
XTALInverting OSC1
Controlled by PTA6EN bit in PTAPUE ($000D)
RC
PTA6EN = 0: RCCLK output
PTA6EN = 1: PTA6/KBI6
6.4.3 Oscillator Enable Signal (SIMOSCEN)
The SIMOSCEN signal comes from the system integration module (SIM) and enables/disables the XTAL
oscillator circuit or the RC-oscillator.
6.4.4 XTAL Oscillator Clock (XTALCLK)
XTALCLK is the XTAL oscillator output signal. It runs at the full speed of the crystal (f
directly from the crystal oscillator circuit. Figure 6-2 shows only the logical relation of XTALCLK to OSC1
and OSC2 and may not represent the actual circuitry. The duty cycle of XTALCLK is unknown and may
depend on the crystal and other external factors. Also, the frequency and amplitude of XTALCLK can be
unstable at start-up.
) and comes
XCLK
6.4.5 RC Oscillator Clock (RCCLK)
RCCLK is the RC oscillator output signal. Its frequency is directly proportional to the time constant of the
external R and C. Figure 6-3 shows only the logical relation of RCCLK to OSC1 and may not represent
the actual circuitry.
6.4.6 Oscillator Out 2 (2OSCOUT)
2OSCOUT is same as the input clock (XTALCLK or RCCLK). This signal is driven to the SIM module.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
82Freescale Semiconductor
Low Power Modes
6.4.7 Oscillator Out (OSCOUT)
The frequency of this signal is equal to half of the 2OSCOUT, this signal is driven to the SIM for generation
of the bus clocks used by the CPU and other modules on the MCU. OSCOUT will be divided again in the
SIM and results in the internal bus frequency being one fourth of the XTALCLK or RCCLK frequency.
6.4.8 Internal Oscillator Clock (ICLK)
ICLK is the internal oscillator output signal (typically 50-kHz), for the COP module and the SIM. Its
frequency depends on the V
voltage. (See Chapter 17 Electrical Specifications for ICLK parameters.)
DD
6.5 Low Power Modes
The WAIT and STOP instructions put the MCU in low-power consumption standby modes.
6.5.1 Wait Mode
The WAIT instruction has no effect on the oscillator logic. OSCOUT, 2OSCOUT, and ICLK continues to
drive to the SIM module.
6.5.2 Stop Mode
The STOP instruction disables the XTALCLK or the RCCLK output, hence, OSCOUT and 2OSCOUT are
disabled.
The STOP instruction also turns off the ICLK input to the COP module if the STOP_ICLKDIS bit is set in
configuration register 2 (CONFIG2). After reset, the STOP_ICLKDIS bit is clear by default and ICLK is
enabled during stop mode.
6.6 Oscillator During Break Mode
The OSCOUT, 2OSCOUT, and ICLK clocks continue to be driven out when the device enters the break
state.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor83
Oscillator (OSC)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
84Freescale Semiconductor
Chapter 7
Monitor ROM (MON)
7.1 Introduction
This section describes the monitor ROM (MON) and the monitor mode entry methods. The monitor ROM
allows complete testing of the MCU through a single-wire interface with a host computer. This mode is
also used for programming and erasing of FLASH memory in the MCU. Monitor mode entry can be
achieved without use of the higher test voltage, V
blank, thus reducing the hardware requirements for in-circuit programming.
7.2 Features
Features of the monitor ROM include the following:
•Normal user-mode pin functionality
•One pin dedicated to serial communication between monitor ROM and host computer
•Standard mark/space non-return-to-zero (NRZ) communication with host computer
•Execution of code in RAM or FLASH
•FLASH memory security feature
•FLASH memory programming interface
•959 bytes monitor ROM code size
•Monitor mode entry without high voltage, V
$FF)
•Standard monitor mode entry if high voltage, V
•Resident routines for FLASH programming and EEPROM emulation
(1)
, as long as vector addresses $FFFE and $FFFF are
TST
, if reset vector is blank ($FFFE and $FFFF contain
TST
, is applied to IRQ
TST
7.3 Functional Description
The monitor ROM receives and executes commands from a host computer. Figure 7-1 shows a example
circuit used to enter monitor mode and communicate with a host computer via a standard RS-232
interface.
Simple monitor commands can access any memory address. In monitor mode, the MCU can execute
host-computer code in RAM while most MCU pins retain normal operating mode functions. All
communication between the host computer and the MCU is through the PTB0 pin. A level-shifting and
multiplexing interface is required between PTB0 and the host computer. PTB0 is used in a wired-OR
configuration and requires a pull-up resistor.
1. No security feature is absolutely secure. However, Motorola’s strategy is to make reading or copying the FLASH difficult for
unauthorized users.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor85
Monitor ROM (MON)
V
DD
EXT OSC (50% DUTY)
EXT OSC CONNECTION TO OSC1, WITH OSC2
UNCONNECTED, CAN REPLACE XTAL CIRCUIT.
OSC1
0.1 µF
0.1 µF
V
DD
RST
HC908JL8
V
DD
V
SS
1 µF
1 µF
DB9
2
3
5
MAX232
1
C1+
+
3
C1–
4
C2+
+
5
C2–
V
GND
CC
V+
V–
7
8
V
DD
16
+
1 µF
15
1 µF
+
2
V
TST
6
1 µF
+
10
9
74HC125
2
3
74HC125
6
4
1
NOTES:
1. Monitor mode entry method:
SW1: Position A — High voltage entry (V
Bus clock depends on SW2.
TST
)
SW1: Position B — Reset vector must be blank ($FFFE = $FFFF = $FF)
Bus clock = OSC1 ÷ 4.
2. Affects high voltage entry to monitor mode only (SW1 at position A):
SW2: Position C — Bus clock = OSC1 ÷ 4
SW2: Position D — Bus clock = OSC1 ÷ 2
5. See Table 17-4 for V
voltage level requirements.
TST
5
9.8304MHz
20 pF
XTAL CIRCUIT
V
1 k
DD
10 k
8.5 V
(SEE NOTE 2)
20 pF
10 k
10 k
OSC1
10M
OSC2
A
SW1
(SEE NOTE 1)
IRQ
B
10 k
V
DD
PTB0
V
DD
V
DD
10 k
SW2
C
PTB1
PTB3
D
PTB2
10 k
Figure 7-1. Monitor Mode Circuit
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
86Freescale Semiconductor
Functional Description
7.3.1 Entering Monitor Mode
Table 7-1 shows the pin conditions for entering monitor mode. As specified in the table, monitor mode
may be entered after a POR.
Communication at 9600 baud will be established provided one of the following sets of conditions is met:
1.If IRQ
= V
TST
:
–Clock on OSC1 is 4.9125MHz
–PTB3 = low
2.If IRQ
= V
TST
:
–Clock on OSC1 is 9.8304MHz
–PTB3 = high
3.If $FFFE and $FFFF are blank (contain $FF):
–Clock on OSC1 is 9.8304MHz
–IRQ
= V
DD
Table 7-1. Monitor Mode Entry Requirements and Options
$FFFE
V
V
IRQ
TST
TST
V
DD
V
DD
(2)
(1)
and
$FFFF
X00114.9152MHz2.4576MHz
X10119.8304MHz2.4576MHz
BLANK
(contain
$FF)
NOT
BLANK
PTB3
PTB2
PTB1
XXX19.8304MHz2.4576 MHz
XXXXXOSC1 ÷ 4Enters User mode.
PTB0
OSC1 Clock
(1)
Bus FrequencyComments
High voltage entry to monitor
mode.
9600 baud communication on
PTB0. COP disabled.
Blank reset vector
(low-voltage) entry to monitor
mode.
9600 baud communication on
PTB0. COP disabled.
1. RC oscillator cannot be used for monitor mode; must use either external oscillator or XTAL oscillator circuit.
2. See Table 17-4 for V
If V
is applied to IRQ and PTB3 is low upon monitor mode entry (Table 7-1 condition set 1), the bus
TST
frequency is a divide-by-two of the clock input to OSC1. If PTB3 is high with V
voltage level requirements.
TST
applied to IRQ upon
TST
monitor mode entry (Table 7-1 condition set 2), the bus frequency is a divide-by-four of the clock input to
OSC1. Holding the PTB3 pin low when entering monitor mode causes a bypass of a divide-by-two stage
at the oscillator only if V
is applied to IRQ. In this event, the OSCOUT frequency is equal to the
TST
2OSCOUT frequency, and OSC1 input directly generates internal bus clocks. In this case, the OSC1
signal must have a 50% duty cycle at maximum bus frequency.
Entering monitor mode with V
. (See Chapter 5 System Integration Module (SIM) for more information on modes of operation.)
RST
If entering monitor mode without high voltage on IRQ
(Table 7-1 condition set 3, where applied voltage is V
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor87
on IRQ, the COP is disabled as long as V
TST
and reset vector being blank ($FFFE and $FFFF)
), then all port B pin requirements and conditions,
DD
is applied to either IRQ or
TST
Monitor ROM (MON)
including the PTB3 frequency divisor selection, are not in effect. This is to reduce circuit requirements
when performing in-circuit programming.
Entering monitor mode with the reset vector being blank, the COP is always disabled regardless of the
state of IRQ
or the RST.
Figure 7-2. shows a simplified diagram of the monitor mode entry when the reset vector is blank and IRQ
= V
. An OSC1 frequency of 9.8304MHz is required for a baud rate of 9600.
Enter monitor mode with the pin configuration shown above by pulling RST
edge of RST
latches monitor mode. Once monitor mode is latched, the values on the specified pins can
low and then high. The rising
change.
Once out of reset, the MCU waits for the host to send eight security bytes. (See 7.4 Security.) After the
security bytes, the MCU sends a break signal (10 consecutive logic zeros) to the host, indicating that it is
ready to receive a command. The break signal also provides a timing reference to allow the host to
determine the necessary baud rate.
In monitor mode, the MCU uses different vectors for reset, SWI, and break interrupt. The alternate vectors
are in the $FE page instead of the $FF page and allow code execution from the internal monitor firmware
instead of user code.
Table 7-2 is a summary of the vector differences between user mode and monitor mode.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
88Freescale Semiconductor
Table 7-2. Monitor Mode Vector Differences
Functions
Functional Description
Modes
COP
Reset
Vector
High
Reset
Vector
Low
Break
Vector
High
Break
Vector
Low
SWI
Vector
High
SWI
Vector
Low
UserEnabled$FFFE$FFFF$FFFC$FFFD$FFFC$FFFD
MonitorDisabled
(1)
$FEFE$FEFF$FEFC$FEFD$FEFC$FEFD
Notes:
1. If the high voltage (V
its COP enable output. The COP is a mask option enabled or disabled by the COPD bit
) is removed from the IRQ pin or the RST pin, the SIM asserts
TST
in the configuration register.
When the host computer has completed downloading code into the MCU RAM, the host then sends a
RUN command, which executes an RTI, which sends control to the address on the stack pointer.
7.3.2 Baud Rate
The communication baud rate is dependant on oscillator frequency. The state of PTB3 also affects baud
rate if entry to monitor mode is by IRQ
=V
pin is at logic zero upon entry into monitor mode, the divide by ratio is 512.
Table 7-3. Monitor Baud Rate Selection
Monitor Mode
Entry By:
. When PTB3 is high, the divide by ratio is 1024. If the PTB3
TST
OSC1 Clock
Frequency
PTB3Baud Rate
4.9152 MHz09600 bps
IRQ
= V
TST
9.8304 MHz19600 bps
4.9152 MHz14800 bps
Blank reset vector,
= V
IRQ
DD
9.8304 MHzX9600 bps
4.9152 MHzX4800 bps
7.3.3 Data Format
Communication with the monitor ROM is in standard non-return-to-zero (NRZ) mark/space data format.
(See Figure 7-3 and Figure 7-4.)
NEXT
STOP
BIT
STOP
BIT
STOP
BIT
START
BIT
NEXT
START
NEXT
START
BIT
BIT
$A5
BREAK
START
BIT
BIT 0BIT 1
START
BIT
START
BIT
BIT 2BIT 3BIT 4BIT 6BIT 7
BIT 5
Figure 7-3. Monitor Data Format
BIT 0BIT 1
BIT 0BIT 1
BIT 2BIT 3BIT 4BIT 6BIT 7
BIT 2
BIT 3BIT 4BIT 5BIT 6BIT 7
BIT 5
Figure 7-4. Sample Monitor Waveforms
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor89
Monitor ROM (MON)
The data transmit and receive rate can be anywhere from 4800 baud to 28.8k-baud. Transmit and receive
baud rates must be identical.
7.3.4 Echoing
As shown in Figure 7-5, the monitor ROM immediately echoes each received byte back to the PTB0 pin
for error checking.
SENT TO
MONITOR
ADDR. HIGHREADREADADDR. HIGH ADDR. LOW ADDR. LOWDATA
ECHO
RESULT
Figure 7-5. Read Transaction
Any result of a command appears after the echo of the last byte of the command.
7.3.5 Break Signal
A start bit followed by nine low bits is a break signal. (See Figure 7-6.) When the monitor receives a break
signal, it drives the PTB0 pin high for the duration of two bits before echoing the break signal.
MISSING STOP BIT
01234567
TWO-STOP-BIT DELAY BEFORE ZERO ECHO
01234567
Figure 7-6. Break Transaction
7.3.6 Commands
The monitor ROM uses the following commands:
•READ (read memory)
•WRITE (write memory)
•IREAD (indexed read)
•IWRITE (indexed write)
•READSP (read stack pointer)
•RUN (run user program)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
90Freescale Semiconductor
Table 7-4. READ (Read Memory) Command
DescriptionRead byte from memory
OperandSpecifies 2-byte address in high byte:low byte order
Data ReturnedReturns contents of specified address
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor91
Monitor ROM (MON)
Table 7-6. IREAD (Indexed Read) Command
DescriptionRead next 2 bytes in memory from last address accessed
OperandSpecifies 2-byte address in high byte:low byte order
Data ReturnedReturns contents of next two addresses
Opcode$1A
Command Sequence
SENT TO
MONITOR
DATAIREADIREADDATA
ECHO
Table 7-7. IWRITE (Indexed Write) Command
DescriptionWrite to last address accessed + 1
OperandSpecifies single data byte
Data ReturnedNone
Opcode$19
Command Sequence
SENT TO
MONITOR
DATAIWRITEIWRITEDATA
ECHO
A sequence of IREAD or IWRITE commands can sequentially access a
block of memory over the full 64-Kbyte memory map.
RESULT
NOTE
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
92Freescale Semiconductor
Table 7-8. READSP (Read Stack Pointer) Command
DescriptionReads stack pointer
OperandNone
Data ReturnedReturns stack pointer in high byte:low byte order
Opcode$0C
Command Sequence
SENT TO
MONITOR
SP HIGHREADSPREADSPSP LOW
Security
ECHO
Table 7-9. RUN (Run User Program) Command
DescriptionExecutes RTI instruction
OperandNone
Data ReturnedNone
Opcode$28
Command Sequence
SENT TO
MONITOR
RUNRUN
ECHO
7.4 Security
RESULT
A security feature discourages unauthorized reading of FLASH locations while in monitor mode. The host
can bypass the security feature at monitor mode entry by sending eight security bytes that match the
bytes at locations $FFF6–$FFFD. Locations $FFF6–$FFFD contain user-defined data.
NOTE
Do not leave locations $FFF6–$FFFD blank. For security reasons, program
locations $FFF6–$FFFD even if they are not used for vectors.
During monitor mode entry, the MCU waits after the power-on reset for the host to send the eight security
bytes on pin PTB0. If the received bytes match those at locations $FFF6–$FFFD, the host bypasses the
security feature and can read all FLASH locations and execute code from FLASH. Security remains
bypassed until a power-on reset occurs. If the reset was not a power-on reset, security remains bypassed
and security code entry is not required. (See Figure 7-7.)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor93
Monitor ROM (MON)
Figure 7-7. Monitor Mode Entry Timing
Upon power-on reset, if the received bytes of the security code do not match the data at locations
$FFF6–$FFFD, the host fails to bypass the security feature. The MCU remains in monitor mode, but
reading a FLASH location returns an invalid value and trying to execute code from FLASH causes an
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
94Freescale Semiconductor
Table 7-10. Summary of ROM-Resident Routines
ROM-Resident Routines
Routine NameRoutine DescriptionCall Address
PRGRNGEProgram a range of locations$FC0615
ERARNGEErase a page or the entire array$FCBE9
LDRNGELoads data from a range of locations$FF309
MON_PRGRNGE
MON_ERARNGE
MON_LDRNGE
EE_WRITE
EE_READ
1. The listed stack size excludes the 2 bytes used by the calling instruction, JSR.
Program a range of locations in monitor
mode
Erase a page or the entire array in monitor
mode
Loads data from a range of locations in
monitor mode
Emulated EEPROM write. Data size ranges
from 2 to 15 bytes at a time.
Emulated EEPROM read. Data size ranges
from 2 to 15 bytes at a time.
$FF2817
$FF2C11
$FF2411
$FD3F24
$FDD016
Stack Used
(bytes)
(1)
The routines are designed to be called as stand-alone subroutines in the user program or monitor mode.
The parameters that are passed to a routine are in the form of a contiguous data block, stored in RAM.
The index register (H:X) is loaded with the address of the first byte of the data block (acting as a pointer),
and the subroutine is called (JSR). Using the start address as a pointer, multiple data blocks can be used,
any area of RAM be used. A data block has the control and data bytes in a defined order, as shown in
Figure 7-8.
During the software execution, it does not consume any dedicated RAM location, the run-time heap will
extend the system stack, all other RAM location will not be affected.
FILE_PTR
$XXXX
ADDRESS AS POINTER
START ADDRESS HIGH (ADDRH)
START ADDRESS LOW (ADDRL)
DATA
ARRAY
RAM
BUS SPEED (BUS_SPD)
DATA SIZE (DATASIZE)
DATA 0
DATA 1
DATA N
DATA
BLOCK
Figure 7-8. Data Block Format for ROM-Resident Routines
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor95
Monitor ROM (MON)
The control and data bytes are described below.
•Bus speed — This one byte indicates the operating bus speed of the MCU. The value of this byte
should be equal to 4 times the bus speed, and should not be set to less than 4 (i.e. minimum bus
speed is 1MHz).
•Data size — This one byte indicates the number of bytes in the data array that are to be
manipulated. The maximum data array size is 128. Routines EE_WRITE and EE_READ are
restricted to manipulate a data array between 2 to 15 bytes. Whereas routines ERARNGE and
MON_ERARNGE do not manipulate a data array, thus, this data size byte has no meaning.
•Start address — These two bytes, high byte followed by low byte, indicate the start address of the
FLASH memory to be manipulated.
•Data array — This data array contains data that are to be manipulated. Data in this array are
programmed to FLASH memory by the programming routines: PRGRNGE, MON_PRGRNGE,
EE_WRITE. For the read routines: LDRNGE, MON_LDRNGE, and EE_READ, data is read from
FLASH and stored in this array.
7.5.1 PRGRNGE
PRGRNGE is used to program a range of FLASH locations with data loaded into the data array.
Table 7-11. PRGRNGE Routine
Routine NamePRGRNGE
Routine DescriptionProgram a range of locations
Calling Address$FC06
Stack Used15 bytes
Data Block FormatBus speed (BUS_SPD)
Data size (DATASIZE)
Start address high (ADDRH)
Start address (ADDRL)
Data 1 (DATA1)
:
Data N (DATAN)
The start location of the FLASH to be programmed is specified by the address ADDRH:ADDRL and the
number of bytes from this location is specified by DATASIZE. The maximum number of bytes that can be
programmed in one routine call is 128 bytes (max. DATASIZE is 128).
ADDRH:ADDRL do not need to be at a page boundary, the routine handles any boundary misalignment
during programming. A check to see that all bytes in the specified range are erased is not performed by
this routine prior programming. Nor does this routine do a verification after programming, so there is no
return confirmation that programming was successful. User must assure that the range specified is first
erased.
The coding example below is to program 32 bytes of data starting at FLASH location $EF00, with a bus
speed of 4.9152 MHz. The coding assumes the data block is already loaded in RAM, with the address
pointer, FILE_PTR, pointing to the first byte of the data block.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
96Freescale Semiconductor
ORGRAM
:
FILE_PTR:
BUS_SPDDS.B1; Indicates 4x bus frequency
DATASIZEDS.B1; Data size to be programmed
START_ADDRDS.W1; FLASH start address
DATAARRAYDS.B32; Reserved data array
PRGRNGEEQU$FC06
FLASH_STARTEQU$EF00
ORGFLASH
INITIALISATION:
MOV#20,BUS_SPD
MOV#32,DATASIZE
LDHX#FLASH_START
STHXSTART_ADDR
RTS
MAIN:
BSRINITIALISATION
:
:
LDHX#FILE_PTR
JSRPRGRNGE
ROM-Resident Routines
7.5.2 ERARNGE
ERARNGE is used to erase a range of locations in FLASH.
Table 7-12. ERARNGE Routine
Routine NameERARNGE
Routine DescriptionErase a page or the entire array
Calling Address$FCBE
Stack Used9 bytes
Data Block FormatBus speed (BUS_SPD)
Data size (DATASIZE)
Starting address (ADDRH)
Starting address (ADDRL)
There are two sizes of erase ranges: a page or the entire array. The ERARNGE will erase the page (64
consecutive bytes) in FLASH specified by the address ADDRH:ADDRL. This address can be any address
within the page. Calling ERARNGE with ADDRH:ADDRL equal to $FFFF will erase the entire FLASH
array (mass erase). Therefore, care must be taken when calling this routine to prevent an accidental mass
erase. To avoid undesirable routine return addresses after a mass erase, the ERARNGE routine should
not be called from code executed from FLASH memory. Load the code into an area of RAM before calling
the ERARNGE routine.
The ERARNGE routine do not use a data array. The DATASIZE byte is a dummy byte that is also not
used.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor97
Monitor ROM (MON)
The coding example below is to perform a page erase, from $EF00–$EF3F. The Initialization subroutine
is the same as the coding example for PRGRNGE (see 7.5.1 PRGRNGE).
ERARNGEEQU$FCBE
MAIN:
BSRINITIALISATION
:
:
LDHX#FILE_PTR
JSRERARNGE
:
7.5.3 LDRNGE
LDRNGE is used to load the data array in RAM with data from a range of FLASH locations.
Table 7-13. LDRNGE Routine
Routine NameLDRNGE
Routine DescriptionLoads data from a range of locations
Calling Address$FF30
Stack Used9 bytes
Data Block FormatBus speed (BUS_SPD)
Data size (DATASIZE)
Starting address (ADDRH)
Starting address (ADDRL)
Data 1
:
Data N
The start location of FLASH from where data is retrieved is specified by the address ADDRH:ADDRL and
the number of bytes from this location is specified by DATASIZE. The maximum number of bytes that can
be retrieved in one routine call is 128 bytes. The data retrieved from FLASH is loaded into the data array
in RAM. Previous data in the data array will be overwritten. User can use this routine to retrieve data from
FLASH that was previously programmed.
The coding example below is to retrieve 32 bytes of data starting from $EF00 in FLASH. The Initialization
subroutine is the same as the coding example for PRGRNGE (see 7.5.1 PRGRNGE).
LDRNGEEQU$FF30
MAIN:
BSRINITIALIZATION
:
:
LDHX#FILE_PTR
JSRLDRNGE
:
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
98Freescale Semiconductor
ROM-Resident Routines
7.5.4 MON_PRGRNGE
In monitor mode, MON_PRGRNGE is used to program a range of FLASH locations with data loaded into
the data array.
Table 7-14. MON_PRGRNGE Routine
Routine NameMON_PRGRNGE
Routine DescriptionProgram a range of locations, in monitor mode
Calling Address$FC28
Stack Used17 bytes
Data Block FormatBus speed
Data size
Starting address (high byte)
Starting address (low byte)
Data 1
:
Data N
The MON_PRGRNGE routine is designed to be used in monitor mode. It performs the same function as
the PRGRNGE routine (see 7.5.1 PRGRNGE), except that MON_PRGRNGE returns to the main program
via an SWI instruction. After a MON_PRGRNGE call, the SWI instruction will return the control back to
the monitor code.
7.5.5 MON_ERARNGE
In monitor mode, ERARNGE is used to erase a range of locations in FLASH.
Table 7-15. MON_ERARNGE Routine
Routine NameMON_ERARNGE
Routine DescriptionErase a page or the entire array, in monitor mode
Calling Address$FF2C
Stack Used11 bytes
Data Block FormatBus speed
Data size
Starting address (high byte)
Starting address (low byte)
The MON_ERARNGE routine is designed to be used in monitor mode. It performs the same function as
the ERARNGE routine (see 7.5.2 ERARNGE), except that MON_ERARNGE returns to the main program
via an SWI instruction. After a MON_ERARNGE call, the SWI instruction will return the control back to the
monitor code.
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.1
Freescale Semiconductor99
Monitor ROM (MON)
7.5.6 MON_LDRNGE
In monitor mode, LDRNGE is used to load the data array in RAM with data from a range of FLASH
locations.
Table 7-16. ICP_LDRNGE Routine
Routine NameMON_LDRNGE
Routine DescriptionLoads data from a range of locations, in monitor mode
Calling Address$FF24
Stack Used11 bytes
Data Block FormatBus speed
Data size
Starting address (high byte)
Starting address (low byte)
Data 1
:
Data N
The MON_LDRNGE routine is designed to be used in monitor mode. It performs the same function as the
LDRNGE routine (see 7.5.3 LDRNGE), except that MON_LDRNGE returns to the main program via an
SWI instruction. After a MON_LDRNGE call, the SWI instruction will return the control back to the monitor
code.
7.5.7 EE_WRITE
EE_WRITE is used to write a set of data from the data array to FLASH.
Table 7-17. EE_WRITE Routine
Routine NameEE_WRITE
Routine Description
Calling Address$FD3F
Stack Used24 bytes
Data Block FormatBus speed (BUS_SPD)
1. The minimum data size is 2 bytes. The maximum data size is 15 bytes.
2. The start address must be a page boundary start address: $xx00, $xx40, $xx80, or $00C0.
The start location of the FLASH to be programmed is specified by the address ADDRH:ADDRL and the
number of bytes in the data array is specified by DATASIZE. The minimum number of bytes that can be
Emulated EEPROM write. Data size ranges from 2 to 15 bytes at
a time.
Data size (DATASIZE)
Starting address (ADDRH)
Starting address (ADDRL)
Data 1
:
Data N
(1)
(2)
(1)
MC68HC908JL8/JK8 • MC68HC08JL8/JK8 • MC68HC908KL8 Data Sheet, Rev. 3.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.