NXP S08JE Reference guide

  • Hello! I am an AI chatbot trained to assist you with the NXP S08JE Reference guide. I’ve already reviewed the document and can help you find the information you need or explain it in simple terms. Just ask your questions, and providing more details will help me assist you more effectively!
HCS08
Microcontrollers
freescale.com
MC9S08JE128RM
Rev. 3
12/2010
MC9S08JE128
MC9S08JE64
Reference Manual
MC9S08JE128 series
8-Bit HCS08 Central Processor Unit (CPU)
Up to 48-MHz CPU above 2.4 V, 40 MHz CPU above 2.1 V, and
20 MHz CPU above 1.8 V across temperature of -40°C to 105°C
HCS08 instruction set with added BGND instruction
Support for up to 33 interrupt/reset sources
On-Chip Memory
128 K Dual Array Flash read/program/erase over full operating voltage
and temperature
12 KB Random-access memory (RAM)
Security circuitry to prevent unauthorized access to RAM and Flash
Power-Saving Modes
Peripheral clock enable register can disable clocks to unused modules
to reduce currents
Time of Day (TOD) — Ultra-low power 1/4 sec counter with up to 64s
timeout.
Ultra-low power external oscillator that can be used in stop modes to
provide accurate clock source to the TOD. 6 usec typical wake up time
from stop3 mode
Clock Source Options
Oscillator (XOSC1) — Loop-control Pierce oscillator; 32.768 kHz
crystal or ceramic resonator dedicated for TOD operation.
Oscillator (XOSC2) — for high frequency crystal input for MCG
reference to be used for system clock and USB operations.
Multipurpose Clock Generator (MCG) — PLL and FLL; precision
trimming of internal reference allows 0.2% resolution and 2%
deviation over temperature and voltage; supports CPU frequencies
from 4 kHz to 48 MHz.
System Protection
Watchdog computer operating properly (COP) reset with option to run
from dedicated 1-kHz internal clock source or bus clock with reset or
interrupt; selectable trip points; separate low-voltage warning with
optional interrupt; selectable trip pointsFlash block protection for each
array to prevent accidental write/erasure
Hardware CRC to support fast cyclic redundancy checks
Development Support
Single-wire background debug interface
Real-time debug with 6 hardware breakpoints (4 PC, 1 address and 1
data) Breakpoint capability to allow single breakpoint setting during
in-circuit debugging
On-chip in-circuit emulator (ICE) debug module containing 3
comparators and 9 trigger modes
Peripherals
CMT— Carrier Modulator timer for remote control communications.
Carrier generator, modulator and driver for dedicated infrared out. Can
be used as an output compare timer.
IIC— Up to 100 kbps with maximum bus loading; Multi-master
operation; Programmable slave address; Interrupt driven byte-by-byte
data transfer; supports broadcast mode and 11-bit addressing
PRACMP — Analog comparator with selectable interrupt; compare
option to programmable internal reference voltage; operation in stop3
SCI — Two serial communications interfaces with optional 13-bit
break; option to connect Rx input to PRACMP output on SCI1 and
SCI2; High current drive on Tx on SCI1 and SCI2; wake-up from stop3
on Rx edge
SPI1— Serial peripheral interface (SPI) with 64-bit FIFO buffer;
16-bit or 8-bit data transfers; full-duplex or single-wire bidirectional;
double-buffered transmit and receive; master or slave mode; MSB-first
or LSB-first shifting
SPI2— Serial peripheral interface with full-duplex or single-wire
bidirectional; Double-buffered transmit and receive; Master or Slave
mode; MSB-first or LSB-first shifting
TPM — Two 4-channel Timer/PWM Module; Selectable input
capture, output compare, or buffered edge- or center-aligned PWM on
each channel; external clock input/pulse accumulator
USB — Supports USB in full-speed device configuration. On-chip
transceiver and 3.3V regulator help save system cost, fully compliant
with USB Specification 2.0. Allows control, bulk, interrupt and
isochronous transfers.
ADC12 — 12-bit Successive approximation ADC with up to 4
dedicated differential channels and 8 single-ended channels; range
compare function; 1.7 mV/C temperature sensor; internal bandgap
reference channel; operation in stop3; fully functional from 3.6V to
1.8V, Configurable hardware trigger for 8 Channel select and result
registers
PDB — Programmable delay block with 16-bit counter and modulus
and prescale to set reference clock to bus divided by 1 to bus divided
by 2048; 8 trigger outputs for ADC12 module provides periodic
coordination of ADC sampling sequence with sequence completion
interrupt; Back-to-Back mode and Timed mode
DAC — 12-bit resolution; 16-word data buffers with configurable
watermark.
Input/Output
Up to 47 GPIOs and 2 output-only pin and 1 input-only pin.
Voltage Reference output (VREFO).
Dedicated infrared output pin (IRO) with high current sink capability.
Up to 16 KBI pins with selectable polarity.
Package Options
81-MBGA 10x10 mm
80-LQFP 12x12 mm
64-LQFP 10x10 mm
MC9S08JE128 Reference Manual
Covers MC9S08JE128
MC9S08JE64
MC9S08JE128RM
Rev. 3
12/2010
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.
© Freescale Semiconductor, Inc., 2010. All rights reserved.
Related Documentation:
MC9S08JE128 (Data Sheet)
Contains descriptive feature set, block diagram,
and electrical characteristics for the device.
Find the most current versions of all documents at:
http://www.freescale.com/
6 Freescale Semiconductor
Revision History
To provide the most up-to-date information, the version of our documents available on the World Wide Web is the most current.
Your printed copy may be an earlier revision. To verify you have the latest information available, refer to:
http://www.freescale.com/
The following revision history table summarizes changes contained in this document.
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.
© Freescale Semiconductor, Inc., 2010. All rights reserved.
Revision
Number
Revision
Date
Description of Changes
0 6/2009 Initial draft of the MC9S08JE128 book.
17/2009
Added missing register name FPROTD to memory map. Added missing FPROT
register description and flash protection address range. Updated the PDB
chapter to latest version of the block guide and corrected the PDB intro to
reference ACMPO and ADCSC1A_COCO correctly as well as added the
section, “PDB Trigger Acknowledgement Inputs.” Updated the ADC Channel
Assignment tables to latest version.
2 6/2010 Updated DAC, VREF, PDB, ADC, and USB.
3 12/2010 Updated to latest block guides.
MC9S08JE128 Series Reference Manual, Rev. 3
Freescale Semiconductor 7
Contents
Section Title Page
Preface
About This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
Audience. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Suggested Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
HCS08 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Register Figure Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Chapter 1
Device Overview
1.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
1.2 MCU Block Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34
1.3 System Clock Distribution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37
1.3.1 System Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38
1.3.2 Clock Gating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38
1.3.3 MCG Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39
1.3.4 MCG Mode State Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40
Chapter 2
Pins and Connections
2.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41
2.2 Device Pin Assignment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42
2.2.1 64-Pin LQFP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42
2.2.2 80-Pin LQFP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43
2.2.3 81-Pin MAPBGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44
2.2.4 Pin Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45
2.2.5 Pinout Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
2.3 Recommended System Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
2.3.1 Interfacing the SCIs to Off-Chip Opto-Isolators . . . . . . . . . . . . . . . . . . . . . . . . .56
2.3.2 Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57
2.3.3 Oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57
2.3.4 PTD1/CMPP2/RESET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .58
2.3.5 PTE4/CMPP3/TPMCLK/IRQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .58
2.3.6 Background / Mode Select (PTD0/BKGD/MS) . . . . . . . . . . . . . . . . . . . . . . . . . .58
2.3.7 ADC Reference Pins (V
REFH
, V
REFL
) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59
2.3.8 Bootloader Mode Select (PTB1/BLMS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59
2.3.9 USB Data Pins (USBDP, USBDN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59
2.3.10 General-Purpose I/O and Peripheral Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59
MC9S08JE128 Series Reference Manual, Rev. 3
8 Freescale Semiconductor
Chapter 3
Modes of Operation
3.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61
3.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61
3.3 Bootloader Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61
3.3.1 Entering Bootloader Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62
3.3.2 Entering User mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62
3.3.3 Active Background Mode and Bootloader Mode Arbitrage . . . . . . . . . . . . . . . . .62
3.3.4 Bootloader Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62
3.3.4.1 Flash Block Checksum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63
3.3.4.2 SIGNATURE Semaphore Register . . . . . . . . . . . . . . . . . . . . . . . . . . .63
3.3.4.3 Flash Partial Erase Semaphore . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63
3.4 Run Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65
3.4.1 Low-power Run Mode (LPRun) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65
3.4.1.1 Interrupts in Low-power Run Mode . . . . . . . . . . . . . . . . . . . . . . . . . .65
3.4.1.2 Resets in Low-power Run Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . .66
3.5 Active Background Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66
3.6 Wait Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67
3.6.1 Low-power Wait Mode (LPWait) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67
3.6.1.1 Interrupts in Low-power Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . .67
3.6.1.2 Resets in Low-power Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . .67
3.7 Stop Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .68
3.7.1 Stop2 Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .68
3.7.2 Stop3 Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69
3.7.2.1 LVD Enabled in Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69
3.7.2.2 Active BDM Enabled in Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . .69
3.7.3 Stop Modes in Low-power Run Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70
3.8 Mode Selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70
3.8.1 On-Chip Peripheral Modules in Stop Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . .72
Chapter 4
Memory
4.1 MC9S08JE128 series Memory Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75
4.1.1 Reset and Interrupt Vector Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .77
4.2 Register Addresses and Bit Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .78
4.3 Memory Management Unit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89
4.3.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89
4.3.2 Register Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .90
4.3.2.1 Program Page Register (PPAGE) . . . . . . . . . . . . . . . . . . . . . . . . . . .90
4.3.2.2 Linear Address Pointer Registers 2:0 (LAP2:LAP0) . . . . . . . . . . . . . .91
4.3.2.3 Linear Word Post Increment Register (LWP) . . . . . . . . . . . . . . . . . . .91
4.3.2.4 Linear Byte Post Increment Register (LBP) . . . . . . . . . . . . . . . . . . . .92
4.3.2.5 Linear Byte Register (LB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93
4.3.2.6 Linear Address Pointer Add Byte Register (LAPAB) . . . . . . . . . . . . .93
4.3.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93
MC9S08JE128 Series Reference Manual, Rev. 3
Freescale Semiconductor 9
4.3.3.1 Memory Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93
4.3.3.1.1Program Space. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94
4.3.3.1.2CALL and RTC (Return from Call) Instructions. . . . . . . . . . . . . .94
4.3.3.1.3Data Space. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95
4.3.3.1.4PPAGE and Linear Address Pointer to Extended Address. . . . .95
4.4 RAM (System RAM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95
4.5 USB RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96
4.6 Flash. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96
4.6.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96
4.6.2 Register Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97
4.6.2.1 Flash Clock Divider Register (FCDIV) . . . . . . . . . . . . . . . . . . . . . . . .97
4.6.2.2 Flash Options Register (FOPT and NVOPT) . . . . . . . . . . . . . . . . . . .98
4.6.2.3 Flash Configuration Register (FCNFG) . . . . . . . . . . . . . . . . . . . . . . .99
4.6.2.4 Flash Protection Register (FPROT and NVPROT) . . . . . . . . . . . . . .100
4.6.2.5 Flash Status Register (FSTAT) . . . . . . . . . . . . . . . . . . . . . . . . . . . .102
4.6.2.6 Flash Command Register (FCMD) . . . . . . . . . . . . . . . . . . . . . . . . . .103
4.6.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104
4.6.3.1 Flash Command Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104
4.6.3.1.1Writing the FCDIV Register. . . . . . . . . . . . . . . . . . . . . . . . . . . .104
4.6.3.1.2Command Write Sequence. . . . . . . . . . . . . . . . . . . . . . . . . . . .105
4.6.3.2 Flash Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105
4.6.3.2.1Erase Verify Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106
4.6.3.2.2Program Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107
4.6.3.2.3Burst Program Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . .108
4.6.3.2.4Sector Erase Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110
4.6.3.2.5Mass Erase Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112
4.6.3.3 Illegal Flash Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113
4.6.3.3.1Flash Access Violations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113
4.6.3.3.2Flash Protection Violations . . . . . . . . . . . . . . . . . . . . . . . . . . . .113
4.6.4 Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114
4.6.4.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114
4.6.4.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114
4.6.4.3 Background Debug Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114
4.6.5 Flash Module Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114
4.6.5.1 Unsecuring the MCU using Backdoor Key Access . . . . . . . . . . . . . .115
4.6.6 Resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .116
Chapter 5
Resets, Interrupts, and System Configuration
5.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
5.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
5.3 MCU Reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
5.4 Computer Operating Properly (COP) Watchdog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118
5.5 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119
5.5.1 Interrupt Stack Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120
MC9S08JE128 Series Reference Manual, Rev. 3
10 Freescale Semiconductor
5.5.2 External Interrupt Request (IRQ) Pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120
5.5.2.1 Pin Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120
5.5.2.2 Edge and Level Sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .121
5.5.3 Interrupt Vectors, Sources, and Local Masks . . . . . . . . . . . . . . . . . . . . . . . . . .121
5.6 Low-Voltage Detect (LVD) System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123
5.6.1 Power-On Reset Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123
5.6.2 Low-Voltage Detection (LVD) Reset Operation . . . . . . . . . . . . . . . . . . . . . . . . .123
5.6.3 Low-Voltage Warning (LVW) Interrupt Operation . . . . . . . . . . . . . . . . . . . . . . .123
5.7 Reset, Interrupt, and System Control Registers and Control Bits . . . . . . . . . . . . . . . . .123
5.7.1 Interrupt Pin Request Status and Control Register (IRQSC) . . . . . . . . . . . . . .124
5.7.2 System Reset Status Register (SRS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .124
5.7.3 System Background Debug Force Reset Register (SBDFR) . . . . . . . . . . . . . .126
5.7.4 System Options 1 (SOPT1) Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126
5.7.5 System Options 2 (SOPT2) Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127
5.7.6 SIM Clock Set and Select Register (SIMCO) . . . . . . . . . . . . . . . . . . . . . . . . . .128
5.7.7 System Device Identification Register (SDIDH, SDIDL) . . . . . . . . . . . . . . . . . .129
5.7.8 System Clock Gating Control 1 Register (SCGC1) . . . . . . . . . . . . . . . . . . . . .130
5.7.9 System Clock Gating Control 2 Register (SCGC2) . . . . . . . . . . . . . . . . . . . . .131
5.7.10 System Clock Gating Control 3 Register (SCGC3) . . . . . . . . . . . . . . . . . . . . .132
5.7.11 System Options 3 Register (SOPT3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132
5.7.12 System Options 4 Register (SOPT4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133
5.7.13 System Options 5 Register (SOPT5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133
5.7.14 SIM Internal Peripheral Select Register (SIMIPS) . . . . . . . . . . . . . . . . . . . . . .134
5.7.15 Flash Protection Defeat Register (FPROTD) . . . . . . . . . . . . . . . . . . . . . . . . . .135
5.7.16 Signature Register (Signature) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135
5.7.17 System Power Management Status and Control 1 Register (SPMSC1) . . . . .135
5.7.18 System Power Management Status and Control 2 Register (SPMSC2) . . . . .136
5.7.19 System Power Management Status and Control 3 Register (SPMSC3) . . . . .138
Chapter 6
Parallel Input/Output
6.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141
6.2 Port Data and Data Direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141
6.3 Pin Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142
6.3.1 Internal Pull-up Enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143
6.3.2 Output Slew Rate Control Enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143
6.3.3 Output Drive Strength Select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143
6.4 Pin Behavior in Stop Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143
6.5 Parallel I/O and Pin Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143
6.5.1 Port A I/O Registers (PTAD and PTADD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144
6.5.2 Port A Pin Control Registers (PTAPE, PTASE, PTADS) . . . . . . . . . . . . . . . . . .144
6.5.2.1 Port A Input Filter Enable Register (PTAIFE) . . . . . . . . . . . . . . . . . .146
6.5.3 Port B Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .146
6.5.4 Port B I/O Registers (PTBD and PTBDD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .146
6.5.5 Port B Pin Control Registers (PTBPE, PTBSE, PTBDS) . . . . . . . . . . . . . . . . .147
MC9S08JE128 Series Reference Manual, Rev. 3
Freescale Semiconductor 11
6.5.5.1 Port B Input Filter Enable Register (PTBIFE) . . . . . . . . . . . . . . . . . .148
6.5.6 Port C Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .149
6.5.7 Port C I/O Registers (PTCD and PTCDD) . . . . . . . . . . . . . . . . . . . . . . . . . . . .149
6.5.8 Port C Pin Control Registers (PTCPE, PTCSE, PTCDS) . . . . . . . . . . . . . . . . .150
6.5.8.1 Port C Input Filter Enable Register (PTCIFE) . . . . . . . . . . . . . . . . . .151
6.5.9 Port D Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151
6.5.10 Port D I/O Registers (PTDD and PTDDD) . . . . . . . . . . . . . . . . . . . . . . . . . . . .151
6.5.11 Port D Pin Control Registers (PTDPE, PTDSE, PTDDS) . . . . . . . . . . . . . . . . .152
6.5.11.1 Port D Input Filter Enable Register (PTDIFE) . . . . . . . . . . . . . . . . . .154
6.5.12 Port E Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154
6.5.13 Port E I/O Registers (PTED and PTEDD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154
6.5.14 Port E Pin Control Registers (PTEPE, PTESE, PTEDS) . . . . . . . . . . . . . . . . .155
6.5.14.1 Port E Input Filter Enable Register (PTEIFE) . . . . . . . . . . . . . . . . . .157
6.5.15 Port F Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .157
6.5.16 Port F I/O Registers (PTFD and PTFDD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .157
6.5.17 Port F Pin Control Registers (PTFPE, PTFSE, PTFDS) . . . . . . . . . . . . . . . . . .158
6.5.17.1 Port F Input Filter Enable Register (PTFIFE) . . . . . . . . . . . . . . . . . .160
6.5.18 Port G Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160
6.5.19 Port G I/O Registers (PTGD and PTGDD) . . . . . . . . . . . . . . . . . . . . . . . . . . . .160
6.5.20 Port G Pin Control Registers (PTGPE, PTGSE, PTGDS) . . . . . . . . . . . . . . . .161
6.5.20.1 Port G Input Filter Enable Register (PTGIFE) . . . . . . . . . . . . . . . . .162
Chapter 7
Keyboard Interrupt
7.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163
7.1.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163
7.1.2 Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163
7.1.2.1 KBI in Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163
7.1.2.2 KBI in Stop Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163
7.1.2.3 KBI in Active Background Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . .163
7.1.3 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164
7.2 External Signal Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164
7.3 Register Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164
7.3.1 KBIx Status and Control Register (KBIxSC) . . . . . . . . . . . . . . . . . . . . . . . . . . .164
7.3.2 KBIx Pin Enable Register (KBIxPE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
7.3.3 KBIx Edge Select Register (KBIxES) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
7.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166
7.4.1 Edge Only Sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166
7.4.2 Edge and Level Sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166
7.4.3 KBI Pullup/Pulldown Resistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
7.4.4 KBI Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
Chapter 8
Central Processor Unit (S08CPUV5)
8.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .169
MC9S08JE128 Series Reference Manual, Rev. 3
12 Freescale Semiconductor
8.1.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .169
8.2 Programmer’s Model and CPU Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170
8.2.1 Accumulator (A) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170
8.2.2 Index Register (H:X) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170
8.2.3 Stack Pointer (SP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .171
8.2.4 Program Counter (PC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .171
8.2.5 Condition Code Register (CCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .171
8.3 Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173
8.3.1 Inherent Addressing Mode (INH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173
8.3.2 Relative Addressing Mode (REL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173
8.3.3 Immediate Addressing Mode (IMM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173
8.3.4 Direct Addressing Mode (DIR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173
8.3.5 Extended Addressing Mode (EXT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174
8.3.6 Indexed Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174
8.3.6.1 Indexed, No Offset (IX) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174
8.3.6.2 Indexed, No Offset with Post Increment (IX+) . . . . . . . . . . . . . . . . .174
8.3.6.3 Indexed, 8-Bit Offset (IX1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174
8.3.6.4 Indexed, 8-Bit Offset with Post Increment (IX1+) . . . . . . . . . . . . . . .174
8.3.6.5 Indexed, 16-Bit Offset (IX2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174
8.3.6.6 SP-Relative, 8-Bit Offset (SP1) . . . . . . . . . . . . . . . . . . . . . . . . . . . .174
8.3.6.7 SP-Relative, 16-Bit Offset (SP2) . . . . . . . . . . . . . . . . . . . . . . . . . . .175
8.4 Special Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175
8.4.1 Reset Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175
8.4.2 Interrupt Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175
8.4.3 Wait Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .176
8.4.4 Stop Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .176
8.4.5 BGND Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177
8.5 HCS08 Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .178
Chapter 9
Programmable Analog Comparator (S08PRACMPV1)
9.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189
9.1.1 PRACMP Configuration Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189
9.1.2 PRACMP/TPM Configuration Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189
9.1.3 PRACMP Clock Gating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189
9.1.4 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191
9.1.5 Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191
9.1.5.1 Operation in Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191
9.1.5.2 Operation in Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191
9.1.5.3 Operation in Background Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . .191
9.1.6 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192
9.2 External Signal Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193
9.3 Memory Map and Register Definition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193
9.3.1 PRACMP Control and Status Register (PRACMPCS) . . . . . . . . . . . . . . . . . . .193
9.3.2 PRACMP Control Register 0 (PRACMPC0) . . . . . . . . . . . . . . . . . . . . . . . . . . .194
MC9S08JE128 Series Reference Manual, Rev. 3
Freescale Semiconductor 13
9.3.3 PRACMP Control Register 1 (PRACMPC1) . . . . . . . . . . . . . . . . . . . . . . . . . . .195
9.3.4 PRACMP Control Register 2 (PRACMPC2) . . . . . . . . . . . . . . . . . . . . . . . . . . .196
9.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .197
9.5 Setup and Operation of PRACMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .197
9.6 Resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198
9.7 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198
Chapter 10
Analog-to-Digital Converter (S08ADC12V1)
10.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199
10.1.1 ADC Reference Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199
10.1.2 Module Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199
10.1.2.1 Configurations for Stop Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199
10.1.2.2 Single-Ended Channel Assignments . . . . . . . . . . . . . . . . . . . . . . . .199
10.1.2.3 Alternate Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200
10.1.2.4 Hardware Trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200
10.1.2.5 Temperature Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .201
10.1.3 ADC Clock Gating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .203
10.1.4 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .204
10.1.5 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .204
10.2 External Signal Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205
10.2.1 Analog Power (V
DDAD
) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206
10.2.2 Analog Ground (V
SSAD
) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206
10.2.3 Voltage Reference High (V
REFH
) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206
10.2.4 Voltage Reference Low (V
REFL
) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206
10.2.5 Analog Channel Inputs (ADx) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206
10.3 Register Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206
10.3.1 Status and Control Register 1 (ADCSC1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207
10.3.2 Configuration Register 1(ADCCFG1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208
10.3.3 Configuration Register 2 (ADCCFG2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209
10.3.4 Data Result Registers (ADCRH:ADCRL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210
10.3.5 Compare Value High Register (ADCCVH) . . . . . . . . . . . . . . . . . . . . . . . . . . . .211
10.3.6 Compare Value Low Register (ADCCVL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .211
10.3.7 Status and Control Register 2 (ADCSC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212
10.3.8 Status and Control Register 3 (ADCSC3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .213
10.3.9 ADC Offset Correction Register (ADCOFSH:ADCOFSL) . . . . . . . . . . . . . . . . .213
10.3.10ADC Plus-Side Gain Register (ADCPGH:ADCPGL) . . . . . . . . . . . . . . . . . . . .214
10.3.11ADC Minus-Side Gain Register (ADCMGH:ADCMGL) . . . . . . . . . . . . . . . . . .214
10.3.12ADC Plus-Side General Calibration Value Registers (ADCCLPx) . . . . . . . . . .215
10.3.13ADC Minus-Side General Calibration Value Registers (ADCCLMx) . . . . . . . .217
10.3.14Pin Control 1 Register (APCTL1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .219
10.3.15Pin Control 2 Register (APCTL2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .220
10.3.16Pin Control 3 Register (APCTL3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .221
10.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .221
10.4.1 Clock Select and Divide Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .222
MC9S08JE128 Series Reference Manual, Rev. 3
14 Freescale Semiconductor
10.4.2 Input Select and Pin Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .222
10.4.3 Hardware Trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223
10.4.4 Conversion Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223
10.4.4.1 Initiating Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223
10.4.4.2 Completing Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223
10.4.4.3 Aborting Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224
10.4.4.4 Power Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224
10.4.4.5 Sample Time and Total Conversion Time . . . . . . . . . . . . . . . . . . . .224
10.4.4.6 Conversion Time Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .226
10.4.4.6.1Typical conversion time configuration. . . . . . . . . . . . . . . . . . .226
10.4.5 Automatic Compare Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .227
10.4.6 Calibration Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .228
10.4.7 User-Defined Offset Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .229
10.4.8 Temperature Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .229
10.4.9 MCU Wait Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .230
10.4.10MCU Stop3 Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .230
10.4.10.1 Stop3 Mode With ADACK Disabled . . . . . . . . . . . . . . . . . . . . . . . . .230
10.4.10.2 Stop3 Mode With ADACK Enabled . . . . . . . . . . . . . . . . . . . . . . . . .231
10.4.11MCU Stop2 Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .231
10.5 Initialization Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .231
10.5.1 ADC Module Initialization Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .232
10.5.1.1 Initialization Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .232
10.5.1.2 Pseudo-Code Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .232
10.6 Application Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233
10.6.1 External Pins and Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234
10.6.1.1 Analog Supply Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234
10.6.1.2 Analog Voltage Reference Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . .234
10.6.1.3 Analog Input Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234
10.6.2 Sources of Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235
10.6.2.1 Sampling Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235
10.6.2.2 Pin Leakage Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235
10.6.2.3 Noise-Induced Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235
10.6.2.4 Code Width and Quantization Error . . . . . . . . . . . . . . . . . . . . . . . . .236
10.6.2.5 Linearity Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .236
10.6.2.6 Code Jitter, Non-Monotonicity, and Missing Codes . . . . . . . . . . . . .237
Chapter 11
Cyclic Redundancy Check (S08CRCV3)
11.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .239
11.1.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241
11.1.2 Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241
11.1.3 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .242
11.2 External Signal Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .242
11.3 Register Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .242
11.3.1 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .242
MC9S08JE128 Series Reference Manual, Rev. 3
Freescale Semiconductor 15
11.3.2 Register Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .243
11.3.2.1 CRC High Register (CRCH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .243
11.3.2.2 CRC Low Register (CRCL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .244
11.3.2.3 Transpose Register (TRANSPOSE) . . . . . . . . . . . . . . . . . . . . . . . . .244
11.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .245
11.4.1 ITU-T (CCITT) Recommendations and Expected CRC Results . . . . . . . . . . . .245
11.4.2 Programming model extension for CF1Core . . . . . . . . . . . . . . . . . . . . . . . . . .246
11.4.3 Transpose feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247
11.5 Initialization Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248
Chapter 12
Carrier Modulator Timer (S08CMTV1)
12.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249
12.2 Clock Selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249
12.3 IRO Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249
12.4 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251
12.5 CMT Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251
12.6 External Signal Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251
12.7 Register Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252
12.7.1 Carrier Generator Data Registers (CMTCGH1, CMTCGL1, CMTCGH2, and
CMTCGL2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252
12.7.2 CMT Output Control Register (CMTOC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .253
12.7.3 CMT Modulator Status and Control Register . . . . . . . . . . . . . . . . . . . . . . . . . .254
12.7.4 CMT Modulator Data Registers (CMTCMD1, CMTCMD2, CMTCMD3 and
CMTCMD4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .256
12.8 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .256
12.8.1 Carrier Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .258
12.8.2 Modulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .260
12.8.2.1 Time Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .261
12.8.2.2 Baseband Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .262
12.8.2.3 FSK Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .262
12.8.2.4 Extended Space Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .263
12.8.2.4.1EXSPC Operation in Time Mode . . . . . . . . . . . . . . . . . . . . . .263
12.8.2.4.2EXSPC Operation in FSK Mode. . . . . . . . . . . . . . . . . . . . . . .264
12.8.3 Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .264
12.8.4 CMT Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .264
12.8.5 Low-Power Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .265
12.8.5.1 Wait Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .265
12.8.5.2 Stop3 Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .265
12.8.5.3 Stop2 Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .265
12.8.5.4 Background Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .266
Chapter 13
12-Bit Digital-to-Analog Converter (DAC12LVLPV1)
13.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .267
MC9S08JE128 Series Reference Manual, Rev. 3
16 Freescale Semiconductor
13.1.1 DAC Clock Gating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .267
13.1.2 DAC V
ext
and V
int
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .267
13.1.3 DAC Hardware Trigger Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .267
13.1.4 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269
13.1.5 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269
13.2 Register Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .270
13.2.1 DAC Data Register x (DACDATxH:DACDATxL) . . . . . . . . . . . . . . . . . . . . . . . .271
13.2.2 DAC Status Register (DACS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .271
13.2.3 DAC Control Register (DACC0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .272
13.2.4 DAC Control Register1 (DACC1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .273
13.2.5 DAC Control Register 2 (DACC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .274
13.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .274
13.3.1 DAC Data Buffer Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .274
13.3.1.1 Buffer Normal Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .274
13.3.1.2 Buffer Swing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275
13.3.1.3 Buffer One-time Scan Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275
13.3.2 Resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275
13.3.3 Low Power Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275
13.3.3.1 Wait Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275
13.3.3.2 Stop Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275
13.3.4 Background Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275
Chapter 14
Inter-Integrated Circuit (S08IICV3)
14.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .277
14.1.1 Module Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .277
14.1.2 IIC Clock Gating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .277
14.1.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279
14.1.4 Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279
14.1.5 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280
14.2 External Signal Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280
14.2.1 SCL — Serial Clock Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280
14.2.2 SDA — Serial Data Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280
14.3 Register Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281
14.3.1 Module Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281
14.3.2 IIC Address Register 1 (IICA1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281
14.3.3 IIC Frequency Divider Register (IICF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .282
14.3.4 IIC Control Register (IICC1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .285
14.3.5 IIC Status Register (IICS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .286
14.3.6 IIC Data I/O Register (IICD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287
14.3.7 IIC Control Register 2 (IICC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .289
14.3.8 IIC SMBus Control and Status Register (IICSMB) . . . . . . . . . . . . . . . . . . . . . .290
14.3.9 IIC Address Register 2 (IICA2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291
14.3.10IIC SCL Low Time Out Register High (IICSLTH) . . . . . . . . . . . . . . . . . . . . . . .291
14.3.11IIC SCL LowTime Out register Low (IICSLTL) . . . . . . . . . . . . . . . . . . . . . . . . .291
MC9S08JE128 Series Reference Manual, Rev. 3
Freescale Semiconductor 17
14.3.12IIC Programmable Input Glitch Filter (IICFLT) . . . . . . . . . . . . . . . . . . . . . . . . .292
14.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .293
14.4.1 IIC Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .293
14.4.1.1 START Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .294
14.4.1.2 Slave Address Transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .294
14.4.1.3 Data Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .294
14.4.1.4 STOP Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .295
14.4.1.5 Repeated START Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .295
14.4.1.6 Arbitration Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .295
14.4.1.7 Clock Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .295
14.4.1.8 Handshaking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .296
14.4.1.9 Clock Stretching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .296
14.4.2 10-bit Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .297
14.4.2.1 Master-Transmitter Addresses a Slave-Receiver . . . . . . . . . . . . . . .297
14.4.2.2 Master-Receiver Addresses a Slave-Transmitter . . . . . . . . . . . . . . .297
14.4.3 Address Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .298
14.4.4 System Management Bus Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .298
14.4.4.1 Timeouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .298
14.4.4.1.1SCL Low Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .298
14.4.4.1.2SCL High (SMBus Free) Timeout. . . . . . . . . . . . . . . . . . . . . .299
14.4.4.1.3CSMBCLK TIMEOUT MEXT . . . . . . . . . . . . . . . . . . . . . . . . .299
14.4.4.1.4CSMBCLK TIMEOUT SEXT. . . . . . . . . . . . . . . . . . . . . . . . . .299
14.4.4.2 FAST ACK and NACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .300
14.5 Resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .300
14.6 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .300
14.6.1 Byte Transfer Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .301
14.6.2 Address Detect Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .301
14.6.3 Arbitration Lost Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .301
14.6.4 Timeouts Interrupt in SMbus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .301
14.6.5 Programmable input glitch filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .302
14.7 Initialization/Application Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .303
14.8 SMBALERT# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .306
Chapter 15
Multipurpose Clock Generator (S08MCGV3)
15.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .307
15.1.1 Clock Check & Select Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .309
15.1.2 Clock Check & Select Control (CCSCTRL) . . . . . . . . . . . . . . . . . . . . . . . . . . .310
15.1.3 CSS XOSC1 Timer Register (CCSTMR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . .310
15.1.4 CSS XOSC2 Timer Register (CCSTMR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . .311
15.1.5 CSS Internal Reference Clock Timer Register (CCSTMRIR) . . . . . . . . . . . . . .311
15.1.6 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .312
15.1.7 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .312
15.1.8 Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .314
15.2 External Signal Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .314
MC9S08JE128 Series Reference Manual, Rev. 3
18 Freescale Semiconductor
15.3 Register Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .314
15.3.1 MCG Control Register 1 (MCGC1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .314
15.3.2 MCG Control Register 2 (MCGC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .316
15.3.3 MCG Trim Register (MCGTRM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .317
15.3.4 MCG Status and Control Register (MCGSC) . . . . . . . . . . . . . . . . . . . . . . . . . .318
15.3.5 MCG Control Register 3 (MCGC3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .319
15.3.6 MCG Control Register 4 (MCGC4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .320
15.3.7 MCG Test Register (MCGT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .321
15.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .322
15.4.1 MCG Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .322
15.4.2 MCG Mode State Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .324
15.4.3 Mode Switching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .324
15.4.4 Bus Frequency Divider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325
15.4.5 Low Power Bit Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325
15.4.6 Internal Reference Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325
15.4.7 External Reference Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325
15.4.8 Fixed Frequency Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .326
15.5 Initialization / Application Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .327
15.5.1 MCG Module Initialization Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .327
15.5.1.1 Initializing the MCG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .327
15.5.2 Using a 32.768 kHz Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .329
15.5.3 MCG Mode Switching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .329
15.5.3.1 Example 1: Moving from FEI to PEE Mode: External Crystal = 8 MHz,
Bus Frequency = 16 MHz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .330
15.5.3.2 Example 2: Moving from PEE to BLPI Mode:
Bus Frequency =16 kHz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .334
15.5.3.3 Example 3: Moving from BLPI to FEE Mode: External Crystal = 8 MHz,
Bus Frequency = 16 MHz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .337
15.5.4 Calibrating the Internal Reference Clock (IRC) . . . . . . . . . . . . . . . . . . . . . . . .338
15.5.4.1 Example 4: Internal Reference Clock Trim . . . . . . . . . . . . . . . . . . . .339
Chapter 16
Programmable Delay Block (S08PDBV1)
16.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .341
16.1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .341
16.1.2 PDB Trigger inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .341
16.2 ADC Hardware Triggers and Selects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .342
16.2.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .344
16.2.2 Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .344
16.2.3 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .345
16.3 Memory Map and Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .349
16.3.1 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .349
16.3.2 Registers Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .349
16.3.2.1 PDB Status and Control Register (PDBSC) . . . . . . . . . . . . . . . . . . .349
16.3.2.2 PDB Control Register 1 (PDBC1) . . . . . . . . . . . . . . . . . . . . . . . . . . .351
MC9S08JE128 Series Reference Manual, Rev. 3
Freescale Semiconductor 19
16.3.2.3 PDB Control Register 2 (PDBC2) . . . . . . . . . . . . . . . . . . . . . . . . . . .352
16.3.2.4 PDB Channel Enable Register (PDBCHEN) . . . . . . . . . . . . . . . . . .353
16.3.2.5 PDB Modulus Registers (PDBMODH:PDBMODL) . . . . . . . . . . . . . .353
16.3.2.6 PDB Counter Registers (PDBCNTH:PDBCNTL) . . . . . . . . . . . . . . .354
16.3.2.7 PDB Interrupt Delay Register (PDBIDLYH:PDBIDLYL) . . . . . . . . . .354
16.3.2.8 DAC Interval Registers (DACINTH:DACINTL) . . . . . . . . . . . . . . . . .354
16.3.2.9 PDB Delay Registers (PDBDLYH:PDBDLYL) . . . . . . . . . . . . . . . . .355
16.3.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .355
16.3.3.1 Impact of Using the Prescaler on Timing Resolution . . . . . . . . . . . .355
16.4 Resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .356
16.5 Clocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .356
16.6 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .356
Chapter 17
Serial Communications Interface (S08SCIV4)
17.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .357
17.1.1 SCIx Clock Gating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .357
17.1.2 Module Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .357
17.1.3 Module Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .358
17.1.4 Interfacing the SCIs to Off-Chip Opto-Isolators . . . . . . . . . . . . . . . . . . . . . . . .360
17.1.5 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .360
17.1.6 Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .361
17.1.7 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .362
17.2 Register Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .364
17.2.1 SCI Baud Rate Registers (SCIxBDH, SCIxBDL) . . . . . . . . . . . . . . . . . . . . . . .364
17.2.2 SCI Control Register 1 (SCIxC1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .365
17.2.3 SCI Control Register 2 (SCIxC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .366
17.2.4 SCI Status Register 1 (SCIxS1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .367
17.2.5 SCI Status Register 2 (SCIxS2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .369
17.2.6 SCI Control Register 3 (SCIxC3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .370
17.2.7 SCI Data Register (SCIxD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .371
17.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .371
17.3.1 Baud Rate Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .371
17.3.2 Transmitter Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .372
17.3.2.1 Send Break and Queued Idle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .373
17.3.3 Receiver Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .373
17.3.3.1 Data Sampling Technique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .374
17.3.3.2 Receiver Wakeup Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .374
17.3.3.2.1Idle-Line Wakeup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .375
17.3.3.2.2Address-Mark Wakeup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .375
17.3.4 Interrupts and Status Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .375
17.3.5 Additional SCI Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .376
17.3.5.1 8- and 9-Bit Data Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .376
17.3.5.2 Stop Mode Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .376
17.3.5.3 Loop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .377
MC9S08JE128 Series Reference Manual, Rev. 3
20 Freescale Semiconductor
17.3.5.4 Single-Wire Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .377
Chapter 18
16-bit Serial Peripheral Interface 1 (S08SPI16V2)
18.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .379
18.1.1 SPI1 Clock Gating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .379
18.1.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .381
18.1.3 Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .381
18.1.4 Block Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .382
18.1.4.1 SPI System Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .382
18.1.4.2 SPI Module Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .382
18.2 External Signal Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .384
18.2.1 SPSCK — SPI Serial Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .384
18.2.2 MOSI — Master Data Out, Slave Data In . . . . . . . . . . . . . . . . . . . . . . . . . . . . .384
18.2.3 MISO — Master Data In, Slave Data Out . . . . . . . . . . . . . . . . . . . . . . . . . . . . .384
18.2.4 SS — Slave Select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .384
18.3 Register Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .384
18.3.1 SPI Control Register 1 (SPIxC1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .385
18.3.2 SPI Control Register 2 (SPIxC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .386
18.3.3 SPI Baud Rate Register (SPIxBR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .388
18.3.4 SPI Status Register (SPIxS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .389
18.3.5 SPI Data Registers (SPIxDH:SPIxDL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .392
18.3.6 SPI Match Registers (SPIxMH:SPIxML) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .393
18.3.7 SPI Control Register 3 (SPIxC3) — enable FIFO feature . . . . . . . . . . . . . . . . .393
18.3.8 SPI Clear Interrupt Register (SPIxCI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .395
18.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .396
18.4.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .396
18.4.2 Master Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .396
18.4.3 Slave Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .397
18.4.4 SPI FIFO MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .399
18.4.5 Data Transmission Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .400
18.4.6 SPI Clock Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .400
18.4.7 SPI Baud Rate Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .402
18.4.8 Special Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .403
18.4.8.1 SS Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .403
18.4.8.2 Bidirectional Mode (MOMI or SISO) . . . . . . . . . . . . . . . . . . . . . . . . .403
18.4.9 Error Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .404
18.4.9.1 Mode Fault Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .404
18.4.10Low-power Mode Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .405
18.4.10.1 SPI in Run Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .405
18.4.10.2 SPI in Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .405
18.4.10.3 SPI in Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .406
18.4.10.4 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .406
18.4.10.5 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .406
18.4.11SPI Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .406
MC9S08JE128 Series Reference Manual, Rev. 3
/