Freescale Semiconductor
Addendum
Document Number: QFN_Addendum
Rev. 0, 07/2014
Addendum for New QFN
Package Migration
This addendum provides the changes to the 98A case outline numbers for products covered in this book.
Case outlines were changed because of the migration from gold wire to copper wire in some packages. See
the table below for the old (gold wire) package versus the new (copper wire) package.
To view the new drawing, go to Freescale.com and search on the new 98A package number for your
device.
For more information about QFN package use, see EB806: Electrical Connection Recommendations for
the Exposed Pad on QFN and DFN Packages.
© Freescale Semiconductor, Inc., 2014. All rights reserved.
Part Number
MC68HC908JW32
Package Description
Original (gold wire)
Current (copper wire)
package document number package document number
48 QFN
98ARH99048A
98ASA00466D
MC9RS08LA8
48 QFN
98ARL10606D
98ASA00466D
MC9S08GT16A
32 QFN
98ARH99035A
98ASA00473D
MC9S908QE32
32 QFN
98ARE10566D
98ASA00473D
MC9S908QE8
32 QFN
98ASA00071D
98ASA00736D
MC9S08JS16
24 QFN
98ARL10608D
98ASA00734D
MC9S08QG8
24 QFN
98ARL10605D
98ASA00474D
MC9S08SH8
24 QFN
98ARE10714D
98ASA00474D
MC9RS08KB12
24 QFN
98ASA00087D
98ASA00602D
MC9S08QG8
16 QFN
98ARE10614D
98ASA00671D
MC9RS08KB12
8 DFN
98ARL10557D
98ASA00672D
6 DFN
98ARL10602D
98ASA00735D
MC9S08AC16
MC9S908AC60
MC9S08AC128
MC9S08AW60
MC9S08GB60A
MC9S08GT16A
MC9S08JM16
MC9S08JM60
MC9S08LL16
MC9S08QE128
MC9S08QE32
MC9S08RG60
MCF51CN128
MC9S08QB8
MC9S08QG8
MC9RS08KA2
Addendum for New QFN Package Migration, Rev. 0
2
Freescale Semiconductor
MC9S08RC8/16/32/60
MC9S08RD8/16/32/60
MC9S08RE8/16/32/60
MC9S08RG32/60
Data Sheet
HCS08
Microcontrollers
MC9S08RG60/D
Rev. 1.11
06/2005
freescale.com
MC9S08RG60 Data Sheet
Covers: MC9S08RC8/16/32/60
MC9S08RD8/16/32/60
MC9S08RE8/16/32/60
MC9S08RG32/60
MC9S08RG60/D
Rev. 1.11
06/2005
Revision History
To provide the most up-to-date information, the revision of our documents on the World Wide Web will
be the most current. Your printed copy may be an earlier revision. To verify you have the latest information
available, refer to:
http://freescale.com
The following revision history table summarizes changes contained in this document.
Version
Number
Revision
Date
Description of Changes
1.11
06/2005
Added 48 QFN package and official mechanical drawings; suppled
TBD values for IRO VOL; updated tRTI values; re-emphasized that
KBI2 will not wake the MCU from stop2 mode.
This product contains SuperFlash® technology licensed from SST.
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.
© Freescale Semiconductor, Inc., 2005. All rights reserved.
List of Chapters
Chapter 1
Introduction............................................................................. 15
Chapter 2
Pins and Connections ............................................................ 19
Chapter 3
Modes of Operation ................................................................ 29
Chapter 4
Memory .................................................................................... 35
Chapter 5
Resets, Interrupts, and System Configuration .................... 57
Chapter 6
Parallel Input/Output .............................................................. 73
Chapter 7
Central Processor Unit (S08CPUV2) ..................................... 87
Chapter 8
Carrier Modulator Timer (S08CMTV1)................................. 107
Chapter 9
Keyboard Interrupt (S08KBIV1) ........................................... 123
Chapter 10
Timer/PWM Module (S08TPMV1)......................................... 129
Chapter 11
Serial Communications Interface (S08SCIV1).................... 145
Chapter 12
Serial Communications Interface (S08SCIV1).................... 147
Chapter 13
Serial Peripheral Interface (S08SPIV3) ............................... 163
Chapter 14
Analog Comparator (S08ACMPV1) ..................................... 179
Chapter 15
Development Support .......................................................... 183
Appendix A
Electrical Characteristics..................................................... 205
Appendix B
Ordering Information and Mechanical Drawings............... 219
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
5
Contents
Section Number
Title
Page
Chapter 1
Introduction
1.1
1.2
1.3
1.4
Overview .........................................................................................................................................15
Features ...........................................................................................................................................15
1.2.1
Devices in the MC9S08RC/RD/RE/RG Series ..............................................................16
MCU Block Diagram ......................................................................................................................17
System Clock Distribution ..............................................................................................................18
Chapter 2
Pins and Connections
2.1
2.2
2.3
Introduction .....................................................................................................................................19
Device Pin Assignment ...................................................................................................................19
Recommended System Connections ...............................................................................................21
2.3.1
Power ..............................................................................................................................23
2.3.2
Oscillator ........................................................................................................................23
2.3.3
PTD1/RESET .................................................................................................................23
2.3.4
Background/Mode Select (PTD0/BKGD/MS) ...............................................................24
2.3.5
IRO Pin Description .......................................................................................................24
2.3.6
General-Purpose I/O and Peripheral Ports .....................................................................24
2.3.7
Signal Properties Summary ............................................................................................25
Chapter 3
Modes of Operation
3.1
3.2
3.3
3.4
3.5
3.6
Introduction .....................................................................................................................................29
Features ...........................................................................................................................................29
Run Mode ........................................................................................................................................29
Active Background Mode ................................................................................................................29
Wait Mode .......................................................................................................................................30
Stop Modes ......................................................................................................................................31
3.6.1
Stop1 Mode ....................................................................................................................31
3.6.2
Stop2 Mode ....................................................................................................................31
3.6.3
Stop3 Mode ....................................................................................................................32
3.6.4
Active BDM Enabled in Stop Mode ...............................................................................33
3.6.5
LVD Reset Enabled ........................................................................................................33
3.6.6
On-Chip Peripheral Modules in Stop Mode ...................................................................33
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
7
Section Number
Title
Page
Chapter 4
Memory
4.1
4.2
4.3
4.4
4.5
4.6
MC9S08RC/RD/RE/RG Memory Map ..........................................................................................35
4.1.1
Reset and Interrupt Vector Assignments ........................................................................36
Register Addresses and Bit Assignments ........................................................................................38
RAM ................................................................................................................................................42
FLASH ............................................................................................................................................42
4.4.1
Features ...........................................................................................................................43
4.4.2
Program and Erase Times ...............................................................................................43
4.4.3
Program and Erase Command Execution .......................................................................44
4.4.4
Burst Program Execution ...............................................................................................45
4.4.5
Access Errors ..................................................................................................................46
4.4.6
FLASH Block Protection ...............................................................................................47
4.4.7
Vector Redirection ..........................................................................................................48
Security ............................................................................................................................................48
FLASH Registers and Control Bits .................................................................................................49
4.6.1
FLASH Clock Divider Register (FCDIV) ......................................................................49
4.6.2
FLASH Options Register (FOPT and NVOPT) .............................................................51
4.6.3
FLASH Configuration Register (FCNFG) .....................................................................51
4.6.4
FLASH Protection Register (FPROT and NVPROT) ....................................................52
4.6.5
FLASH Status Register (FSTAT) ...................................................................................54
4.6.6
FLASH Command Register (FCMD) ............................................................................55
Chapter 5
Resets, Interrupts, and System Configuration
5.1
5.2
5.3
5.4
5.5
5.6
5.7
Introduction .....................................................................................................................................57
Features ...........................................................................................................................................57
MCU Reset ......................................................................................................................................57
Computer Operating Properly (COP) Watchdog .............................................................................58
Interrupts .........................................................................................................................................58
5.5.1
Interrupt Stack Frame .....................................................................................................59
5.5.2
External Interrupt Request (IRQ) Pin .............................................................................60
5.5.2.1 Pin Configuration Options ..............................................................................60
5.5.2.2 Edge and Level Sensitivity ..............................................................................61
5.5.3
Interrupt Vectors, Sources, and Local Masks .................................................................61
Low-Voltage Detect (LVD) System ................................................................................................62
5.6.1
Power-On Reset Operation .............................................................................................63
5.6.2
LVD Reset Operation .....................................................................................................63
5.6.3
LVD Interrupt and Safe State Operation ........................................................................63
5.6.4
Low-Voltage Warning (LVW) ........................................................................................63
Real-Time Interrupt (RTI) ...............................................................................................................64
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
8
Freescale Semiconductor
Section Number
5.8
Title
Page
Reset, Interrupt, and System Control Registers and Control Bits ...................................................64
5.8.1
Interrupt Pin Request Status and Control Register (IRQSC) .........................................64
5.8.2
System Reset Status Register (SRS) ...............................................................................65
5.8.3
System Background Debug Force Reset Register (SBDFR) ..........................................67
5.8.4
System Options Register (SOPT) ...................................................................................68
5.8.5
System Device Identification Register (SDIDH, SDIDL) ..............................................69
5.8.6
System Real-Time Interrupt Status and Control Register (SRTISC) .............................70
5.8.7
System Power Management Status and Control 1 Register (SPMSC1) .........................71
5.8.8
System Power Management Status and Control 2 Register (SPMSC2) .........................72
Chapter 6
Parallel Input/Output
6.1
6.2
6.3
6.4
6.5
6.6
Introduction .....................................................................................................................................73
Features ...........................................................................................................................................73
Pin Descriptions ..............................................................................................................................74
6.3.1
Port A ..............................................................................................................................74
6.3.2
Port B ..............................................................................................................................74
6.3.3
Port C ..............................................................................................................................75
6.3.4
Port D ..............................................................................................................................75
6.3.5
Port E ..............................................................................................................................76
Parallel I/O Controls ........................................................................................................................76
6.4.1
Data Direction Control ...................................................................................................76
6.4.2
Internal Pullup Control ...................................................................................................77
Stop Modes ......................................................................................................................................77
Parallel I/O Registers and Control Bits ...........................................................................................77
6.6.1
Port A Registers (PTAD, PTAPE, and PTADD) ............................................................78
6.6.2
Port B Registers (PTBD, PTBPE, and PTBDD) ............................................................79
6.6.3
Port C Registers (PTCD, PTCPE, and PTCDD) ............................................................81
6.6.4
Port D Registers (PTDD, PTDPE, and PTDDD) ...........................................................82
6.6.5
Port E Registers (PTED, PTEPE, and PTEDD) .............................................................84
Chapter 7
Central Processor Unit (S08CPUV2)
7.1
7.2
7.3
Introduction .....................................................................................................................................87
7.1.1
Features ...........................................................................................................................87
Programmer’s Model and CPU Registers .......................................................................................88
7.2.1
Accumulator (A) .............................................................................................................88
7.2.2
Index Register (H:X) ......................................................................................................88
7.2.3
Stack Pointer (SP) ...........................................................................................................89
7.2.4
Program Counter (PC) ....................................................................................................89
7.2.5
Condition Code Register (CCR) .....................................................................................89
Addressing Modes ...........................................................................................................................90
7.3.1
Inherent Addressing Mode (INH) ..................................................................................91
7.3.2
Relative Addressing Mode (REL) ..................................................................................91
7.3.3
Immediate Addressing Mode (IMM) .............................................................................91
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
9
Section Number
Title
Page
7.3.4
7.3.5
7.3.6
7.4
7.5
Direct Addressing Mode (DIR) ......................................................................................91
Extended Addressing Mode (EXT) ................................................................................91
Indexed Addressing Mode ..............................................................................................91
7.3.6.1 Indexed, No Offset (IX) ..................................................................................92
7.3.6.2 Indexed, No Offset with Post Increment (IX+) ...............................................92
7.3.6.3 Indexed, 8-Bit Offset (IX1) .............................................................................92
7.3.6.4 Indexed, 8-Bit Offset with Post Increment (IX1+) .........................................92
7.3.6.5 Indexed, 16-Bit Offset (IX2) ...........................................................................92
7.3.6.6 SP-Relative, 8-Bit Offset (SP1) ......................................................................92
7.3.6.7 SP-Relative, 16-Bit Offset (SP2) ....................................................................92
Special Operations ...........................................................................................................................92
7.4.1
Reset Sequence ...............................................................................................................93
7.4.2
Interrupt Sequence ..........................................................................................................93
7.4.3
Wait Mode Operation .....................................................................................................94
7.4.4
Stop Mode Operation .....................................................................................................94
7.4.5
BGND Instruction ..........................................................................................................94
HCS08 Instruction Set Summary ....................................................................................................95
Chapter 8
Carrier Modulator Timer (S08CMTV1)
8.1
8.2
8.3
8.4
8.5
8.6
Introduction ...................................................................................................................................107
Features .........................................................................................................................................108
CMT Block Diagram .....................................................................................................................108
Pin Description ..............................................................................................................................108
Functional Description ..................................................................................................................109
8.5.1
Carrier Generator ..........................................................................................................110
8.5.2
Modulator .....................................................................................................................112
8.5.2.1 Time Mode ....................................................................................................113
8.5.2.2 Baseband Mode .............................................................................................114
8.5.2.3 FSK Mode .....................................................................................................114
8.5.3
Extended Space Operation ...........................................................................................115
8.5.3.1 EXSPC Operation in Time Mode .................................................................115
8.5.3.2 EXSPC Operation in FSK Mode ..................................................................116
8.5.4
Transmitter ....................................................................................................................116
8.5.5
CMT Interrupts .............................................................................................................117
8.5.6
Wait Mode Operation ...................................................................................................117
8.5.7
Stop Mode Operation ...................................................................................................117
8.5.8
Background Mode Operation .......................................................................................118
CMT Registers and Control Bits ...................................................................................................118
8.6.1
Carrier Generator Data Registers (CMTCGH1, CMTCGL1, CMTCGH2, and
CMTCGL2) ..............................................................................................................118
8.6.2
CMT Output Control Register (CMTOC) ....................................................................120
8.6.3
CMT Modulator Status and Control Register (CMTMSC) ..........................................121
8.6.4
CMT Modulator Data Registers (CMTCMD1, CMTCMD2, CMTCMD3, and
CMTCMD4) .............................................................................................................122
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
10
Freescale Semiconductor
Section Number
Title
Page
Chapter 9
Keyboard Interrupt (S08KBIV1)
9.1
9.2
9.3
9.4
Introduction ...................................................................................................................................123
KBI Block Diagram ......................................................................................................................125
Keyboard Interrupt (KBI) Module ................................................................................................125
9.3.1
Pin Enables ...................................................................................................................125
9.3.2
Edge and Level Sensitivity ...........................................................................................125
9.3.3
KBI Interrupt Controls .................................................................................................126
KBI Registers and Control Bits .....................................................................................................126
9.4.1
KBI x Status and Control Register (KBIxSC) ..............................................................127
9.4.2
KBI x Pin Enable Register (KBIxPE) ..........................................................................128
Chapter 10
Timer/PWM Module (S08TPMV1)
10.1
10.2
10.3
10.4
Introduction ...................................................................................................................................129
Features .........................................................................................................................................129
TPM Block Diagram .....................................................................................................................131
Pin Descriptions ............................................................................................................................132
10.4.1 External TPM Clock Sources .......................................................................................132
10.4.2 TPM1CHn — TPM1 Channel n I/O Pins .....................................................................132
10.5 Functional Description ..................................................................................................................132
10.5.1 Counter .........................................................................................................................133
10.5.2 Channel Mode Selection ...............................................................................................134
10.5.2.1 Input Capture Mode ......................................................................................134
10.5.2.2 Output Compare Mode .................................................................................134
10.5.2.3 Edge-Aligned PWM Mode ...........................................................................134
10.5.3 Center-Aligned PWM Mode ........................................................................................135
10.6 TPM Interrupts ..............................................................................................................................137
10.6.1 Clearing Timer Interrupt Flags .....................................................................................137
10.6.2 Timer Overflow Interrupt Description ..........................................................................137
10.6.3 Channel Event Interrupt Description ............................................................................137
10.6.4 PWM End-of-Duty-Cycle Events .................................................................................138
10.7 TPM Registers and Control Bits ...................................................................................................138
10.7.1 Timer Status and Control Register (TPM1SC) .............................................................139
10.7.2 Timer Counter Registers (TPM1CNTH:TPM1CNTL) ................................................140
10.7.3 Timer Counter Modulo Registers (TPM1MODH:TPM1MODL) ................................141
10.7.4 Timer Channel n Status and Control Register (TPM1CnSC) .......................................142
10.7.5 Timer Channel Value Registers (TPM1CnVH:TPM1CnVL) .......................................143
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
11
Section Number
Title
Page
Chapter 11
Serial Communications Interface (S08SCIV1)
11.1 Introduction ...................................................................................................................................145
Chapter 12
Serial Communications Interface (S08SCIV1)
12.1 Introduction ...................................................................................................................................147
12.1.1 Features .........................................................................................................................147
12.1.2 Modes of Operation ......................................................................................................147
12.1.3 Block Diagram ..............................................................................................................148
12.2 Register Definition ........................................................................................................................150
12.2.1 SCI Baud Rate Registers (SCI1BDH, SCI1BHL) ........................................................150
12.2.2 SCI Control Register 1 (SCI1C1) .................................................................................151
12.2.3 SCI Control Register 2 (SCI1C2) .................................................................................152
12.2.4 SCI Status Register 1 (SCI1S1) ....................................................................................153
12.2.5 SCI Status Register 2 (SCI1S2) ....................................................................................155
12.2.6 SCI Control Register 3 (SCI1C3) .................................................................................155
12.2.7 SCI Data Register (SCI1D) ..........................................................................................156
12.3 Functional Description ..................................................................................................................157
12.3.1 Baud Rate Generation ...................................................................................................157
12.3.2 Transmitter Functional Description ..............................................................................157
12.3.2.1 Send Break and Queued Idle .........................................................................158
12.3.3 Receiver Functional Description ..................................................................................158
12.3.3.1 Data Sampling Technique .............................................................................159
12.3.3.2 Receiver Wakeup Operation .........................................................................159
12.3.4 Interrupts and Status Flags ...........................................................................................160
12.3.5 Additional SCI Functions .............................................................................................161
12.3.5.1 8- and 9-Bit Data Modes ...............................................................................161
12.3.5.2 Stop Mode Operation ....................................................................................161
12.3.5.3 Loop Mode ....................................................................................................161
12.3.5.4 Single-Wire Operation ..................................................................................162
Chapter 13
Serial Peripheral Interface (S08SPIV3)
13.1 Features .........................................................................................................................................164
13.2 Block Diagrams .............................................................................................................................164
13.2.1 SPI System Block Diagram ..........................................................................................164
13.2.2 SPI Module Block Diagram .........................................................................................165
13.2.3 SPI Baud Rate Generation ............................................................................................167
13.3 Functional Description ..................................................................................................................167
13.3.1 SPI Clock Formats ........................................................................................................168
13.3.2 SPI Pin Controls ...........................................................................................................170
13.3.2.1 SPSCK1 — SPI Serial Clock ........................................................................170
13.3.2.2 MOSI1 — Master Data Out, Slave Data In ..................................................170
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
12
Freescale Semiconductor
Section Number
Title
Page
13.3.2.3 MISO1 — Master Data In, Slave Data Out ..................................................170
13.3.2.4 SS1 — Slave Select .......................................................................................170
13.3.3 SPI Interrupts ................................................................................................................171
13.3.4 Mode Fault Detection ...................................................................................................171
13.4 SPI Registers and Control Bits ......................................................................................................171
13.4.1 SPI Control Register 1 (SPI1C1) ..................................................................................172
13.4.2 SPI Control Register 2 (SPI1C2) ..................................................................................173
13.4.3 SPI Baud Rate Register (SPI1BR) ...............................................................................174
13.4.4 SPI Status Register (SPI1S) ..........................................................................................176
13.4.5 SPI Data Register (SPI1D) ...........................................................................................177
Chapter 14
Analog Comparator (S08ACMPV1)
14.1
14.2
14.3
14.4
Features .........................................................................................................................................180
Block Diagram ..............................................................................................................................180
Pin Description ..............................................................................................................................180
Functional Description ..................................................................................................................181
14.4.1 Interrupts .......................................................................................................................181
14.4.2 Wait Mode Operation ...................................................................................................181
14.4.3 Stop Mode Operation ...................................................................................................181
14.4.4 Background Mode Operation .......................................................................................181
14.5 ACMP Status and Control Register (ACMP1SC) .........................................................................182
Chapter 15
Development Support
15.1 Introduction ...................................................................................................................................183
15.1.1 Features .........................................................................................................................183
15.2 Background Debug Controller (BDC) ..........................................................................................184
15.2.1 BKGD Pin Description .................................................................................................184
15.2.2 Communication Details ................................................................................................185
15.2.3 BDC Commands ...........................................................................................................189
15.2.4 BDC Hardware Breakpoint ..........................................................................................191
15.3 On-Chip Debug System (DBG) ....................................................................................................192
15.3.1 Comparators A and B ...................................................................................................192
15.3.2 Bus Capture Information and FIFO Operation .............................................................192
15.3.3 Change-of-Flow Information ........................................................................................193
15.3.4 Tag vs. Force Breakpoints and Triggers .......................................................................193
15.3.5 Trigger Modes ..............................................................................................................194
15.3.6 Hardware Breakpoints ..................................................................................................196
15.4 Register Definition ........................................................................................................................196
15.4.1 BDC Registers and Control Bits ...................................................................................196
15.4.1.1 BDC Status and Control Register (BDCSCR) ..............................................197
15.4.1.2 BDC Breakpoint Match Register (BDCBKPT) ............................................198
15.4.2 System Background Debug Force Reset Register (SBDFR) ........................................198
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
13
Section Number
15.4.3
Title
Page
DBG Registers and Control Bits ..................................................................................199
15.4.3.1 Debug Comparator A High Register (DBGCAH) ........................................199
15.4.3.2 Debug Comparator A Low Register (DBGCAL) .........................................199
15.4.3.3 Debug Comparator B High Register (DBGCBH) .........................................199
15.4.3.4 Debug Comparator B Low Register (DBGCBL) ..........................................199
15.4.3.5 Debug FIFO High Register (DBGFH) ..........................................................200
15.4.3.6 Debug FIFO Low Register (DBGFL) ...........................................................200
15.4.3.7 Debug Control Register (DBGC) ..................................................................201
15.4.3.8 Debug Trigger Register (DBGT) ..................................................................202
15.4.3.9 Debug Status Register (DBGS) .....................................................................203
Appendix A
Electrical Characteristics
A.1
A.2
A.3
A.4
A.5
A.6
A.7
A.8
A.9
Introduction ...................................................................................................................................205
Absolute Maximum Ratings ..........................................................................................................205
Thermal Characteristics .................................................................................................................206
Electrostatic Discharge (ESD) Protection Characteristics ............................................................207
DC Characteristics .........................................................................................................................207
Supply Current Characteristics ......................................................................................................211
Analog Comparator (ACMP) Electricals ......................................................................................211
Oscillator Characteristics ..............................................................................................................212
AC Characteristics .........................................................................................................................212
A.9.1 Control Timing ...............................................................................................................212
A.9.2 Timer/PWM (TPM) Module Timing .............................................................................213
A.9.3 SPI Timing ......................................................................................................................214
A.10 FLASH Specifications ...................................................................................................................218
Appendix B
Ordering Information and Mechanical Drawings
B.1 Ordering Information ....................................................................................................................219
B.2 Mechanical Drawings ....................................................................................................................220
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
14
Freescale Semiconductor
Chapter 1
Introduction
1.1
Overview
The MC9S08RC/RD/RE/RG are members of the low-cost, high-performance HCS08 Family of 8-bit
microcontroller units (MCUs). All MCUs in this family use the enhanced HCS08 core and are available
with a variety of modules, memory sizes, memory types, and package types.
1.2
Features
Features of the MC9S08RC/RD/RE/RG Family of devices are listed here. Please see Table 1-1 for the
features that are available on the different family members.
HCS08 CPU
(Central Processor Unit)
On-Chip Memory
Oscillator (OSC)
Analog Comparator
(ACMP1)
•
•
•
•
Object code fully upward-compatible with M68HC05 and M68HC08 Families
HC08 instruction set with added BGND instruction
Support for up to 32 interrupt/reset sources
Power-saving modes: wait plus three stops
• On-chip in-circuit programmable FLASH memory with block protection and security
option
• On-chip random-access memory (RAM)
• Low power oscillator capable of operating from crystal or resonator from 1 to 16 MHz
• 8 MHz internal bus frequency
• On-chip analog comparator with internal reference (ACMP1)
• Full rail-to-rail supply operation
• Option to compare to a fixed internal bandgap reference voltage
Serial Communications
Interface Module (SCI1)
•
•
•
•
Full-duplex, standard non-return-to-zero (NRZ) format
Double-buffered transmitter and receiver with separate enables
Programmable 8-bit or 9-bit character length
Programmable baud rates (13-bit modulo divider)
Serial Peripheral
Interface Module (SPI1)
•
•
•
•
•
•
•
Master or slave mode operation
Full-duplex or single-wire bidirectional option
Programmable transmit bit rate
Double-buffered transmit and receive
Serial clock phase and polarity options
Slave select output
Selectable MSB-first or LSB-first shifting
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
15
Introduction
Timer/Pulse-Width
Modulator (TPM1)
• 2-channel, 16-bit timer/pulse-width modulator (TPM1) module that can operate as a
free-running counter, a modulo counter, or an up-/down-counter when the TPM is
configured for center-aligned PWM
• Selectable input capture, output compare, and edge-aligned or center-aligned PWM
capability on each channel
Keyboard Interrupt Ports
(KBI1, KBI2)
• Providing 12 keyboard interrupts
• Eight with falling-edge/low-level plus four with selectable polarity
• KBI1 inputs can be configured for edge-only sensitivity or edge-and-level sensitivity
Carrier Modulator Timer
(CMT)
• Dedicated infrared output (IRO) pin
• Drives IRO pin for remote control communications
• Can be disconnected from IRO pin and used as output compare timer
• IRO output pin has high-current sink capability
Development Support
• Background debugging system (see also the Development Support chapter)
• Breakpoint capability to allow single breakpoint setting during in-circuit debugging (plus
two more breakpoints in on-chip debug module)
• Debug module containing two comparators and nine trigger modes. Eight deep FIFO
for storing change-of-flow addresses and event-only data. Debug module supports
both tag and force breakpoints.
Port Pins
• Eight high-current pins (limited by maximum package dissipation)
• Software selectable pullups on ports when used as input. Selection is on an individual
port bit basis. During output mode, pullups are disengaged.
• 39 general-purpose input/output (I/O) pins, depending on package selection
1.2.1
Package Options
•
•
•
•
•
28-pin plastic dual in-line package (PDIP)
28-pin small outline integrated circuit (SOIC)
32-pin low-profile quad flat package (LQFP)
44-pin low-profile quad flat package (LQFP)
48-pin quad flat package (QFN)
System Protection
•
•
•
•
Optional computer operating properly (COP) reset
Low-voltage detection with reset or interrupt
Illegal opcode detection with reset
Illegal address detection with reset (some devices don’t have illegal addresses)
Devices in the MC9S08RD/RE/RG Series
Table 1-1 lists the devices available in the MC9S08RD/RE/RG series and summarizes the differences in
functions and configuration among them.
Table 1-1. Devices in the MC9S08RD/RE/RG Series
Device
9S08RG32/60
9S08RE8/16/32/60
9S08RD8/16/32/60
FLASH
RAM
ACMP(1)
SCI
SPI
32K/60K
8/16K/32K/60K
8/16K/32K/60K
2K/2K
1K/1K/2K/2K
1K/1K/2K/2K
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
1. Available only in 32-, 44-, and 48-pin LQFP packages.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
16
Freescale Semiconductor
Introduction
1.3
MCU Block Diagram
This block diagram shows the structure of the MC9S08RC/RD/RE/RG MCUs
RTI
COP
IRQ
LVD
PTB7/TPM1CH1
PTE6
PTB5
PTB4
PTB3
PTB2
PTB1/RxD1
PTB0/TxD1
PTC7/SS1
PTC6/SPSCK1
PTC5/MISO1
PTC4/MOSI1
PTC3/KBI2P3
PTC2/KBI2P2
PTC1/KBI2P1
PTC0/KBI2P0
NOTE 1
PTD6/TPM1CH0
PTD5/ACMP1+
PTD4/ACMP1–
PTD3
PTD2/IRQ
PTD1/RESET
PTD0/BKGD/MS
NOTES
1, 3, 4
8-BIT KEYBOARD
INTERRUPT MODULE (KBI1)
RESETS AND INTERRUPTS
MODES OF OPERATION
POWER MANAGEMENT
4-BIT KEYBOARD
INTERRUPT MODULE (KBI2)
SERIAL COMMUNICATIONS
INTERFACE MODULE (SCI1)
USER FLASH
(RC/RD/RE/RG60 = 63,364 BYTES)
(RC/RD/RE/RG32 = 32,768 BYTES)
(RC/RD/RE16 = 16,384 BYTES)
(RC/RD/RE8 = 8192 BYTES)
USER RAM
(RC/RD/RE/RG32/60 = 2048 BYTES)
(RC/RD/RE8/16 = 1024 BYTES)
VDD
VSS
LOW-POWER OSCILLATOR
2-CHANNEL TIMER/PWM
MODULE (TPM1)
SERIAL PERIPHERAL
INTERFACE MODULE (SPI1)
PORT E
EXTAL
XTAL
ANALOG COMPARATOR
MODULE (ACMP1)
VOLTAGE
REGULATOR
NOTES1, 2, 6
PTA0/KBI1P0
PORT B
HCS08 SYSTEM CONTROL
PTA7/KBI1P7–
PTA1/KBI1P1
PORT C
DEBUG
MODULE (DBG)
CPU
7
PORT D
BDC
PORT A
INTERNAL BUS
HCS08 CORE
8
NOTES 1, 5
PTE7– PTE0 NOTE 1
CARRIER MODULATOR
TIMER MODULE (CMT)
IRO NOTE 5
NOTES:
1. Port pins are software configurable with pullup device if input port
2. PTA0 does not have a clamp diode to VDD. PTA0 should not be driven above VDD. Also, PTA0 does not pullup to
VDD when internal pullup is enabled.
3. IRQ pin contains software configurable pullup/pulldown device if IRQ enabled (IRQPE = 1)
4. The RESET pin contains integrated pullup device enabled if reset enabled (RSTPE = 1)
5. High current drive
6. Pins PTA[7:4] contain both pullup and pulldown devices. Pulldown enabled when KBI is enabled (KBIPEn = 1) and
rising edge is selected (KBEDGn = 1).
Figure 1-1. MC9S08RC/RD/RE/RG Block Diagram
Table 1-2 lists the functional versions of the on-chip modules.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
17
Introduction
Table 1-2. Block Versions
Module
Version
Analog Comparator (ACMP)
1.4
1
Carrier Modulator Transmitter (CMT)
1
Keyboard Interrupt (KBI)
1
Serial Communications Interface (SCI)
1
Serial Peripheral Interface (SPI)
3
Timer Pulse-Width Modulator (TPM)
1
Central Processing Unit (CPU)
2
Debug Module (DBG)
1
FLASH
1
System Control
2
System Clock Distribution
RTI
OSC
RTICLKS
SYSTEM
CONTROL
LOGIC
TPM
CMT
SCI
SPI
RTI
÷2
OSCOUT*
OSC
CPU
BUSCLK
BDC
ACMP
* OSCOUT is the alternate BDC clock source for the MC9S08RC/RD/RE/RG.
RAM
FLASH
FLASH has frequency
requirements for program
and erase operation.
See Appendix A.
Figure 1-2. System Clock Distribution Diagram
Table 1-2 shows a simplified clock connection diagram for the MCU. The CPU operates at the input
frequency of the oscillator. The bus clock frequency is half of the oscillator frequency and is used by all of
the internal circuits with the exception of the CPU and RTI. The RTI can use either the oscillator input or
the internal RTI oscillator as its clock source.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
18
Freescale Semiconductor
Chapter 2
Pins and Connections
2.1
Introduction
This section describes signals that connect to package pins. It includes a pinout diagram, a table of signal
properties, and detailed discussion of signals.
34 PTA1/KBI1P1
PTA2/KBI1P2
PTE5
38
35
PTE6
39
PTA3/KBI1P3
PTE7
40
36
PTA4/KBI1P4
41
PTE4
PTA5/KBI1P5
42
PTB0/TxD1 1
37
PTA6/KBI1P6
43
Device Pin Assignment
44 PTA7/KBI1P7
33 PTA0/KBI1P0
28
XTAL
VSS
7
27
PTD3
IRO
8
26
PTD2/IRQ
PTB5
9
25
PTD1/RESET
PTB6
10
24
PTD0/BKGD/MS
PTC0/KBI2P0 12
PTB7/TPM1CH1 11
21
6
PTC5/MISO1
VDD
20
EXTAL
PTC4/MOSI1
29
19
5
PTE3
PTB4
18
PTD4/ACMP1–
PTE2
30
17
4
PTE1
PTB3
16
PTD5/ACMP1+
PTE0
31
15
3
PTC3/KBI2P3
PTB2
14
PTD6/TPM1CH0
PTC2/KBI2P2
32
13
2
PTC1/KBI2P1
PTB1/RxD1
23
PTC7/SS1
PTC6/SPSCK1 22
2.2
Figure 2-1. MC9S08RC/RD/RE/RG in 44-Pin LQFP Package
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
19
PTA5/KBI1P5
PTA4/KBI1P4
PTA3/KBI1P3
PTA2/KBI1P2
PTA1/KBI1P1
PTA0/KBI1P0
30
29
28
27
26
25
1
PTA6/KBI1P6
PTB0/TxD1
31
32 PTA7/KBI1P7
Pins and Connections
24
PTD6/TPM1CH0
XTAL
IRO
6
19
PTD2/IRQ
PTB6
7
18
PTD1/RESET
PTB7/TPM1CH1
8
17
PTD0/BKGD/MS
PTC0/KBI2P0
16
20
PTC7/SS1
5
15
VSS
PTC6/SPSCK1
EXTAL
14
21
PTC5/MISO1
4
13
VDD
PTC4/MISO1
PTD4/ACMP1–
12
22
PTC3/KBI2P3
3
11
PTB2
PTC2/KBI2P2
PTD5/ACMP1+
10
23
PTC1/KBI2P1
2
9
PTB1/RxD1
Figure 2-2. MC9S08RC/RD/RE/RG in 32-Pin LQFP Package
PTA5/KBI1P5
1
28
PTA4/KBI1P4
PTA6/KBI1P6
2
27
PTA3/KBI1P3
PTA7/KBI1P7
3
26
PTA2/KBI1P2
PTB0/TxD1
4
25
PTA1/KBI1P1
PTB1/RxD1
5
24
PTA0/KBI1P0
PTB2
6
23
PTD6/TPM1CH0
VDD
7
22
EXTAL
VSS
8
21
XTAL
IRO
9
20
PTD1/RESET
PTB7/TPM1CH1
10
19
PTD0/BKGD/MS
PTC0/KBI2P0
11
18
PTC7/SS1
PTC1/KBI2P1
12
17
PTC6/SPSCK1
PTC2/KBI2P2
13
16
PTC5/MISO1
PTC3/KBI2P3
14
15
PTC4/MOSI1
Figure 2-3. MC9S08RC/RD/RE/RG in 28-Pin SOIC Package and 28-Pin PDIP Package
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
20
Freescale Semiconductor
37 PTA1/KBI1P1
38 PTA2/KBI1P2
39 PTA3/KBI1P3
40 PTE4
41 PTE5
42 PTE6
43 PTE7
44 PTA4/KBI1P4
45 PTA5/KBI1P5
46 PTA6/KBI1P6
47 PTA7/KBI1P7
48 NC
Pins and Connections
PTB0/TxD1 1
36 NC
PTB1/RxD1 2
35 PTA0/KBI1P0
PTB2 3
34 PTD6/TPM1CH0
PTB3 4
33 PTD5/ACMP1+
PTB4 5
32 PTD4/ACMP1–
VDD 6
31 EXTAL
VSS 7
30 XTAL
IRQ 8
29 PTD3
PTB5 9
28 PTD2/IRQ
PTB6 10
27 PTD1/RESET
PTB7/TPM1CH1 11
26 PTD0/BKGD/MS
25 PTC7/SS1
NC 24
PTC6/SPSCK1 23
PTC5/MISO1 22
PTC4/MOSI1 21
PTE3 20
PTE2 19
PTE1 18
PTE0 17
PTC3/KBI2P3 16
PTC2/KBI2P2 15
PTC1/KBI2P1 14
PTC0/KBI2P0 13
NC 12
Figure 2-4. MC9S08RC/RD/RE/RG in 48-Pin QFN Package
2.3
Recommended System Connections
Figure 2-5 shows pin connections that are common to almost all MC9S08RC/RD/RE/RG application
systems. A more detailed discussion of system connections follows.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
21
Pins and Connections
MC9S08RC/RD/RE/RG
+
3V
PTA0/KBI1P0
VDD
SYSTEM
POWER
PTA1/KBI1P1
PTA2/KBI1P2
VDD
CBLK +
10 µF
CBY
0.1 µF
PORT
A
VSS
PTA3/KBI1P3
PTA4/KBI1P4
PTA5/KBI1P5
PTA6/KBI1P6
RF
PTA7/KBI1P7
XTAL
C2
PTB0/TxD1
C1
X1
PTB1/RxD1
PTB2
EXTAL
BACKGROUND HEADER
PORT
B
PTB3
PTB4
PTB5
I/O AND
PTB6
1
VDD
PTB7/TPM1CH1
BKGD/MS
NOTE 1
PTC0/KBI2P0
INTERFACE TO
PTC1/KBI2P1
APPLICATION
PTC2/KBI2P2
RESET
NOTE 2
PORT
C
PERIPHERAL
PTC3/KBI2P3
SYSTEM
PTC4/MOSI1
PTC5/MISO1
OPTIONAL
MANUAL
RESET
PTC6/SPSCK1
PTC7/SS1
PTD0/BKGD/MS
PTD1/RESET
PTD2/IRQ
PORT
D
PTD3
PTD4/ACMP1–
PTD5/ACMP1+
PTD6/TPM1CH0
IRO
PTE0
PTE1
PTE2
NOTES:
1. BKGD/MS is the
same pin as PTD0.
2. RESET is the
same pin as PTD1.
PORT
E
PTE3
PTE4
PTE5
PTE6
PTE7
Figure 2-5. Basic System Connections
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
22
Freescale Semiconductor
Pins and Connections
2.3.1
Power
VDD and VSS are the primary power supply pins for the MCU. This voltage source supplies power to all
I/O buffer circuitry and to an internal voltage regulator. The internal voltage regulator provides a regulated
lower-voltage source to the CPU and other internal circuitry of the MCU.
Typically, application systems have two separate capacitors across the power pins. In this case, there
should be a bulk electrolytic capacitor, such as a 10-µF tantalum capacitor, to provide bulk charge storage
for the overall system and a 0.1-µF ceramic bypass capacitor located as near to the MCU power pins as
practical to suppress high-frequency noise.
2.3.2
Oscillator
The oscillator in the MC9S08RC/RD/RE/RG is a traditional Pierce oscillator that can accommodate a
crystal or ceramic resonator in the range of 1 MHz to 16 MHz.
Refer to Figure 2-5 for the following discussion. RF should be a low-inductance resistor such as a carbon
composition resistor. Wire-wound resistors, and some metal film resistors, have too much inductance. C1
and C2 normally should be high-quality ceramic capacitors specifically designed for high-frequency
applications.
RF is used to provide a bias path to keep the EXTAL input in its linear range during crystal startup and its
value is not generally critical. Typical systems use 1 MΩ. Higher values are sensitive to humidity and lower
values reduce gain and (in extreme cases) could prevent startup.
C1 and C2 are typically in the 5-pF to 25-pF range and are chosen to match the requirements of a specific
crystal or resonator. Be sure to take into account printed circuit board (PCB) capacitance and MCU pin
capacitance when sizing C1 and C2. The crystal manufacturer typically specifies a load capacitance that
is the series combination of C1 and C2, which are usually the same size. As a first-order approximation,
use 5 pF as an estimate of combined pin and PCB capacitance for each oscillator pin (EXTAL and XTAL).
2.3.3
PTD1/RESET
The external pin reset function is shared with an output-only port function on the PTD1/RESET pin. The
reset function is enabled when RSTPE in SOPT is set. RSTPE is set following any reset of the MCU and
must be cleared in order to use this pin as an output-only port.
Whenever any reset is initiated (whether from an external signal or from an internal system), the reset pin
is driven low for about 34 cycles of fSelf_reset, released, and sampled again about 38 cycles of fSelf_reset
later. If reset was caused by an internal source such as low-voltage reset or watchdog timeout, the circuitry
expects the reset pin sample to return a logic 1. If the pin is still low at this sample point, the reset is
assumed to be from an external source. The reset circuitry decodes the cause of reset and records it by
setting a corresponding bit in the system control reset status register (SRS).
Never connect any significant capacitance to the reset pin because that would interfere with the circuit and
sequence that detects the source of reset. If an external capacitance prevents the reset pin from rising to a
valid logic 1 before the reset sample point, all resets will appear to be external resets.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
23
Pins and Connections
2.3.4
Background/Mode Select (PTD0/BKGD/MS)
The background/mode select function is shared with an output-only port function on the PTD0/BKDG/MS
pin. While in reset, the pin functions as a mode select pin. Immediately after reset rises, the pin functions
as the background pin and can be used for background debug communication. While functioning as a
background/mode select pin, this pin has an internal pullup device enabled. To use as an output-only port,
BKGDPE in SOPT must be cleared.
If nothing is connected to this pin, the MCU will enter normal operating mode at the rising edge of reset.
If a debug system is connected to the 6-pin standard background debug header, it can hold BKGD/MS low
during the rising edge of reset, which forces the MCU to active background mode.
The BKGD pin is used primarily for background debug controller (BDC) communications using a custom
protocol that uses 16 clock cycles of the target MCU’s BDC clock per bit time. The target MCU’s BDC
clock could be as fast as the bus clock rate, so there should never be any significant capacitance connected
to the BKGD/MS pin that could interfere with background serial communications.
Although the BKGD pin is a pseudo open-drain pin, the background debug communication protocol
provides brief, actively driven, high speedup pulses to ensure fast rise times. Small capacitances from
cables and the absolute value of the internal pullup device play almost no role in determining rise and fall
times on the BKGD pin.
2.3.5
IRO Pin Description
The IRO pin is the output of the CMT. See the Carrier Modulator Timer (CMT) Module Chapter for a
detailed description of this pin function.
2.3.6
General-Purpose I/O and Peripheral Ports
The remaining pins are shared among general-purpose I/O and on-chip peripheral functions such as timers
and serial I/O systems. (Not all pins are available in all packages. See Table 2-2.) Immediately after reset,
all 37 of these pins are configured as high-impedance general-purpose inputs with internal pullup devices
disabled.
NOTE
To avoid extra current drain from floating input pins, the reset initialization
routine in the application program should either enable on-chip pullup
devices or change the direction of unused pins to outputs so the pins do not
float.
For information about controlling these pins as general-purpose I/O pins, see the Chapter 6, “Parallel
Input/Output." For information about how and when on-chip peripheral systems use these pins, refer to the
appropriate chapter from Table 2-1.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
24
Freescale Semiconductor
Pins and Connections
Table 2-1. Pin Sharing References
Port Pins
PTA7–PTA0
PTB7
Alternate
Function
Reference(1)
KBI1P7–KBI1P0
TPM1CH1
PTB6–PTB2
RxD1
TxD1
PTC7
PTC6
PTC5
PTC4
SS1
SPSCK1
MISO1
MOSI1
PTC3–PTC0
Chapter 10, “Timer/PWM Module (S08TPMV1)”
—
PTB1
PTB0
Chapter 9, “Keyboard Interrupt (S08KBIV1)”
Chapter 6, “Parallel Input/Output”
Chapter 11, “Serial Communications Interface (S08SCIV1)”
Chapter 13, “Serial Peripheral Interface (S08SPIV3)”
KBI2P3–KBI2P0
Chapter 9, “Keyboard Interrupt (S08KBIV1)”
PTD6
TPM1CH0
Chapter 10, “Timer/PWM Module (S08TPMV1)”
PTD5
PTD4
ACMP1+
ACMP1–
Chapter 14, “Analog Comparator (S08ACMPV1)”
PTD2
IRQ
PTD1
RESET
PTD0
BKGD/MS
PTE7–PTE0
—
Chapter 5, “Resets, Interrupts, and System Configuration”
Chapter 6, “Parallel Input/Output”
1. See this chapter for information about modules that share these pins.
When an on-chip peripheral system is controlling a pin, data direction control bits still determine what is
read from port data registers even though the peripheral module controls the pin direction by controlling
the enable for the pin’s output buffer. See the Chapter 6, “Parallel Input/Output,” for more details.
Pullup enable bits for each input pin control whether on-chip pullup devices are enabled whenever the pin
is acting as an input even if it is being controlled by an on-chip peripheral module. When the PTA7–PTA4
pins are controlled by the KBI module and are configured for rising-edge/high-level sensitivity, the pullup
enable control bits enable pulldown devices rather than pullup devices. Similarly, when PTD2 is
configured as the IRQ input and is set to detect rising edges, the pullup enable control bit enables a
pulldown device rather than a pullup device.
2.3.7
Signal Properties Summary
Table 2-2 summarizes I/O pin characteristics. These characteristics are determined by the way the
common pin interfaces are hardwired to internal circuits.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
25
Pins and Connections
Table 2-2. Signal Properties
Pin
Name
High Current
Pin
Pullup(2)
VDD
—
—
VSS
—
—
Dir(1)
Comments(3)
XTAL
O
—
—
Crystal oscillator output
EXTAL
I
—
—
Crystal oscillator input
IRO
O
Y
—
Infrared output
PTA0/KBI1P0
I
N
SWC
PTA1/KBI1P1
I/O
N
SWC
PTA2/KBI1P2
I/O
N
SWC
PTA3/KBI1P3
I/O
N
SWC
PTA4/KBI1P4
I/O
N
SWC
PTA5/KBI1P5
I/O
N
SWC
PTA6/KBI1P6
I/O
N
SWC
PTA7/KBI1P7
I/O
N
SWC
PTB0/TxD1
I/O
Y
SWC
PTB1/RxD1
I/O
Y
SWC
PTB2
I/O
Y
SWC
PTB3
I/O
Y
SWC
Available only in 44- and 48-pin packages
PTB4
I/O
Y
SWC
Available only in 44- and 48-pin packages
PTB5
I/O
Y
SWC
Available only in 44- and 48-pin packages
PTB6
I/O
Y
SWC
Available only in 32-, 44-, and 48-pin packagess
PTB7/TPM1CH1
I/O
Y
SWC
PTC0/KBI2P0
I/O
N
SWC
PTC1/KBI2P1
I/O
N
SWC
PTC2/KBI2P2
I/O
N
SWC
PTC3/KBI2P3
I/O
N
SWC
PTC4/MOSI1
I/O
N
SWC
PTC5/MISO1
I/O
N
SWC
PTC6/SPSCK1
I/O
N
SWC
PTC7/SS1
I/O
N
SWC
PTD0/BKGD/MS
I/O
N
SWC(4)
Output-only when configured as PTD0 pin. Pullup enabled.
PTD1/RESET
I/O
N
SWC(3)
Output-only when configured as PTD1 pin.
PTA0 does not have a clamp diode to VDD. PTA0 should not be
driven above VDD.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
26
Freescale Semiconductor
Pins and Connections
Table 2-2. Signal Properties (continued)
Pin
Name
Dir(1)
High Current
Pin
Pullup(2)
PTD2/IRQ
I/O
N
SWC(5)
PTD3
I/O
N
SWC
Available only in 44- and 48-pin packages
PTD4/ACMP1–
I/O
N
SWC
Available only in 32-, 44-, and 48-pin packagess
PTD5/ACMP1+
I/O
N
SWC
Available only in 32-, 44-, and 48-pin packagess
PTD6/TPM1CH0
I/O
N
SWC
PTE0
I/O
N
SWC
Available only in 44- and 48-pin packages
PTE1
I/O
N
SWC
Available only in 44- and 48-pin packages
PTE2
I/O
N
SWC
Available only in 44- and 48-pin packages
PTE3
I/O
N
SWC
Available only in 44- and 48-pin packages
PTE4
I/O
N
SWC
Available only in 44- and 48-pin packages
PTE5
I/O
N
SWC
Available only in 44- and 48-pin packages
PTE6
I/O
N
SWC
Available only in 44- and 48-pin packages
PTE7
I/O
N
SWC
Available only in 44- and 48-pin packages
Comments(3)
Available only in 32-, 44-, and 48-pin packagess
1. Unless otherwise indicated, all digital inputs have input hysteresis.
2. SWC is software-controlled pullup resistor, the register is associated with the respective port.
3. Not all general-purpose I/O pins are available on all packages. To avoid extra current drain from floating input pins, the user’s
reset initialization routine in the application program should either enable on-chip pullup devices or change the direction of
unconnected pins to outputs so the pins do not float.
4. When these pins are configured as RESET or BKGD/MS pullup device is enabled.
5. When configured for the IRQ function, this pin will have a pullup device enabled when the IRQ is set for falling edge detection
and a pulldown device enabled when the IRQ is set for rising edge detection.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
27
Pins and Connections
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
28
Freescale Semiconductor
Chapter 3
Modes of Operation
3.1
Introduction
The operating modes of the MC9S08RC/RD/RE/RG are described in this section. Entry into each mode,
exit from each mode, and functionality while in each of the modes are described.
3.2
•
•
•
3.3
Features
Active background mode for code development
Wait mode:
— CPU shuts down to conserve power
— System clocks running
— Full voltage regulation maintained
Stop modes:
— System clocks stopped; voltage regulator in standby
— Stop1 — Full power down of internal circuits for maximum power savings
— Stop2 — Partial power down of internal circuits, RAM remains operational
— Stop3 — All internal circuits powered for fast recovery
Run Mode
This is the normal operating mode for the MC9S08RC/RD/RE/RG. This mode is selected when the
BKGD/MS pin is high at the rising edge of reset. In this mode, the CPU executes code from internal
memory with execution beginning at the address fetched from memory at $FFFE:$FFFF after reset.
3.4
Active Background Mode
The active background mode functions are managed through the background debug controller (BDC) in
the HCS08 core. The BDC, together with the on-chip debug module (DBG), provide the means for
analyzing MCU operation during software development.
Active background mode is entered in any of five ways:
• When the BKGD/MS pin is low at the rising edge of reset
• When a BACKGROUND command is received through the BKGD pin
• When a BGND instruction is executed
• When encountering a BDC breakpoint
• When encountering a DBG breakpoint
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
29
Modes of Operation
After active background mode is entered, the CPU is held in a suspended state waiting for serial
background commands rather than executing instructions from the user’s application program.
Background commands are of two types:
• Non-intrusive commands, defined as commands that can be issued while the user program is
running. Non-intrusive commands can be issued through the BKGD pin while the MCU is in run
mode; non-intrusive commands can also be executed when the MCU is in the active background
mode. Non-intrusive commands include:
— Memory access commands
— Memory-access-with-status commands
— BDC register access commands
— BACKGROUND command
• Active background commands, which can only be executed while the MCU is in active background
mode, include commands to:
— Read or write CPU registers
— Trace one user program instruction at a time
— Leave active background mode to return to the user’s application program (GO)
The active background mode is used to program a bootloader or user application program into the FLASH
program memory before the MCU is operated in run mode for the first time. When the
MC9S08RC/RD/RE/RG is shipped from the Freescale Semiconductor factory, the FLASH program
memory is usually erased so there is no program that could be executed in run mode until the FLASH
memory is initially programmed. The active background mode can also be used to erase and reprogram
the FLASH memory after it has been previously programmed.
For additional information about the active background mode, refer to the Development Support chapter.
3.5
Wait Mode
Wait mode is entered by executing a WAIT instruction. Upon execution of the WAIT instruction, the CPU
enters a low-power state in which it is not clocked. The I bit in CCR is cleared when the CPU enters the
wait mode, enabling interrupts. When an interrupt request occurs, the CPU exits the wait mode and
resumes processing, beginning with the stacking operations leading to the interrupt service routine.
Only the BACKGROUND command and memory-access-with-status commands are available when the
MCU is in wait mode. The memory-access-with-status commands do not allow memory access, but they
report an error indicating that the MCU is in either stop or wait mode. The BACKGROUND command can
be used to wake the MCU from wait mode and enter active background mode.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
30
Freescale Semiconductor
Modes of Operation
3.6
Stop Modes
One of three stop modes is entered upon execution of a STOP instruction when the STOPE bit in the
system option register is set. In all stop modes, all internal clocks are halted. If the STOPE bit is not set
when the CPU executes a STOP instruction, the MCU will not enter any of the stop modes and an illegal
opcode reset is forced. The stop modes are selected by setting the appropriate bits in SPMSC2.
Table 3-1 summarizes the behavior of the MCU in each of the stop modes.
Table 3-1. Stop Mode Behavior
Mode
PDC
PPDC
CPU, Digital
Peripherals,
FLASH
Stop1
1
0
Stop2
1
1
Stop3
0
Don’t
care
3.6.1
RAM
OSC
ACMP
Regulator
I/O Pins
RTI
Off
Off
Off
Standby
Standby
Reset
Off
Off
Standby
Off
Standby
Standby
States
held
Optionally on
Standby
Standby
Off
Standby
Standby
States
held
Optionally on
Stop1 Mode
Stop1 mode provides the lowest possible standby power consumption by causing the internal circuitry of
the MCU to be powered down. To enter stop1, the user must execute a STOP instruction with the PDC bit
in SPMSC2 set and the PPDC bit clear. Stop1 can be entered only if the LVD reset is disabled
(LVDRE = 0).
When the MCU is in stop1 mode, all internal circuits that are powered from the voltage regulator are turned
off. The voltage regulator is in a low-power standby state, as are the OSC and ACMP.
Exit from stop1 is done by asserting any of the wakeup pins on the MCU: RESET, IRQ, or KBI1, which
have been enabled. IRQ and KBI pins are always active-low when used as wakeup pins in stop1 regardless
of how they were configured before entering stop1.
Upon wakeup from stop1 mode, the MCU will start up as from a power-on reset (POR). The CPU will take
the reset vector.
3.6.2
Stop2 Mode
Stop2 mode provides very low standby power consumption and maintains the contents of RAM and the
current state of all of the I/O pins. To select entry into stop2 upon execution of a STOP instruction, the user
must execute a STOP instruction with the PPDC and PDC bits in SPMSC2 set. Stop2 can be entered only
if LVDRE = 0.
Before entering stop2 mode, the user must save the contents of the I/O port registers, as well as any other
memory-mapped registers that they want to restore after exit of stop2, to locations in RAM. Upon exit from
stop2, these values can be restored by user software.
When the MCU is in stop2 mode, all internal circuits that are powered from the voltage regulator are turned
off, except for the RAM. The voltage regulator is in a low-power standby state, as is the ACMP. Upon entry
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
31
Modes of Operation
into stop2, the states of the I/O pins are latched. The states are held while in stop2 mode and after exiting
stop2 mode until a 1 is written to PPDACK in SPMSC2.
Exit from stop2 is done by asserting any of the wakeup pins: RESET, IRQ, or KBI1 that have been enabled,
or through the real-time interrupt. IRQ and KBI1 pins are always active-low when used as wakeup pins in
stop2 regardless of how they were configured before entering stop2. (KBI2 will not wake the MCU from
stop2.)
Upon wakeup from stop2 mode, the MCU will start up as from a power-on reset (POR) except pin states
remain latched. The CPU will take the reset vector. The system and all peripherals will be in their default
reset states and must be initialized.
After waking up from stop2, the PPDF bit in SPMSC2 is set. This flag may be used to direct user code to
go to a stop2 recovery routine. PPDF remains set and the I/O pin states remain latched until a 1 is written
to PPDACK in SPMSC2.
For pins that were configured as general-purpose I/O, the user must copy the contents of the I/O port
registers, which have been saved in RAM, back to the port registers before writing to the PPDACK bit. If
the port registers are not restored from RAM before writing to PPDACK, then the register bits will be in
their reset states when the I/O pin latches are opened and the I/O pins will switch to their reset states.
For pins that were configured as peripheral I/O, the user must reconfigure the peripheral module that
interfaces to the pin before writing to the PPDACK bit. If the peripheral module is not enabled before
writing to PPDACK, the pins will be controlled by their associated port control registers when the I/O
latches are opened.
3.6.3
Stop3 Mode
Upon entering stop3 mode, all of the clocks in the MCU, including the oscillator itself, are halted. The
OSC is turned off, the ACMP is disabled, and the voltage regulator is put in standby. The states of all of
the internal registers and logic, as well as the RAM content, are maintained. The I/O pin states are not
latched at the pin as in stop2. Instead they are maintained by virtue of the states of the internal logic driving
the pins being maintained.
Exit from stop3 is done by asserting RESET, any asynchronous interrupt pin that has been enabled, or
through the real-time interrupt. The asynchronous interrupt pins are the IRQ or KBI1 and KBI2 pins.
If stop3 is exited by means of the RESET pin, then the MCU will be reset and operation will resume after
taking the reset vector. Exit by means of an asynchronous interrupt or the real-time interrupt will result in
the MCU taking the appropriate interrupt vector.
A separate self-clocked source (≈1 kHz) for the real-time interrupt allows a wakeup from stop2 or stop3
mode with no external components. When RTIS2:RTIS1:RTIS0 = 0:0:0, the real-time interrupt function
and this 1-kHz source are disabled. Power consumption is lower when the 1-kHz source is disabled, but in
that case the real-time interrupt cannot wake the MCU from stop.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
32
Freescale Semiconductor
Modes of Operation
3.6.4
Active BDM Enabled in Stop Mode
Entry into the active background mode from run mode is enabled if the ENBDM bit in BDCSCR is set.
This register is described in the Development Support chapter of this data sheet. If ENBDM is set when
the CPU executes a STOP instruction, the system clocks to the background debug logic remain active when
the MCU enters stop mode so background debug communication is still possible. In addition, the voltage
regulator does not enter its low-power standby state but maintains full internal regulation. The MCU
cannot enter either stop1 mode or stop2 mode if ENBDM is set.
Most background commands are not available in stop mode. The memory-access-with-status commands
do not allow memory access, but they report an error indicating that the MCU is in either stop or wait
mode. The BACKGROUND command can be used to wake the MCU from stop and enter active
background mode if the ENBDM bit is set. After active background mode is entered, all background
commands are available. Table 3-2 summarizes the behavior of the MCU in stop when entry into the active
background mode is enabled.
Table 3-2. BDM Enabled Stop Mode Behavior
Mode
PDC
PPDC
Stop3
Don’t
care
Don’t
care
3.6.5
CPU, Digital
Peripherals,
FLASH
RAM
OSC
ACMP
Regulator
I/O Pins
RTI
Standby
Standby
On
Standby
On
States
held
Optionally on
LVD Reset Enabled
The LVD system is capable of generating either an interrupt or a reset when the supply voltage drops below
the LVD voltage. If the LVD reset is enabled in stop by setting the LVDRE bit in SPMSC1 when the CPU
executes a STOP instruction, then the voltage regulator remains active during stop mode. If the user
attempts to enter either stop1 or stop2 with the LVD reset enabled (LVDRE = 1) the MCU will instead
enter stop3. Table 3-3 summarizes the behavior of the MCU in stop when LVD reset is enabled.
Table 3-3. LVD Enabled Stop Mode Behavior
Mode
PDC
PPDC
Stop3
Don’t
care
Don’t
care
3.6.6
CPU, Digital
Peripherals,
FLASH
RAM
OSC
ACMP
Regulator
I/O Pins
RTI
Standby
Standby
On
Standby
On
States
held
Optionally on
On-Chip Peripheral Modules in Stop Mode
When the MCU enters any stop mode, system clocks to the internal peripheral modules are stopped. Even
in the exception case (ENBDM = 1), where clocks are kept alive to the background debug logic, clocks to
the peripheral systems are halted to reduce power consumption.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
33
Modes of Operation
I/O Pins
• All I/O pin states remain unchanged when the MCU enters stop3 mode.
• If the MCU is configured to go into stop2 mode, all I/O pin states are latched before entering stop.
Pin states remain latched until the PPDACK bit is written.
• If the MCU is configured to go into stop1 mode, all I/O pins are forced to their default reset state
upon entry into stop.
Memory
• All RAM and register contents are preserved while the MCU is in stop3 mode.
• All registers will be reset upon wakeup from stop2, but the contents of RAM are preserved. The
user may save any memory-mapped register data into RAM before entering stop2 and restore the
data upon exit from stop2.
• All registers will be reset upon wakeup from stop1 and the contents of RAM are not preserved. The
MCU must be initialized as upon reset. The contents of the FLASH memory are non-volatile and
are preserved in any of the stop modes.
OSC — In any of the stop modes, the OSC stops running.
TPM — When the MCU enters stop mode, the clock to the TPM module stops. The modules halt
operation. If the MCU is configured to go into stop2 or stop1 mode, the TPM module will be reset upon
wakeup from stop and must be reinitialized.
ACMP — When the MCU enters any stop mode, the ACMP will enter a low-power standby state. No
compare operation will occur while in stop. If the MCU is configured to go into stop2 or stop1 mode, the
ACMP will be reset upon wakeup from stop and must be reinitialized.
KBI — During stop3, the KBI pins that are enabled continue to function as interrupt sources. During stop1
or stop2, enabled KBI1 pins function as wakeup inputs. When functioning as a wakeup, a KBI pin is
always active low regardless of how it was configured before entering stop1 or stop2.
SCI — When the MCU enters stop mode, the clock to the SCI module stops. The module halts operation.
If the MCU is configured to go into stop2 or stop1 mode, the SCI module will be reset upon wakeup from
stop and must be reinitialized.
SPI — When the MCU enters stop mode, the clock to the SPI module stops. The module halts operation.
If the MCU is configured to go into stop2 or stop1 mode, the SPI module will be reset upon wakeup from
stop and must be reinitialized.
CMT — When the MCU enters stop mode, the clock to the CMT module stops. The module halts
operation. If the MCU is configured to go into stop2 or stop1 mode, the CMT module will be reset upon
wakeup from stop and must be reinitialized.
Voltage Regulator — The voltage regulator enters a low-power standby state when the MCU enters any
of the stop modes unless the LVD reset function is enabled or BDM is enabled.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
34
Freescale Semiconductor
Chapter 4
Memory
4.1
MC9S08RC/RD/RE/RG Memory Map
As shown in Figure 4-1, on-chip memory in the MC9S08RC/RD/RE/RG series of MCUs consists of
RAM, FLASH program memory for nonvolatile data storage, and I/O and control/status registers. The
registers are divided into three groups:
• Direct-page registers ($0000 through $0045 for 32K and 60K parts, and $0000 through $003F for
16K and 8K parts)
• High-page registers ($1800 through $182B)
• Nonvolatile registers ($FFB0 through $FFBF)
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
35
Memory
$0000
DIRECT PAGE REGISTERS
$0045
$0046
RAM
2048 BYTES
$0845
$0846
$17FF
$1800
$182B
$182C
DIRECT PAGE REGISTERS
RAM
2048 BYTES
FLASH
4026 BYTES
UNIMPLEMENTED
4026 BYTES
HIGH PAGE REGISTERS
HIGH PAGE REGISTERS
$0000
$0045
$0046
DIRECT PAGE REGISTERS
RAM 1024 BYTES(1)
$0845
$0846
$0000
$003F
$0040
$043F
$0440
UNIMPLEMENTED
5056 BYTES
$17FF
$1800
$182B
$182C
HIGH PAGE REGISTERS
DIRECT PAGE REGISTERS
RAM 1024 BYTES(1)
$0000
$003F
$0040
$043F
$0440
UNIMPLEMENTED
5056 BYTES
$17FF
$1800
$182B
$182C
HIGH PAGE REGISTERS
$17FF
$1800
$182B
$182C
UNIMPLEMENTED
26580 BYTES
$8000
UNIMPLEMENTED
42964 BYTES
FLASH
59348 BYTES
UNIMPLEMENTED
51156 BYTES
FLASH
32768 BYTES
$BFFF
$C000
FLASH
16384 BYTES
$DFFF
$E000
FLASH
8192 BYTES
$FFFF
$FFFF
$FFFF
MC9S08RC/RD/RE/RG60
MC9S08RC/RD/RE/RG32
MC9S08RC/RD/RE16
MC9S08RC/RD/RE8
Figure 4-1. MC9S08RC/RD/RE/RG Memory Map
4.1.1
Reset and Interrupt Vector Assignments
Figure 4-2 shows address assignments for reset and interrupt vectors. The vector names shown in this table
are the labels used in the Freescale-provided equate file for the MC9S08RC/RD/RE/RG. For more details
about resets, interrupts, interrupt priority, and local interrupt mask controls, refer to the Chapter 5, “Resets,
Interrupts, and System Configuration."
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
36
Freescale Semiconductor
Memory
Figure 4-2. Reset and Interrupt Vectors
Vector
Number
Address
(High/Low)
16
through
31
$FFC0:FFC1
Vector
Vector Name
Unused Vector Space
(available for user program)
$FFDE:FFDF
15
$FFE0:FFE1
SPI(1)
Vspi1
14
$FFE2:FFE3
RTI
Vrti
13
$FFE4:FFE5
KBI2
Vkeyboard2
12
$FFE6:FFE7
KBI1
Vkeyboard1
(2)
11
$FFE8:FFE9
ACMP
10
$FFEA:FFEB
CMT
9
8
$FFEC:FFED
$FFEE:FFEF
SCI
Vacmp1
Vcmt
Transmit(3)
Vsci1tx
(3)
Vsci1rx
SCI Receive
(3)
SCI Error
Vsci1err
7
$FFF0:FFF1
6
$FFF2:FFF3
TPM Overflow
Vtpm1ovf
5
$FFF4:FFF5
TPM Channel 1
Vtpm1ch1
4
$FFF6:FFF7
TPM Channel 0
Vtpm1ch0
3
$FFF8:FFF9
IRQ
Virq
2
$FFFA:FFFB
Low Voltage Detect
Vlvd
1
$FFFC:FFFD
SWI
Vswi
0
$FFFE:FFFF
Reset
Vreset
1. The SPI module is not included on the MC9S08RC/RD/RE devices. This vector location is unused for those devices.
2. The analog comparator (ACMP) module is not included on the MC9S08RD devices. This vector location is unused for
those devices.
3. The SCI module is not included on the MC9S08RC devices. This vector location is unused for those devices.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
37
Memory
4.2
Register Addresses and Bit Assignments
The registers in the MC9S08RC/RD/RE/RG are divided into these three groups:
• Direct-page registers are located within the first 256 locations in the memory map, so they are
accessible with efficient direct addressing mode instructions.
• High-page registers are used much less often, so they are located above $1800 in the memory map.
This leaves more room in the direct page for more frequently used registers and variables.
• The nonvolatile register area consists of a block of 16 locations in FLASH memory at
$FFB0–$FFBF.
Nonvolatile register locations include:
— Three values that are loaded into working registers at reset
— An 8-byte backdoor comparison key that optionally allows a user to gain controlled access to
secure memory
Because the nonvolatile register locations are FLASH memory, they must be erased and
programmed like other FLASH memory locations.
Direct-page registers can be accessed with efficient direct addressing mode instructions. Bit manipulation
instructions can be used to access any bit in any direct-page register. Table 4-1 is a summary of all
user-accessible direct-page registers and control bits.
The direct page registers in Table 4-1 can use the more efficient direct addressing mode, which requires
only the lower byte of the address. Because of this, the lower byte of the address in column one is shown
in bold text. In Table 4-2 and Table 4-3, the whole address in column one is shown in bold. In Table 4-1,
Table 4-2, and Table 4-3, the register names in column two are shown in bold to set them apart from the
bit names to the right. Cells that are not associated with named bits are shaded. A shaded cell with a 0
indicates this unused bit always reads as a 0. Shaded cells with dashes indicate unused or reserved bit
locations that could read as 1s or 0s.
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
38
Freescale Semiconductor
Memory
Table 4-1. Direct-Page Register Summary
Address
Register Name
Bit 7
6
5
4
3
2
1
Bit 0
$0000
PTAD
$0001
PTAPE
PTAD7
PTAD6
PTAD5
PTAD4
PTAD3
PTAD2
PTAD1
PTAD0
PTAPE7
PTAPE6
PTAPE5
PTAPE4
PTAPE3
PTAPE2
PTAPE1
PTAPE0
$0002
Reserved
$0003
PTADD
$0004
PTBD
$0005
PTBPE
$0006
Reserved
$0007
PTBDD
$0008
PTCD
$0009
PTCPE
$000A
Reserved
$000B
PTCDD
$000C
PTDD
0
PTDD6
PTDD5
PTDD4
PTDD3
PTDD2
PTDD1
PTDD0
$000D
PTDPE
0
PTDPE6
PTDPE5
PTDPE4
PTDPE3
PTDPE2
PTDPE1
PTDPE0
—
—
—
—
—
—
—
—
PTADD7
PTADD6
PTADD5
PTADD4
PTADD3
PTADD2
PTADD1
PTADD0
PTBD7
PTBD6
PTBD5
PTBD4
PTBD3
PTBD2
PTBD1
PTBD0
PTBPE7
PTBPE6
PTBPE5
PTBPE4
PTBPE3
PTBPE2
PTBPE1
PTBPE0
—
—
—
—
—
—
—
—
PTBDD7
PTBDD6
PTBDD5
PTBDD4
PTBDD3
PTBDD2
PTBDD1
PTBDD0
PTCD7
PTCD6
PTCD5
PTCD4
PTCD3
PTCD2
PTCD1
PTCD0
PTCPE7
PTCPE6
PTCPE5
PTCPE4
PTCPE3
PTCPE2
PTCPE1
PTCPE0
—
—
—
—
—
—
—
—
PTCDD7
PTCDD6
PTCDD5
PTCDD4
PTCDD3
PTCDD2
PTCDD1
PTCDD0
$000E
Reserved
—
—
—
—
—
—
—
—
$000F
PTDDD
0
PTDDD6
PTDDD5
PTDDD4
PTDDD3
PTDDD2
PTDDD1
PTDDD0
$0010
PTED
$0011
PTEPE
PTED7
PTED6
PTED5
PTED4
PTED3
PTED2
PTED1
PTED0
PTEPE7
PTEPE6
PTEPE5
PTEPE4
PTEPE3
PTEPE2
PTEPE1
PTEPE0
$0012
Reserved
—
—
—
—
—
—
—
—
$0013
PTEDD
PTEDD7
PTEDD6
PTEDD5
PTEDD4
PTEDD3
PTEDD2
PTEDD1
PTEDD0
$0014
KBI1SC
KBEDG7
KBEDG6
KBEDG5
KBEDG4
KBF
KBACK
KBIE
KBIMOD
$0015
KBI1PE
KBIPE7
KBIPE6
KBIPE5
KBIPE4
KBIPE3
KBIPE2
KBIPE1
KBIPE0
$0016
KBI2SC
0
0
0
0
KBF
KBACK
KBIE
KBIMOD
$0017
KBI2PE
0
0
0
0
KBIPE3
KBIPE2
KBIPE1
KBIPE0
(1)
$0018
SCI1BDH
$0019
SCI1BDL(1)
(1)
0
0
0
SBR12
SBR11
SBR10
SBR9
SBR8
SBR7
SBR6
SBR5
SBR4
SBR3
SBR2
SBR1
SBR0
$001A
SCI1C1
LOOPS
SCISWAI
RSRC
M
WAKE
ILT
PE
PT
$001B
SCI1C2(1)
TIE
TCIE
RIE
ILIE
TE
RE
RWU
SBK
$001C
SCI1S1(1)
TDRE
TC
RDRF
IDLE
OR
NF
FE
PF
$001D
SCI1S2(1)
0
0
0
0
0
0
0
RAF
$001E
SCI1C3(1)
R8
T8
TXDIR
0
ORIE
NEIE
FEIE
PEIE
$001F
SCI1D(1)
R7/T7
R6/T6
R5/T5
R4/T4
R3/T3
R2/T2
R1/T1
R0/T0
$0020
CMTCGH1
PH7
PH6
PH5
PH4
PH3
PH2
PH1
PH0
$0021
CMTCGL1
PL7
PL6
PL5
PL4
PL3
PL2
PL1
PL0
$0022
CMTCGH2
SH7
SH6
SH5
SH4
SH3
SH2
SH1
SH0
$0023
CMTCGL2
SL7
SL6
SL5
SL4
SL3
SL2
SL1
SL0
IROPEN
$0024
CMTOC
IROL
CMTPOL
$0025
CMTMSC
EOCF
CMTDIV1 CMTDIV0
0
0
0
0
0
EXSPC
BASE
FSK
EOCIE
MCGEN
$0026
CMTCMD1
MB15
MB14
$0027
CMTCMD2
MB7
MB6
MB13
MB12
MB11
MB10
MB9
MB8
MB5
MB4
MB3
MB2
MB1
MB0
$0028
CMTCMD3
SB15
$0029
CMTCMD4
SB7
SB14
SB13
SB12
SB11
SB10
SB9
SB8
SB6
SB5
SB4
SB3
SB2
SB1
SB0
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
39
Memory
Table 4-1. Direct-Page Register Summary (continued)
Address
Register Name
$002A
IRQSC
$002B
ACMP1SC(2)
$002C–
$002F
Bit 7
6
5
4
3
2
1
Bit 0
0
0
IRQEDG
IRQPE
IRQF
IRQACK
IRQIE
IRQMOD
ACME
ACBGS
ACF
ACIE
ACO
—
ACMOD1
ACMOD0
Reserved
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
$0030
TPM1SC
TOF
TOIE
CPWMS
CLKSB
CLKSA
PS2
PS1
PS0
$0031
TPM1CNTH
Bit 15
14
13
12
11
10
9
Bit 8
$0032
TPM1CNTL
Bit 7
6
5
4
3
2
1
Bit 0
$0033
TPM1MODH
Bit 15
14
13
12
11
10
9
Bit 8
$0034
TPM1MODL
Bit 7
6
5
4
3
2
1
Bit 0
$0035
TPM1C0SC
CH0F
CH0IE
MS0B
MS0A
ELS0B
ELS0A
0
0
$0036
TPM1C0VH
Bit 15
14
13
12
11
10
9
Bit 8
$0037
TPM1C0VL
Bit 7
6
5
4
3
2
1
Bit 0
$0038
TPM1C1SC
CH1F
CH1IE
MS1B
MS1A
ELS1B
ELS1A
0
0
$0039
TPM1C1VH
Bit 15
14
13
12
11
10
9
Bit 8
$003A
TPM1C1VL
Bit 7
6
5
4
3
2
1
Bit 0
$003B–
$003F
Reserved
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
$0040
SPI1C1(3)
SPIE
SPE
SPTIE
MSTR
CPOL
CPHA
SSOE
LSBFE
$0041
SPI1C2(3)
0
0
0
MODFEN
BIDIROE
0
SPISWAI
SPC0
$0042
SPI1BR
(3)
$0043
SPI1S(3)
0
SPPR2
SPPR1
SPPR0
0
SPR2
SPR1
SPR0
SPRF
0
SPTEF
MODF
0
0
0
0
$0044
Reserved
—
—
—
—
—
—
—
—
$0045
SPI1D(3)
Bit 7
6
5
4
3
2
1
Bit 0
1. The SCI module is not included on the MC9S08RC devices. This is a reserved location for those devices.
2. The analog comparator (ACMP) module is not included on the MC9S08RD devices. This is a reserved location for those
devices.
3. The SPI module is not included on the MC9S08RC/RD/RE devices. These are reserved locations on the 32K and 60K versions
of these devices. The address range $0040–$004F are RAM locations on the 16K and 8K devices. There are no
MC9S08RG8/16 devices.
High-page registers, shown in Table 4-2, are accessed much less often than other I/O and control registers
so they have been located outside the direct addressable memory space, starting at $1800.
Table 4-2. High-Page Register Summary
Address
$1800
Register Name
SRS
Bit 7
POR
6
PIN
5
COP
4
ILOP
3
(1)
ILAD
2
1
Bit 0
0
LVD
0
$1801
SBDFR
0
0
0
0
0
0
0
BDFR
$1802
SOPT
7
COPT
STOPE
—
0
0
BKGDPE
RSTPE
$1803–
$1804
Reserved
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
$1805
Reserved
$1806
SDIDH
$1807
SDIDL
$1808
SRTISC
0
0
0
0
0
0
0
0
REV3
REV2
REV1
REV0
ID11
ID10
ID9
ID8
ID7
ID6
ID5
ID4
ID3
ID2
ID1
ID0
RTIF
RTIACK
RTICLKS
RTIE
0
RTIS2
RTIS1
RTIS0
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
40
Freescale Semiconductor
Memory
Table 4-2. High-Page Register Summary (continued)
Address
Register Name
Bit 7
6
5
4
3
2
1
Bit 0
$1809
SPMSC1
LVDF
LVDACK
LVDIE
SAFE
LVDRE
—
—
—
$180A
SPMSC2
LVWF
LVWACK
0
0
PPDF
PPDACK
PDC
PPDC
$180B–
$180F
Reserved
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
$1810
DBGCAH
Bit 15
14
13
12
11
10
9
Bit 8
$1811
DBGCAL
Bit 7
6
5
4
3
2
1
Bit 0
$1812
DBGCBH
Bit 15
14
13
12
11
10
9
Bit 8
$1813
DBGCBL
Bit 7
6
5
4
3
2
1
Bit 0
$1814
DBGFH
Bit 15
14
13
12
11
10
9
Bit 8
$1815
DBGFL
Bit 7
6
5
4
3
2
1
Bit 0
$1816
DBGC
DBGEN
ARM
TAG
BRKEN
RWA
RWAEN
RWB
RWBEN
$1817
DBGT
TRGSEL
BEGIN
0
0
TRG3
TRG2
TRG1
TRG0
$1818
DBGS
AF
BF
ARMF
0
CNT3
CNT2
CNT1
CNT0
$1819–
$181F
Reserved
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
$1820
FCDIV
DIVLD
PRDIV8
DIV5
DIV4
DIV3
DIV2
DIV1
DIV0
$1821
FOPT
KEYEN
FNORED
0
0
0
0
SEC01
SEC00
$1822
Reserved
—
—
—
—
—
—
—
—
$1823
FCNFG
0
0
KEYACC
0
0
0
0
0
$1824
FPROT
FPOPEN
FPDIS
FPS2
FPS1
FPS0
0
0
0
$1825
FSTAT
FCBEF
FCCF
FPVIOL
FACCERR
0
FBLANK
0
0
$1826
FCMD
FCMD7
FCMD6
FCMD5
FCMD4
FCMD3
FCMD2
FCMD1
FCMD0
$1827–
$182B
Reserved
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
1. The ILAD bit is only present on 16K and 8K versions of the devices.
Nonvolatile FLASH registers, shown in Table 4-3, are located in the FLASH memory. These registers
include an 8-byte backdoor key that optionally can be used to gain access to secure memory resources.
During reset events, the contents of NVPROT and NVOPT in the nonvolatile register area of the FLASH
memory are transferred into corresponding FPROT and FOPT working registers in the high-page registers
to control security and block protection options.
Table 4-3. Nonvolatile Register Summary
Address
Register Name
Bit 7
6
5
4
3
$FFB0–
$FFB7
NVBACKKEY
$FFB8–
$FFBC
Reserved
—
—
—
—
—
—
—
—
—
—
2
1
Bit 0
—
—
—
—
—
—
8-Byte Comparison Key
$FFBD
NVPROT
FPOPEN
FPDIS
FPS2
FPS1
FPS0
0
0
0
$FFBE
Reserved
—
—
—
—
—
—
—
—
$FFBF
NVOPT
KEYEN
FNORED
0
0
0
0
SEC01
SEC00
MC9S08RC/RD/RE/RG Data Sheet, Rev. 1.11
Freescale Semiconductor
41
Memory
Provided the key enable (KEYEN) bit is 1, the 8-byte comparison key can be used to temporarily
disengage memory security. This key mechanism can be accessed only through user code running in secure
memory. (A security key cannot be entered directly through background debug commands.) This security
key can be disabled completely by programming the KEYEN bit to 0. If the security key is disabled, the
only way to disengage security is by mass erasing the FLASH if needed (normally through the background
debug interface) and verifying that FLASH is blank. To avoid returning to secure mode after the next reset,
program the security bits (SEC01:SEC00) to the unsecured state (1:0).
4.3
RAM
The MC9S08RC/RD/RE/RG includes static RAM. The locations in RAM below $0100 can be accessed
using the more efficient direct addressing mode, and any single bit in this area can be accessed with the
bit-manipulation instructions (BCLR, BSET, BRCLR, and BRSET). Locating the most frequently
accessed program variables in this area of RAM is preferred.
The RAM retains data when the MCU is in low-power wait, stop2, or stop3 mode. At power-on or after
wakeup from stop1, the contents of RAM are uninitialized. RAM data is unaffected by any reset provided
that the supply voltage does not drop below the minimum value for RAM retention.
For compatibility with older M68HC05 MCUs, the HCS08 resets the stack pointer to $00FF. In the
MC9S08RC/RD/RE/RG, it is usually best to reinitialize the stack pointer to the top of the RAM so the
direct page RAM can be used for frequently accessed RAM variables and bit-addressable program
variables. Include the following 2-instruction sequence in your reset initialization routine (where RamLast
is equated to the highest address of the RAM in the Freescale-provided equate file).
LDHX
TXS
#RamLast+1
;point one past RAM
;SP