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
1.072/4/2004Initial external release.
1.084/22/2004Changes to Table C-6 in electricals section.
1.097/7/2004
1.108/11/2004
Revision
Date
Description of Changes
Added Table C-4; changes to Table C-6; changed to Freescale
format
Removed BRK bit 13 and TXINV, which are not available on this
module version; fixed typo in Figure 13-2; corrected the SPTEF
description in section 12.3
This product contains SuperFlash® technology licensed from SST.
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.
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 have been organized to reflect:
•Standard features of the HCS08 Family
•Additional features of the MC9S08RC/RD/RE/RG MCU
1.2.1 Standard Features of the HCS08 Family
•HCS08 CPU (central processor unit)
•HC08 instruction set with added BGND instruction
•Background debugging system (see also the Development Support section)
•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.
•Support for up to 32 interrupt/reset sources
•Power-saving modes: wait plus three stops
•System protection features:
–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)
1.2.2 Features of MC9S08RC/RD/RE/RG Series of MCUs
•8 MHz internal bus frequency
•On-chip in-circuit programmable FLASH memory with block protection and security option (see
Table 1-1 for device specific information)
•On-chip random-access memory (RAM) (see Table 1-1 for device specific information)
Freescale Semiconductor
15MC9S08RC/RD/RE/RG
Introduction
•Low power oscillator capable of operating from crystal or resonator from 1 to 16 MHz
•On-chip analog comparator with internal reference (ACMP1) see Table 1-1
–Full rail-to-rail supply operation
–Option to compare to a fixed internal bandgap reference voltage
•Serial communications interface module (SCI1) — see Table 1-1
•Serial peripheral interface module (SPI1) — see Table 1-1
•2-channel, 16-bit timer/pulse-width modulator (TPM1) module with 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
•Carrier modulator timer (CMT) with 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
•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
•Four packages available
–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)
1.2.3 Devices in the MC9S08RC/RD/RE/RG Series
Table 1-1 below lists the devices available in the MC9S08RC/RD/RE/RG series and summarizes the
differences in functions and configuration between them.
6. Pins PTA[7:0] contain both pullup and pulldown devices. Pulldown available when KBI enabled (KBI1Pn = 1).
Figure 1-1 MC9S08RC/RD/RE/RG Block Diagram
Freescale Semiconductor
PTE0
NOTE 1
17MC9S08RC/RD/RE/RG
Introduction
Table 1-2 lists the functional versions of the on-chip modules.
Table 1-2 Block Versions
ModuleVersion
Analog Comparator (ACMP)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
FLASH1
System Control2
1.4 System Clock Distribution
SYSTEM
CONTROL
LOGIC
RTI
BUSCLK
OSC
RTI
OSC
OSCOUT*
CPU
* OSCOUT is the alternate BDC clock source for the MC9S08RC/RD/RE/RG.
RTICLKS
÷2
Figure 1-2 System Clock Distribution Diagram
BDC
TPM
ACMP
CMT
SCI
RAMFLASH
SPI
FLASH has frequency
requirements for program
and erase operation.
See Appendix A.
Figure 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/RG18
Freescale Semiconductor
SoC Guide — MC9S08RG60/D Rev 1.10
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.
2.2 Device Pin Assignment
PTA3/KBI1P3
PTE5
38
18
PTE4
37
19
36
20
PTA1/KBI1P1
PTA2/KBI1P2
34
35
32
31
30
29
28
27
26
25
24
21
22
PTA0/KBI1P0
33
PTD6/TPM1CH0
PTD5/ACMP1+
PTD4/ACMP1–
EXTAL
XTAL
PTD3
PTD2/IRQ
PTD1/RESET
PTD0/BKGD/MS
PTC7/SS1
23
PTB0/TxD1
PTB1/RxD1
PTB2
PTB3
PTB4
V
V
IRO
PTB5
PTB6
PTB7/TPM1CH1
PTA7/KBI1P7
PTA6/KBI1P6
PTA5/KBI1P5
44
43
1
2
3
4
5
6
DD
7
SS
8
9
10
11
12
42
13
14
PTE7
PTA4/KBI1P4
41
40
15
16
PTE6
39
17
Figure 2-1 MC9S08RC/RD/RE/RG in 44-Pin LQFP Package
Freescale Semiconductor
PTC1/KBI2P1
PTC0/KBI2P0
PTC2/KBI2P2
PTC3/KBI2P3
PTE0
PTE1
PTE2
PTE3
PTC4/MOSI1
PTC5/MISO1
PTC6/SPSCK1
19MC9S08RC/RD/RE/RG
Pins and Connections
PTA0/KBI1P0
PTA1/KBI1P1
25
26
24
23
22
21
20
19
18
17
15
16
PTC7/SS1
PTC6/SPSCK1
PTD6/TPM1CH0
PTD5/ACMP1+
PTD4/ACMP1–
EXTAL
XTAL
PTD2/IRQ
PTD1/RESET
PTD0/BKGD/MS
PTB0/TxD1
PTB1/RxD1
PTB2
V
V
IRO
PTB6
PTB7/TPM1CH1
PTA7/KBI1P7
PTA6/KBI1P6
PTA5/KBI1P5
PTA4/KBI1P4
PTA3/KBI1P3
PTA2/KBI1P2
32
27
28
29
30
2
3
4
5
6
7
8
9
PTC0/KBI2P0
31
10
11
PTC1/KBI2P1
PTC2/KBI2P2
12
13
PTC4/MISO1
PTC3/KBI2P3
14
PTC5/MISO1
1
DD
SS
Figure 2-2 MC9S08RC/RD/RE/RG in 32-Pin LQFP Package
MC9S08RC/RD/RE/RG20
Freescale Semiconductor
SoC Guide — MC9S08RG60/D Rev 1.10
PTA5/KBI1P5
PTA6/KBI1P6
PTA7/KBI1P7
PTB0/TxD1
PTB1/RxD1
PTB2
V
V
IRO
PTB7/TPM1CH1
PTC0/KBI2P0
PTC1/KBI2P1
PTC2/KBI2P2
PTC3/KBI2P3
1
2
3
4
5
6
7
DD
8
SS
9
10
11
12
13
14
28
27
26
25
24
23
22
21
20
19
18
17
16
15
PTA4/KBI1P4
PTA3/KBI1P3
PTA2/KBI1P2
PTA1/KBI1P1
PTA0/KBI1P0
PTD6/TPM1CH0
EXTAL
XTAL
PTD1/RESET
PTD0/BKGD/MS
PTC7/SS1
PTC6/SPSCK1
PTC5/MISO1
PTC4/MOSI1
Figure 2-3 MC9S08RC/RD/RE/RG in 28-Pin SOIC Package and 28-Pin PDIP Package
2.3 Recommended System Connections
Figure 2-4 shows pin connections that are common to almost all MC9S08RC/RD/RE/RG application
systems. A more detailed discussion of system connections follows.
Freescale Semiconductor
21MC9S08RC/RD/RE/RG
Pins and Connections
MC9S08RC/RD/RE/RG
SYSTEM
POWER
C2
BACKGROUND HEADER
V
DD
+
3 V
OPTIONAL
MANUAL
RESET
C
BLK
10 µF
X1
V
DD
V
DD
+
R
F
1
C1
C
BY
0.1 µF
V
SS
XTAL
EXTAL
BKGD/MS
NOTE 1
RESET
NOTE 2
PORT
A
PORT
B
PORT
C
PTA0/KBI1P0
PTA1/KBI1P1
PTA2/KBI1P2
PTA3/KBI1P3
PTA4/KBI1P4
PTA5/KBI1P5
PTA6/KBI1P6
PTA7/KBI1P7
PTB0/TxD1
PTB1/RxD1
PTB2
PTB3
PTB4
PTB5
PTB6
PTB7/TPM1CH1
PTC0/KBI2P0
PTC1/KBI2P1
PTC2/KBI2P2
PTC3/KBI2P3
PTC4/MOSI1
PTC5/MISO1
PTC6/SPSCK1
PTC7/SS1
I/O AND
PERIPHERAL
INTERFACE TO
APPLICATION
SYSTEM
NOTES:
1. BKGD/MS is the
same pin as PTD0.
2.
RESET is the
same pin as PTD1.
PORT
D
PORT
E
Figure 2-4 Basic System Connections
PTD0/BKGD/MS
PTD1/
RESET
PTD2/IRQ
PTD3
PTD4/ACMP1–
PTD5/ACMP1+
PTD6/TPM1CH0
IRO
PTE0
PTE1
PTE2
PTE3
PTE4
PTE5
PTE6
PTE7
MC9S08RC/RD/RE/RG22
Freescale Semiconductor
SoC Guide — MC9S08RG60/D Rev 1.10
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-4 for the following discussion. RFshould 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.
is used to provide a bias path to keep the EXTAL input in its linear range during crystal startup and its
R
F
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 f
Self_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).
, released, and sampled again about 38 cycles of f
Self_reset
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.
Freescale Semiconductor
23MC9S08RC/RD/RE/RG
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 Carrier Modulator Timer (CMT) Module 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 Parallel Input/Output
section. For information about how and when on-chip peripheral systems use these pins, refer to the
appropriate section from Table 2-1.
1. See this section 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 Parallel Input/Output section 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.
Freescale Semiconductor
25MC9S08RC/RD/RE/RG
Pins and Connections
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.
Table 2-2 Signal Properties
Pin
Name
V
DD
V
SS
XTALO——Crystal oscillator output
EXTALI——Crystal oscillator input
IROOY—Infrared output
PTA0/KBI1P0INSWC
PTA1/KBI1P1I/ONSWC
PTA2/KBI1P2I/ONSWC
PTA3/KBI1P3I/ONSWC
PTA4/KBI1P4I/ONSWC
PTA5/KBI1P5I/ONSWC
PTA6/KBI1P6I/ONSWC
PTA7/KBI1P7I/ONSWC
PTB0/TxD1I/OYSWC
PTB1/RxD1I/OYSWC
PTB2I/OYSWC
PTB3I/OYSWCAvailable only in 44-LQFP package
PTB4I/OYSWCAvailable only in 44-LQFP package
PTB5I/OYSWCAvailable only in 44-LQFP package
PTB6I/OYSWCAvailable only in 32- or 44-LQFP packages
PTB7/TPM1CH1I/OYSWC
PTC0/KBI2P0I/ONSWC
PTC1/KBI2P1I/ONSWC
PTC2/KBI2P2I/ONSWC
PTC3/KBI2P3I/ONSWC
PTC4/MOSI1I/ONSWC
PTC5/MISO1I/ONSWC
PTC6/SPSCK1I/ONSWC
SS1I/ONSWC
PTC7/
PTD0/BKGD/MSI/ON
PTD1/
RESETI/ON
PTD2/IRQI/ON
PTD3I/ONSWCAvailable only in 44-LQFP package
PTD4/ACMP1–I/ONSWCAvailable only in 32- or 44-LQFP packages
PTD5/ACMP1+I/ONSWCAvailable only in 32- or 44-LQFP packages
Dir
(1)
High
Current Pin
——
——
Pullup
SWC
SWC
SWC
(2)
PTA0 does not have a clamp diode to V
driven above V
(3)
Output-only when configured as PTD0 pin. Pullup enabled.
(3)
Output-only when configured as PTD1 pin.
(4)
Available only in 32- or 44-LQFP packages
DD
.
Comments
. PTA0 should not be
DD
MC9S08RC/RD/RE/RG26
Freescale Semiconductor
SoC Guide — MC9S08RG60/D Rev 1.10
Table 2-2 Signal Properties (Continued)
Pin
Name
PTD6/TPM1CH0I/ONSWC
PTE0I/ONSWCAvailable only in 44-LQFP package
PTE1I/ONSWCAvailable only in 44-LQFP package
PTE2I/ONSWCAvailable only in 44-LQFP package
PTE3I/ONSWCAvailable only in 44-LQFP package
PTE4I/ONSWCAvailable only in 44-LQFP package
PTE5I/ONSWCAvailable only in 44-LQFP package
PTE6I/ONSWCAvailable only in 44-LQFP package
PTE7I/ONSWCAvailable only in 44-LQFP package
NOTES:
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. When these pins are configured as
4. 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.
Dir
(1)
High
Current Pin
Pullup
RESET or BKGD/MS pullup device is enabled.
(2)
Comments
Freescale Semiconductor
27MC9S08RC/RD/RE/RG
Pins and Connections
MC9S08RC/RD/RE/RG28
Freescale Semiconductor
SoC Guide — MC9S08RG60/D Rev 1.10
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 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
3.3 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
Freescale Semiconductor
29MC9S08RC/RD/RE/RG
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 section.
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/RG30
Freescale Semiconductor
Loading...
+ 202 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.