MC68HC908GT8CFB Datasheetz
MC68HC908GT8CFB Datasheetz
MC68HC908GT8
MC68HC08GT16
Data Sheet
M68HC08
Microcontrollers
MC68HC908GT16
Rev. 5.0
04/2007
freescale.com
MC68HC908GT16
MC68HC908GT8
MC68HC08GT16
Data Sheet
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
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.
This product incorporates SuperFlash® technology licensed from SST.
© Freescale Semiconductor, Inc., 2007. All rights reserved.
Freescale Semiconductor 3
Revision History
The following revision history table summarizes changes contained in this document. For your
convenience, the page number designators have been linked to the appropriate location.
4 Freescale Semiconductor
Revision History
Freescale Semiconductor 5
Revision History
6 Freescale Semiconductor
List of Chapters
Chapter 2 Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Freescale Semiconductor 7
List of Chapters
8 Freescale Semiconductor
Table of Contents
Chapter 1
General Description
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.2.1 Standard Features of the MC68HC908GT16/MC68HC908GT8 . . . . . . . . . . . . . . . . . . . . . 21
1.2.2 Features of the CPU08 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.3 MCU Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.4 Pin Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.5 Pin Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.5.1 Power Supply Pins (VDD and VSS). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.5.2 Oscillator Pins (PTE4/OSC1 and PTE3/OSC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.5.3 External Reset Pin (RST). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.5.4 External Interrupt Pin (IRQ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.5.5 ADC and ICG Power Supply Pins (VDDA and VSSA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.5.6 ADC Reference Pins (VREFH and VREFL). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.5.7 Port A Input/Output (I/O) Pins (PTA7/KBD7–PTA0/KBD0) . . . . . . . . . . . . . . . . . . . . . . . . . 28
1.5.8 Port B I/O Pins (PTB7/AD7–PTB0/AD0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
1.5.9 Port C I/O Pins (PTC6–PTC0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
1.5.10 Port D I/O Pins (PTD7/T2CH1–PTD0/SS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
1.5.11 Port E I/O Pins (PTE4–PTE2, PTE1/RxD, and PTE0/TxD) . . . . . . . . . . . . . . . . . . . . . . . . . 28
Chapter 2
Memory
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.2 Unimplemented Memory Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.3 Reserved Memory Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.4 Input/Output (I/O) Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.5 Random-Access Memory (RAM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.6 Flash Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.6.1 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.6.2 Flash Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.6.3 Flash Page Erase Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.6.4 Flash Mass Erase Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.6.5 Flash Program/Read Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
2.6.6 Flash Block Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2.6.7 Flash Block Protect Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2.6.8 ICG User Trim Registers (ICGTR5 and ICGTR3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.6.9 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.6.10 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Freescale Semiconductor 9
Table of Contents
Chapter 3
Analog-to-Digital Converter (ADC)
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3.1 ADC Port I/O Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3.2 ADC Port I/O Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.3.3 Voltage Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.3.4 Conversion Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.3.5 Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.3.6 Accuracy and Precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.4 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.5 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.5.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.5.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.6 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.6.1 ADC Analog Power Pin (VDDA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.6.2 ADC Analog Ground Pin (VSSA). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.6.3 ADC Voltage Reference High Pin (VREFH). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.6.4 ADC Voltage Reference Low Pin (VREFL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.6.5 ADC Voltage In (VADIN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.7 I/O Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.7.1 ADC Status and Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.7.2 ADC Data Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.7.3 ADC Clock Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Chapter 4
Configuration Register (CONFIG)
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
4.2 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Chapter 5
Computer Operating Properly (COP) Module
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.2 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.3 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.3.1 COPCLK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.3.2 STOP Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.3.3 COPCTL Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.3.4 Power-On Reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.3.5 Internal Reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.3.6 Reset Vector Fetch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.3.7 COPD (COP Disable). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.3.8 COPRS (COP Rate Select) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.4 COP Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.5 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
10 Freescale Semiconductor
5.6 Monitor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.7 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.7.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.7.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.8 COP Module During Break Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Chapter 6
Central Processor Unit (CPU)
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.3 CPU Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.3.1 Accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
6.3.2 Index Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
6.3.3 Stack Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.3.4 Program Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.3.5 Condition Code Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.4 Arithmetic/Logic Unit (ALU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.5 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.5.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.5.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.6 CPU During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.7 Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.8 Opcode Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Chapter 7
Internal Clock Generator (ICG) Module)
7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.3.1 Clock Enable Circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
7.3.2 Internal Clock Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
7.3.2.1 Digitally Controlled Oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
7.3.2.2 Modulo N Divider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
7.3.2.3 Frequency Comparator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
7.3.2.4 Digital Loop Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
7.3.3 External Clock Generator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
7.3.3.1 External Oscillator Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
7.3.3.2 External Clock Input Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
7.3.4 Clock Monitor Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
7.3.4.1 Clock Monitor Reference Generator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
7.3.4.2 Internal Clock Activity Detector. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
7.3.4.3 External Clock Activity Detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
7.3.5 Clock Selection Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
7.3.5.1 Clock Selection Switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
7.3.5.2 Clock Switching Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Freescale Semiconductor 11
Table of Contents
Chapter 8
External Interrupt (IRQ)
8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
8.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
8.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
8.4 IRQ Pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
8.5 IRQ Module During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
8.6 IRQ Status and Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Chapter 9
Keyboard Interrupt Module (KBI)
9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
9.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
9.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
9.4 Keyboard Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
12 Freescale Semiconductor
9.5 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
9.5.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
9.5.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
9.6 Keyboard Module During Break Interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
9.7 I/O Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
9.7.1 Keyboard Status and Control Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
9.7.2 Keyboard Interrupt Enable Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Chapter 10
Low-Voltage Inhibit (LVI)
10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
10.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
10.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
10.3.1 Polled LVI Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
10.3.2 Forced Reset Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
10.3.3 Voltage Hysteresis Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
10.3.4 LVI Trip Selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
10.4 LVI Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
10.5 LVI Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
10.6 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
10.6.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
10.6.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Chapter 11
Low-Power Modes (MODES)
11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
11.1.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
11.1.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
11.2 Analog-to-Digital Converter (ADC). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
11.2.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
11.2.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
11.3 Break Module (BRK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
11.3.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
11.3.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
11.4 Central Processor Unit (CPU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
11.4.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
11.4.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
11.5 Internal Clock Generator Module (ICG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
11.5.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
11.5.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
11.6 Computer Operating Properly Module (COP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
11.6.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
11.6.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
11.7 External Interrupt Module (IRQ). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
11.7.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
11.7.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Freescale Semiconductor 13
Table of Contents
Chapter 12
Input/Output (I/O) Ports (PORTS)
12.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
12.2 Port A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
12.2.1 Port A Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
12.2.2 Data Direction Register A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
12.2.3 Port A Input Pullup Enable Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
12.3 Port B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
12.3.1 Port B Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
12.3.2 Data Direction Register B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
12.4 Port C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
12.4.1 Port C Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.4.2 Data Direction Register C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.4.3 Port C Input Pullup Enable Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
12.5 Port D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
12.5.1 Port D Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
12.5.2 Data Direction Register D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
12.5.3 Port D Input Pullup Enable Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
12.6 Port E . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
12.6.1 Port E Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
12.6.2 Data Direction Register E . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
14 Freescale Semiconductor
Chapter 13
Resets and Interrupts
13.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
13.2 Resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
13.2.1 Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
13.2.2 External Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
13.2.3 Internal Reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
13.2.3.1 Power-On Reset (POR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
13.2.3.2 Computer Operating Properly (COP) Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
13.2.3.3 Low-Voltage Inhibit Reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
13.2.3.4 Illegal Opcode Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
13.2.3.5 Illegal Address Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
13.2.4 SIM Reset Status Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
13.3 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
13.3.1 Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
13.3.2 Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
13.3.2.1 Software Interrupt (SWI) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
13.3.2.2 Break Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
13.3.2.3 IRQ Pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
13.3.2.4 Internal Clock Generator (ICG). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
13.3.2.5 Timer Interface Module 1 (TIM1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
13.3.2.6 Timer Interface Module 2 (TIM2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
13.3.2.7 Serial Peripheral Interface (SPI). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
13.3.2.8 Serial Communications Interface (SCI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
13.3.2.9 KBD0–KBD7 Pins. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
13.3.2.10 Analog-to-Digital Converter (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
13.3.2.11 Timebase Module (TBM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
13.3.3 Interrupt Status Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
13.3.3.1 Interrupt Status Register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
13.3.3.2 Interrupt Status Register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
13.3.3.3 Interrupt Status Register 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Chapter 14
Enhanced Serial Communications Interface (ESCI) Module
14.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
14.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
14.3 Pin Name Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
14.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
14.4.1 Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
14.4.2 Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
14.4.2.1 Character Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
14.4.2.2 Character Transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
14.4.2.3 Break Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
14.4.2.4 Idle Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
14.4.2.5 Inversion of Transmitted Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
14.4.2.6 Transmitter Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Freescale Semiconductor 15
Table of Contents
Chapter 15
System Integration Module (SIM)
15.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
15.2 SIM Bus Clock Control and Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
15.2.1 Bus Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
15.2.2 Clock Startup from POR or LVI Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
15.2.3 Clocks in Stop Mode and Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
15.3 Reset and System Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
15.3.1 External Pin Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
15.3.2 Active Resets from Internal Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
15.3.2.1 Power-On Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
15.3.2.2 Computer Operating Properly (COP) Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
15.3.2.3 Illegal Opcode Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
15.3.2.4 Illegal Address Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
15.3.2.5 Low-Voltage Inhibit (LVI) Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
15.3.2.6 Monitor Mode Entry Module Reset (MODRST) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
16 Freescale Semiconductor
15.4 SIM Counter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
15.4.1 SIM Counter During Power-On Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
15.4.2 SIM Counter During Stop Mode Recovery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
15.4.3 SIM Counter and Reset States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
15.5 Exception Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
15.5.1 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
15.5.1.1 Hardware Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
15.5.1.2 SWI Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
15.5.1.3 Interrupt Status Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
15.5.2 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
15.5.3 Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
15.5.4 Status Flag Protection in Break Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
15.6 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
15.6.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
15.6.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
15.7 SIM Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
15.7.1 SIM Break Status Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
15.7.2 SIM Reset Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
15.7.3 SIM Break Flag Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Chapter 16
Serial Peripheral Interface (SPI) Module
16.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
16.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
16.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
16.3.1 Master Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
16.3.2 Slave Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
16.4 Transmission Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
16.4.1 Clock Phase and Polarity Controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
16.4.2 Transmission Format When CPHA = 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
16.4.3 Transmission Format When CPHA = 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
16.4.4 Transmission Initiation Latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
16.5 Queuing Transmission Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
16.6 Error Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
16.6.1 Overflow Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
16.6.2 Mode Fault Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
16.7 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
16.8 Resetting the SPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
16.9 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
16.9.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
16.9.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
16.10 SPI During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
16.11 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
16.11.1 MISO (Master In/Slave Out). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
16.11.2 MOSI (Master Out/Slave In). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
16.11.3 SPSCK (Serial Clock) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
16.11.4 SS (Slave Select) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Freescale Semiconductor 17
Table of Contents
Chapter 17
Timebase Module (TBM)
17.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
17.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
17.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
17.4 Timebase Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
17.5 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
17.6 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
17.6.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
17.6.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Chapter 18
Timer Interface Module (TIM)
18.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
18.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
18.3 Pin Name Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
18.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
18.4.1 TIM Counter Prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
18.4.2 Input Capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
18.4.3 Output Compare. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
18.4.3.1 Unbuffered Output Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
18.4.3.2 Buffered Output Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
18.4.4 Pulse Width Modulation (PWM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
18.4.4.1 Unbuffered PWM Signal Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
18.4.4.2 Buffered PWM Signal Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
18.4.4.3 PWM Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
18.5 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
18.6 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
18.6.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
18.6.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
18.7 TIM During Break Interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
18.8 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
18.9 I/O Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
18.9.1 TIM Status and Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
18.9.2 TIM Counter Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
18.9.3 TIM Counter Modulo Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
18.9.4 TIM Channel Status and Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
18.9.5 TIM Channel Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
18 Freescale Semiconductor
Chapter 19
Development Support
19.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
19.2 Break Module (BRK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
19.2.1 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
19.2.1.1 Flag Protection During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
19.2.1.2 TIM1 and TIM2 During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
19.2.1.3 COP During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
19.2.2 Break Module Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
19.2.2.1 Break Status and Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
19.2.2.2 Break Address Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
19.2.2.3 SIM Break Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
19.2.2.4 Break Flag Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
19.3 Monitor Module (MON) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
19.3.1 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
19.3.1.1 Normal Monitor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
19.3.1.2 Forced Monitor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
19.3.1.3 Monitor Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
19.3.1.4 Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
19.3.1.5 Break Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
19.3.1.6 Baud Rate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
19.3.1.7 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
19.3.2 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Chapter 20
Electrical Specifications
20.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
20.2 Absolute Maximum Ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
20.3 Functional Operating Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
20.4 Thermal Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
20.5 5.0-V DC Electrical Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
20.6 3.0-V DC Electrical Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
20.7 Supply Current Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
20.8 5-V Control Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
20.9 3-V Control Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
20.10 Internal Oscillator Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
20.11 External Oscillator Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
20.12 Trimmed Accuracy of the Internal Clock Generator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
20.12.1 2.7-Volt to 3.3-Volt Trimmed Internal Clock Generator Characteristics . . . . . . . . . . . . . . . 262
20.12.2 4.5-Volt to 5.5-Volt Trimmed Internal Clock Generator Characteristics . . . . . . . . . . . . . . . 262
20.13 Output High-Voltage Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
20.14 Output Low-Voltage Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
20.15 Typical Supply Currents. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
20.16 ADC Characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
20.17 5.0-V SPI Characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Freescale Semiconductor 19
Table of Contents
Chapter 21
Ordering Information and Mechanical Specifications
21.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
21.2 MC Order Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
21.3 Package Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Appendix A
MC68HC08GT16
A.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
A.2 MCU Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
A.3 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
A.4 Reserved Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
A.5 ICG Trim Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
A.6 Monitor ROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
A.7 ADC Reference Pins (VREFH and VREFL). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
A.8 Electrical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
A.8.1 5.0-V DC Electrical Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
A.8.2 3.0-V DC Electrical Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
A.8.3 Supply Current Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
A.9 ADC Characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
A.9.1 Internal Oscillator Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
A.9.2 Memory Characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
A.10 Order Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
20 Freescale Semiconductor
Chapter 1
General Description
1.1 Introduction
The MC68HC908GT16, MC68HC908GT8, and MC68HC08GT16 are members of the low-cost,
high-performance M68HC08 Family of 8-bit microcontroller units (MCUs). All MCUs in the family use the
enhanced M68HC08 central processor unit (CPU08) and are available with a variety of modules, memory
sizes and types, and package types.
All references to the MC68HC908GT16 in this data book apply equally to the MC68HC908GT8, unless
otherwise stated.
This revision introduces the MC68HC08GT16, the ROM part equivalent to the MC68HC908GT16. The
entire data book applies to this ROM device, with the exceptions outlined in Appendix A MC68HC08GT16.
1.2 Features
For convenience, features have been organized to reflect:
• Standard features of the MC68HC908GT16/MC68HC908GT8
• Features of the CPU08
1. No security feature is absolutely secure. However, Freescale’s strategy is to make reading or copying the Flash difficult for
unauthorized users.
Freescale Semiconductor 21
General Description
22 Freescale Semiconductor
MCU Block Diagram
Freescale Semiconductor 23
General Description
INTERNAL BUS
M68HC08 CPU
PORTA
PTA7/KBD7–
DDRA
CPU ARITHMETIC/LOGIC PROGRAMMABLE TIMEBASE
MODULE PTA0/KBD0(1)
REGISTERS UNIT (ALU)
PTB7/AD7
CONTROL AND STATUS SINGLE BREAKPOINT BREAK
REGISTERS — 64 BYTES MODULE PTB6/AD6
PTB5/AD5
PORTB
PTB4/AD4
DDRB
USER FLASH
DUAL VOLTAGE
MC68HC908GT16 — 15,872 BYTES LOW-VOLTAGE INHIBIT MODULE PTB3/AD3
MC68HC908GT8 — 7,680 BYTES PTB2/AD2
PTB1/AD1
8-BIT KEYBOARD
USER RAM — 512 BYTES INTERRUPT MODULE PTB0/AD0
PTC6(1)
MONITOR ROM — 304 BYTES 2-CHANNEL TIMER INTERFACE PTC5(1)
MODULE 1 PTC4(1)(2)
PORTC
DDRC
FLASH PROGRAMMING ROUTINES
PTC3(1)(2)
ROM — 720 BYTES
2-CHANNEL TIMER INTERFACE PTC2(1)(2)
MODULE 2 PTC1(1)(2)
USER FLASH VECTOR SPACE — 36 BYTES
PTC0(1)(2)
SERIAL COMMUNICATIONS
PTE4/OSC1 INTERFACE MODULE PTD7/T2CH1(1)
INTERNAL CLOCK
GENERATOR MODULE PTD6/T2CH0(1)
PTE3/OSC2
COMPUTER OPERATING PTD5/T1CH1(1)
PTD4/T1CH0(1)
PORTD
PROPERLY MODULE
DDRD
PTD3/SPSCK(1)
SYSTEM INTEGRATION PTD2/MOSI(1)
RST(3) SERIAL PERIPHERAL
MODULE
INTERFACE MODULE PTD1/MISO(1)
PTD0/SS(1)
SINGLE EXTERNAL
IRQ(3)
INTERRUPT MODULE MONITOR MODULE PTE2
PORTE
DDRE
VREFH PTE1/RxD
8-BIT ANALOG-TO-DIGITAL
CONVERTER MODULE MEMORY MAP PTE0/TxD
VREFL
MODULE
POWER-ON RESET
MODULE CONFIGURATION REGISTER 1 SECURITY
MODULE MODULE
VDD
VSS
VDDA POWER CONFIGURATION REGISTER 2
MODULE MONITOR MODE ENTRY
VSSA
MODULE
24 Freescale Semiconductor
Pin Assignments
PTE2 3 40 PTA5/KBD5
PTE3/OSC2 4 39 PTA4/KBD4
PTE4/OSC1 5 38 PTA3/KBD3
RST 6 37 PTA2/KBD2
PTC0 7 36 PTA1/KBD1
PTC1 8 35 PTA0/KBD0
PTC4 11 32 PTB7/AD7
PTE0/TxD 12 31 PTB6/AD6
PTE1/RxD 13 30 PTB5/AD5
IRQ 14 29 PTB4/AD4
PTD0/SS 15 28 PTB3/AD3
PTD1/MISO 16 27 PTB2/AD2
PTD2/MOSI 17 26 PTB1/AD1
PTD3/SPSCK 18 25 PTB0/AD0
VSS 19 24 PTD7/T2CH1
VDD 20 23 PTD6/T2CH0
PTD4/T1CH0 21 22 PTD5/T1CH1
Freescale Semiconductor 25
General Description
PTE4/OSC1
PTE3/OSC2
PTA5/KBD5
PTA4/KBD4
PTA2/KBD2
PTA7/KBD7
PTA6/KBD6
PTA3/KBD3
PTE2
VDDA
VSSA
44
43
42
41
40
39
38
37
36
35
34
RST 1 33 PTA1/KBD1
PTC0 2 32 PTA0/KBD0
PTC1 3 31 VREFL
PTC2 4 30 VREFH
PTC3 5 29 PTB7/AD7
PTC4 6 28 PTB6/AD6
PTC5 7 27 PTB5/AD5
PTC6 8 26 PTB4/AD4
PTE0/TxD 9 25 PTB3/AD3
PTE1/RxD 10 24 PTB2/AD2
IRQ 11 23 PTB1/AD1
12
13
14
15
16
17
18
19
20
21
22
PTD3/SPSCK
PTB0/AD0
PTD0/SS
PTD4/T1CH0
PTD5/T1CH1
PTD6/T2CH0
PTD7/T2CH1
PTD1/MISO
VSS
VDD
PTD2/MOSI
26 Freescale Semiconductor
Pin Functions
MCU
VDD VSS
C1
0.1 μF
C2
VDD
1.5.5 ADC and ICG Power Supply Pins (VDDA and VSSA)
VDDA and VSSA are the power supply pins for the analog-to-digital converter (ADC) and the internal clock
generator (ICG). Connect the VDDA pin to the same voltage potential as VDD, and the VSSA pin to the
same voltage potential as VSS. Decoupling of these pins should be as per the digital supply. See
Chapter 3 Analog-to-Digital Converter (ADC) and Chapter 7 Internal Clock Generator (ICG) Module).
Freescale Semiconductor 27
General Description
28 Freescale Semiconductor
Chapter 2
Memory
2.1 Introduction
The CPU08 can address 64 Kbytes of memory space. The memory map, shown in Figure 2-1, includes:
• User Flash memory:
– MC68HC908GT16 — 15,872 bytes
– MC68HC908GT8 — 7,680 bytes
• 512 bytes of random-access memory (RAM)
• 720 bytes of Flash programming routines read-only memory (ROM)
• 36 bytes of user-defined vectors
• 304 bytes of monitor ROM
Freescale Semiconductor 29
Memory
$0000
I/O REGISTERS
↓
64 BYTES
$003F
$0040
RAM
↓
512 BYTES
$023F
$0240
UNIMPLEMENTED
↓
6416 BYTES
$1B4F
$1B50
FLASH PROGRAMMING ROUTINES ROM
↓
720 BYTES
$1E1F
$1E20
UNIMPLEMENTED
↓
41,440 BYTES
$BFFF
$C000 $C000
RESERVED(1) ↓
FLASH MEMORY $DFFF
↓ MC68HC908GT16
15,872 BYTES FLASH MEMORY $E000
MC68HC908GT8 ↓
$FDFF 7,680 BYTES $FDFF
$FE00 SIM BREAK STATUS REGISTER (SBSR) 1. Inadvertent access to
these locations will not
$FE01 SIM RESET STATUS REGISTER (SRSR)
cause an illegal address
$FE02 RESERVED (SUBAR) reset.
$FE03 SIM BREAK FLAG CONTROL REGISTER (SBFCR)
$FE04 INTERRUPT STATUS REGISTER 1 (INT1)
$FE05 INTERRUPT STATUS REGISTER 2 (INT2)
$FE06 INTERRUPT STATUS REGISTER 3 (INT3)
$FE07 RESERVED
$FE08 FLASH CONTROL REGISTER (FLCR)
$FE09 BREAK ADDRESS REGISTER HIGH (BRKH)
$FE0A BREAK ADDRESS REGISTER LOW (BRKL)
$FE0B BREAK STATUS AND CONTROL REGISTER (BRKSCR)
30 Freescale Semiconductor
Input/Output (I/O) Section
Freescale Semiconductor 31
Memory
Port A Data Register Read: PTA7 PTA6 PTA5 PTA4 PTA3 PTA2 PTA1 PTA0
$0000 (PTA) Write:
See page 126. Reset: Unaffected by reset
Port B Data Register Read: PTB7 PTB6 PTB5 PTB4 PTB3 PTB2 PTB1 PTB0
$0001 (PTB) Write:
See page 128. Reset: Unaffected by reset
Port D Data Register ( Read: PTD7 PTD6 PTD5 PTD4 PTD3 PTD2 PTD1 PTD0
$0003 PTD) Write:
See page 132. Reset: Unaffected by reset
Data Direction Register A Read: DDRA7 DDRA6 DDRA5 DDRA4 DDRA3 DDRA2 DDRA1 DDRA0
$0004 (DDRA) Write:
See page 126. Reset: 0 0 0 0 0 0 0 0
Data Direction Register B Read: DDRB7 DDRB6 DDRB5 DDRB4 DDRB3 DDRB2 DDRB1 DDRB0
$0005 (DDRB) Write:
See page 128. Reset: 0 0 0 0 0 0 0 0
Data Direction Register D Read: DDRD7 DDRD6 DDRD5 DDRD4 DDRD3 DDRD2 DDRD1 DDRD0
$0007 (DDRD) Write:
See page 133. Reset: 0 0 0 0 0 0 0 0
ESCI Prescaler Register Read: PDS2 PDS1 PDS0 PSSB4 PSSB3 PSSB2 PSSB1 PSSB0
$0009 (SCPSC) Write:
See page 172. Reset: 0 0 0 0 0 0 0 0
ESCI Arbiter Data Read: ARD7 ARD6 ARD5 ARD4 ARD3 ARD2 ARD1 ARD0
$000B Register (SCIADAT) Write:
See page 177. Reset: 0 0 0 0 0 0 0 0
32 Freescale Semiconductor
Input/Output (I/O) Section
Port A Input Pullup Enable Read: PTAPUE7 PTAPUE6 PTAPUE5 PTAPUE4 PTAPUE3 PTAPUE2 PTAPUE1 PTAPUE0
$000D Register (PTAPUE) Write:
See page 127. Reset: 0 0 0 0 0 0 0 0
Port D Input Pullup Enable Read: PTDPUE7 PTDPUE6 PTDPUE5 PTDPUE4 PTDPUE3 PTDPUE2 PTDPUE1 PTDPUE0
$000F Register (PTDPUE) Write:
See page 134. Reset: 0 0 0 0 0 0 0 0
SPI Control Register Read: SPRIE R SPMSTR CPOL CPHA SPWOM SPE SPTIE
$0010 (SPCR) Write:
See page 213. Reset: 0 0 1 0 1 0 0 0
ESCI Control Register 1 Read: LOOPS ENSCI TXINV M WAKE ILTY PEN PTY
$0013 (SCC1) Write:
See page 163. Reset: 0 0 0 0 0 0 0 0
ESCI Control Register 2 Read: SCTIE TCIE SCRIE ILIE TE RE RWU SBK
$0014 (SCC2) Write:
See page 165. Reset: 0 0 0 0 0 0 0 0
ESCI Baud Rate Register Read: SCP1 SCP0 R SCR2 SCR1 SCR0
$0019 (SCBR) Write:
See page 171. Reset: 0 0 0 0 0 0 0 0
= Unimplemented R = Reserved U = Unaffected
Freescale Semiconductor 33
Memory
Keyboard Interrupt Enable Read: KBIE7 KBIE6 KBIE5 KBIE4 KBIE3 KBIE2 KBIE1 KBIE0
$001B Register (INTKBIER) Write:
See page 112. Reset: 0 0 0 0 0 0 0 0
Configuration Register 1 Read: COPRS LVISTOP LVIRSTD LVIPWRD LVI5OR3(1) SSREC STOP COPD
$001F (CONFIG1)† Write:
See page 58. Reset: 0 0 0 0 0 0 0 0
1. One-time writable register after each reset, except LVI5OR3 bit. LVI5OR3 bit is only reset via POR (power-on reset).
34 Freescale Semiconductor
Input/Output (I/O) Section
Freescale Semiconductor 35
Memory
ICG Trim Register Read: TRIM7 TRIM6 TRIM5 TRIM4 TRIM3 TRIM2 TRIM1 TRIM0
$0038 (ICGTR) Write:
See page 100. Reset: 1 0 0 0 0 0 0 0
ICG DCO Stage Control Read: DSTG7 DSTG6 DSTG5 DSTG4 DSTG3 DSTG2 DSTG1 DSTG0
$003A Register (ICGDSR) Write: R R R R R R R R
See page 100. Reset: Unaffected by reset
Read:
R R R R R R R R
$003B Reserved Write:
Reset: Indeterminate after reset
ADC Data Register Read: AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0
$003D (ADR) Write:
See page 55. Reset: 0 0 0 0 0 0 0 0
36 Freescale Semiconductor
Input/Output (I/O) Section
SIM Reset Status Register Read: POR PIN COP ILOP ILAD MODRST LVI 0
$FE01 (SRSR) Write:
See page 140. POR: 1 0 0 0 0 0 0 0
Read:
SIM Upper Byte Address R R R R R R R R
$FE02 Write:
Register (SUBAR)
Reset:
Interrupt Status Register 1 Read: IF6 IF5 IF4 IF3 IF2 IF1 0 0
$FE04 (INT1) Write: R R R R R R R R
See page 147. Reset: 0 0 0 0 0 0 0 0
Interrupt Status Register 2 Read: IF14 IF13 IF12 IF11 IF10 IF9 IF8 IF7
$FE05 (INT2) Write: R R R R R R R R
See page 147. Reset: 0 0 0 0 0 0 0 0
Freescale Semiconductor 37
Memory
Flash Block Protect Read: BPR7 BPR6 BPR5 BPR4 BPR3 BPR2 BPR1 BPR0
$FF7E Register (FLBPR)(1) Write:
See page 45. Reset: Unaffected by reset
ICG User Trim Read: TRIM7 TRIM6 TRIM5 TRIM4 TRIM3 TRIM2 TRIM1 TRIM0
$FF80 Register 5V (ICGTR5)(1) Write:
See page 46. Reset: Unaffected by reset
ICG User Trim Read: TRIM7 TRIM6 TRIM5 TRIM4 TRIM3 TRIM2 TRIM1 TRIM0
$FF81 Register 3V (ICGTR3)(1) Write:
See page 46. Reset: Unaffected by reset
38 Freescale Semiconductor
Input/Output (I/O) Section
.
Table 2-1. Vector Addresses
Vector Priority Vector Address Vector
Lowest $FFDC Timebase Vector (High)
IF16
$FFDD Timebase Vector (Low)
$FFDE ADC Conversion Complete Vector (High)
IF15
$FFDF ADC Conversion Complete Vector (Low)
$FFE0 Keyboard Vector (High)
IF14
$FFE1 Keyboard Vector (Low)
$FFE2 SCI Transmit Vector (High)
IF13
$FFE3 SCI Transmit Vector (Low)
$FFE4 SCI Receive Vector (High)
IF12
$FFE5 SCI Receive Vector (Low)
$FFE6 SCI Error Vector (High)
IF11
$FFE7 SCI Error Vector (Low)
$FFE8 SPI Transmit Vector (High)
IF10
$FFE9 SPI Transmit Vector (Low)
$FFEA SPI Receive Vector (High)
IF9
$FFEB SPI Receive Vector (Low)
$FFEC TIM2 Overflow Vector (High)
IF8
$FFED TIM2 Overflow Vector (Low)
$FFEE TIM2 Channel 1 Vector (High)
IF7
$FFEF TIM2 Channel 1 Vector (Low)
$FFF0 TIM2 Channel 0 Vector (High)
IF6
$FFF1 TIM2 Channel 0 Vector (Low)
$FFF2 TIM1 Overflow Vector (High)
IF5
$FFF3 TIM1 Overflow Vector (Low)
$FFF4 TIM1 Channel 1 Vector (High)
IF4
$FFF5 TIM1 Channel 1 Vector (Low)
$FFF6 TIM1 Channel 0 Vector (High)
IF3
$FFF7 TIM1 Channel 0 Vector (Low)
$FFF8 ICG Vector (High)
IF2
$FFF9 ICG Vector (Low)
$FFFA IRQ Vector (High)
IF1
$FFFB IRQ Vector (Low)
$FFFC SWI Vector (High)
—
$FFFD SWI Vector (Low)
$FFFE Reset Vector (High)
—
Highest $FFFF Reset Vector (Low)
Freescale Semiconductor 39
Memory
40 Freescale Semiconductor
Flash Memory
Address: $FE08
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0
HVEN MASS ERASE PGM
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
Freescale Semiconductor 41
Memory
1. Set the ERASE bit and clear the MASS bit in the Flash control register.
2. Read the Flash block protect register.
3. Write any data to any Flash location within the address range of the block to be erased.
4. Wait for a time, tNVS (minimum 10 μs).
5. Set the HVEN bit.
6. Wait for a time, tErase (minimum 1 ms or 4 ms).
7. Clear the ERASE bit.
8. Wait for a time, tNVH (minimum 5 μs).
9. Clear the HVEN bit.
10. After time, tRCV (typical 1 μs), the memory can be accessed in read mode again.
NOTE
Programming and erasing of Flash locations cannot be performed by code
being executed from the Flash memory. While these operations must be
performed in the order as shown, but other unrelated operations may occur
between the steps.
CAUTION
A page erase of the vector page will erase the internal oscillator trim values
at $FF80 and $FF81.
In applications that require more than 1000 program/erase cycles, use the 4 ms page erase specification
to get improved long-term reliability. Any application can use this 4 ms page erase specification. However,
in applications where a Flash location will be erased and reprogrammed less than 1000 times, and speed
is important, use the 1 ms page erase specification to get a shorter cycle time.
1. When in monitor mode, with security sequence failed (see 19.3.2 Security), write to the Flash block protect register instead
of any Flash address.
42 Freescale Semiconductor
Flash Memory
performed in the order as shown, but other unrelated operations may occur
between the steps.
CAUTION
A mass erase will erase the internal oscillator trim values at $FF80 and
$FF81.
1. The time between each Flash address change, or the time between the last Flash address programmed to clearing PGM
bit, must not exceed the maximum programming time, tPROG maximum.
Freescale Semiconductor 43
Memory
2
READ THE FLASH BLOCK PROTECT REGISTER
3
WRITE ANY DATA TO ANY FLASH ADDRESS
WITHIN THE ROW ADDRESS RANGE DESIRED
4
WAIT FOR A TIME, tNVS
5
SET HVEN BIT
6
WAIT FOR A TIME, tPGS
7
WRITE DATA TO THE FLASH ADDRESS
TO BE PROGRAMMED
8
WAIT FOR A TIME, tPROG
COMPLETED
Y
PROGRAMMING
THIS ROW?
10
CLEAR PGM BIT
11
WAIT FOR A TIME, tNVH
Note:
12
The time between each Flash address change (step 7 to step 7), CLEAR HVEN BIT
or the time between the last Flash address programmed
to clearing PGM bit (step 7 to step 10)
must not exceed the maximum programming 13
WAIT FOR A TIME, tRCV
time, tPROG max.
44 Freescale Semiconductor
Flash Memory
Address: $FF7E
Bit 7 6 5 4 3 2 1 Bit 0
Read:
BPR7 BPR6 BPR5 BPR4 BPR3 BPR2 BPR1 BPR0
Write:
Reset: Unaffected by reset. Initial value from factory is 1.
Write to this register is by a programming sequence to the Flash memory.
Figure 2-5. Flash Block Protect Register (FLBPR)
BPR[7:0] — Flash Block Protect Bits
These eight bits represent bits [13:6] of a 16-bit memory address. Bit 15 and Bit 14 are 1s and bits [5:0]
are 0s.
The resultant 16-bit address is used for specifying the start address of the Flash memory for block
protection. The Flash is protected from this start address to the end of Flash memory, at $FFFF. With
this mechanism, the protect start address can be $XX00, $XX40, $XX80, and $XXC0 (64 bytes page
boundaries) within the Flash memory.
Freescale Semiconductor 45
Memory
46 Freescale Semiconductor
Flash Memory
Freescale Semiconductor 47
Memory
48 Freescale Semiconductor
Chapter 3
Analog-to-Digital Converter (ADC)
3.1 Introduction
This section describes the 8-bit analog-to-digital converter (ADC).
3.2 Features
Features of the ADC module include:
• Eight channels with multiplexed input
• Linear successive approximation with monotonicity
• 8-bit resolution
• Single or continuous conversion
• Conversion complete flag or conversion complete interrupt
• Selectable ADC clock
Freescale Semiconductor 49
Analog-to-Digital Converter (ADC)
INTERNAL BUS
M68HC08 CPU
PORTA
PTA7/KBD7–
DDRA
CPU ARITHMETIC/LOGIC PROGRAMMABLE TIMEBASE
MODULE PTA0/KBD0(1)
REGISTERS UNIT (ALU)
PTB7/AD7
CONTROL AND STATUS SINGLE BREAKPOINT BREAK
REGISTERS — 64 BYTES MODULE PTB6/AD6
PTB5/AD5
PORTB
PTB4/AD4
DDRB
USER FLASH
DUAL VOLTAGE
MC68HC908GT16 — 15,872 BYTES LOW-VOLTAGE INHIBIT MODULE PTB3/AD3
MC68HC908GT8 — 7,680 BYTES PTB2/AD2
PTB1/AD1
8-BIT KEYBOARD
USER RAM — 512 BYTES INTERRUPT MODULE PTB0/AD0
PTC6(1)
MONITOR ROM — 304 BYTES 2-CHANNEL TIMER INTERFACE PTC5(1)
MODULE 1 PTC4(1)(2)
PORTC
DDRC
FLASH PROGRAMMING ROUTINES
PTC3(1)(2)
ROM — 720 BYTES
2-CHANNEL TIMER INTERFACE PTC2(1)(2)
MODULE 2 PTC1(1)(2)
USER FLASH VECTOR SPACE — 36 BYTES
PTC0(1)(2)
SERIAL COMMUNICATIONS
PTE4/OSC1 INTERFACE MODULE PTD7/T2CH1(1)
INTERNAL CLOCK
GENERATOR MODULE PTD6/T2CH0(1)
PTE3/OSC2
COMPUTER OPERATING PTD5/T1CH1(1)
PTD4/T1CH0(1)
PORTD
PROPERLY MODULE
DDRD
PTD3/SPSCK(1)
SYSTEM INTEGRATION PTD2/MOSI(1)
RST(3) SERIAL PERIPHERAL
MODULE
INTERFACE MODULE PTD1/MISO(1)
PTD0/SS(1)
SINGLE EXTERNAL
IRQ(3)
INTERRUPT MODULE MONITOR MODULE PTE2
PORTE
DDRE
VREFH PTE1/RxD
8-BIT ANALOG-TO-DIGITAL
CONVERTER MODULE MEMORY MAP PTE0/TxD
VREFL
MODULE
POWER-ON RESET
MODULE CONFIGURATION REGISTER 1 SECURITY
MODULE MODULE
VDD
VSS
VDDA POWER CONFIGURATION REGISTER 2
MODULE MONITOR MODE ENTRY
VSSA
MODULE
50 Freescale Semiconductor
Functional Description
READ DDRBx
WRITE PTBx
PTBx PTBx
ADC CHANNEL x
READ PTBx
DISABLE
ADC
VOLTAGE IN
(VADIN) CHANNEL ADCH4–ADCH0
CONVERSION SELECT
INTERRUPT COMPLETE
ADC VREFH
LOGIC
VREFL
ADC CLOCK
AIEN COCO
CGMXCLK
CLOCK
BUS CLOCK GENERATOR
ADIV2–ADIV0 ADICLK
Freescale Semiconductor 51
Analog-to-Digital Converter (ADC)
NOTE
Connect the VDDA pin to the same voltage potential as the VDD pin, and
connect the VSSA pin to the same voltage potential as the VSS pin. The
VDDA pin should be routed carefully for maximum noise immunity.
3.3.5 Conversion
In continuous conversion mode, the ADC data register will be filled with new data after each conversion.
Data from the previous conversion will be overwritten whether that data has been read or not.
Conversions will continue until the ADCO bit is cleared. The COCO bit is set after the first conversion and
will stay set until the next read of the ADC data register.
In single conversion mode, conversion begins with a write to the ADSCR. Only one conversion occurs
between writes to the ADSCR.
When a conversion is in process and the ADSCR is written, the current conversion data should be
discarded to prevent an incorrect reading.
3.4 Interrupts
When the AIEN bit is set, the ADC module is capable of generating CPU interrupts after each ADC
conversion. A CPU interrupt is generated if the COCO bit is at 0. The COCO bit is not used as a
conversion complete flag when interrupts are enabled.
52 Freescale Semiconductor
I/O Signals
Freescale Semiconductor 53
Analog-to-Digital Converter (ADC)
Address: $003C
Bit 7 6 5 4 3 2 1 Bit 0
Read: COCO
AIEN ADCO ADCH4 ADCH3 ADCH2 ADCH1 ADCH0
Write: R
Reset: 0 0 0 1 1 1 1 1
R = Reserved
54 Freescale Semiconductor
I/O Registers
Address: $003D
Bit 7 6 5 4 3 2 1 Bit 0
Read: AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
Freescale Semiconductor 55
Analog-to-Digital Converter (ADC)
Address: $003E
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0
ADIV2 ADIV1 ADIV0 ADICLK
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
1. X = Don’t care
56 Freescale Semiconductor
Chapter 4
Configuration Register (CONFIG)
4.1 Introduction
This section describes the configuration registers, CONFIG1 and CONFIG2. The configuration registers
enable or disable these options:
• Stop mode recovery time (32 CGMXCLK cycles or 4096 CGMXCLK cycles)
• COP timeout period (262,128 or 8176 COPCLK cycles)
• STOP instruction
• Computer operating properly module (COP)
• Low-voltage inhibit (LVI) module control and voltage trip point selection
• Enable/disable the oscillator (OSC) during stop mode
• External clock, external crystal, or ICG clock source
Freescale Semiconductor 57
Configuration Register (CONFIG)
Address: $001E
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0
EXTXTALEN EXTSLOW EXTCLKEN OSCENINSTOP R
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented R = Reserved
Address: $001F
Bit 7 6 5 4 3 2 1 Bit 0
Read:
COPRS LVISTOP LVIRSTD LVIPWRD LVI5OR3 SSREC STOP COPD
Write:
Reset: 0 0 0 0 See Note 0 0 0
Note: LVI5OR3 bit is only reset via POR (power-on reset)
58 Freescale Semiconductor
Functional Description
Freescale Semiconductor 59
Configuration Register (CONFIG)
60 Freescale Semiconductor
Chapter 5
Computer Operating Properly (COP) Module
5.1 Introduction
The computer operating properly (COP) module contains a free-running counter that generates a reset if
allowed to overflow. The COP module helps software recover from runaway code. Prevent a COP reset
by clearing the COP counter periodically. The COP module can be disabled through the COPD bit in the
CONFIG register.
SIM MODULE
COP TIMEOUT
COPCTL WRITE
COP CLOCK
COP MODULE
6-BIT COP COUNTER
COPEN (FROM SIM)
COPD (FROM CONFIG1)
CLEAR
RESET COP COUNTER
COPCTL WRITE
Freescale Semiconductor 61
Computer Operating Properly (COP) Module
The COP counter is a free-running 6-bit counter preceded by a 12-bit prescaler counter. If not cleared by
software, the COP counter overflows and generates an asynchronous reset after 262,128 or 8176
COPCLK cycles, depending on the state of the COP rate select bit, COPRS, in the configuration register.
With a 8176 COPCLK cycle overflow option, a 32.768-kHz crystal gives a COP timeout period of 250 ms.
Writing any value to location $FFFF before an overflow occurs prevents a COP reset by clearing the COP
counter and stages 12 through 5 of the prescaler.
NOTE
Service the COP immediately after reset and before entering or after exiting
stop mode to guarantee the maximum time before the first COP counter
overflow.
A COP reset pulls the RST pin low for 32 COPCLK cycles and sets the COP bit in the reset status register
(RSR).
In monitor mode, the COP is disabled if the RST pin or the IRQ1 is held at VTST. During the break state,
VTST on the RST pin disables the COP.
NOTE
Place COP clearing instructions in the main program and not in an interrupt
subroutine. Such an interrupt subroutine could keep the COP from
generating a reset even while the main program is not working properly.
5.3.1 COPCLK
COPCLK is a clock generated by the clock selection circuit in the internal clock generator (ICG). See 7.3.5
Clock Selection Circuit for more details.
62 Freescale Semiconductor
COP Control Register
Address: $FFFF
Bit 7 6 5 4 3 2 1 Bit 0
Read: Low byte of reset vector
Write: Clear COP counter
Reset: Unaffected by reset
5.5 Interrupts
The COP does not generate central processor unit (CPU) interrupt requests.
Freescale Semiconductor 63
Computer Operating Properly (COP) Module
64 Freescale Semiconductor
Chapter 6
Central Processor Unit (CPU)
6.1 Introduction
The M68HC08 CPU (central processor unit) is an enhanced and fully object-code-compatible version of
the M68HC05 CPU. The CPU08 Reference Manual (document order number CPU08RM/AD) contains a
description of the CPU instruction set, addressing modes, and architecture.
6.2 Features
Features of the CPU include:
• Object code fully upward-compatible with M68HC05 Family
• 16-bit stack pointer with stack manipulation instructions
• 16-bit index register with x-register manipulation instructions
• 8-MHz CPU internal bus frequency
• 64-Kbyte program/data memory space
• 16 addressing modes
• Memory-to-memory data moves without using accumulator
• Fast 8-bit by 8-bit multiply and 16-bit by 8-bit divide instructions
• Enhanced binary-coded decimal (BCD) data handling
• Modular architecture with expandable internal bus definition for extension of addressing range
beyond 64 Kbytes
• Low-power stop and wait modes
Freescale Semiconductor 65
Central Processor Unit (CPU)
7 0
ACCUMULATOR (A)
15 0
H X INDEX REGISTER (H:X)
15 0
STACK POINTER (SP)
15 0
PROGRAM COUNTER (PC)
7 0
V 1 1 H I N Z C CONDITION CODE REGISTER (CCR)
CARRY/BORROW FLAG
ZERO FLAG
NEGATIVE FLAG
INTERRUPT MASK
HALF-CARRY FLAG
TWO’S COMPLEMENT OVERFLOW FLAG
6.3.1 Accumulator
The accumulator is a general-purpose 8-bit register. The CPU uses the accumulator to hold operands and
the results of arithmetic/logic operations.
Bit 7 6 5 4 3 2 1 Bit 0
Read:
Write:
Reset: Unaffected by reset
66 Freescale Semiconductor
CPU Registers
NOTE
The location of the stack is arbitrary and may be relocated anywhere in
random-access memory (RAM). Moving the SP out of page 0 ($0000 to
$00FF) frees direct address (page 0) space. For correct operation, the
stack pointer must point only to RAM locations.
Freescale Semiconductor 67
Central Processor Unit (CPU)
V — Overflow Flag
The CPU sets the overflow flag when a two's complement overflow occurs. The signed branch
instructions BGT, BGE, BLE, and BLT use the overflow flag.
1 = Overflow
0 = No overflow
H — Half-Carry Flag
The CPU sets the half-carry flag when a carry occurs between accumulator bits 3 and 4 during an
add-without-carry (ADD) or add-with-carry (ADC) operation. The half-carry flag is required for
binary-coded decimal (BCD) arithmetic operations. The DAA instruction uses the states of the H and
C flags to determine the appropriate correction factor.
1 = Carry between bits 3 and 4
0 = No carry between bits 3 and 4
I — Interrupt Mask
When the interrupt mask is set, all maskable CPU interrupts are disabled. CPU interrupts are enabled
when the interrupt mask is cleared. When a CPU interrupt occurs, the interrupt mask is set
automatically after the CPU registers are saved on the stack, but before the interrupt vector is fetched.
1 = Interrupts disabled
0 = Interrupts enabled
NOTE
To maintain M6805 Family compatibility, the upper byte of the index
register (H) is not stacked automatically. If the interrupt service routine
modifies H, then the user must stack and unstack H using the PSHH and
PULH instructions.
After the I bit is cleared, the highest-priority interrupt request is serviced first.
A return-from-interrupt (RTI) instruction pulls the CPU registers from the stack and restores the
interrupt mask from the stack. After any reset, the interrupt mask is set and can be cleared only by the
clear interrupt mask software instruction (CLI).
N — Negative Flag
The CPU sets the negative flag when an arithmetic operation, logic operation, or data manipulation
produces a negative result, setting bit 7 of the result.
1 = Negative result
0 = Non-negative result
68 Freescale Semiconductor
Arithmetic/Logic Unit (ALU)
Z — Zero Flag
The CPU sets the zero flag when an arithmetic operation, logic operation, or data manipulation
produces a result of $00.
1 = Zero result
0 = Non-zero result
C — Carry/Borrow Flag
The CPU sets the carry/borrow flag when an addition operation produces a carry out of bit 7 of the
accumulator or when a subtraction operation requires a borrow. Some instructions — such as bit test
and branch, shift, and rotate — also clear or set the carry/borrow flag.
1 = Carry out of bit 7
0 = No carry out of bit 7
Freescale Semiconductor 69
Central Processor Unit (CPU)
Operand
Effect
Address
Opcode
Cycles
Source on CCR
Mode
Operation Description
Form
V H I N Z C
ADC #opr IMM A9 ii 2
ADC opr DIR B9 dd 3
ADC opr EXT C9 hh ll 4
ADC opr,X IX2 D9 ee ff 4
Add with Carry A ← (A) + (M) + (C) –
ADC opr,X IX1 E9 ff 3
ADC ,X IX F9 2
ADC opr,SP SP1 9EE9 ff 4
ADC opr,SP SP2 9ED9 ee ff 5
ADD #opr IMM AB ii 2
ADD opr DIR BB dd 3
ADD opr EXT CB hh ll 4
ADD opr,X Add without Carry A ← (A) + (M) – IX2 DB ee ff 4
ADD opr,X IX1 EB ff 3
ADD ,X IX FB 2
ADD opr,SP SP1 9EEB ff 4
ADD opr,SP SP2 9EDB ee ff 5
AIS #opr Add Immediate Value (Signed) to SP SP ← (SP) + (16 « M) – – – – – – IMM A7 ii 2
AIX #opr Add Immediate Value (Signed) to H:X H:X ← (H:X) + (16 « M) – – – – – – IMM AF ii 2
AND #opr IMM A4 ii 2
AND opr DIR B4 dd 3
AND opr EXT C4 hh ll 4
AND opr,X IX2 D4 ee ff 4
AND opr,X Logical AND A ← (A) & (M) 0 – – – IX1 E4 ff 3
AND ,X IX F4 2
AND opr,SP SP1 9EE4 ff 4
AND opr,SP SP2 9ED4 ee ff 5
ASL opr DIR 38 dd 4
ASLA INH 48 1
ASLX Arithmetic Shift Left INH 58 1
ASL opr,X (Same as LSL)
C 0 – – IX1 68 ff 4
ASL ,X b7 b0 IX 78 3
ASL opr,SP SP1 9E68 ff 5
ASR opr DIR 37 dd 4
ASRA INH 47 1
ASRX Arithmetic Shift Right C – – INH 57 1
ASR opr,X IX1 67 ff 4
ASR opr,X b7 b0 IX 77 3
ASR opr,SP SP1 9E67 ff 5
BCC rel Branch if Carry Bit Clear PC ← (PC) + 2 + rel ? (C) = 0 – – – – – – REL 24 rr 3
DIR (b0) 11 dd 4
DIR (b1) 13 dd 4
DIR (b2) 15 dd 4
BCLR n, opr Clear Bit n in M Mn ← 0 – – – – – – DIR (b3) 17 dd 4
DIR (b4) 19 dd 4
DIR (b5) 1B dd 4
DIR (b6) 1D dd 4
DIR (b7) 1F dd 4
BCS rel Branch if Carry Bit Set (Same as BLO) PC ← (PC) + 2 + rel ? (C) = 1 – – – – – – REL 25 rr 3
BEQ rel Branch if Equal PC ← (PC) + 2 + rel ? (Z) = 1 – – – – – – REL 27 rr 3
Branch if Greater Than or Equal To
BGE opr (Signed Operands) PC ← (PC) + 2 + rel ? (N ⊕ V) = 0 – – – – – – REL 90 rr 3
Branch if Greater Than (Signed
BGT opr
Operands) PC ← (PC) + 2 + rel ? (Z) | (N ⊕ V) = 0 – – – – – – REL 92 rr 3
BHCC rel Branch if Half Carry Bit Clear PC ← (PC) + 2 + rel ? (H) = 0 – – – – – – REL 28 rr 3
BHCS rel Branch if Half Carry Bit Set PC ← (PC) + 2 + rel ? (H) = 1 – – – – – – REL 29 rr 3
BHI rel Branch if Higher PC ← (PC) + 2 + rel ? (C) | (Z) = 0 – – – – – – REL 22 rr 3
70 Freescale Semiconductor
Instruction Set Summary
Operand
Effect
Address
Opcode
Cycles
Source on CCR
Mode
Operation Description
Form
V H I N Z C
Branch if Higher or Same
BHS rel PC ← (PC) + 2 + rel ? (C) = 0 – – – – – – REL 24 rr 3
(Same as BCC)
BIH rel Branch if IRQ Pin High PC ← (PC) + 2 + rel ? IRQ = 1 – – – – – – REL 2F rr 3
BIL rel Branch if IRQ Pin Low PC ← (PC) + 2 + rel ? IRQ = 0 – – – – – – REL 2E rr 3
BIT #opr IMM A5 ii 2
BIT opr DIR B5 dd 3
BIT opr EXT C5 hh ll 4
BIT opr,X Bit Test (A) & (M) 0 – – – IX2 D5 ee ff 4
BIT opr,X IX1 E5 ff 3
BIT ,X IX F5 2
BIT opr,SP SP1 9EE5 ff 4
BIT opr,SP SP2 9ED5 ee ff 5
Branch if Less Than or Equal To
BLE opr (Signed Operands) PC ← (PC) + 2 + rel ? (Z) | (N ⊕ V) = 1 – – – – – – REL 93 rr 3
BLO rel Branch if Lower (Same as BCS) PC ← (PC) + 2 + rel ? (C) = 1 – – – – – – REL 25 rr 3
BLS rel Branch if Lower or Same PC ← (PC) + 2 + rel ? (C) | (Z) = 1 – – – – – – REL 23 rr 3
BLT opr Branch if Less Than (Signed Operands) PC ← (PC) + 2 + rel ? (N ⊕ V) =1 – – – – – – REL 91 rr 3
BMC rel Branch if Interrupt Mask Clear PC ← (PC) + 2 + rel ? (I) = 0 – – – – – – REL 2C rr 3
BMI rel Branch if Minus PC ← (PC) + 2 + rel ? (N) = 1 – – – – – – REL 2B rr 3
BMS rel Branch if Interrupt Mask Set PC ← (PC) + 2 + rel ? (I) = 1 – – – – – – REL 2D rr 3
BNE rel Branch if Not Equal PC ← (PC) + 2 + rel ? (Z) = 0 – – – – – – REL 26 rr 3
BPL rel Branch if Plus PC ← (PC) + 2 + rel ? (N) = 0 – – – – – – REL 2A rr 3
BRA rel Branch Always PC ← (PC) + 2 + rel – – – – – – REL 20 rr 3
DIR (b0) 01 dd rr 5
DIR (b1) 03 dd rr 5
DIR (b2) 05 dd rr 5
DIR (b3) 07 dd rr 5
BRCLR n,opr,rel Branch if Bit n in M Clear PC ← (PC) + 3 + rel ? (Mn) = 0 – – – – – DIR (b4) 09 dd rr 5
DIR (b5) 0B dd rr 5
DIR (b6) 0D dd rr 5
DIR (b7) 0F dd rr 5
BRN rel Branch Never PC ← (PC) + 2 – – – – – – REL 21 rr 3
DIR (b0) 00 dd rr 5
DIR (b1) 02 dd rr 5
DIR (b2) 04 dd rr 5
DIR (b3) 06 dd rr 5
BRSET n,opr,rel Branch if Bit n in M Set PC ← (PC) + 3 + rel ? (Mn) = 1 – – – – –
DIR (b4) 08 dd rr 5
DIR (b5) 0A dd rr 5
DIR (b6) 0C dd rr 5
DIR (b7) 0E dd rr 5
DIR (b0) 10 dd 4
DIR (b1) 12 dd 4
DIR (b2) 14 dd 4
BSET n,opr Set Bit n in M Mn ← 1 – – – – – – DIR (b3) 16 dd 4
DIR (b4) 18 dd 4
DIR (b5) 1A dd 4
DIR (b6) 1C dd 4
DIR (b7) 1E dd 4
PC ← (PC) + 2; push (PCL)
SP ← (SP) – 1; push (PCH)
BSR rel Branch to Subroutine – – – – – – REL AD rr 4
SP ← (SP) – 1
PC ← (PC) + rel
CBEQ opr,rel PC ← (PC) + 3 + rel ? (A) – (M) = $00 DIR 31 dd rr 5
CBEQA #opr,rel PC ← (PC) + 3 + rel ? (A) – (M) = $00 IMM 41 ii rr 4
CBEQX #opr,rel Compare and Branch if Equal PC ← (PC) + 3 + rel ? (X) – (M) = $00 – – – – – – IMM 51 ii rr 4
CBEQ opr,X+,rel PC ← (PC) + 3 + rel ? (A) – (M) = $00 IX1+ 61 ff rr 5
CBEQ X+,rel PC ← (PC) + 2 + rel ? (A) – (M) = $00 IX+ 71 rr 4
CBEQ opr,SP,rel PC ← (PC) + 4 + rel ? (A) – (M) = $00 SP1 9E61 ff rr 6
CLC Clear Carry Bit C←0 – – – – – 0 INH 98 1
CLI Clear Interrupt Mask I←0 – – 0 – – – INH 9A 2
Freescale Semiconductor 71
Central Processor Unit (CPU)
Operand
Effect
Address
Opcode
Cycles
Source on CCR
Mode
Operation Description
Form
V H I N Z C
CLR opr M ← $00 DIR 3F dd 3
CLRA A ← $00 INH 4F 1
CLRX X ← $00 INH 5F 1
CLRH Clear H ← $00 0 – – 0 1 – INH 8C 1
CLR opr,X M ← $00 IX1 6F ff 3
CLR ,X M ← $00 IX 7F 2
CLR opr,SP M ← $00 SP1 9E6F ff 4
CMP #opr IMM A1 ii 2
CMP opr DIR B1 dd 3
CMP opr EXT C1 hh ll 4
CMP opr,X IX2 D1 ee ff 4
Compare A with M (A) – (M) – –
CMP opr,X IX1 E1 ff 3
CMP ,X IX F1 2
CMP opr,SP SP1 9EE1 ff 4
CMP opr,SP SP2 9ED1 ee ff 5
COM opr M ← (M) = $FF – (M) DIR 33 dd 4
COMA A ← (A) = $FF – (M) INH 43 1
COMX X ← (X) = $FF – (M) INH 53 1
Complement (One’s Complement) 0 – – 1
COM opr,X M ← (M) = $FF – (M) IX1 63 ff 4
COM ,X M ← (M) = $FF – (M) IX 73 3
COM opr,SP M ← (M) = $FF – (M) SP1 9E63 ff 5
CPHX #opr IMM 65 ii ii+1 3
Compare H:X with M (H:X) – (M:M + 1) – –
CPHX opr DIR 75 dd 4
CPX #opr IMM A3 ii 2
CPX opr DIR B3 dd 3
CPX opr EXT C3 hh ll 4
CPX ,X IX2 D3 ee ff 4
CPX opr,X Compare X with M (X) – (M) – – IX1 E3 ff 3
CPX opr,X IX F3 2
CPX opr,SP SP1 9EE3 ff 4
CPX opr,SP SP2 9ED3 ee ff 5
DAA Decimal Adjust A (A)10 U – – INH 72 2
A ← (A) – 1 or M ← (M) – 1 or X ← (X) – 1 5
DBNZ opr,rel PC ← (PC) + 3 + rel ? (result) ≠ 0 DIR 3B dd rr
DBNZA rel PC ← (PC) + 2 + rel ? (result) ≠ 0 INH 4B rr 3
3
DBNZX rel Decrement and Branch if Not Zero PC ← (PC) + 2 + rel ? (result) ≠ 0 – – – – – – INH 5B rr 5
DBNZ opr,X,rel PC ← (PC) + 3 + rel ? (result) ≠ 0 IX1 6B ff rr
DBNZ X,rel PC ← (PC) + 2 + rel ? (result) ≠ 0 IX 7B rr 4
6
DBNZ opr,SP,rel PC ← (PC) + 4 + rel ? (result) ≠ 0 SP1 9E6B ff rr
DEC opr M ← (M) – 1 DIR 3A dd 4
DECA A ← (A) – 1 INH 4A 1
DECX X ← (X) – 1 INH 5A 1
Decrement – – –
DEC opr,X M ← (M) – 1 IX1 6A ff 4
DEC ,X M ← (M) – 1 IX 7A 3
DEC opr,SP M ← (M) – 1 SP1 9E6A ff 5
A ← (H:A)/(X)
DIV Divide – – – – INH 52 7
H ← Remainder
EOR #opr IMM A8 ii 2
EOR opr DIR B8 dd 3
EOR opr EXT C8 hh ll 4
EOR opr,X Exclusive OR M with A A ← (A ⊕ M) 0 – – – IX2 D8 ee ff 4
EOR opr,X IX1 E8 ff 3
EOR ,X IX F8 2
EOR opr,SP SP1 9EE8 ff 4
EOR opr,SP SP2 9ED8 ee ff 5
INC opr M ← (M) + 1 DIR 3C dd 4
INCA A ← (A) + 1 INH 4C 1
INCX Increment X ← (X) + 1 – – – INH 5C 1
INC opr,X M ← (M) + 1 IX1 6C ff 4
INC ,X M ← (M) + 1 IX 7C 3
INC opr,SP M ← (M) + 1 SP1 9E6C ff 5
72 Freescale Semiconductor
Instruction Set Summary
Operand
Effect
Address
Opcode
Cycles
Source on CCR
Mode
Operation Description
Form
V H I N Z C
JMP opr DIR BC dd 2
JMP opr EXT CC hh ll 3
JMP opr,X Jump PC ← Jump Address – – – – – – IX2 DC ee ff 4
JMP opr,X IX1 EC ff 3
JMP ,X IX FC 2
JSR opr PC ← (PC) + n (n = 1, 2, or 3) DIR BD dd 4
JSR opr EXT CD hh ll 5
JSR opr,X Jump to Subroutine Push (PCL); SP ← (SP) – 1 – – – – – – IX2 DD ee ff 6
Push (PCH); SP ← (SP) – 1
JSR opr,X PC ← Unconditional Address IX1 ED ff 5
JSR ,X IX FD 4
LDA #opr IMM A6 ii 2
LDA opr DIR B6 dd 3
LDA opr EXT C6 hh ll 4
LDA opr,X IX2 D6 ee ff 4
LDA opr,X Load A from M A ← (M) 0 – – – IX1 E6 ff 3
LDA ,X IX F6 2
LDA opr,SP SP1 9EE6 ff 4
LDA opr,SP SP2 9ED6 ee ff 5
LDHX #opr IMM 45 ii jj 3
Load H:X from M H:X ← (M:M + 1) 0 – – –
LDHX opr DIR 55 dd 4
LDX #opr IMM AE ii 2
LDX opr DIR BE dd 3
LDX opr EXT CE hh ll 4
LDX opr,X IX2 DE ee ff 4
LDX opr,X Load X from M X ← (M) 0 – – – IX1 EE ff 3
LDX ,X IX FE 2
LDX opr,SP SP1 9EEE ff 4
LDX opr,SP SP2 9EDE ee ff 5
LSL opr DIR 38 dd 4
LSLA INH 48 1
LSLX Logical Shift Left C 0 INH
– – IX1
58 1
LSL opr,X (Same as ASL) 68 ff 4
LSL ,X b7 b0 IX 78 3
LSL opr,SP SP1 9E68 ff 5
LSR opr DIR 34 dd 4
LSRA INH 44 1
LSRX Logical Shift Right 0 C – – 0 INH 54 1
LSR opr,X IX1 64 ff 4
LSR ,X b7 b0 IX 74 3
LSR opr,SP SP1 9E64 ff 5
MOV opr,opr (M)Destination ← (M)Source DD 4E dd dd 5
MOV opr,X+ DIX+ 5E dd 4
Move 0 – – – IMD 6E ii dd 4
MOV #opr,opr
MOV X+,opr H:X ← (H:X) + 1 (IX+D, DIX+) IX+D 7E dd 4
MUL Unsigned multiply X:A ← (X) × (A) – 0 – – – 0 INH 42 5
NEG opr M ← –(M) = $00 – (M) DIR 30 dd 4
NEGA INH 40 1
NEGX A ← –(A) = $00 – (A) INH 50 1
Negate (Two’s Complement) X ← –(X) = $00 – (X) – –
NEG opr,X M ← –(M) = $00 – (M) IX1 60 ff 4
NEG ,X IX 70 3
NEG opr,SP M ← –(M) = $00 – (M) SP1 9E60 ff 5
NOP No Operation None – – – – – – INH 9D 1
NSA Nibble Swap A A ← (A[3:0]:A[7:4]) – – – – – – INH 62 3
ORA #opr IMM AA ii 2
ORA opr DIR BA dd 3
ORA opr EXT CA hh ll 4
ORA opr,X IX2 DA ee ff 4
Inclusive OR A and M A ← (A) | (M) 0 – – – ff
ORA opr,X IX1 EA 3
ORA ,X IX FA 2
ORA opr,SP SP1 9EEA ff 4
ORA opr,SP SP2 9EDA ee ff 5
PSHA Push A onto Stack Push (A); SP ← (SP) – 1 – – – – – – INH 87 2
PSHH Push H onto Stack Push (H); SP ← (SP) – 1 – – – – – – INH 8B 2
PSHX Push X onto Stack Push (X); SP ← (SP) – 1 – – – – – – INH 89 2
Freescale Semiconductor 73
Central Processor Unit (CPU)
Operand
Effect
Address
Opcode
Cycles
Source on CCR
Mode
Operation Description
Form
V H I N Z C
PULA Pull A from Stack SP ← (SP + 1); Pull (A) – – – – – – INH 86 2
PULH Pull H from Stack SP ← (SP + 1); Pull (H) – – – – – – INH 8A 2
PULX Pull X from Stack SP ← (SP + 1); Pull (X) – – – – – – INH 88 2
ROL opr DIR 39 dd 4
ROLA INH 49 1
ROLX INH 59 1
ROL opr,X Rotate Left through Carry C – – IX1 69 ff 4
ROL ,X b7 b0 IX 79 3
ROL opr,SP SP1 9E69 ff 5
ROR opr DIR 36 dd 4
RORA INH 46 1
RORX Rotate Right through Carry C – – INH 56 1
ROR opr,X IX1 66 ff 4
ROR ,X b7 b0 IX 76 3
ROR opr,SP SP1 9E66 ff 5
RSP Reset Stack Pointer SP ← $FF – – – – – – INH 9C 1
SP ← (SP) + 1; Pull (CCR)
SP ← (SP) + 1; Pull (A)
RTI Return from Interrupt SP ← (SP) + 1; Pull (X) INH 80 7
SP ← (SP) + 1; Pull (PCH)
SP ← (SP) + 1; Pull (PCL)
SP ← SP + 1; Pull (PCH)
RTS Return from Subroutine – – – – – – INH 81 4
SP ← SP + 1; Pull (PCL)
SBC #opr IMM A2 ii 2
SBC opr DIR B2 dd 3
SBC opr EXT C2 hh ll 4
SBC opr,X Subtract with Carry A ← (A) – (M) – (C) – – IX2 D2 ee ff 4
SBC opr,X IX1 E2 ff 3
SBC ,X IX F2 2
SBC opr,SP SP1 9EE2 ff 4
SBC opr,SP SP2 9ED2 ee ff 5
SEC Set Carry Bit C←1 – – – – – 1 INH 99 1
SEI Set Interrupt Mask I←1 – – 1 – – – INH 9B 2
STA opr DIR B7 dd 3
STA opr EXT C7 hh ll 4
STA opr,X IX2 D7 ee ff 4
STA opr,X Store A in M M ← (A) 0 – – – IX1 E7 ff 3
STA ,X IX F7 2
STA opr,SP SP1 9EE7 ff 4
STA opr,SP SP2 9ED7 ee ff 5
STHX opr Store H:X in M (M:M + 1) ← (H:X) 0 – – – DIR 35 dd 4
Enable Interrupts, Stop Processing,
STOP I ← 0; Stop Processing – – 0 – – – INH 8E 1
Refer to MCU Documentation
STX opr DIR BF dd 3
STX opr EXT CF hh ll 4
STX opr,X IX2 DF ee ff 4
STX opr,X Store X in M M ← (X) 0 – – – IX1 EF ff 3
STX ,X IX FF 2
STX opr,SP SP1 9EEF ff 4
STX opr,SP SP2 9EDF ee ff 5
SUB #opr IMM A0 ii 2
SUB opr DIR B0 dd 3
SUB opr EXT C0 hh ll 4
SUB opr,X Subtract A ← (A) – (M) – – IX2 D0 ee ff 4
SUB opr,X IX1 E0 ff 3
SUB ,X IX F0 2
SUB opr,SP SP1 9EE0 ff 4
SUB opr,SP SP2 9ED0 ee ff 5
74 Freescale Semiconductor
Opcode Map
Operand
Effect
Address
Opcode
Cycles
Source on CCR
Mode
Operation Description
Form
V H I N Z C
PC ← (PC) + 1; Push (PCL)
SP ← (SP) – 1; Push (PCH)
SP ← (SP) – 1; Push (X)
SP ← (SP) – 1; Push (A)
SWI Software Interrupt – – 1 – – – INH 83 9
SP ← (SP) – 1; Push (CCR)
SP ← (SP) – 1; I ← 1
PCH ← Interrupt Vector High Byte
PCL ← Interrupt Vector Low Byte
TAP Transfer A to CCR CCR ← (A) INH 84 2
TAX Transfer A to X X ← (A) – – – – – – INH 97 1
TPA Transfer CCR to A A ← (CCR) – – – – – – INH 85 1
TST opr DIR 3D dd 3
TSTA INH 4D 1
TSTX INH 5D 1
Test for Negative or Zero (A) – $00 or (X) – $00 or (M) – $00 0 – – –
TST opr,X IX1 6D ff 3
TST ,X IX 7D 2
TST opr,SP SP1 9E6D ff 4
TSX Transfer SP to H:X H:X ← (SP) + 1 – – – – – – INH 95 2
TXA Transfer X to A A ← (X) – – – – – – INH 9F 1
TXS Transfer H:X to SP (SP) ← (H:X) – 1 – – – – – – INH 94 2
I bit ← 0; Inhibit CPU clocking
WAIT Enable Interrupts; Wait for Interrupt – – 0 – – – INH 8F 1
until interrupted
A Accumulator n Any bit
C Carry/borrow bit opr Operand (one or two bytes)
CCR Condition code register PC Program counter
dd Direct address of operand PCH Program counter high byte
dd rr Direct address of operand and relative offset of branch instruction PCL Program counter low byte
DD Direct to direct addressing mode REL Relative addressing mode
DIR Direct addressing mode rel Relative program counter offset byte
DIX+ Direct to indexed with post increment addressing mode rr Relative program counter offset byte
ee ff High and low bytes of offset in indexed, 16-bit offset addressing SP1 Stack pointer, 8-bit offset addressing mode
EXT Extended addressing mode SP2 Stack pointer 16-bit offset addressing mode
ff Offset byte in indexed, 8-bit offset addressing SP Stack pointer
H Half-carry bit U Undefined
H Index register high byte V Overflow bit
hh ll High and low bytes of operand address in extended addressing X Index register low byte
I Interrupt mask Z Zero bit
ii Immediate operand byte & Logical AND
IMD Immediate source to direct destination addressing mode | Logical OR
IMM Immediate addressing mode ⊕ Logical EXCLUSIVE OR
INH Inherent addressing mode () Contents of
IX Indexed, no offset addressing mode –( ) Negation (two’s complement)
IX+ Indexed, no offset, post increment addressing mode # Immediate value
IX+D Indexed with post increment to direct addressing mode « Sign extend
IX1 Indexed, 8-bit offset addressing mode ← Loaded with
IX1+ Indexed, 8-bit offset, post increment addressing mode ? If
IX2 Indexed, 16-bit offset addressing mode : Concatenated with
M Memory location Set or cleared
N Negative bit — Not affected
Freescale Semiconductor 75
76
1 BRCLR0 BCLR0 BRN CBEQ CBEQA CBEQX CBEQ CBEQ CBEQ RTS BLT CMP CMP CMP CMP CMP CMP CMP CMP
3 DIR 2 DIR 2 REL 3 DIR 3 IMM 3 IMM 3 IX1+ 4 SP1 2 IX+ 1 INH 2 REL 2 IMM 2 DIR 3 EXT 3 IX2 4 SP2 2 IX1 3 SP1 1 IX
5 4 3 5 7 3 2 3 2 3 4 4 5 3 4 2
2 BRSET1 BSET1 BHI MUL DIV NSA DAA BGT SBC SBC SBC SBC SBC SBC SBC SBC
3 DIR 2 DIR 2 REL 1 INH 1 INH 1 INH 1 INH 2 REL 2 IMM 2 DIR 3 EXT 3 IX2 4 SP2 2 IX1 3 SP1 1 IX
5 4 3 4 1 1 4 5 3 9 3 2 3 4 4 5 3 4 2
3 BRCLR1 BCLR1 BLS COM COMA COMX COM COM COM SWI BLE CPX CPX CPX CPX CPX CPX CPX CPX
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 3 SP1 1 IX 1 INH 2 REL 2 IMM 2 DIR 3 EXT 3 IX2 4 SP2 2 IX1 3 SP1 1 IX
5 4 3 4 1 1 4 5 3 2 2 2 3 4 4 5 3 4 2
4 BRSET2 BSET2 BCC LSR LSRA LSRX LSR LSR LSR TAP TXS AND AND AND AND AND AND AND AND
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 3 SP1 1 IX 1 INH 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 4 SP2 2 IX1 3 SP1 1 IX
5 4 3 4 3 4 3 4 1 2 2 3 4 4 5 3 4 2
5 BRCLR2 BCLR2 BCS STHX LDHX LDHX CPHX CPHX TPA TSX BIT BIT BIT BIT BIT BIT BIT BIT
3 DIR 2 DIR 2 REL 2 DIR 3 IMM 2 DIR 3 IMM 2 DIR 1 INH 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 4 SP2 2 IX1 3 SP1 1 IX
5 4 3 4 1 1 4 5 3 2 2 3 4 4 5 3 4 2
6 BRSET3 BSET3 BNE ROR RORA RORX ROR ROR ROR PULA LDA LDA LDA LDA LDA LDA LDA LDA
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 3 SP1 1 IX 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 4 SP2 2 IX1 3 SP1 1 IX
5 4 3 4 1 1 4 5 3 2 1 2 3 4 4 5 3 4 2
7 BRCLR3 BCLR3 BEQ ASR ASRA ASRX ASR ASR ASR PSHA TAX AIS STA STA STA STA STA STA STA
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 3 SP1 1 IX 1 INH 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 4 SP2 2 IX1 3 SP1 1 IX
5 4 3 4 1 1 4 5 3 2 1 2 3 4 4 5 3 4 2
8 BRSET4 BSET4 BHCC LSL LSLA LSLX LSL LSL LSL PULX CLC EOR EOR EOR EOR EOR EOR EOR EOR
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 3 SP1 1 IX 1 INH 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 4 SP2 2 IX1 3 SP1 1 IX
5 4 3 4 1 1 4 5 3 2 1 2 3 4 4 5 3 4 2
9 BRCLR4 BCLR4 BHCS ROL ROLA ROLX ROL ROL ROL PSHX SEC ADC ADC ADC ADC ADC ADC ADC ADC
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 3 SP1 1 IX 1 INH 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 4 SP2 2 IX1 3 SP1 1 IX
5 4 3 4 1 1 4 5 3 2 2 2 3 4 4 5 3 4 2
A BRSET5 BSET5 BPL DEC DECA DECX DEC DEC DEC PULH CLI ORA ORA ORA ORA ORA ORA ORA ORA
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 3 SP1 1 IX 1 INH 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 4 SP2 2 IX1 3 SP1 1 IX
5 4 3 5 3 3 5 6 4 2 2 2 3 4 4 5 3 4 2
B BRCLR5 BCLR5 BMI DBNZ DBNZA DBNZX DBNZ DBNZ DBNZ PSHH SEI ADD ADD ADD ADD ADD ADD ADD ADD
3 DIR 2 DIR 2 REL 3 DIR 2 INH 2 INH 3 IX1 4 SP1 2 IX 1 INH 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 4 SP2 2 IX1 3 SP1 1 IX
5 4 3 4 1 1 4 5 3 1 1 2 3 4 3 2
C BRSET6 BSET6 BMC INC INCA INCX INC INC INC CLRH RSP JMP JMP JMP JMP JMP
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 3 SP1 1 IX 1 INH 1 INH 2 DIR 3 EXT 3 IX2 2 IX1 1 IX
5 4 3 3 1 1 3 4 2 1 4 4 5 6 5 4
D BRCLR6 BCLR6 BMS TST TSTA TSTX TST TST TST NOP BSR JSR JSR JSR JSR JSR
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 3 SP1 1 IX 1 INH 2 REL 2 DIR 3 EXT 3 IX2 2 IX1 1 IX
5 4 3 5 4 4 4 1 2 3 4 4 5 3 4 2
E BRSET7 BSET7 BIL MOV MOV MOV MOV STOP LDX LDX LDX LDX LDX LDX LDX LDX
3 DIR 2 DIR 2 REL 3 DD 2 DIX+ 3 IMD 2 IX+D 1 INH * 2 IMM 2 DIR 3 EXT 3 IX2 4 SP2 2 IX1 3 SP1 1 IX
Freescale Semiconductor
5 4 3 3 1 1 3 4 2 1 1 2 3 4 4 5 3 4 2
F BRCLR7 BCLR7 BIH CLR CLRA CLRX CLR CLR CLR WAIT TXA AIX STX STX STX STX STX STX STX
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 3 SP1 1 IX 1 INH 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 4 SP2 2 IX1 3 SP1 1 IX
INH Inherent REL Relative SP1 Stack Pointer, 8-Bit Offset MSB
IMM Immediate IX Indexed, No Offset SP2 Stack Pointer, 16-Bit Offset 0 High Byte of Opcode in Hexadecimal
DIR Direct IX1 Indexed, 8-Bit Offset IX+ Indexed, No Offset with LSB
EXT Extended IX2 Indexed, 16-Bit Offset Post Increment 5 Cycles
DD Direct-Direct IMD Immediate-Direct IX1+ Indexed, 1-Byte Offset with Low Byte of Opcode in Hexadecimal 0 BRSET0 Opcode Mnemonic
IX+D Indexed-Direct DIX+ Direct-Indexed Post Increment 3 DIR Number of Bytes / Addressing Mode
*Pre-byte for stack pointer indexed instructions
Chapter 7
Internal Clock Generator (ICG) Module)
7.1 Introduction
The internal clock generator module (ICG) is used to create a stable clock source for the microcontroller
without using any external components. The ICG generates the oscillator output clock (CGMXCLK),
which is used by the low-voltage inhibit (LVI) and other modules. The ICG also generates the clock
generator output (CGMOUT), which is fed to the system integration module (SIM) to create the bus
clocks. The bus frequency will be one-fourth the frequency of CGMXCLK and one-half the frequency of
CGMOUT. Finally, the ICG generates the timebase clock (TBMCLK), which is used in the timebase
module (TBM) and the computer operating properly (COP) clock (COPCLK) which is used by the COP
module.
7.2 Features
The ICG has these features:
• Selectable external clock generator, either 1-pin external source or 2-pin crystal, multiplexed with
port pins
• Internal clock generator with programmable frequency output in integer multiples of a nominal
frequency (307.2 kHz ± 25 percent)
• Frequency adjust (trim) register to improve variability to ±4 percent
• Bus clock software selectable from either internal or external clock (bus frequency range from
76.8 kHz ± 25 percent to 9.75 MHz ± 25 percent in 76.8-kHz increments
NOTE
Do not exceed the maximum bus frequency of 8 MHz at 5.0 V and 4 MHz
at 3.0 V.
• Timebase clock automatically selected from external if external clock is available
• Clock monitor for both internal and external clocks
Freescale Semiconductor 77
Internal Clock Generator (ICG) Module)
INTERNAL BUS
M68HC08 CPU
PORTA
PTA7/KBD7–
DDRA
CPU ARITHMETIC/LOGIC PROGRAMMABLE TIMEBASE
MODULE PTA0/KBD0(1)
REGISTERS UNIT (ALU)
PTB7/AD7
CONTROL AND STATUS SINGLE BREAKPOINT BREAK
REGISTERS — 64 BYTES MODULE PTB6/AD6
PTB5/AD5
PORTB
PTB4/AD4
DDRB
USER FLASH
DUAL VOLTAGE
MC68HC908GT16 — 15,872 BYTES LOW-VOLTAGE INHIBIT MODULE PTB3/AD3
MC68HC908GT8 — 7,680 BYTES PTB2/AD2
PTB1/AD1
8-BIT KEYBOARD
USER RAM — 512 BYTES INTERRUPT MODULE PTB0/AD0
PTC6(1)
MONITOR ROM — 304 BYTES 2-CHANNEL TIMER INTERFACE PTC5(1)
MODULE 1 PTC4(1)(2)
PORTC
DDRC
FLASH PROGRAMMING ROUTINES
PTC3(1)(2)
ROM — 720 BYTES
2-CHANNEL TIMER INTERFACE PTC2(1)(2)
MODULE 2 PTC1(1)(2)
USER FLASH VECTOR SPACE — 36 BYTES
PTC0(1)(2)
SERIAL COMMUNICATIONS
PTE4/OSC1 INTERFACE MODULE PTD7/T2CH1(1)
INTERNAL CLOCK
GENERATOR MODULE PTD6/T2CH0(1)
PTE3/OSC2
COMPUTER OPERATING PTD5/T1CH1(1)
PTD4/T1CH0(1)
PORTD
PROPERLY MODULE
DDRD
PTD3/SPSCK(1)
SYSTEM INTEGRATION PTD2/MOSI(1)
RST(3) SERIAL PERIPHERAL
MODULE
INTERFACE MODULE PTD1/MISO(1)
PTD0/SS(1)
SINGLE EXTERNAL
IRQ(3)
INTERRUPT MODULE MONITOR MODULE PTE2
PORTE
DDRE
VREFH PTE1/RxD
8-BIT ANALOG-TO-DIGITAL
CONVERTER MODULE MEMORY MAP PTE0/TxD
VREFL
MODULE
POWER-ON RESET
MODULE CONFIGURATION REGISTER 1 SECURITY
MODULE MODULE
VDD
VSS
VDDA POWER CONFIGURATION REGISTER 2
MODULE MONITOR MODE ENTRY
VSSA
MODULE
78 Freescale Semiconductor
Functional Description
CS CGMOUT
RESET CGMXCLK
CLOCK
SELECTION TBMCLK
CIRCUIT COPCLK
IOFF
EOFF
CMON ECGS
CLOCK ICGS
MONITOR
CIRCUIT
FICGS
DDIV[3:0]
INTERNAL CLOCK
N[6:0} DSTG[7:0]
GENERATOR
TRIM[7:0] ICLK
IBASE
ICGEN
SIMOSCEN
OSCENINSTOP CLOCK/PIN
ENABLE
EXTCLKEN CIRCUIT
ECGON
ICGON
ECGEN
PTE4 PTE3
INTERNAL LOGIC LOGIC
TO MCU OSC1 OSC2
PTE4 PTE3
EXTERNAL
Freescale Semiconductor 79
Internal Clock Generator (ICG) Module)
80 Freescale Semiconductor
Functional Description
ICGEN
TRIM[7:0] N[6:0]
FREQUENCY MODULO
COMPARATOR N
CLOCK GENERATOR DIVIDER
IBASE
Freescale Semiconductor 81
Internal Clock Generator (ICG) Module)
1. x = Maximum error is independent of value in DDIV[3:0]. DDIV increments or decrements when an addition to DSTG[7:0]
carries or borrows.
82 Freescale Semiconductor
Functional Description
ECGEN
ECLK
INPUT PATH
EXTXTALEN
EXTERNAL AMPLIFIER
CLOCK
GENERATOR
EXTSLOW
OSC1 OSC2
INTERNAL TO MCU
PTE4 PTE3
EXTERNAL
RB
Freescale Semiconductor 83
Internal Clock Generator (ICG) Module)
In its typical configuration, the external oscillator requires five external components:
1. Crystal, X1
2. Fixed capacitor, C1
3. Tuning capacitor, C2 (can also be a fixed capacitor)
4. Feedback resistor, RB
5. Series resistor, RS (Included in Figure 7-4 to follow strict Pierce oscillator guidelines and may not
be required for all ranges of operation, especially with high frequency crystals. Refer to the crystal
manufacturer’s data for more information.)
84 Freescale Semiconductor
Functional Description
FICGS FICGS
ICLK
IBASE ACTIVITY
IBASE DETECTOR
ICGEN ICGEN
IBASE EREF
ICGON
ECLK ESTBCLK
ECGEN IREF
ECLK
ECGEN ECGEN ACTIVITY
DETECTOR
ECLK ECLK
To conserve size, the long divider (divide by 4096) is also used as an external crystal stabilization divider.
The divider is reset when the external clock generator is turned off or in stop mode (ECGEN is clear).
When the external clock generator is first turned on, the external clock generator stable bit (ECGS) will
be clear. This condition automatically selects ECLK as the input to the long divider. The external
stabilization clock (ESTBCLK) will be ECLK divided by 16 when EXTXTALEN is low or 4096 when
EXTXTALEN is high. This timeout allows the crystal to stabilize. The falling edge of ESTBCLK is used to
set ECGS, which will set after a full 16 or 4096 cycles. When ECGS is set, the divider returns to its normal
function. ESTBCLK may be generated by either IBASE or ECLK, but any clocking will only reinforce the
set condition. If ECGS is cleared because the clock monitor determined that ECLK was inactive, the
divider will revert to a stabilization divider. Since this will change the EREF and IREF divide ratios, it is
important to turn the clock monitor off (CMON = 0) after inactivity is detected to ensure valid recovery.
Freescale Semiconductor 85
Internal Clock Generator (ICG) Module)
CMON
IOFF
EREF CK Q
1/4
R
R R R
D D Q D Q ICGS
DFFRS DFFRR DFFRR
IBASE CK Q CK CK
S R R
DLF MEASURE
OUTPUT CLOCK
ICGEN
FICGS
86 Freescale Semiconductor
Functional Description
CMON
EOFF
IREF CK Q
1/4
R
R R
D D
DFFRS DFFRR
ECLK CK Q CK Q EGGS
S R
ESTBCLK
ECGEN
ICLK ICLK
ECLK ECLK DIV2
SYNCHRONIZING
IOFF IOFF CLOCK
SWITCHER
EOFF EOFF
FORCE_I CGMOUT
RESET
VSS FORCE_E
ICLK COPCLK
ECLK
SYNCHRONIZING
IOFF CLOCK
SWITCHER
EOFF
FORCE_I
FORCE_E
Freescale Semiconductor 87
Internal Clock Generator (ICG) Module)
88 Freescale Semiconductor
Usage Notes
Freescale Semiconductor 89
Internal Clock Generator (ICG) Module)
90 Freescale Semiconductor
Usage Notes
quantized steps as the DLF increments or decrements its output. The following sections describe how
each block will affect the output frequency.
Freescale Semiconductor 91
Internal Clock Generator (ICG) Module)
92 Freescale Semiconductor
Usage Notes
Settling time depends primarily on how many corrections it takes to change the clock period and the
period of each correction. Since the corrections require four periods of the low-frequency base clock
(4*τIBASE), and since ICLK is N (the ICG multiply factor for the desired frequency) times faster than
IBASE, each correction takes 4*N*τICLK. The period of ICLK, however, will vary as the corrections occur.
The equations for τ15, τ5, and τtot are dependent on the actual initial and final clock periods τ1 and τ2, not
the nominal. This means the variability in the ICLK frequency due to process, temperature, and voltage
must be considered. Additionally, other process factors and noise can affect the actual tolerances of the
points at which the filter changes modes. This means a worst case adjustment of up to 35 percent (ICLK
Freescale Semiconductor 93
Internal Clock Generator (ICG) Module)
clock period tolerance plus 10 percent) must be added. This adjustment can be reduced with trimming.
Table 7-3 shows some typical values for settling time.
Table 7-3. Typical Settling Time Examples
τ1 τ2 N τ15 τ5 τtot
94 Freescale Semiconductor
CONFIG2 Options
Freescale Semiconductor 95
Internal Clock Generator (ICG) Module)
96 Freescale Semiconductor
Input/Output (I/O) Registers
ICG DCO Stage Control Read: DSTG7 DSTG6 DSTG5 DSTG4 DSTG3 DSTG2 DSTG1 DSTG0
$003A Register (ICGDSR) Write: R R R R R R R R
See page 100. Reset: Unaffected by reset
DSTG[7:0]
TRIM[7:0]
DDIV[3:0]
ECGON
ICGON
CMON
N[6:0]
ECGS
Condition
CMIE
ICGS
CMF
CS
Freescale Semiconductor 97
Internal Clock Generator (ICG) Module)
Address: $0036
Bit 7 6 5 4 3 2 1 Bit 0
Read: CMF ICGS ECGS
CMIE CMON CS ICGON ECGON
Write: 0(1)
Reset: 0 0 0 0 1 0 0 0
1. See CMF bit description for method of clearing CMF bit.
= Unimplemented
98 Freescale Semiconductor
Input/Output (I/O) Registers
Address: $0037
Bit 7 6 5 4 3 2 1 Bit 0
Read:
N6 N5 N4 N3 N2 N1 N0
Write:
Reset: 0 0 0 1 0 1 0 1
= Unimplemented
Freescale Semiconductor 99
Internal Clock Generator (ICG) Module)
8.1 Introduction
The IRQ (external interrupt) module provides a maskable interrupt input.
8.2 Features
Features of the IRQ module include:
• A dedicated external interrupt pin (IRQ)
• IRQ interrupt control bits
• Hysteresis buffer
• Programmable edge-only or edge and level interrupt sensitivity
• Automatic interrupt acknowledge
• Internal pullup resistor
INTERNAL BUS
M68HC08 CPU
PORTA
PTA7/KBD7–
DDRA
CPU ARITHMETIC/LOGIC PROGRAMMABLE TIMEBASE
MODULE PTA0/KBD0(1)
REGISTERS UNIT (ALU)
PTB7/AD7
CONTROL AND STATUS SINGLE BREAKPOINT BREAK
REGISTERS — 64 BYTES MODULE PTB6/AD6
PTB5/AD5
PORTB
PTB4/AD4
DDRB
USER FLASH
DUAL VOLTAGE
MC68HC908GT16 — 15,872 BYTES LOW-VOLTAGE INHIBIT MODULE PTB3/AD3
MC68HC908GT8 — 7,680 BYTES PTB2/AD2
PTB1/AD1
8-BIT KEYBOARD
USER RAM — 512 BYTES INTERRUPT MODULE PTB0/AD0
PTC6(1)
MONITOR ROM — 304 BYTES 2-CHANNEL TIMER INTERFACE PTC5(1)
MODULE 1 PTC4(1)(2)
PORTC
DDRC
FLASH PROGRAMMING ROUTINES
PTC3(1)(2)
ROM — 720 BYTES
2-CHANNEL TIMER INTERFACE PTC2(1)(2)
MODULE 2 PTC1(1)(2)
USER FLASH VECTOR SPACE — 36 BYTES
PTC0(1)(2)
SERIAL COMMUNICATIONS
PTE4/OSC1 INTERFACE MODULE PTD7/T2CH1(1)
INTERNAL CLOCK
GENERATOR MODULE PTD6/T2CH0(1)
PTE3/OSC2
COMPUTER OPERATING PTD5/T1CH1(1)
PTD4/T1CH0(1)
PORTD
PROPERLY MODULE
DDRD
PTD3/SPSCK(1)
SYSTEM INTEGRATION PTD2/MOSI(1)
RST(3) SERIAL PERIPHERAL
MODULE
INTERFACE MODULE PTD1/MISO(1)
PTD0/SS(1)
SINGLE EXTERNAL
IRQ(3)
INTERRUPT MODULE MONITOR MODULE PTE2
PORTE
DDRE
VREFH PTE1/RxD
8-BIT ANALOG-TO-DIGITAL
CONVERTER MODULE MEMORY MAP PTE0/TxD
VREFL
MODULE
POWER-ON RESET
MODULE CONFIGURATION REGISTER 1 SECURITY
MODULE MODULE
VDD
VSS
VDDA POWER CONFIGURATION REGISTER 2
MODULE MONITOR MODE ENTRY
VSSA
MODULE
RESET
ACK
TO CPU FOR
VECTOR
INTERNAL ADDRESS BUS
BIL/BIH
FETCH INSTRUCTIONS
DECODER
VDD
INTERNAL VDD
PULLUP IRQF
DEVICE
CLR
D Q IRQ
SYNCHRONIZER
CK INTERRUPT
IRQ REQUEST
IMASK
MODE
HIGH TO MODE
VOLTAGE SELECT
DETECT LOGIC
The vector fetch or software clear may occur before or after the interrupt pin returns to logic 1. As long as
the pin is low, the interrupt request remains pending. A reset will clear the latch and the MODE control bit,
thereby clearing the interrupt even if the pin stays low.
When set, the IMASK bit in the INTSCR mask all external interrupt requests. A latched interrupt request
is not presented to the interrupt priority logic unless the IMASK bit is clear.
NOTE
The interrupt mask (I) in the condition code register (CCR) masks all
interrupt requests, including external interrupt requests.
IRQ pin and require software to clear the IRQ latch. Writing to the ACK bit prior to leaving an
interrupt service routine can also prevent spurious interrupts due to noise. Setting ACK does not
affect subsequent transitions on the IRQ pin. A falling edge that occurs after writing to the ACK bit
another interrupt request. If the IRQ mask bit, IMASK, is clear, the CPU loads the program counter
with the vector address at locations $FFFA and $FFFB.
• Return of the IRQ pin to logic 1 — As long as the IRQ pin is at logic 0, IRQ remains active.
The vector fetch or software clear and the return of the IRQ pin to logic 1 may occur in any order. The
interrupt request remains pending as long as the IRQ pin is at logic 0. A reset will clear the latch and the
MODE control bit, thereby clearing the interrupt even if the pin stays low.
If the MODE bit is clear, the IRQ pin is falling-edge-sensitive only. With MODE clear, a vector fetch or
software clear immediately clears the IRQ latch.
The IRQF bit in the INTSCR register can be used to check for pending interrupts. The IRQF bit is not
affected by the IMASK bit, which makes it useful in applications where polling is preferred.
Use the BIH or BIL instruction to read the logic level on the IRQ pin.
NOTE
When using the level-sensitive interrupt trigger, avoid false interrupts by
masking interrupt requests in the interrupt routine.
Address: $001D
Bit 7 6 5 4 3 2 1 Bit 0
Read: IRQF 0
IMASK MODE
Write: ACK
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
Figure 8-4. IRQ Status and Control Register (INTSCR)
9.1 Introduction
The keyboard interrupt module (KBI) provides eight independently maskable external interrupts which are
accessible via PTA0–PTA7. When a port pin is enabled for keyboard interrupt function, an internal pullup
device is also enabled on the pin.
9.2 Features
Features include:
• Eight keyboard interrupt pins with separate keyboard interrupt enable bits and one keyboard
interrupt mask
• Hysteresis buffers
• Programmable edge-only or edge- and level- interrupt sensitivity
• Exit from low-power modes
• I/O (input/output) port bit(s) software configurable with pullup device(s) if configured as input port
bit(s)
INTERNAL BUS
M68HC08 CPU
PORTA
PTA7/KBD7–
DDRA
CPU ARITHMETIC/LOGIC PROGRAMMABLE TIMEBASE
MODULE PTA0/KBD0(1)
REGISTERS UNIT (ALU)
PTB7/AD7
CONTROL AND STATUS SINGLE BREAKPOINT BREAK
REGISTERS — 64 BYTES MODULE PTB6/AD6
PTB5/AD5
PORTB
PTB4/AD4
DDRB
USER FLASH
DUAL VOLTAGE
MC68HC908GT16 — 15,872 BYTES LOW-VOLTAGE INHIBIT MODULE PTB3/AD3
MC68HC908GT8 — 7,680 BYTES PTB2/AD2
PTB1/AD1
8-BIT KEYBOARD
USER RAM — 512 BYTES INTERRUPT MODULE PTB0/AD0
PTC6(1)
MONITOR ROM — 304 BYTES 2-CHANNEL TIMER INTERFACE PTC5(1)
MODULE 1 PTC4(1)(2)
PORTC
DDRC
FLASH PROGRAMMING ROUTINES
PTC3(1)(2)
ROM — 720 BYTES
2-CHANNEL TIMER INTERFACE PTC2(1)(2)
MODULE 2 PTC1(1)(2)
USER FLASH VECTOR SPACE — 36 BYTES
PTC0(1)(2)
SERIAL COMMUNICATIONS
PTE4/OSC1 INTERFACE MODULE PTD7/T2CH1(1)
INTERNAL CLOCK
GENERATOR MODULE PTD6/T2CH0(1)
PTE3/OSC2
COMPUTER OPERATING PTD5/T1CH1(1)
PTD4/T1CH0(1)
PORTD
PROPERLY MODULE
DDRD
PTD3/SPSCK(1)
SYSTEM INTEGRATION PTD2/MOSI(1)
RST(3) SERIAL PERIPHERAL
MODULE
INTERFACE MODULE PTD1/MISO(1)
PTD0/SS(1)
SINGLE EXTERNAL
IRQ(3)
INTERRUPT MODULE MONITOR MODULE PTE2
PORTE
DDRE
VREFH PTE1/RxD
8-BIT ANALOG-TO-DIGITAL
CONVERTER MODULE MEMORY MAP PTE0/TxD
VREFL
MODULE
POWER-ON RESET
MODULE CONFIGURATION REGISTER 1 SECURITY
MODULE MODULE
VDD
VSS
VDDA POWER CONFIGURATION REGISTER 2
MODULE MONITOR MODE ENTRY
VSSA
MODULE
INTERNAL BUS
VECTOR FETCH
DECODER
ACKK
KBD0
VDD RESET
KEYF
. CLR
TO PULLUP ENABLE D Q
SYNCHRONIZER
. CK
KB0IE
. KEYBOARD
INTERRUPT
IMASKK REQUEST
KBD7
KB7IE
If the MODEK bit is set, the keyboard interrupt pins are both falling edge- and low-level sensitive, and both
of the following actions must occur to clear a keyboard interrupt request:
• Vector fetch or software clear — A vector fetch generates an interrupt acknowledge signal to clear
the interrupt request. Software may generate the interrupt acknowledge signal by writing a 1 to the
ACKK bit in the keyboard status and control register (INTKBSCR). The ACKK bit is useful in
applications that poll the keyboard interrupt pins and require software to clear the keyboard
interrupt request. Writing to the ACKK bit prior to leaving an interrupt service routine can also
prevent spurious interrupts due to noise. Setting ACKK does not affect subsequent transitions on
the keyboard interrupt pins. A falling edge that occurs after writing to the ACKK bit latches another
interrupt request. If the keyboard interrupt mask bit, IMASKK, is clear, the CPU loads the program
counter with the vector address at locations $FFE0 and $FFE1.
• Return of all enabled keyboard interrupt pins to logic 1 — As long as any enabled keyboard
interrupt pin is at logic 0, the keyboard interrupt remains set.
The vector fetch or software clear and the return of all enabled keyboard interrupt pins to logic 1 may occur
in any order.
If the MODEK bit is clear, the keyboard interrupt pin is falling-edge-sensitive only. With MODEK clear, a
vector fetch or software clear immediately clears the keyboard interrupt request.
Reset clears the keyboard interrupt request and the MODEK bit, clearing the interrupt request even if a
keyboard interrupt pin stays at logic 0.
The keyboard flag bit (KEYF) in the keyboard status and control register can be used to see if a pending
interrupt exists. The KEYF bit is not affected by the keyboard interrupt mask bit (IMASKK) which makes
it useful in applications where polling is preferred.
To determine the logic level on a keyboard interrupt pin, use the data direction register to configure the
pin as an input and read the data register.
NOTE
Setting a keyboard interrupt enable bit (KBIEx) forces the corresponding
keyboard interrupt pin to be an input, overriding the data direction register.
However, the data direction register bit must be a 0 for software to read the
pin.
Address: $001A
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0 KEYF 0
IMASKK MODEK
Write: ACKK
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
Address: $001B
Bit 7 6 5 4 3 2 1 Bit 0
Read:
KBIE7 KBIE6 KBIE5 KBIE4 KBIE3 KBIE2 KBIE1 KBIE0
Write:
Reset: 0 0 0 0 0 0 0 0
10.1 Introduction
This section describes the low-voltage inhibit (LVI) module, which monitors the voltage on the VDD pin
and can force a reset when the VDD voltage falls below the LVI trip falling voltage, VTRIPF.
10.2 Features
Features of the LVI module include:
• Programmable LVI reset
• Selectable LVI trip voltage
• Programmable stop mode operation
LVISTOP, LVIPWRD, LVI5OR3, and LVIRSTD are in the configuration register (CONFIG1). See Figure
4-2. Configuration Register 1 (CONFIG1) for details of the LVI’s configuration bits. Once an LVI reset
occurs, the MCU remains in reset until VDD rises above a voltage, VTRIPR, which causes the MCU to exit
reset. See 15.3.2.5 Low-Voltage Inhibit (LVI) Reset for details of the interaction between the SIM and the
LVI. The output of the comparator controls the state of the LVIOUT flag in the LVI status register (LVISR).
An LVI reset also drives the RST pin low to provide low-voltage protection to external peripheral devices.
VDD
STOP INSTRUCTION
LVISTOP
FROM CONFIG1
FROM CONFIG1
LVIRSTD
LVIPWRD
FROM CONFIG
LVIOUT
LVI5OR3
FROM CONFIG1
continually entering and exiting reset if VDD is approximately equal to VTRIPF. VTRIPR is greater than
VTRIPF by the hysteresis voltage, VHYS.
Address: $FE0C
Bit 7 6 5 4 3 2 1 Bit 0
Read: LVIOUT 0 0 0 0 0 0 0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
11.1 Introduction
The microcontroller (MCU) may enter two low-power modes: wait mode and stop mode. They are
common to all HC08 MCUs and are entered through instruction execution. This section describes how
each module acts in the low-power modes.
• Timer 2 interface module (TIM2) interrupt — A CPU interrupt request from the TIM2 loads the
program counter with the contents of:
– $FFEC and $FFED; TIM2 overflow
– $FFEE and $FFEF; TIM2 channel 1
– $FFF0 and $FFF1; TIM2 channel 0
• Serial peripheral interface module (SPI) interrupt — A CPU interrupt request from the SPI loads
the program counter with the contents of:
– $FFE8 and $FFE9; SPI transmitter
– $FFEA and $FFEB; SPI receiver
• Serial communications interface module (SCI) interrupt — A CPU interrupt request from the SCI
loads the program counter with the contents of:
– $FFE2 and $FFE3; SCI transmitter
– $FFE4 and $FFE5; SCI receiver
– $FFE6 and $FFE7; SCI receiver error
• Analog-to-digital converter module (ADC) interrupt — A CPU interrupt request from the ADC loads
the program counter with the contents of: $FFDE and $FFDF; ADC conversion complete.
• Timebase module (TBM) interrupt — A CPU interrupt request from the TBM loads the program
counter with the contents of: $FFDC and $FFDD; TBM interrupt.
12.1 Introduction
Bidirectional input-output (I/O) pins form five parallel ports. All I/O pins are programmable as inputs or
outputs. All individual bits within port A, port C, and port D are software configurable with pullup devices
if configured as input port bits. The pullup devices are automatically and dynamically disabled when a port
bit is switched to output mode.
NOTE
Connect any unused I/O pins to an appropriate logic level, either VDD or
VSS. Although the I/O ports do not require termination for proper operation,
termination reduces excess current consumption and the possibility of
electrostatic damage.
12.2 Port A
Port A is an 8-bit special-function port that shares all eight of its pins with the keyboard interrupt (KBI)
module. Port A also has software configurable pullup devices if configured as an input port.
Address: $0000
Bit 7 6 5 4 3 2 1 Bit 0
Read:
PTA7 PTA6 PTA5 PTA4 PTA3 PTA2 PTA1 PTA0
Write:
Reset: Unaffected by reset
Alternative
KBD7 KBD6 KBD5 KBD4 KBD3 KBD2 KBD1 KBD0
Function:
Address: $0004
Bit 7 6 5 4 3 2 1 Bit 0
Read:
DDRA7 DDRA6 DDRA5 DDRA4 DDRA3 DDRA2 DDRA1 DDRA0
Write:
Reset: 0 0 0 0 0 0 0 0
VDD
READ DDRA ($0004)
PTAPUEx
WRITE DDRA ($0004)
DDRAx
RESET 45 k
INTERNAL DATA BUS
1. X = Don’t care
2. I/O pin pulled up to VDD by internal pullup device
3. Writing affects data register, but does not affect input.
4. Hi-Z = High impedance
12.3 Port B
Port B is an 8-bit special-function port that shares all eight of its pins with the analog-to-digital converter
(ADC) module.
Address: $0005
Bit 7 6 5 4 3 2 1 Bit 0
Read:
DDRB7 DDRB6 DDRB5 DDRB4 DDRB3 DDRB2 DDRB1 DDRB0
Write:
Reset: 0 0 0 0 0 0 0 0
RESET
1. X = Don’t care
2. Hi-Z = High impedance
3. Writing affects data register, but does not affect input.
12.4 Port C
Port C is a 7-bit, general-purpose bidirectional I/O port. Port C also has software configurable pullup
devices if configured as an input port.
Address: $0002
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0
PTC6 PTC5 PTC4 PTC3 PTC2 PTC1 PTC0
Write:
Reset: Unaffected by reset
= Unimplemented
Address: $0006
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0
DDRC6 DDRC5 DDRC4 DDRC3 DDRC2 DDRC1 DDRC0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
VDD
READ DDRC ($0006)
PTCPUEx
WRITE DDRC ($0006)
INTERNAL DATA BUS DDRCx
RESET 45 k
1. X = Don’t care
2. I/O pin pulled up to VDD by internal pullup device.
3. Writing affects data register, but does not affect input.
4. Hi-Z = High impedance
Address: $000E
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0
PTCPUE6 PTCPUE5 PTCPUE4 PTCPUE3 PTCPUE2 PTCPUE1 PTCPUE0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
12.5 Port D
Port D is an 8-bit special-function port that shares four of its pins with the serial peripheral interface (SPI)
module and four of its pins with two timer interface (TIM1 and TIM2) modules. Port D also has software
configurable pullup devices if configured as an input port.
Address: $0003
Bit 7 6 5 4 3 2 1 Bit 0
Read:
PTD7 PTD6 PTD5 PTD4 PTD3 PTD2 PTD1 PTD0
Write:
Reset: Unaffected by reset
Alternative Function: T2CH1 T2CH0 T1CH1 T1CH0 SPSCK MOSI MISO SS
Data direction register D (DDRD) does not affect the data direction of port D pins that are being used
by the SPI module. However, the DDRD bits always determine whether reading port D returns the
states of the latches or the states of the pins. See Table 12-5.
SS — Slave Select
The PTD0/SS pin is the slave select input of the SPI module. When the SPE bit is clear, or when the
SPI master bit, SPMSTR, is set, the PTD0/SS pin is available for general-purpose I/O. When the SPI
is enabled, the DDRB0 bit in data direction register B (DDRB) has no effect on the PTD0/SS pin.
Address: $0007
Bit 7 6 5 4 3 2 1 Bit 0
Read:
DDRD7 DDRD6 DDRD5 DDRD4 DDRD3 DDRD2 DDRD1 DDRD0
Write:
Reset: 0 0 0 0 0 0 0 0
VDD
READ DDRD ($0007)
PTDPUEx
WRITE DDRD ($0007)
DDRDx
RESET 30 k
INTERNAL DATA BUS
When bit DDRDx is a 1, reading address $0003 reads the PTDx data latch. When bit DDRDx is a 0,
reading address $0003 reads the voltage level on the pin. The data latch can always be written,
regardless of the state of its data direction bit. Table 12-5 summarizes the operation of the port D pins.
Table 12-5. Port D Pin Functions
1. X = Don’t care
2. I/O pin pulled up to VDD by internal pullup device.
3. Writing affects data register, but does not affect input.
4. Hi-Z = High imp[edance
Address: $000F
Bit 7 6 5 4 3 2 1 Bit 0
Read:
PTDPUE7 PTDPUE6 PTDPUE5 PTDPUE4 PTDPUE3 PTDPUE2 PTDPUE1 PTDPUE0
Write:
Reset: 0 0 0 0 0 0 0 0
12.6 Port E
Port E is a 5-bit special-function port that shares two of its pins with the serial communications interface
(SCI) module and two of its pins with the internal clock generator (ICG).
Address: $0008
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0
PTE4 PTE3 PTE2 PTE1 PTE0
Write:
Reset: Unaffected by reset
Alternative Function: OSC1 OSC2 RxD TxD
= Unimplemented
Address: $000C
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0
DDRE4 DDRE3 DDRE2 DDRE1 DDRE0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
RESET
1. X = Don’t care
2. Hi-Z = High impedance
3. Writing affects data register, but does not affect input.
13.1 Introduction
Resets and interrupts are responses to exceptional events during program execution. A reset re-initializes
the MCU to its startup condition. An interrupt vectors the program counter to a service routine.
13.2 Resets
A reset immediately returns the MCU to a known startup condition and begins program execution from a
user-defined memory location.
13.2.1 Effects
A reset:
• Immediately stops the operation of the instruction being executed
• Initializes certain control and status bits
• Loads the program counter with a user-defined reset vector address from locations $FFFE and
$FFFF
• Selects CGMXCLK divided by four as the bus clock
INTERNAL
RESET
OSC1
PORRST(1)
4096 32 32
CYCLES CYCLES CYCLES
CGMXCLK
CGMOUT
RST PIN
INTERNAL
RESET
Address: $FE01
Bit 7 6 5 4 3 2 1 Bit 0
Read: POR PIN COP ILOP ILAD MODRST LVI 0
Write:
POR: 1 0 0 0 0 0 0 0
= Unimplemented
13.3 Interrupts
An interrupt temporarily changes the sequence of program execution to respond to a particular event. An
interrupt does not stop the operation of the instruction being executed, but begins when the current
instruction completes its operation.
13.3.1 Effects
An interrupt:
• Saves the CPU registers on the stack. At the end of the interrupt, the RTI instruction recovers the
CPU registers from the stack so that normal processing can resume.
• Sets the interrupt mask (I bit) to prevent additional interrupts. Once an interrupt is latched, no other
interrupt can take precedence, regardless of its priority.
• Loads the program counter with a user-defined vector address
•
•
•
•
•
•
CLI
INT1 PSHH
INT2 PSHH
FROM RESET
BREAK YES
INTERRUPT
?
NO
YES
IIBIT
BITSET?
SET?
NO
IRQ YES
INTERRUPT
?
NO
ICG YES
INTERRUPT
?
NO
OTHER YES
INTERRUPTS
?
NO
STACK CPU REGISTERS
SET I BIT
LOAD PC WITH INTERRUPT VECTOR
FETCH NEXT
INSTRUCTION
SWI YES
INSTRUCTION
?
NO
RTI YES
INSTRUCTION UNSTACK CPU REGISTERS
?
NO
EXECUTE INSTRUCTION
modifies the H register or uses the indexed addressing mode, save the H
register and then restore it prior to exiting the routine.
13.3.2 Sources
The sources in Table 13-1 can generate CPU interrupt requests.
• Mode fault bit (MODF) — The MODF bit is set in a slave SPI if the SS pin goes high during a
transmission with the mode fault enable bit (MODFEN) set. In a master SPI, the MODF bit is set if
the SS pin goes low at any time with the MODFEN bit set. The error interrupt enable bit, ERRIE,
enables MODF CPU interrupt requests. MODF, MODFEN, and ERRIE are in the SPI status and
control register.
• Overflow bit (OVRF) — The OVRF bit is set if software does not read the byte in the receive data
register before the next full byte enters the shift register. The error interrupt enable bit, ERRIE,
enables OVRF CPU interrupt requests. OVRF and ERRIE are in the SPI status and control
register.
Address: $FE04
Bit 7 6 5 4 3 2 1 Bit 0
Read: IF6 IF5 IF4 IF3 IF2 IF1 0 0
Write: R R R R R R R R
Reset: 0 0 0 0 0 0 0 0
R = Reserved
Address: $FE05
Bit 7 6 5 4 3 2 1 Bit 0
Read: IF14 IF13 IF12 IF11 IF10 IF9 IF8 IF7
Write: R R R R R R R R
Reset: 0 0 0 0 0 0 0 0
R = Reserved
Address: $FE06
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0 0 0 IF16 IF15
Write: R R R R R R R R
Reset: 0 0 0 0 0 0 0 0
R = Reserved
14.1 Introduction
The enhanced serial communications interface (ESCI) module allows asynchronous communications
with peripheral devices and other microcontroller units (MCU).
14.2 Features
Features include:
• Full-duplex operation
• Standard mark/space non-return-to-zero (NRZ) format
• Programmable baud rates
• Programmable 8-bit or 9-bit character length
• Separately enabled transmitter and receiver
• Separate receiver and transmitter central processor unit (CPU) interrupt requests
• Programmable transmitter output polarity
• Two receiver wakeup methods:
– Idle line wakeup
– address mark wakeup
• Interrupt-driven operation with eight interrupt flags:
– Transmitter empty
– Transmission complete
– Receiver full
– Idle receiver input
– Receiver overrun
– Noise error
– Framing error
– Parity error
• Receiver framing error detection
• Hardware parity checking
• 1/16 bit-time noise detection
INTERNAL BUS
M68HC08 CPU
PORTA
PTA7/KBD7–
DDRA
CPU ARITHMETIC/LOGIC PROGRAMMABLE TIMEBASE
MODULE PTA0/KBD0(1)
REGISTERS UNIT (ALU)
PTB7/AD7
CONTROL AND STATUS SINGLE BREAKPOINT BREAK
REGISTERS — 64 BYTES MODULE PTB6/AD6
PTB5/AD5
PORTB
PTB4/AD4
DDRB
USER FLASH
DUAL VOLTAGE
MC68HC908GT16 — 15,872 BYTES LOW-VOLTAGE INHIBIT MODULE PTB3/AD3
MC68HC908GT8 — 7,680 BYTES PTB2/AD2
PTB1/AD1
8-BIT KEYBOARD
USER RAM — 512 BYTES INTERRUPT MODULE PTB0/AD0
PTC6(1)
MONITOR ROM — 304 BYTES 2-CHANNEL TIMER INTERFACE PTC5(1)
MODULE 1 PTC4(1)(2)
PORTC
DDRC
FLASH PROGRAMMING ROUTINES
PTC3(1)(2)
ROM — 720 BYTES
2-CHANNEL TIMER INTERFACE PTC2(1)(2)
MODULE 2 PTC1(1)(2)
USER FLASH VECTOR SPACE — 36 BYTES
PTC0(1)(2)
SERIAL COMMUNICATIONS
PTE4/OSC1 INTERFACE MODULE PTD7/T2CH1(1)
INTERNAL CLOCK
GENERATOR MODULE PTD6/T2CH0(1)
PTE3/OSC2
COMPUTER OPERATING PTD5/T1CH1(1)
PTD4/T1CH0(1)
PORTD
PROPERLY MODULE
DDRD
PTD3/SPSCK(1)
SYSTEM INTEGRATION PTD2/MOSI(1)
RST(3) SERIAL PERIPHERAL
MODULE
INTERFACE MODULE PTD1/MISO(1)
PTD0/SS(1)
SINGLE EXTERNAL
IRQ(3)
INTERRUPT MODULE MONITOR MODULE PTE2
PORTE
DDRE
VREFH PTE1/RxD
8-BIT ANALOG-TO-DIGITAL
CONVERTER MODULE MEMORY MAP PTE0/TxD
VREFL
MODULE
POWER-ON RESET
MODULE CONFIGURATION REGISTER 1 SECURITY
MODULE MODULE
VDD
VSS
VDDA POWER CONFIGURATION REGISTER 2
MODULE MONITOR MODE ENTRY
VSSA
MODULE
INTERNAL BUS
INTERRUPT
INTERRUPT
RECEIVER
CONTROL
CONTROL
CONTROL
ERROR
RECEIVE TRANSMIT
RxD SHIFT REGISTER SHIFT REGISTER ARBITER- TxD
SCI_TxD
LINR TXINV
SCTIE
R8
TCIE
T8
SCRIE
ILIE
TE
SCTE
RE
TC
RWU
SCRF OR ORIE
SBK
IDLE NF NEIE
FE FEIE
PE PEIE
LOOPS
LOOPS ENSCI
BKF M
ENSCI LINT
RPF WAKE
ILTY
PRE- PRE- BAUD RATE PEN
SCALER ÷4 SCALER GENERATOR PTY
BUS CLOCK
÷ 16 DATA SELECTION
CONTROL
PARITY
8-BIT DATA FORMAT OR DATA
NEXT
START (BIT M IN SCC1 CLEAR) BIT
START
BIT BIT 0 BIT 1 BIT 2 BIT 3 BIT 4 BIT 5 BIT 6 BIT 7 STOP BIT
BIT
PARITY
9-BIT DATA FORMAT OR DATA NEXT
START (BIT M IN SCC1 SET) BIT START
BIT BIT 0 BIT 1 BIT 2 BIT 3 BIT 4 BIT 5 BIT 6 BIT 7 BIT 8 STOP BIT
BIT
Figure 14-3. SCI Data Formats
14.4.2 Transmitter
Figure 14-5 shows the structure of the SCI transmitter and the registers are summarized in Figure 14-4.
INTERNAL BUS
PRE- BAUD
÷4 SCALER DIVIDER
÷ 16 ESCI DATA REGISTER
SCP1
11-BIT
START
TRANSMIT
STOP
SCP0
SHIFT REGISTER
SCR1
H 8 7 6 5 4 3 2 1 0 L SCI_TxD
SCR2
SCR0
MSB
TRANSMITTER CPU INTERRUPT REQUEST
TXINV
SCALER
PRE-
SHIFT ENABLE
(ALL ZEROS)
PTY GENERATION
(ALL ONES)
PREAMBLE
PDS1
BREAK
PDS0
PSSB4 T8
PSSB3
TRANSMITTER
PSSB2 CONTROL LOGIC
PSSB1
PSSB0 SCTE SBK
SCTE
LOOPS
SCTIE
SCTIE ENSCI
TC
TC TE
TCIE
TCIE LINT
If the TE bit is cleared during a transmission, the TxD pin becomes idle after completion of the
transmission in progress. Clearing and then setting the TE bit during a transmission queues an idle
character to be sent after the character currently being transmitted.
NOTE
When queueing an idle character, return the TE bit to 1 before the stop bit
of the current character shifts out to the TxD pin. Setting TE after the stop
bit appears on TxD causes data previously written to the SCDR to be lost.
A good time to toggle the TE bit for a queued idle character is when the
SCTE bit becomes set and just before writing the next byte to the SCDR.
14.4.3 Receiver
Figure 14-6 shows the structure of the ESCI receiver. The receiver I/O registers are summarized in
Figure 14-4.
INTERNAL BUS
LINR SCR1
SCP1 SCR2 ESCI DATA REGISTER
SCP0 SCR0
PRE- BAUD
÷4 SCALER DIVIDER
÷ 16
START
11-BIT
STOP
RECEIVE SHIFT REGISTER
DATA
SCALER
H 8 7 6 5 4 3 2 1 0 L
PRE-
RxD RECOVERY
ALL ONES
ALL ZEROS
BKF
BUS CLOCK
PDS2
MSB
RPF
PDS1
PDS0
M RWU
PSSB4 SCRF
WAKE WAKEUP
PSSB3 IDLE
ILTY LOGIC
PSSB2
PSSB1 PEN PARITY R8
PSSB0 PTY CHECKING
IDLE
ILIE
ILIE
SCRF
SCRIE
SCRIE
CPU INTERRUPT
REQUEST
OR
OR
ORIE
ORIE
NF
INTERRUPT REQUEST
NF
ERROR CPU
NEIE
NEIE
FE
FE
FEIE
FEIE
PE
PE
PEIE
PEIE
RT
CLOCK
RT10
RT11
RT12
RT13
RT14
RT15
RT16
RT CLOCK
RT1
RT1
RT1
RT1
RT1
RT1
RT1
RT1
RT1
RT2
RT3
RT4
RT5
RT6
RT7
RT8
RT9
RT1
RT2
RT3
RT4
STATE
RT CLOCK
RESET
Figure 14-7. Receiver Data Sampling
To verify the start bit and to detect noise, data recovery logic takes samples at RT3, RT5, and RT7.
Table 14-2 summarizes the results of the start bit verification samples.
If start bit verification is not successful, the RT clock is reset and a new search for a start bit begins.
To determine the value of a data bit and to detect noise, recovery logic takes samples at RT8, RT9, and
RT10. Table 14-3 summarizes the results of the data bit samples.
NOTE
The RT8, RT9, and RT10 samples do not affect start bit verification. If any
or all of the RT8, RT9, and RT10 start bit samples are 1s following a
successful start bit verification, the noise flag (NF) is set and the receiver
assumes that the bit is a start bit.
To verify a stop bit and to detect noise, recovery logic takes samples at RT8, RT9, and RT10. Table 14-4
summarizes the results of the stop bit samples.
Table 14-4. Stop Bit Recovery
RT8, RT9, and RT10 Samples Framing Error Flag Noise Flag
000 1 0
001 1 1
010 1 1
011 0 1
100 1 1
101 0 1
110 0 1
111 0 0
MSB STOP
RECEIVER
RT CLOCK
RT1
RT2
RT3
RT4
RT5
RT6
RT7
RT8
RT9
RT10
RT11
RT12
RT13
RT14
RT15
RT16
DATA SAMPLES
RECEIVER
RT CLOCK
RT1
RT2
RT3
RT4
RT5
RT6
RT7
RT8
RT9
RT10
RT11
RT12
RT13
RT14
RT15
RT16
DATA SAMPLE
For an 8-bit character, data sampling of the stop bit takes the receiver 9 bit times × 16 RT cycles
+ 10 RT cycles = 154 RT cycles.
With the misaligned character shown in Figure 14-9, the receiver counts 154 RT cycles at the point when
the count of the transmitting device is 10 bit times × 16 RT cycles = 160 RT cycles.
The maximum percent difference between the receiver count and the transmitter count of a fast 8-bit
character with no errors is
154 – 160 × 100 = 3.90%.
--------------------------
154
For a 9-bit character, data sampling of the stop bit takes the receiver 10 bit times × 16 RT cycles
+ 10 RT cycles = 170 RT cycles.
With the misaligned character shown in Figure 14-9, the receiver counts 170 RT cycles at the point when
the count of the transmitting device is 11 bit times × 16 RT cycles = 176 RT cycles.
The maximum percent difference between the receiver count and the transmitter count of a fast 9-bit
character with no errors is:
170 – 176 × 100 = 3.53%.
--------------------------
170
Address: $0013
Bit 7 6 5 4 3 2 1 Bit 0
Read:
LOOPS ENSCI TXINV M WAKE ILTY PEN PTY
Write:
Reset: 0 0 0 0 0 0 0 0
Address: $0014
Bit 7 6 5 4 3 2 1 Bit 0
Read:
SCTIE TCIE SCRIE ILIE TE RE RWU SBK
Write:
Reset: 0 0 0 0 0 0 0 0
Address: $0015
Bit 7 6 5 4 3 2 1 Bit 0
Read: R8
T8 R R ORIE NEIE FEIE PEIE
Write:
Reset: U 0 0 0 0 0 0 0
= Unimplemented R = Reserved U = Unaffected
Figure 14-12. ESCI Control Register 3 (SCC3)
R8 — Received Bit 8
When the ESCI is receiving 9-bit characters, R8 is the read-only ninth bit (bit 8) of the received
character. R8 is received at the same time that the SCDR receives the other 8 bits.
When the ESCI is receiving 8-bit characters, R8 is a copy of the eighth bit (bit 7). Reset has no effect
on the R8 bit.
T8 — Transmitted Bit 8
When the ESCI is transmitting 9-bit characters, T8 is the read/write ninth bit (bit 8) of the transmitted
character. T8 is loaded into the transmit shift register at the same time that the SCDR is loaded into
the transmit shift register. Reset clears the T8 bit.
ORIE — Receiver Overrun Interrupt Enable Bit
This read/write bit enables ESCI error CPU interrupt requests generated by the receiver overrun bit,
OR. Reset clears ORIE.
1 = ESCI error CPU interrupt requests from OR bit enabled
0 = ESCI error CPU interrupt requests from OR bit disabled
NEIE — Receiver Noise Error Interrupt Enable Bit
This read/write bit enables ESCI error CPU interrupt requests generated by the noise error bit, NE.
Reset clears NEIE.
1 = ESCI error CPU interrupt requests from NE bit enabled
0 = ESCI error CPU interrupt requests from NE bit disabled
FEIE — Receiver Framing Error Interrupt Enable Bit
This read/write bit enables ESCI error CPU interrupt requests generated by the framing error bit, FE.
Reset clears FEIE.
1 = ESCI error CPU interrupt requests from FE bit enabled
0 = ESCI error CPU interrupt requests from FE bit disabled
PEIE — Receiver Parity Error Interrupt Enable Bit
This read/write bit enables ESCI receiver CPU interrupt requests generated by the parity error bit, PE.
Reset clears PEIE.
1 = ESCI error CPU interrupt requests from PE bit enabled
0 = ESCI error CPU interrupt requests from PE bit disabled
Address: $0016
Bit 7 6 5 4 3 2 1 Bit 0
Read: SCTE TC SCRF IDLE OR NF FE PE
Write:
Reset: 1 1 0 0 0 0 0 0
= Unimplemented
a valid character that sets the SCRF bit before an idle condition can set the IDLE bit. Also, after the
IDLE bit has been cleared, a valid character must again set the SCRF bit before an idle condition can
set the IDLE bit. Reset clears the IDLE bit.
1 = Receiver input idle
0 = Receiver input active (or idle since the IDLE bit was cleared)
OR — Receiver Overrun Bit
This clearable, read-only bit is set when software fails to read the SCDR before the receive shift
register receives the next character. The OR bit generates an ESCI error CPU interrupt request if the
ORIE bit in SCC3 is also set. The data in the shift register is lost, but the data already in the SCDR is
not affected. Clear the OR bit by reading SCS1 with OR set and then reading the SCDR. Reset clears
the OR bit.
1 = Receive shift register full and SCRF = 1
0 = No receiver overrun
Software latency may allow an overrun to occur between reads of SCS1 and SCDR in the flag-clearing
sequence. Figure 14-14 shows the normal flag-clearing sequence and an example of an overrun
caused by a delayed flag-clearing sequence. The delayed read of SCDR does not clear the OR bit
because OR was not set when SCS1 was read. Byte 2 caused the overrun and is lost. The next
flag-clearing sequence reads byte 3 in the SCDR instead of byte 2.
In applications that are subject to software latency or in which it is important to know which byte is lost
due to an overrun, the flag-clearing routine can check the OR bit in a second read of SCS1 after
reading the data register.
SCRF = 0
SCRF = 1
SCRF = 0
SCRF = 1
SCRF = 0
BYTE 1 BYTE 2 BYTE 3 BYTE 4
SCRF = 0
SCRF = 0
SCRF = 1
SCRF = 1
OR = 1
OR = 1
OR = 0
OR = 1
Address: $0018
Bit 7 6 5 4 3 2 1 Bit 0
Read: R7 R6 R5 R4 R3 R2 R1 R0
Write: T7 T6 T5 T4 T3 T2 T1 T0
Reset: Unaffected by reset
Address: $0019
Bit 7 6 5 4 3 2 1 Bit 0
Read:
R LINR SCP1 SCP0 R SCR2 SCR1 SCR0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented R = Reserved
Address: $0009
Bit 7 6 5 4 3 2 1 Bit 0
Read:
PDS2 PDS1 PDS0 PSSB4 PSSB3 PSSB2 PSSB1 PSSB0
Write:
Reset: 0 0 0 0 0 0 0 0
Address: $000A
Bit 7 6 5 4 3 2 1 Bit 0
Read: ALOST AFIN ARUN AROVFL ARD8
AM1 AM0 ACLK
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
Address: $000B
Bit 7 6 5 4 3 2 1 Bit 0
Read: ARD7 ARD6 ARD5 ARD4 ARD3 ARD2 ARD1 ARD0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
MEASURED TIME
RXD
OUT OF SCIADAT
ARUN = 1
CPU WRITES SCIACTL
COUNTER STOPS,
COUNTER STARTS,
Figure 14-21. Bit Time Measurement with ACLK = 0
MEASURED TIME
RXD
OF SCIADAT
CPU WRITES SCIACTL WITH $30
MEASURED TIME
RXD
OUT OF SCIADAT
ARUN = 1
CPU WRITES SCIACTL
COUNTER STOPS,
AFIN = 1
COUNTER STARTS,
15.1 Introduction
This section describes the system integration module (SIM). Together with the central processor unit
(CPU), the SIM controls all microconroller unit (MCU) activities. A block diagram of the SIM is shown in
Figure 15-1. Table 15-1 is a summary of the SIM input/output (I/O) registers. The SIM is a system state
controller that coordinates CPU and exception timing.
The SIM is responsible for:
• Bus clock generation and control for CPU and peripherals:
– Stop/wait/reset/break entry and recovery
– Internal clock control
• Master reset control, including power-on reset (POR) and computer operating properly (COP)
timeout
• Interrupt arbitration
Table 15-1 shows the internal signal names used in this section.
MODULE STOP
MODULE WAIT
STOP/WAIT CPU STOP (FROM CPU)
CONTROL CPU WAIT (FROM CPU)
SIMOSCEN (TO ICG)
÷2
VDD CLOCK
CONTROL CLOCK GENERATORS INTERNAL CLOCKS
INTERNAL
PULLUP
DEVICE
FORCED MONITOR MODE ENTRY
RESET
SIM Reset Status Register Read: POR PIN COP ILOP ILAD MODRST LVI 0
$FE01 (SRSR) Write:
See page 194. POR: 1 0 0 0 0 0 0 0
Read:
SIM Upper Byte Address R R R R R R R R
$FE02 Write:
Register (SUBAR)
Reset:
Interrupt Status Read: IF14 IF13 IF12 IF11 IF10 IF9 IF8 IF7
$FE05 Register 2 (INT2) Write: R R R R R R R R
See page 190. Reset: 0 0 0 0 0 0 0 0
COPCLK
COP PRESCALER
TBMCLK
TBM PRESCALER
ECLK CLOCK
SELECT CGMXCLK
SIM COUNTER
CIRCUIT
A CGMOUT
ICLK ÷2 BUS CLOCK
÷2 GENERATORS
B S*
ICG *WHEN S = 1,
GENERATOR CGMOUT = B
CS SIM
MONITOR MODE
USER MODE
ICG
CGMOUT
RST
IRST
32 CYCLES 32 CYCLES
CGMXCLK
OSC1
PORRST
4096 32 32
CYCLES CYCLES CYCLES
CGMXCLK
CGMOUT
RST
IRST
15.5.1 Interrupts
At the beginning of an interrupt, the CPU saves the CPU register contents on the stack and sets the
interrupt mask (I bit) to prevent additional interrupts. At the end of an interrupt, the RTI instruction recovers
the CPU register contents from the stack so that normal processing can resume. Figure 15-8 shows
interrupt entry timing. Figure 15-9 shows interrupt recovery timing.
MODULE
INTERRUPT
I BIT
R/W
MODULE
INTERRUPT
I BIT
IAB SP – 4 SP – 3 SP – 2 SP – 1 SP PC PC + 1
R/W
Interrupts are latched, and arbitration is performed in the SIM at the start of interrupt processing. The
arbitration result is a constant that the CPU uses to determine which vector to fetch. Once an interrupt is
latched by the SIM, no other interrupt can take precedence, regardless of priority, until the latched
interrupt is serviced (or the I bit is cleared). See Figure 15-10.
FROM RESET
BREAK
I BIT SET? YES
INTERRUPT?
NO
YES
I BIT SET?
NO
IRQ YES
INTERRUPT?
NO
AS MANY INTERRUPTS
AS EXIST ON CHIP
STACK CPU REGISTERS
SET I BIT
LOAD PC WITH INTERRUPT VECTOR
FETCH NEXT
INSTRUCTION
SWI YES
INSTRUCTION?
NO
RTI YES
INSTRUCTION? UNSTACK CPU REGISTERS
NO
EXECUTE INSTRUCTION
is pending upon exit from the original interrupt service routine, the pending interrupt is serviced before the
LDA instruction is executed.
The LDA opcode is prefetched by both the INT1 and INT2 RTI instructions. However, in the case of the
INT1 RTI prefetch, this is a redundant operation.
NOTE
To maintain compatibility with the M6805 Family, the H register is not
pushed on the stack during interrupt entry. If the interrupt service routine
modifies the H register or uses the indexed addressing mode, software
should save the H register and then restore it prior to exiting the routine.
CLI
INT1 PSHH
INT2 PSHH
Address: $FE04
Bit 7 6 5 4 3 2 1 Bit 0
Read: I6 I5 I4 I3 I2 I1 0 0
Write: R R R R R R R R
Reset: 0 0 0 0 0 0 0 0
R = Reserved
Address: $FE05
Bit 7 6 5 4 3 2 1 Bit 0
Read: I14 I13 I12 I11 I10 I9 I8 I7
Write: R R R R R R R R
Reset: 0 0 0 0 0 0 0 0
R = Reserved
Address: $FE06
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0 0 0 I16 I15
Write: R R R R R R R R
Reset: 0 0 0 0 0 0 0 0
R = Reserved
15.5.2 Reset
All reset sources always have equal and highest priority and cannot be arbitrated.
Protecting flags in break mode ensures that set flags will not be cleared while in break mode. This
protection allows registers to be freely read and written during break mode without losing status flag
information.
Setting the BCFE bit enables the clearing mechanisms. Once cleared in break mode, a flag remains
cleared even when break mode is exited. Status flags with a 2-step clearing mechanism — for example,
a read of one register followed by the read or write of another — are protected, even when the first step
is accomplished prior to entering break mode. Upon leaving break mode, execution of the second step
will clear the flag as normal.
R/W
Note: Previous data can be operand data or the WAIT opcode, depending on the
last instruction.
A module that is active during wait mode can wake up the CPU with an interrupt if the interrupt is enabled.
Stacking for the interrupt begins one cycle after the WAIT instruction during which the interrupt occurred.
In wait mode, the CPU clocks are inactive. Refer to the wait mode subsection of each module to see if the
module is active or inactive in wait mode. Some modules can be programmed to be active in wait mode.
Wait mode also can be exited by a reset or break. A break interrupt during wait mode sets the SIM break
stop/wait bit, SBSW, in the SIM break status register (SBSR). If the COP disable bit, COPD, in the
CONFIG1 register is 0, then the computer operating properly module (COP) is enabled and remains
active in wait mode.
Figure 15-16 and Figure 15-17 show the timing for WAIT recovery.
EXITSTOPWAIT
32 32
CYCLES CYCLES
RST
CGMXCLK
CPUSTOP
R/W
Note: Previous data can be operand data or the STOP opcode, depending on the last instruction.
Figure 15-18. Stop Mode Entry Timing
CGMXCLK
INT/BREAK
Address: $FE00
Bit 7 6 5 4 3 2 1 Bit 0
Read: SBSW
R R R R R R R
Write: Note(1)
Reset: 0 0 0 0 0 0 0 0
R = Reserved
Note: 1. Writing a 0 clears SBSW.
Address: $FE01
Bit 7 6 5 4 3 2 1 Bit 0
Read: POR PIN COP ILOP ILAD MODRST LVI 0
Write:
Reset: 1 0 0 0 0 0 0 0
= Unimplemented
Address: $FE03
Bit 7 6 5 4 3 2 1 Bit 0
Read:
BCFE R R R R R R R
Write:
Reset: 0
R = Reserved
16.1 Introduction
This section describes the serial peripheral interface (SPI) module, which allows full-duplex, synchronous,
serial communications with peripheral devices.
The text that follows describes the SPI. The SPI I/O pin names are SS (slave select), SPSCK (SPI serial
clock), MOSI (master out slave in), and MISO (master in/slave out). The SPI shares four I/O pins with four
parallel I/O ports.
16.2 Features
Features of the SPI module include:
• Full-duplex operation
• Master and slave modes
• Double-buffered operation with separate transmit and receive registers
• Four master mode frequencies (maximum = bus frequency ÷ 2)
• Maximum slave mode frequency = bus frequency
• Serial clock with programmable polarity and phase
• Two separately enabled interrupts:
– SPRF (SPI receiver full)
– SPTE (SPI transmitter empty)
• Mode fault error flag with CPU interrupt capability
• Overflow error flag with CPU interrupt capability
• Programmable wired-OR mode
• I/O (input/output) port bit(s) software configurable with pullup device(s) if configured as input port
bit(s)
INTERNAL BUS
M68HC08 CPU
PORTA
PTA7/KBD7–
DDRA
CPU ARITHMETIC/LOGIC PROGRAMMABLE TIMEBASE
MODULE PTA0/KBD0(1)
REGISTERS UNIT (ALU)
PTB7/AD7
CONTROL AND STATUS SINGLE BREAKPOINT BREAK
REGISTERS — 64 BYTES MODULE PTB6/AD6
PTB5/AD5
PORTB
PTB4/AD4
DDRB
USER FLASH
DUAL VOLTAGE
MC68HC908GT16 — 15,872 BYTES LOW-VOLTAGE INHIBIT MODULE PTB3/AD3
MC68HC908GT8 — 7,680 BYTES PTB2/AD2
PTB1/AD1
8-BIT KEYBOARD
USER RAM — 512 BYTES INTERRUPT MODULE PTB0/AD0
PTC6(1)
MONITOR ROM — 304 BYTES 2-CHANNEL TIMER INTERFACE PTC5(1)
MODULE 1 PTC4(1)(2)
PORTC
DDRC
FLASH PROGRAMMING ROUTINES
PTC3(1)(2)
ROM — 720 BYTES
2-CHANNEL TIMER INTERFACE PTC2(1)(2)
MODULE 2 PTC1(1)(2)
USER FLASH VECTOR SPACE — 36 BYTES
PTC0(1)(2)
SERIAL COMMUNICATIONS
PTE4/OSC1 INTERFACE MODULE PTD7/T2CH1(1)
INTERNAL CLOCK
GENERATOR MODULE PTD6/T2CH0(1)
PTE3/OSC2
COMPUTER OPERATING PTD5/T1CH1(1)
PTD4/T1CH0(1)
PORTD
PROPERLY MODULE
DDRD
PTD3/SPSCK(1)
SYSTEM INTEGRATION PTD2/MOSI(1)
RST(3) SERIAL PERIPHERAL
MODULE
INTERFACE MODULE PTD1/MISO(1)
PTD0/SS(1)
SINGLE EXTERNAL
IRQ(3)
INTERRUPT MODULE MONITOR MODULE PTE2
PORTE
DDRE
VREFH PTE1/RxD
8-BIT ANALOG-TO-DIGITAL
CONVERTER MODULE MEMORY MAP PTE0/TxD
VREFL
MODULE
POWER-ON RESET
MODULE CONFIGURATION REGISTER 1 SECURITY
MODULE MODULE
VDD
VSS
VDDA POWER CONFIGURATION REGISTER 2
MODULE MONITOR MODE ENTRY
VSSA
MODULE
INTERNAL BUS
SHIFT REGISTER
BUSCLK
7 6 5 4 3 2 1 0 MISO
÷2
MOSI
CLOCK ÷8 RECEIVE DATA REGISTER
DIVIDER ÷ 32 PIN
CONTROL
÷ 128 LOGIC
CLOCK SPSCK
SPMSTR SPE SELECT
CLOCK M
LOGIC S
SS
SPR1 SPR0
SPI ERRIE
CONTROL SPTIE
RECEIVER/ERROR CPU INTERRUPT REQUEST
SPRIE
SPE
SPRF
SPTE
OVRF
MODF
MISO MISO
SHIFT REGISTER
MOSI MOSI
SHIFT REGISTER
SPSCK SPSCK
BAUD RATE
SS SS
GENERATOR VDD
The SPR1 and SPR0 bits control the baud rate generator and determine the speed of the shift register.
(See 16.12.2 SPI Status and Control Register.) Through the SPSCK pin, the baud rate generator of the
master also controls the shift register of the slave peripheral.
As the byte shifts out on the MOSI pin of the master, another byte shifts in from the slave on the master’s
MISO pin. The transmission ends when the receiver full bit, SPRF, becomes set. At the same time that
SPRF becomes set, the byte from the slave transfers to the receive data register. In normal operation,
SPRF signals the end of a transmission. Software clears SPRF by reading the SPI status and control
register with SPRF set and then reading the SPI data register. Writing to the SPI data register (SPDR)
clears SPTE.
The maximum frequency of the SPSCK for an SPI configured as a slave is the bus clock speed (which is
twice as fast as the fastest master SPSCK clock that can be generated). The frequency of the SPSCK for
an SPI configured as a slave does not have to correspond to any SPI baud rate. The baud rate only
controls the speed of the SPSCK generated by an SPI configured as a master. Therefore, the frequency
of the SPSCK for an SPI configured as a slave can be any frequency less than or equal to the bus speed.
When the master SPI starts a transmission, the data in the slave shift register begins shifting out on the
MISO pin. The slave can load its shift register with a new byte for the next transmission by writing to its
transmit data register. The slave must write to its transmit data register at least one bus cycle before the
master starts the next transmission. Otherwise, the byte already in the slave shift register shifts out on the
MISO pin. Data written to the slave shift register during a transmission remains in a buffer until the end of
the transmission.
When the clock phase bit (CPHA) is set, the first edge of SPSCK starts a transmission. When CPHA is
clear, the falling edge of SS starts a transmission. See 16.4 Transmission Formats.
NOTE
SPSCK must be in the proper idle state before the slave is enabled to
prevent SPSCK from appearing as a clock edge.
input (SS) is low, so that only the selected slave drives to the master. The SS pin of the master is not
shown but is assumed to be inactive. The SS pin of the master must be high or must be reconfigured as
general-purpose I/O not affecting the SPI. (See 16.6.2 Mode Fault Error.) When CPHA = 0, the first
SPSCK edge is the MSB capture strobe. Therefore, the slave must begin driving its data before the first
SPSCK edge, and a falling edge on the SS pin is used to start the slave data transmission. The slave’s
SS pin must be toggled back to high and then low again between each byte transmitted as shown in
Figure 16-6.
When CPHA = 0 for a slave, the falling edge of SS indicates the beginning of the transmission. This
causes the SPI to leave its idle state and begin driving the MISO pin with the MSB of its data. Once the
transmission begins, no new data is allowed into the shift register from the transmit data register.
Therefore, the SPI data register of the slave must be loaded with transmit data before the falling edge of
SS. Any data written after the falling edge is stored in the transmit data register and transferred to the shift
register after the current transmission.
SPSCK CYCLE # 1 2 3 4 5 6 7 8
FOR REFERENCE
SPSCK; CPOL = 0
SPSCK; CPOL =1
SS; TO SLAVE
CAPTURE STROBE
MASTER SS
SLAVE SS
CPHA = 0
SLAVE SS
CPHA = 1
slave drives to the master. The SS pin of the master is not shown but is assumed to be inactive. The SS
pin of the master must be high or must be reconfigured as general-purpose I/O not affecting the SPI. (See
16.6.2 Mode Fault Error.) When CPHA = 1, the master begins driving its MOSI pin on the first SPSCK
edge. Therefore, the slave uses the first SPSCK edge as a start transmission signal. The SS pin can
remain low between transmissions. This format may be preferable in systems having only one master and
only one slave driving the MISO data line.
SPSCK CYCLE # 1 2 3 4 5 6 7 8
FOR REFERENCE
SPSCK; CPOL = 0
SPSCK; CPOL =1
SS; TO SLAVE
CAPTURE STROBE
When CPHA = 1 for a slave, the first edge of the SPSCK indicates the beginning of the transmission. This
causes the SPI to leave its idle state and begin driving the MISO pin with the MSB of its data. Once the
transmission begins, no new data is allowed into the shift register from the transmit data register.
Therefore, the SPI data register of the slave must be loaded with transmit data before the first edge of
SPSCK. Any data written after the first edge is stored in the transmit data register and transferred to the
shift register after the current transmission.
WRITE
TO SPDR INITIATION DELAY
BUS
CLOCK
SPSCK
CPHA = 1
SPSCK
CPHA = 0
SPSCK CYCLE
NUMBER 1 2 3
WRITE
TO SPDR
BUS
CLOCK
WRITE TO SPDR 1 3 8
SPTE 2 5 10
SPSCK
CPHA:CPOL = 1:0
MOSI MSB BIT BIT BIT BIT BIT BIT LSB MSB BIT BIT BIT BIT BIT BIT LSB MSB BIT BIT BIT
6 5 4 3 2 1 6 5 4 3 2 1 6 5 4
BYTE 1 BYTE 2 BYTE 3
SPRF 4 9
READ SPSCR 6 11
READ SPDR 7 12
1 CPU WRITES BYTE 1 TO SPDR, CLEARING SPTE BIT. 7 CPU READS SPDR, CLEARING SPRF BIT.
2 BYTE 1 TRANSFERS FROM TRANSMIT DATA 8 CPU WRITES BYTE 3 TO SPDR, QUEUEING BYTE
REGISTER TO SHIFT REGISTER, SETTING SPTE BIT. 3 AND CLEARING SPTE BIT.
9 SECOND INCOMING BYTE TRANSFERS FROM SHIFT
3 CPU WRITES BYTE 2 TO SPDR, QUEUEING BYTE 2 REGISTER TO RECEIVE DATA REGISTER, SETTING
AND CLEARING SPTE BIT.
SPRF BIT.
4 FIRST INCOMING BYTE TRANSFERS FROM SHIFT 10 BYTE 3 TRANSFERS FROM TRANSMIT DATA
REGISTER TO RECEIVE DATA REGISTER, SETTING REGISTER TO SHIFT REGISTER, SETTING SPTE BIT.
SPRF BIT. 11 CPU READS SPSCR WITH SPRF BIT SET.
5 BYTE 2 TRANSFERS FROM TRANSMIT DATA 12 CPU READS SPDR, CLEARING SPRF BIT.
REGISTER TO SHIFT REGISTER, SETTING SPTE BIT.
6 CPU READS SPSCR WITH SPRF BIT SET.
The transmit data buffer allows back-to-back transmissions without the slave precisely timing its writes
between transmissions as in a system with a single data buffer. Also, if no new data is written to the data
buffer, the last value contained in the shift register is the next data word to be transmitted.
For an idle master or idle slave that has no data loaded into its transmit buffer, the SPTE is set again no
more than two bus cycles after the transmit buffer empties into the shift register. This allows the user to
queue up a 16-bit value to send. For an already active slave, the load of the shift register cannot occur
until the transmission is completed. This implies that a back-to-back write to the transmit data register is
not possible. SPTE indicates when the next write can occur.
SPRF
OVRF
READ 2 5
SPSCR
READ 3 7
SPDR
1 BYTE 1 SETS SPRF BIT. 5 CPU READS SPSCR WITH SPRF BIT SET
2 CPU READS SPSCR WITH SPRF BIT SET AND OVRF BIT CLEAR.
AND OVRF BIT CLEAR. 6 BYTE 3 SETS OVRF BIT. BYTE 3 IS LOST.
3 CPU READS BYTE 1 IN SPDR,
CLEARING SPRF BIT. 7 CPU READS BYTE 2 IN SPDR, CLEARING SPRF BIT,
BUT NOT OVRF BIT.
4 BYTE 2 SETS SPRF BIT.
8 BYTE 4 FAILS TO SET SPRF BIT BECAUSE
OVRF BIT IS NOT CLEARED. BYTE 4 IS LOST.
In this case, an overflow can be missed easily. Since no more SPRF interrupts can be generated until this
OVRF is serviced, it is not obvious that bytes are being lost as more transmissions are completed. To
prevent this, either enable the OVRF interrupt or do another read of the SPSCR following the read of the
SPDR. This ensures that the OVRF was not set before the SPRF was cleared and that future
transmissions can set the SPRF bit. Figure 16-11 illustrates this process. Generally, to avoid this second
SPSCR read, enable the OVRF to the CPU by setting the ERRIE bit.
SPRF
OVRF
READ 2 4 6 9 12 14
SPSCR
READ 3 8 10 13
SPDR
In a master SPI with the mode fault enable bit (MODFEN) set, the mode fault flag (MODF) is set if SS
goes low. A mode fault in a master SPI causes the following events to occur:
• If ERRIE = 1, the SPI generates an SPI receiver/error CPU interrupt request.
• The SPE bit is cleared.
• The SPTE bit is set.
• The SPI state counter is cleared.
• The data direction register of the shared I/O port regains control of port drivers.
NOTE
To prevent bus contention with another master SPI after a mode fault error,
clear all SPI bits of the data direction register of the shared I/O port before
enabling the SPI.
When configured as a slave (SPMSTR = 0), the MODF flag is set if SS goes high during a transmission.
When CPHA = 0, a transmission begins when SS goes low and ends once the incoming SPSCK goes
back to its idle level following the shift of the eighth data bit. When CPHA = 1, the transmission begins
when the SPSCK leaves its idle level and SS is already low. The transmission continues until the SPSCK
returns to its idle level following the shift of the last data bit. See
See 16.4 Transmission Formats.
NOTE
Setting the MODF flag does not clear the SPMSTR bit. SPMSTR has no
function when SPE = 0. Reading SPMSTR when MODF = 1 shows the
difference between a MODF occurring when the SPI is a master and when
it is a slave.
NOTE
When CPHA = 0, a MODF occurs if a slave is selected (SS is low) and later
unselected (SS is high) even if no SPSCK is sent to that slave. This
happens because SS low indicates the start of the transmission (MISO
driven out with the value of MSB) for CPHA = 0. When CPHA = 1, a slave
can be selected and then later unselected with no transmission occurring.
Therefore, MODF does not occur since a transmission was never begun.
In a slave SPI (MSTR = 0), MODF generates an SPI receiver/error CPU interrupt request if the ERRIE bit
is set. The MODF bit does not clear the SPE bit or reset the SPI in any way. Software can abort the SPI
transmission by clearing the SPE bit of the slave.
NOTE
A high on the SS pin of a slave SPI puts the MISO pin in a high impedance
state. Also, the slave SPI ignores all incoming SPSCK clocks, even if it was
already in the middle of a transmission.
To clear the MODF flag, read the SPSCR with the MODF bit set and then write to the SPCR register. This
entire clearing mechanism must occur with no MODF condition existing or else the flag is not cleared.
16.7 Interrupts
Four SPI status flags can be enabled to generate CPU interrupt requests. See Table 16-1.
Table 16-1. SPI Interrupts
Flag Request
SPTE — Transmitter empty SPI transmitter CPU interrupt request (SPTIE = 1, SPE = 1)
SPRF — Receiver full SPI receiver CPU interrupt request (SPRIE = 1)
OVRF — Overflow SPI receiver/error interrupt request (ERRIE = 1)
MODF — Mode fault SPI receiver/error interrupt request (ERRIE = 1)
Reading the SPI status and control register with SPRF set and then reading the receive data register
clears SPRF. The clearing mechanism for the SPTE flag is always just a write to the transmit data register.
The SPI transmitter interrupt enable bit (SPTIE) enables the SPTE flag to generate transmitter CPU
interrupt requests, provided that the SPI is enabled (SPE = 1).
The SPI receiver interrupt enable bit (SPRIE) enables SPRF to generate receiver CPU interrupt requests,
regardless of the state of SPE. See Figure 16-12.
SPI TRANSMITTER
CPU INTERRUPT REQUEST
SPRIE SPRF
SPI RECEIVER/ERROR
CPU INTERRUPT REQUEST
ERRIE
MODF
OVRF
The error interrupt enable bit (ERRIE) enables both the MODF and OVRF bits to generate a receiver/error
CPU interrupt request.
The mode fault enable bit (MODFEN) can prevent the MODF flag from being set so that only the OVRF
bit is enabled by the ERRIE bit to generate receiver/error CPU interrupt requests.
The following sources in the SPI status and control register can generate CPU interrupt requests:
• SPI receiver full bit (SPRF) — SPRF becomes set every time a byte transfers from the shift register
to the receive data register. If the SPI receiver interrupt enable bit, SPRIE, is also set, SPRF
generates an SPI receiver/error CPU interrupt request.
• SPI transmitter empty (SPTE) — SPTE becomes set every time a byte transfers from the transmit
data register to the shift register. If the SPI transmit interrupt enable bit, SPTIE, is also set, SPTE
generates an SPTE CPU interrupt request.
To protect status bits during the break state, write a 0 to BCFE. With BCFE at 0 (its default state), software
can read and write I/O registers during the break state without affecting status bits. Some status bits have
a 2-step read/write clearing procedure. If software does the first step on such a bit before the break, the
bit cannot change during the break state as long as BCFE is 0. After the break, doing the second step
clears the status bit.
Since the SPTE bit cannot be cleared during a break with BCFE cleared, a write to the transmit data
register in break mode does not initiate a transmission nor is this data transferred into the shift register.
Therefore, a write to the SPDR in break mode with BCFE cleared has no effect.
MASTER SS
SLAVE SS
CPHA = 0
SLAVE SS
CPHA = 1
NOTE
A high on the SS pin of a slave SPI puts the MISO pin in a high-impedance
state. The slave SPI ignores all incoming SPSCK clocks, even if it was
already in the middle of a transmission.
When an SPI is configured as a master, the SS input can be used in conjunction with the MODF flag to
prevent multiple masters from driving MOSI and SPSCK. (See 16.6.2 Mode Fault Error.) For the state of
the SS pin to set the MODF flag, the MODFEN bit in the SPSCK register must be set. If MODFEN is 0 for
an SPI master, the SS pin can be used as a general-purpose I/O under the control of the data direction
register of the shared I/O port. When MODFEN is 1, SS is an input-only pin to the SPI regardless of the
state of the data direction register of the shared I/O port.
The CPU can always read the state of the SS pin by configuring the appropriate pin as an input and
reading the port data register. See Table 16-2
.
Table 16-2. SPI Configuration
SPE SPMSTR MODFEN SPI Configuration Function of SS Pin
General-purpose I/O;
0 X(1)) X Not enabled
SS ignored by SPI
1 0 X Slave Input-only to SPI
General-purpose I/O;
1 1 0 Master without MODF
SS ignored by SPI
1 1 1 Master with MODF Input-only to SPI
1. X = Don’t care
Address: $0010
Bit 7 6 5 4 3 2 1 Bit 0
Read:
SPRIE R SPMSTR CPOL CPHA SPWOM SPE SPTIE
Write:
Reset: 0 0 1 0 1 0 0 0
R = Reserved
Address: $0011
Bit 7 6 5 4 3 2 1 Bit 0
Read: SPRF OVRF MODF SPTE
ERRIE MODFEN SPR1 SPR0
Write:
Reset: 0 0 0 0 1 0 0 0
= Unimplemented
Address: $0012
Bit 7 6 5 4 3 2 1 Bit 0
Read: R7 R6 R5 R4 R3 R2 R1 R0
Write: T7 T6 T5 T4 T3 T2 T1 T0
Reset: Unaffected by reset
17.1 Introduction
This section describes the timebase module (TBM). The TBM will generate periodic interrupts at user
selectable rates using a counter clocked by the external crystal clock. This TBM version uses 15 divider
stages, eight of which are user selectable.
17.2 Features
Features of the TBM include:
• Software programmable 1-Hz, 4-Hz, 16-Hz, 256-Hz, 512-Hz, 1024-Hz, 2048-Hz, and 4096-Hz
periodic interrupt using external 32.768-kHz crystal
• User selectable oscillator clock source enable during stop mode to allow periodic wakeup from stop
This module can generate a periodic interrupt by dividing the clock TBMCLK. The counter is initialized to
all 0s when TBON bit is cleared. The counter, shown in Figure 17-1, starts counting when the TBON bit
is set. When the counter overflows at the tap selected by TBR2:TBR0, the TBIF bit gets set. If the TBIE
bit is set, an interrupt request is sent to the CPU. The TBIF flag is cleared by writing a 1 to the TACK bit.
The first time the TBIF flag is set after enabling the timebase module, the interrupt is generated at
approximately half of the overflow period. Subsequent events occur at the exact period.
TBON
TBMCLK ÷2 ÷2 ÷2 ÷2 ÷2 ÷2 ÷2
÷8 ÷ 16 ÷ 32 ÷ 64 ÷ 128
TBMINT
TACK
TBR0
TBR2
TBR1
÷2 ÷2 ÷2 ÷2 ÷2 ÷2 ÷2 ÷2
TBIF TBIE
000
R
001
010
011
100 SEL
101
110
111
Address: $001C
Bit 7 6 5 4 3 2 1 Bit 0
Read: TBIF 0
TBR2 TBR1 TBR0 TBIE TBON R
Write: TACK
Reset: 0 0 0 0 0 0 0 0
= Unimplemented R = Reserved
NOTE
Do not change TBR2:TBR0 bits while the timebase is enabled (TBON = 1).
TACK — Timebase ACKnowledge
The TACK bit is a write-only bit and always reads as 0. Writing a 1 to this bit clears TBIF, the timebase
interrupt flag bit. Writing a 0 to this bit has no effect.
1 = Clear timebase interrupt flag
0 = No effect
TBIE — Timebase Interrupt Enabled
This read/write bit enables the timebase interrupt when the TBIF bit becomes set. Reset clears the
TBIE bit.
1 = Timebase interrupt enabled
0 = Timebase interrupt disabled
TBON — Timebase Enabled
This read/write bit enables the timebase. Timebase may be turned off to reduce power consumption
when its function is not necessary. The counter can be initialized by clearing and then setting this bit.
Reset clears the TBON bit.
1 = Timebase enabled
0 = Timebase disabled and the counter initialized to 0s
17.5 Interrupts
The timebase module can interrupt the CPU on a regular basis with a rate defined by TBR2:TBR0. When
the timebase counter chain rolls over, the TBIF flag is set. If the TBIE bit is set, enabling the timebase
interrupt, the counter chain overflow will generate a CPU interrupt request.
Interrupts must be acknowledged by writing a 1 to the TACK bit.
18.1 Introduction
This section describes the timer interface (TIM) module. The TIM is a two-channel timer that provides a
timing reference with input capture, output compare, and pulse-width-modulation functions. Figure 18-1
is a block diagram of the TIM.
This particular MCU has two timer interface modules which are denoted as TIM1 and TIM2.
PRESCALER SELECT
INTERNAL
BUS CLOCK PRESCALER
TSTOP
PS2 PS1 PS0
TRST
TOV0
CHANNEL 0 ELS0B ELS0A CH0MAX PORT
T[1,2]CH0
LOGIC
16-BIT COMPARATOR
TCH0H:TCH0L CH0F
16-BIT LATCH INTERRUPT
CH0IE LOGIC
MS0A
MS0B
TOV1
CHANNEL 1 ELS1B ELS1A CH1MAX PORT
T[1,2]CH1
LOGIC
INTERNAL BUS
16-BIT COMPARATOR
TCH1H:TCH1L CH1F
16-BIT LATCH INTERRUPT
CH1IE LOGIC
MS1A
INTERNAL BUS
M68HC08 CPU
PORTA
PTA7/KBD7–
DDRA
CPU ARITHMETIC/LOGIC PROGRAMMABLE TIMEBASE
MODULE PTA0/KBD0(1)
REGISTERS UNIT (ALU)
PTB7/AD7
CONTROL AND STATUS SINGLE BREAKPOINT BREAK
REGISTERS — 64 BYTES MODULE PTB6/AD6
PTB5/AD5
PORTB
PTB4/AD4
DDRB
USER FLASH
DUAL VOLTAGE
MC68HC908GT16 — 15,872 BYTES LOW-VOLTAGE INHIBIT MODULE PTB3/AD3
MC68HC908GT8 — 7,680 BYTES PTB2/AD2
PTB1/AD1
8-BIT KEYBOARD
USER RAM — 512 BYTES INTERRUPT MODULE PTB0/AD0
PTC6(1)
MONITOR ROM — 304 BYTES 2-CHANNEL TIMER INTERFACE PTC5(1)
MODULE 1 PTC4(1)(2)
PORTC
DDRC
FLASH PROGRAMMING ROUTINES
PTC3(1)(2)
ROM — 720 BYTES
2-CHANNEL TIMER INTERFACE PTC2(1)(2)
MODULE 2 PTC1(1)(2)
USER FLASH VECTOR SPACE — 36 BYTES
PTC0(1)(2)
SERIAL COMMUNICATIONS
PTE4/OSC1 INTERFACE MODULE PTD7/T2CH1(1)
INTERNAL CLOCK
GENERATOR MODULE PTD6/T2CH0(1)
PTE3/OSC2
COMPUTER OPERATING PTD5/T1CH1(1)
PTD4/T1CH0(1)
PORTD
PROPERLY MODULE
DDRD
PTD3/SPSCK(1)
SYSTEM INTEGRATION PTD2/MOSI(1)
RST(3) SERIAL PERIPHERAL
MODULE
INTERFACE MODULE PTD1/MISO(1)
PTD0/SS(1)
SINGLE EXTERNAL
IRQ(3)
INTERRUPT MODULE MONITOR MODULE PTE2
PORTE
DDRE
VREFH PTE1/RxD
8-BIT ANALOG-TO-DIGITAL
CONVERTER MODULE MEMORY MAP PTE0/TxD
VREFL
MODULE
POWER-ON RESET
MODULE CONFIGURATION REGISTER 1 SECURITY
MODULE MODULE
VDD
VSS
VDDA POWER CONFIGURATION REGISTER 2
MODULE MONITOR MODE ENTRY
VSSA
MODULE
18.2 Features
Features of the TIM include:
• Two input capture/output compare channels:
– Rising-edge, falling-edge, or any-edge input capture trigger
– Set, clear, or toggle output compare action
• Buffered and unbuffered pulse-width-modulation (PWM) signal generation
• Programmable TIM clock input with 7-frequency internal bus clock prescaler selection
• Free-running or modulo up-count operation
• Toggle any channel pin on overflow
• TIM counter stop and reset bits
into the TIM channel registers, TCHxH:TCHxL. The polarity of the active edge is programmable. Input
captures can generate TIM CPU interrupt requests.
PERIOD
PULSE
WIDTH
TCHx
• When changing to a longer pulse width, enable TIM overflow interrupts and write the new value in
the TIM overflow interrupt routine. The TIM overflow interrupt occurs at the end of the current PWM
period. Writing a larger value in an output compare interrupt routine (at the end of the current pulse)
could cause two output compares to occur in the same PWM period.
NOTE
In PWM signal generation, do not program the PWM channel to toggle on
output compare. Toggling on output compare prevents reliable 0% duty
cycle generation and removes the ability of the channel to self-correct in the
event of software error or noise. Toggling on output compare also can
cause incorrect PWM signal generation when changing the PWM pulse
width to a new, much larger value.
c. Write 1:0 (to clear output on compare) or 1:1 (to set output on compare) to the edge/level
select bits, ELSxB:ELSxA. The output action on compare must force the output to the
complement of the pulse width level. (See Table 18-2.)
NOTE
In PWM signal generation, do not program the PWM channel to toggle on
output compare. Toggling on output compare prevents reliable 0% duty
cycle generation and removes the ability of the channel to self-correct in the
event of software error or noise. Toggling on output compare can also
cause incorrect PWM signal generation when changing the PWM pulse
width to a new, much larger value.
5. In the TIM status control register (TSC), clear the TIM stop bit, TSTOP.
Setting MS0B links channels 0 and 1 and configures them for buffered PWM operation. The TIM channel
0 registers (TCH0H:TCH0L) initially control the buffered PWM output. TIM status control register 0
(TSCR0) controls and monitors the PWM signal from the linked channels.
Clearing the toggle-on-overflow bit, TOVx, inhibits output toggles on TIM overflows. Subsequent output
compares try to force the output to a state it is already in and have no effect. The result is a 0% duty cycle
output.
Setting the channel x maximum duty cycle bit (CHxMAX) and setting the TOVx bit generates a 100% duty
cycle output. (See 18.9.4 TIM Channel Status and Control Registers.)
18.5 Interrupts
The following TIM sources can generate interrupt requests:
• TIM overflow flag (TOF) — The TOF bit is set when the TIM counter reaches the modulo value
programmed in the TIM counter modulo registers. The TIM overflow interrupt enable bit, TOIE,
enables TIM overflow CPU interrupt requests. TOF and TOIE are in the TIM status and control
register.
• TIM channel flags (CH1F:CH0F) — The CHxF bit is set when an input capture or output compare
occurs on channel x. Channel x TIM CPU interrupt requests are controlled by the channel x
interrupt enable bit, CHxIE. Channel x TIM CPU interrupt requests are enabled when CHxIE = 1.
CHxF and CHxIE are in the TIM channel x status and control register.
NOTE
Reset the TIM counter before writing to the TIM counter modulo registers.
PERIOD
TCHx
19.1 Introduction
This section describes the break module, the monitor module (MON), and the monitor mode entry
methods.
INTERNAL BUS
M68HC08 CPU
PORTA
PTA7/KBD7–
DDRA
CPU ARITHMETIC/LOGIC PROGRAMMABLE TIMEBASE
MODULE PTA0/KBD0(1)
REGISTERS UNIT (ALU)
PTB7/AD7
CONTROL AND STATUS SINGLE BREAKPOINT BREAK
REGISTERS — 64 BYTES MODULE PTB6/AD6
PTB5/AD5
PORTB
PTB4/AD4
DDRB
USER FLASH
DUAL VOLTAGE
MC68HC908GT16 — 15,872 BYTES LOW-VOLTAGE INHIBIT MODULE PTB3/AD3
MC68HC908GT8 — 7,680 BYTES PTB2/AD2
PTB1/AD1
8-BIT KEYBOARD
USER RAM — 512 BYTES INTERRUPT MODULE PTB0/AD0
PTC6(1)
MONITOR ROM — 304 BYTES 2-CHANNEL TIMER INTERFACE PTC5(1)
MODULE 1 PTC4(1)(2)
PORTC
DDRC
FLASH PROGRAMMING ROUTINES
PTC3(1)(2)
ROM — 720 BYTES
2-CHANNEL TIMER INTERFACE PTC2(1)(2)
MODULE 2 PTC1(1)(2)
USER FLASH VECTOR SPACE — 36 BYTES
PTC0(1)(2)
SERIAL COMMUNICATIONS
PTE4/OSC1 INTERFACE MODULE PTD7/T2CH1(1)
INTERNAL CLOCK
GENERATOR MODULE PTD6/T2CH0(1)
PTE3/OSC2
COMPUTER OPERATING PTD5/T1CH1(1)
PTD4/T1CH0(1)
PORTD
PROPERLY MODULE
DDRD
PTD3/SPSCK(1)
SYSTEM INTEGRATION PTD2/MOSI(1)
RST(3) SERIAL PERIPHERAL
MODULE
INTERFACE MODULE PTD1/MISO(1)
PTD0/SS(1)
SINGLE EXTERNAL
IRQ(3)
INTERRUPT MODULE MONITOR MODULE PTE2
PORTE
DDRE
VREFH PTE1/RxD
8-BIT ANALOG-TO-DIGITAL
CONVERTER MODULE MEMORY MAP PTE0/TxD
VREFL
MODULE
POWER-ON RESET
MODULE CONFIGURATION REGISTER 1 SECURITY
MODULE MODULE
VDD
VSS
VDDA POWER CONFIGURATION REGISTER 2
MODULE MONITOR MODE ENTRY
VSSA
MODULE
IAB15–IAB8
8-BIT COMPARATOR
IAB15–IAB0
CONTROL BREAK
8-BIT COMPARATOR
IAB7–IAB0
When the internal address bus matches the value written in the break address registers or when software
writes a 1 to the BRKA bit in the break status and control register, the CPU starts a break interrupt by:
• Loading the instruction register with the SWI instruction
• Loading the program counter with $FFFC and $FFFD ($FEFC and $FEFD in monitor mode)
The break interrupt timing is:
• When a break address is placed at the address of the instruction opcode, the instruction is not
executed until after completion of the break interrupt routine.
• When a break address is placed at an address of an instruction operand, the instruction is executed
before the break interrupt.
• When software writes a 1 to the BRKA bit, the break interrupt occurs just before the next instruction
is executed.
By updating a break address and clearing the BRKA bit in a break interrupt routine, a break interrupt can
be generated continuously.
CAUTION
A break address should be placed at the address of the instruction opcode.
When software does not change the break address and clears the BRKA
bit in the first break interrupt routine, the next break interrupt will not be
generated after exiting the interrupt routine even when the internal address
bus matches the value written in the break address registers.
The system integration module (SIM) controls whether or not module status bits can be cleared during
the break state. The BCFE bit in the break flag control register (BFCR) enables software to clear status
bits during the break state. See 15.7.3 SIM Break Flag Control Register and the Break Interrupts
subsection for each module.
Address: $FE0B
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0 0 0
BRKE BRKA
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
Address: $FE09
Bit 7 6 5 4 3 2 1 Bit 0
Read:
Bit 15 14 13 12 11 10 9 Bit 8
Write:
Reset: 0 0 0 0 0 0 0 0
Address: $FE0A
Bit 7 6 5 4 3 2 1 Bit 0
Read:
Bit 7 6 5 4 3 2 1 Bit 0
Write:
Reset: 0 0 0 0 0 0 0 0
Address: $FE00
Bit 7 6 5 4 3 2 1 Bit 0
Read: SBSW
R R R R R R R
Write: Note(1)
Reset: 0
R = Reserved 1. Writing a 0 clears SBSW.
Address: $FE03
Bit 7 6 5 4 3 2 1 Bit 0
Read:
BCFE R R R R R R R
Write:
Reset: 0
R = Reserved
1. No security feature is absolutely secure. However, Freescale’s strategy is to make reading or copying the Flash difficult for
unauthorized users.
POR RESET
NO YES
IRQ = VTST?
CONDITIONS
PTA0 = 1, NO PTA0 = 1, PTC0 = 1, NO
FROM Table 19-1
RESET PTC1 = 0, AND
BLANK? PTC3 = 1?
YES YES
SEND 8 BYTES
SECURITY
IS RESET YES
POR?
NO
ARE ALL
YES NO
SECURITY BYTES
CORRECT?
DEBUGGING
AND FLASH EXECUTE
PROGRAMMING MONITOR CODE
(IF FLASH
IS ENABLED)
VDD
RST VDDA
0.1 μF VDD
0.1 μF
1
5
VDD
RST VDDA
0.1 μF VDD
0.1 μF
MAX232 VDD
1 16 N.C. OSC2
C1+ VCC
+
1 μF 0.1 μF 9.8304 MHz CLOCK
OSC1
3 GND 15 PTC0 N.C.
C1–
VTST
4
C2+ V+ 2 N.C. IRQ PTC3 N.C.
+ + VDD
1 μF 1 μF
V– 6
5 C2–
1 μF PTC1 N.C.
+ 10 kΩ
DB9 74HC125
2 7 10 6 5
74HC125 PTA0
3 8 9 2 3 4 VSS
VSSA
1
5
VDD
RST VDDA
0.1 μF VDD
0.1 μF
N.C. OSC2
VDD
9.8304 MHz CLOCK
OSC1
MAX232 10 kΩ
VDD PTC0
1
C1+ VCC 16 10 kΩ
+ PTC3
1 μF 0.1 μF
3 15
C1– GND
VTST 1 kΩ
4 2 kΩ
+
C2+ V+ 2 IRQ PTC1
+ VDD
1 μF
V– 6 1 μF
5 C2– 9.1 V
1 μF
+ 10 kΩ
DB9 74HC125 VSS
2 7 10 6 5 VSSA
PTA0
74HC125
3 8 9 2 3 4
1
5
Table 19-1 shows the pin conditions for entering monitor mode. As specified in the table, monitor mode
must be entered after a power-on reset (POR) and will allow communication at 9600 baud provided one
of the following sets of conditions is met:
1. If $FFFE and $FFFF does not contain $FF (programmed state):
– The external clock is 4.9152 MHz with PTC3 low or 9.8304 MHz with PTC3 high
– IRQ = VTST
2. If $FFFE and $FFFF contain $FF (erased state):
– The external clock is 9.8304 MHz
– IRQ = VDD (this can be implemented through the internal IRQ pullup)
3. If $FFFE and $FFFF contain $FF (erased state):
– IRQ = VSS (ICG is selected, no external clock required)
Once out of reset, the MCU waits for the host to send eight security bytes (see 19.3.2 Security). After the
security bytes, the MCU sends a break signal (10 consecutive 0s) to the host, indicating that it is ready to
receive a command.
NOTE
The PTA0 pin must remain high for 24 bus cycles after the RST pin goes
high to enter monitor mode properly.
NC 1 2 GND
NC 3 4 RST
NC 5 6 IRQ
NC 7 8 PTA0
NC 9 10 NC
NC 11 12 PTC0
OSC1 13 14 PTC1
VDD 15 16 PTC3
If monitor mode was entered with VTST on IRQ, then the COP is disabled as long as VTST is applied to
either IRQ or RST.
This condition states that as long as VTST is maintained on the IRQ pin after entering monitor mode, or if
VTST is applied to RST after the initial reset to get into monitor mode (when VTST was applied to IRQ),
then the COP will be disabled. In the latter situation, after VTST is applied to the RST pin, VTST can be
removed from the IRQ pin in the interest of freeing the IRQ for normal functionality in monitor mode.
NEXT
START START
BIT BIT 0 BIT 1 BIT 2 BIT 3 BIT 4 BIT 5 BIT 6 BIT 7 STOP BIT
BIT
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
19.3.1.7 Commands
The monitor ROM firmware uses these commands:
• READ (read memory)
• WRITE (write memory)
• IREAD (indexed read)
• IWRITE (indexed write)
• READSP (read stack pointer)
• RUN (run user program)
The monitor ROM firmware echoes each received byte back to the PTA0 pin for error checking. An 11-bit
delay at the end of each command allows the host to send a break character to cancel the command. A
delay of two bit times occurs before each echo and before READ, IREAD, or READSP data is returned.
The data returned by a read command appears after the echo of the last byte of the command.
NOTE
Wait one bit time after each echo before sending the next byte.
FROM
HOST
4 1 4 1 4 1 3, 2 4
ECHO RETURN
Notes:
1 = Echo delay, approximately 2 bit times
2 = Data return delay, approximately 2 bit times
3 = Cancel command delay, 11 bit times
4 = Wait 1 bit time before sending next byte.
FROM
HOST
A brief description of each monitor mode command is given in Table 19-3 through Table 19-7.
ECHO RETURN
ECHO
ECHO RETURN
A sequence of IREAD or IWRITE commands can access a block of memory sequentially over the full
64-Kbyte memory map.
SP SP
READSP READSP HIGH LOW
ECHO RETURN
RUN RUN
ECHO
The MCU executes the SWI and PSHH instructions when it enters monitor mode. The RUN command
tells the MCU to execute the PULH and RTI instructions. Before sending the RUN command, the host can
modify the stacked CPU registers to prepare to run the host program. The READSP command returns
the incremented stack pointer value, SP + 1. The high and low bytes of the program counter are at
addresses SP + 5 and SP + 6.
SP
HIGH BYTE OF INDEX REGISTER SP + 1
CONDITION CODE REGISTER SP + 2
ACCUMULATOR SP + 3
LOW BYTE OF INDEX REGISTER SP + 4
HIGH BYTE OF PROGRAM COUNTER SP + 5
LOW BYTE OF PROGRAM COUNTER SP + 6
SP + 7
19.3.2 Security
A security feature discourages unauthorized reading of Flash locations while in monitor mode. The host
can bypass the security feature at monitor mode entry by sending eight security bytes that match the
bytes at locations $FFF6–$FFFD. Locations $FFF6–$FFFD contain user-defined data.
NOTE
Do not leave locations $FFF6–$FFFD blank. For security reasons, program
locations $FFF6–$FFFD even if they are not used for vectors.
During monitor mode entry, the MCU waits after the power-on reset for the host to send the eight security
bytes on pin PTA0. If the received bytes match those at locations $FFF6–$FFFD, the host bypasses the
security feature and can read all Flash locations and execute code from Flash. Security remains bypassed
until a power-on reset occurs. If the reset was not a power-on reset, security remains bypassed and
security code entry is not required. See Figure 19-18.
Upon power-on reset, if the received bytes of the security code do not match the data at locations
$FFF6–$FFFD, the host fails to bypass the security feature. The MCU remains in monitor mode, but
reading a Flash location returns an invalid value and trying to execute code from Flash causes an illegal
address reset. After receiving the eight security bytes from the host, the MCU transmits a break character,
signifying that it is ready to receive a command.
NOTE
The MCU does not transmit a break character until after the host sends the
eight security bytes.
VDD
4096 + 32 CGMXCLK CYCLES
COMMAND
RST
BYTE 1
BYTE 2
BYTE 8
FROM HOST
PA0
5 1 4 1 1 2 4 1
FROM MCU
BYTE 1 ECHO
BYTE 2 ECHO
BYTE 8 ECHO
BREAK
COMMAND ECHO
Notes:
1 = Echo delay, approximately 2 bit times
2 = Data return delay, approximately 2 bit times
4 = Wait 1 bit time before sending next byte
5 = Wait until the monitor ROM runs
20.1 Introduction
This section contains electrical and timing specifications.
NOTE
This device contains circuitry to protect the inputs against damage due to
high static voltages or electric fields; however, it is advised that normal
precautions be taken to avoid application of any voltage higher than
maximum-rated voltages to this high-impedance circuit. For proper
operation, it is recommended that VIn and VOut be constrained to the range
VSS ≤ (VIn or VOut) ≤ VDD. Reliability of operation is enhanced if unused
inputs are connected to an appropriate logic voltage level (for example,
either VSS or VDD).
tRL
RST
tILIL
tILIH
IRQ
tRL
RST
tILIL
tILIH
IRQ
Internal oscillator base frequency(2), (3) fINTOSC 230.4 307.2 384 kHz
1. VDD = 5.5 Vdc to 2.7 Vdc, VSS = 0 Vdc, TA = TA (min) to TA (max), unless otherwise noted
2. Internal oscillator is selectable through software for a maximum frequency. Actual frequency will be
multiplier (N) x base frequency.
3. fBus = (fINTOSC / 4) x N when internal clock source selected
4. Multiplier must be chosen to limit the maximum bus frequency of 4 MHz for 2.7-V operation and 8 MHz
for 4.5-V operation.
IOH (mA)
–20 25
–25 85
–30
–35
–40
3 3.2 3.4 3.6 3.8 4.0 4.2
VOH (V)
VOH > VDD –0.8 V @ IOH = –2.0 mA
VOH > VDD –1.5 V @ IOH = –10.0 mA
Figure 20-3. Typical High-Side Driver Characteristics –
Port PTA7–PTA0 (VDD = 4.5 Vdc)
0
–5
–40
–10
0
IOH (mA)
25
–15 85
–20
–25
1.3 1.5 1.7 1.9 2.1 2.3 2.5
VOH (V)
VOH > VDD –0.3 V @ IOH = –0.6 mA
VOH > VDD –1.0 V @ IOH = –10.0 mA
–20 25
–25 85
–30
–35
–40
3 3.2 3.4 3.6 3.8 4.0 4.2
VOH (V)
VOH > VDD –1.5 V @ IOH = –20.0 mA
–5
–40
IOH (mA)
–10
0
25
–15 85
–20
–25
1.3 1.5 1.7
1.9 2.1 2.3 2.5
VOH (V)
VOH > VDD –1.0 V @ IOH = –10.0 mA
–50 85
–60
–70
–80
–90
3 3.2 3.4 3.6 3.8 4.0 4.2 4.4 4.6
VOH (V)
VOH > VDD –0.8 V @ IOH = –2.0 mA
VOH > VDD –1.5 V @ IOH = –10.0 mA
–5
–40
–10
0
IOH (mA)
25
–15 85
–20
–25
1.3 1.5 1.7
1.9 2.1 2.3 2.5
VOH (V)
VOH > VDD –0.3 V @ IOH = –0.6 mA
VOH > VDD –1.0 V @ IOH = –4.0 mA
IOL (mA)
25
15 85
10
5
0
0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6
VOL (V)
VOL < 0.4 V @ IOL = 1.6 mA
VOL < 1.5 V @ IOL = 10.0 mA
Figure 20-9. Typical Low-Side Driver Characteristics –
Port PTA7–PTA0 (VDD = 5.5 Vdc)
14
12
10 –40
0
8
IOL (mA)
25
6 85
4
2
0
0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6
VOL (V)
VOL < 0.3 V @ IOL = 0.5 mA
VOL < 1.0 V @ IOL = 6.0 mA
Figure 20-10. Typical Low-Side Driver Characteristics –
Port PTA7–PTA0 (VDD = 2.7 Vdc)
60
50
40 –40
IOL (mA)
0
30
25
20 85
10
0
0.4 0.6 0.8 1.0 1.2 1.4 1.6
VOL (V)
VOL < 1.5 V @ IOL = 20 mA
30
25
20 –40
0
IOL (mA)
15 25
85
10
0
0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6
VOL (V)
VOL < 0.8 V @ IOL = 10 mA
35
30
25 –40
0
20
IOL (mA)
25
15 85
10
5
0
0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6
VOL (V)
VOL < 0.4 V @ IOL = 1.6 mA
VOL < 1.5 V @ IOL = 10.0 mA
14
12
10 –40
0
8
IOL (mA)
25
6 85
4
2
0
0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6
VOL (V)
VOL < 0.3 V @ IOL = 0.5 mA
VOL < 1.0 V @ IOL = 6.0 mA
14
12
10
IDD (mA)
8
4
5.5 V
2
3.6 V
0
0 1 2 3 4 5 6 7 8 9
fBUS (MHz)
5.0
4.5
4.0
3.5
3.0
IDD (mA)
2.5
2.0
1.5
1.0 5.5 V
0.5 3.6 V
0
0 1 2 3 4 5 6 7 8
fBUS (MHz)
Figure 20-16. Typical Wait Mode IDD, with all Modules Disabled
(–40°C to 85°C)
1. VDD = 5.0 Vdc ± 10%, VSS = 0 Vdc, VDDA = 5.0 Vdc ± 10%, VSSA = 0 Vdc, VREFH = 5.0 Vdc ± 10%, VREFL = 0
2. Source impedances greater than 10 kΩ adversely affect internal RC charging time during input sampling.
3. Zero-input/full-scale reading requires sufficient decoupling measures for accurate conversions.
4. The external system error caused by input leakage current is approximately equal to the product of R source and input
current.
SS
INPUT SS PIN OF MASTER HELD HIGH
1
SPSCK OUTPUT 5
CPOL = 0 NOTE
4
SPSCK OUTPUT 5
CPOL = 1 NOTE
4
6 7
MISO
INPUT MSB IN BITS 6–1 LSB IN
11 10 11
MOSI
OUTPUT MASTER MSB OUT BITS 6–1 MASTER LSB OUT
Note: This first clock edge is generated internally, but is not seen at the SPSCK pin.
SS
INPUT SS PIN OF MASTER HELD HIGH
1
SPSCK OUTPUT 5
CPOL = 0 NOTE
4
SPSCK OUTPUT 5
CPOL = 1 NOTE
4
6 7
MISO
INPUT MSB IN BITS 6–1 LSB IN
10 11 10
MOSI
OUTPUT MASTER MSB OUT BITS 6–1 MASTER LSB OUT
Note: This last clock edge is generated internally, but is not seen at the SPSCK pin.
SS
INPUT
1 3
SPSCK INPUT 5
CPOL = 0 4
2
SPSCK INPUT 5
CPOL = 1
4
8 9
MISO
INPUT SLAVE MSB OUT BITS 6–1 SLAVE LSB OUT NOTE
6 7 10 11 11
MOSI
OUTPUT MSB IN BITS 6–1 LSB IN
SS
INPUT
1
SPSCK INPUT 5
CPOL = 0 4
2 3
SPSCK INPUT 5
CPOL = 1
4
10 9
8
MISO
OUTPUT NOTE SLAVE MSB OUT BITS 6–1 SLAVE LSB OUT
6 7 10 11
MOSI
INPUT MSB IN BITS 6–1 LSB IN
21.1 Introduction
This section contains ordering numbers for the MC68HC908GT16 and MC68HC908GT8 and gives the
dimensions for:
• 42-pin shrink dual in-line package (case 858-01)
• 44-pin plastic quad flat pack (case 824A-01)
The following figures show the latest package drawings at the time of this publication. To make sure that
you have the latest package specifications, contact your local Freescale Semiconductor sales office.
MC908GTXX X XX E
FAMILY Pb FREE
PACKAGE DESIGNATOR
TEMPERATURE RANGE
A.1 Introduction
This section introduces the MC68HC08GT16, the ROM part equivalent to the MC68HC908GT16. The
entire data book apply to this ROM device, with exceptions outlined in this appendix.
INTERNAL BUS
M68HC08 CPU
PORTA
PTA7/KBD7–
DDRA
CPU ARITHMETIC/LOGIC PROGRAMMABLE TIMEBASE
MODULE PTA0/KBD0(1)
REGISTERS UNIT (ALU)
PTB7/AD7
CONTROL AND STATUS SINGLE BREAKPOINT BREAK
REGISTERS — 64 BYTES MODULE PTB6/AD6
PTB5/AD5
PORTB
PTB4/AD4
DDRB
USER ROM DUAL VOLTAGE
LOW-VOLTAGE INHIBIT MODULE PTB3/AD3
15,872 BYTES
PTB2/AD2
PTB1/AD1
8-BIT KEYBOARD
USER RAM — 512 BYTES INTERRUPT MODULE PTB0/AD0
PTC6(1)
MONITOR ROM (Monitor Block) — 350 BYTES 2-CHANNEL TIMER INTERFACE PTC5(1)
MODULE 1 PTC4(1)(2)
PORTC
DDRC
MONITOR ROM (ROM Block) — 649 BYTES
PTC3(1)(2)
MONITOR ROM (Jump Table) — 24 BYTES
2-CHANNEL TIMER INTERFACE PTC2(1)(2)
MODULE 2 PTC1(1)(2)
USER ROM VECTOR SPACE — 36 BYTES
PTC0(1)(2)
SERIAL COMMUNICATIONS
PTE4/OSC1 INTERFACE MODULE PTD7/T2CH1(1)
INTERNAL CLOCK
PTE3/OSC2 GENERATOR MODULE PTD6/T2CH0(1)
COMPUTER OPERATING PTD5/T1CH1(1)
PTD4/T1CH0(1)
PORTD
PROPERLY MODULE
DDRD
PTD3/SPSCK(1)
SYSTEM INTEGRATION
RST(3) SERIAL PERIPHERAL PTD2/MOSI(1)
MODULE
INTERFACE MODULE PTD1/MISO(1)
PTD0/SS(1)
SINGLE EXTERNAL
IRQ(3)
INTERRUPT MODULE MONITOR MODULE PTE2
PORTE
DDRE
VREFH PTE1/RxD
8-BIT ANALOG-TO-DIGITAL
CONVERTER MODULE MEMORY MAP PTE0/TxD
VREFL
MODULE
POWER-ON RESET
MODULE CONFIGURATION REGISTER 1 SECURITY
MODULE MODULE
VDD
VSS
VDDA POWER CONFIGURATION REGISTER 2
MODULE MONITOR MODE ENTRY
VSSA
MODULE
$0000
I/O REGISTERS
↓
64 BYTES
$003F
$0040
RAM
↓
512 BYTES
$023F
$0240
UNIMPLEMENTED
↓
6416 BYTES
$1B4F
$1B50
MONITOR ROM (ROM BLOCK)
↓
649 BYTES
$1DD8
$1DD9
UNIMPLEMENTED
↓
41,511 BYTES
$BFFF
$C000
ROM
↓ 15,872 BYTES
$FDFF
$FE00 SIM BREAK STATUS REGISTER (SBSR)
$FE01 SIM RESET STATUS REGISTER (SRSR)
$FE02 RESERVED (SUBAR)
$FE03 SIM BREAK FLAG CONTROL REGISTER (SBFCR)
$FE04 INTERRUPT STATUS REGISTER 1 (INT1)
$FE05 INTERRUPT STATUS REGISTER 2 (INT2)
$FE06 INTERRUPT STATUS REGISTER 3 (INT3)
$FE07 RESERVED
$FE08 RESERVED
$FE09 BREAK ADDRESS REGISTER HIGH (BRKH)
$FE0A BREAK ADDRESS REGISTER LOW (BRKL)
$FE0B BREAK STATUS AND CONTROL REGISTER (BRKSCR)
$FE0C LVI STATUS REGISTER (LVISR)
$FE0D
UNIMPLEMENTED
↓
3 BYTES
$FE0F
$FE10 UNIMPLEMENTED
↓ 16 BYTES
RESERVED FOR COMPATIBILITY WITH MONITOR CODE
$FE1F FOR A-FAMILY PART
$FE20
MONITOR ROM (MONITOR BLOCK)
↓
350 BYTES
$FF7D
$FF7E RESERVED
$FF7F MONITOR ROM (JUMP TABLE) 1 BYTE
$FF80 ICG TRIM REGISTER 5V (ICGTR5) FIX VALUE
$FF81 ICG TRIM REGISTER 3V (ICGTR3) FIX VALUE
$FF82
MONITOR ROM (JUMP TABLE)
↓
21 BYTES
$FF96
$FF97
UNIMPLEMENTED
↓
69 BYTES
$FFDB
$FFDC
ROM VECTORS
↓
36 BYTES
$FFFF(1)
1. $FFF6–$FFFD reserved for eight security bytes
Bus
Characteristic(1) Voltage Frequency Symbol Typ(2) Max Unit
(MHz)
5.0 8 15 20
Run mode VDD supply current(3) RIDD mA
3.0 4 4.5 8
5.0 8 4 8
Wait mode VDD supply current(4) WIDD mA
3.0 4 1.5 4
Stop mode VDD supply current(5)
25°C 1 5
25°C with TBM enabled(6) 20 —
5.0 SIDD μA
25°C with LVI and TBM enabled(6) 300 —
–40°C to 85°C with TBM enabled(6) 50 —
–40°C to 85°C with LVI and TBM enabled(6) 500 —
Stop mode VDD supply current(5)
25°C 1 3
25°C with TBM enabled(6) 12 —
3.0 SIDD μA
25°C with LVI and TBM enabled(6) 200 —
–40°C to 85°C with TBM enabled(6) 30 —
–40°C to 85°C with LVI and TBM enabled(6) 300 —
1. VDD = 5.0 Vdc ± 10%, VSS = 0 Vdc, TA = TA (min) to TA (max), unless otherwise noted.
2. Typical values reflect average measurements at 25°C only.
3. Run (operating) IDD measured using external square wave clock source (fOSC = 32 MHz for 5 V and fOSC = 16 MHz for
3 V). All inputs 0.2 V from rail. No dc loads. Less than 100 pF on all outputs. Measured with all modules enabled.
4. Wait IDD measured using external square wave clock source (fOSC = 32 MHz for 5 V and fOSC = 16 MHz for 3 V). All inputs
0.2 V from rail. No dc loads. Less than 100 pF on all outputs. All ports configured as inputs. Measured with ICG and LVI
enabled.
5. Stop IDD is measured with OSC1 = VSS.
6. Stop IDD with TBM enabled is measured using an external square wave clock source (fOSC = 32 MHz for 5 V and
fOSC = 16 MHz for 3 V).
1. VDD = 5.0 Vdc ± 10%, VSS = 0 Vdc, VDDA = 5.0 Vdc ± 10%, VSSA = 0 Vdc, VREFH = 5.0 Vdc ± 10%, VREFL = 0
2. Source impedances greater than 10 kΩ adversely affect internal RC charging time during input sampling.
3. Zero-input/full-scale reading requires sufficient decoupling measures for accurate conversions.
4. The external system error caused by input leakage current is approximately equal to the product of R source and input
current.
Internal oscillator base frequency(2), (3) fINTOSC 183.75 245 306.25 kHz
Internal oscillator tolerance fOSC_TOL –25 — +25 %
(4)
Internal oscillator multiplier N 1 — 127 —
1. VDD = 5.5 Vdc to 2.7 Vdc, VSS = 0 Vdc, TA = TA (min) to TA (max), unless otherwise noted
2. Internal oscillator is selectable through software for a maximum frequency.
Actual frequency will be multiplier (N) x base frequency.
3. fBus = (fINTOSC / 4) x N when internal clock source selected
4. Multiplier must be chosen to limit the maximum bus frequency of 4 MHz for 2.7-V operation and 8 MHz for 4.5-V operation.
MC68HC908GT16
Rev. 5.0, 04/2007