MC68HC08AZ32A
MC68HC08AZ32A
Data Sheet
M68HC08
Microcontrollers
MC68HC08AZ32A
Rev. 2
07/2005
freescale.com
MC68HC08AZ32A
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/
Refer to the Revision History for a summary of changes contained in this document. For your
convenience, the page number designators have been linked to the appropriate location.
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.
Freescale Semiconductor 3
MC68HC08AZ32A Data Sheet, Rev. 2
4 Freescale Semiconductor
List of Chapters
Chapter 2 Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Freescale Semiconductor 5
List of Chapters
6 Freescale Semiconductor
Table of Contents
Chapter 1
General Description
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.3 Pin Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.3.1 Power Supply Pins (VDD and VSS). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.3.2 Oscillator Pins (OSC1 and OSC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.3.3 External Reset Pin (RST). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.3.4 External Interrupt Pin (IRQ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.3.5 Analog Power Supply Pin (VDDA). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.3.6 Analog Ground Pin (VSSA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.3.7 ADC Analog Ground Pin (AVSS/VREFL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.3.8 ADC Reference High Voltage Pin (VREFH). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.3.9 ADC Analog Power Supply Pin (VDDAREF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.3.10 External Filter Capacitor Pin (CGMXFC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.3.11 Port A Input/Output (I/O) Pins (PTA7–PTA0). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.3.12 Port B I/O Pins (PTB7/ATD7–PTB0/ATD0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.3.13 Port C I/O Pins (PTC5–PTC0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.3.14 Port D I/O Pins (PTD7–PTD0/ATD8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.3.15 Port E I/O Pins (PTE7/SPSCK–PTE0/TxD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.3.16 Port F I/O Pins (PTF6–PTF0/TACH2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.3.17 Port G I/O Pins (PTG2/KBD2–PTG0/KBD0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.3.18 Port H I/O Pins (PTH1/KBD4–PTH0/KBD3). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.3.19 CAN Transmit Pin (TxCAN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.3.20 CAN Receive Pin (RxCAN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.4 Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Chapter 2
Memory
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.2 I/O Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.3 Additional Status and Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.4 Vector Addresses and Priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.5 Random-Access Memory (RAM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.6 Read-Only Memory (ROM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.7 Electrically Erasable Programmable Read-Only Memory (EEPROM) . . . . . . . . . . . . . . . . . . . . 41
2.7.1 EEPROM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.7.1.1 EEPROM Timebase Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.7.1.2 EEPROM Program/Erase Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.7.1.3 EEPROM Block Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Freescale Semiconductor 7
Table of Contents
Chapter 3
Analog-to-Digital Converter (ADC) Module
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.3.1 ADC Port I/O Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.3.2 Voltage Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.3.3 Conversion Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.3.4 Continuous Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.3.5 Accuracy and Precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.4 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.5 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.5.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.5.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.6 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.6.1 ADC Analog Power Pin (VDDAREF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.6.2 ADC Analog Ground/ADC Voltage Reference Low Pin (AVSS/VREFL) . . . . . . . . . . . . . . . . 57
3.6.3 ADC Voltage Reference Pin (VREFH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.6.4 ADC Voltage In (ADCVIN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.7 I/O Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.7.1 ADC Status and Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.7.2 ADC Data Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.7.3 ADC Input Clock Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Chapter 4
Clock Generator Module (CGM)
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
4.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
4.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
4.3.1 Crystal Oscillator Circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
4.3.2 Phase-Locked Loop Circuit (PLL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
4.3.2.1 Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
4.3.2.2 Acquisition and Tracking Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
8 Freescale Semiconductor
4.3.2.3 Manual and Automatic PLL Bandwidth Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.3.2.4 Programming the PLL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.3.2.5 Special Programming Exceptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4.3.3 Base Clock Selector Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4.3.4 CGM External Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.4 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.4.1 Crystal Amplifier Input Pin (OSC1). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.4.2 Crystal Amplifier Output Pin (OSC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.4.3 External Filter Capacitor Pin (CGMXFC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.4.4 Analog Power Pin (VDDA). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.4.5 Oscillator Enable Signal (SIMOSCEN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.4.6 Crystal Output Frequency Signal (CGMXCLK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.4.7 CGM Base Clock Output (CGMOUT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.4.8 CGM CPU Interrupt (CGMINT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.5 CGM Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.5.1 PLL Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.5.2 PLL Bandwidth Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
4.5.3 PLL Programming Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.6 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4.7 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.7.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.7.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.8 CGM During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.9 Acquisition/Lock Time Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.9.1 Acquisition/Lock Time Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.9.2 Parametric Influences on Reaction Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.9.3 Choosing a Filter Capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.9.4 Reaction Time Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Chapter 5
Computer Operating Properly (COP) Module
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.2 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.3 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.3.1 CGMXCLK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.3.2 STOP Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.3.3 COPCTL Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.3.4 Power-On Reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.3.5 Internal Reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.3.6 Reset Vector Fetch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.3.7 COPD (COP Disable). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.3.8 COPRS (COP Rate Select) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.4 COP Control Register (COPCTL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.5 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.6 Monitor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Freescale Semiconductor 9
Table of Contents
Chapter 6
Central Processor Unit (CPU)
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
6.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
6.3 CPU Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
6.3.1 Accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
6.3.2 Index Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
6.3.3 Stack Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
6.3.4 Program Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
6.3.5 Condition Code Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
6.4 Arithmetic/Logic Unit (ALU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.5 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.5.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.5.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.6 CPU During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.7 Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
6.8 Opcode Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Chapter 7
External Interrupt (IRQ) Module
7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
7.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
7.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
7.4 IRQ Pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
7.5 IRQ Module During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
7.6 IRQ Status and Control Register (ISCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Chapter 8
Keyboard Interrupt (KBD) Module
8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
8.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
8.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
8.4 Keyboard Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
8.5 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
8.5.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
8.5.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
8.6 Keyboard Module During Break Interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
8.7 I/O Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
8.7.1 Keyboard Status and Control Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
8.7.2 Keyboard Interrupt Enable Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
10 Freescale Semiconductor
Chapter 9
Low-Voltage Inhibit (LVI) Module)
9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
9.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
9.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
9.3.1 Polled LVI Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
9.3.2 Forced Reset Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
9.3.3 False Reset Protection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
9.4 LVI Status Register (LVISR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
9.5 LVI Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
9.6 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
9.6.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
9.6.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Chapter 10
Mask Options
10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
10.2 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Chapter 11
MSCAN08 Controller (MSCAN08)
11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
11.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
11.3 External Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
11.4 Message Storage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
11.4.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
11.4.2 Receive Structures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
11.4.3 Transmit Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
11.5 Identifier Acceptance Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
11.5.1 MSCAN Extended ID Rejected if Stuff Bit Between ID16 and ID15. . . . . . . . . . . . . . . . . . 121
11.6 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
11.6.1 Interrupt Acknowledge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
11.6.2 Interrupt Vectors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
11.7 Protocol Violation Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
11.8 Low Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
11.8.1 MSCAN08 Sleep Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
11.8.2 MSCAN08 Soft Reset Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
11.8.3 MSCAN08 Power Down Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
11.8.4 CPU Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
11.8.5 Programmable Wakeup Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
11.9 Timer Link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
11.10 Clock System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
11.11 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Freescale Semiconductor 11
Table of Contents
Chapter 12
Programmable Interrupt Timer (PIT)
12.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
12.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
12.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
12.4 PIT Counter Prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
12.5 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
12.5.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
12.5.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
12.6 PIT During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
12.7 I/O Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
12.7.1 PIT Status and Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
12.7.2 PIT Counter Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
12.7.3 PIT Counter Modulo Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Chapter 13
Input/Output (I/O) Ports
13.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
13.2 Port A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
13.2.1 Port A Data Register (PTA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
13.2.2 Data Direction Register A (DDRA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
13.3 Port B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
13.3.1 Port B Data Register (PTB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
13.3.2 Data Direction Register B (DDRB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
12 Freescale Semiconductor
13.4 Port C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
13.4.1 Port C Data Register (PTC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
13.4.2 Data Direction Register C (DDRC). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
13.5 Port D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
13.5.1 Port D Data Register (PTD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
13.5.2 Data Direction Register D (DDRD). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
13.6 Port E . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
13.6.1 Port E Data Register (PTE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
13.6.2 Data Direction Register E (DDRE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
13.7 Port F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
13.7.1 Port F Data Register (PTF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
13.7.2 Data Direction Register F (DDRF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
13.8 Port G. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
13.8.1 Port G Data Register (PTG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
13.8.2 Data Direction Register G (DDRG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
13.9 Port H. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
13.9.1 Port H Data Register (PTH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
13.9.2 Data Direction Register H (DDRH). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Chapter 14
Serial Communications Interface (SCI)
14.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
14.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
14.3 Pin Name Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
14.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
14.4.1 Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
14.4.2 Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
14.4.2.1 Character Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
14.4.2.2 Character Transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
14.4.2.3 Break Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
14.4.2.4 Idle Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
14.4.2.5 Inversion of Transmitted Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
14.4.2.6 Transmitter Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
14.4.3 Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
14.4.3.1 Character Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
14.4.3.2 Character Reception. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
14.4.3.3 Data Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
14.4.3.4 Framing Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
14.4.3.5 Baud Rate Tolerance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
14.4.3.6 Receiver Wakeup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
14.4.3.7 Receiver Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
14.4.3.8 Error Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
14.5 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
14.5.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
14.5.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
14.6 SCI During Break Module Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Freescale Semiconductor 13
Table of Contents
Chapter 15
System Integration Module (SIM)
15.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
15.2 SIM Bus Clock Control and Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
15.2.1 Bus Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
15.2.2 Clock Start-Up From POR or LVI Reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
15.2.3 Clocks in Stop and Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
15.3 Reset and System Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
15.3.1 External Pin Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
15.3.2 Active Resets From Internal Sources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
15.3.2.1 Power-On Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
15.3.2.2 Computer Operating Properly (COP) Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
15.3.2.3 Illegal Opcode Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
15.3.2.4 Illegal Address Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
15.3.2.5 Low-Voltage Inhibit (LVI) Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
15.3.3 SIM Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
15.3.4 SIM Counter During Power-On Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
15.3.5 SIM Counter During Stop Mode Recovery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
15.3.6 SIM Counter and Reset States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
15.4 Exception Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
15.4.1 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
15.4.1.1 Hardware Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
15.4.1.2 SWI Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
15.4.2 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
15.5 Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
15.5.1 Status Flag Protection in Break Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
15.6 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
15.6.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
15.6.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
15.7 SIM Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
15.7.1 SIM Break Status Register (SBSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
15.7.2 SIM Reset Status Register (SRSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
15.7.3 SIM Break Flag Control Register (SBFCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
14 Freescale Semiconductor
Chapter 16
Serial Peripheral Interface (SPI)
16.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
16.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
16.3 Pin Name Conventions and I/O Register Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
16.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
16.4.1 Master Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
16.4.2 Slave Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
16.5 Transmission Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
16.5.1 Clock Phase and Polarity Controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
16.5.2 Transmission Format When CPHA = 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
16.5.3 Transmission Format When CPHA = 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
16.5.4 Transmission Initiation Latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
16.5.5 Error Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
16.5.6 Overflow Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
16.5.7 Mode Fault Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
16.6 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
16.7 Queuing Transmission Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
16.8 Resetting the SPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
16.9 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
16.9.1 WAIT Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
16.9.2 STOP Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
16.10 SPI During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
16.11 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
16.11.1 MISO (Master In/Slave Out). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
16.11.2 MOSI (Master Out/Slave In). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
16.11.3 SPSCK (Serial Clock) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
16.11.4 SS (Slave Select) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
16.11.5 VSS (Clock Ground) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
16.12 I/O Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
16.12.1 SPI Control Register (SPCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
16.12.2 SPI Status and Control Register (SPSCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
16.12.3 SPI Data Register (SPDR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Chapter 17
Timer Interface Module A (TIMA)
17.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
17.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
17.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
17.3.1 TIMA Counter Prescaler. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
17.3.2 Input Capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
17.3.3 Output Compare. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
17.3.3.1 Unbuffered Output Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
17.3.3.2 Buffered Output Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Freescale Semiconductor 15
Table of Contents
Chapter 18
Timer Interface Module B (TIMB)
18.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
18.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
18.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
18.3.1 TIMB Counter Prescaler. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
18.3.2 Input Capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
18.3.3 Output Compare. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
18.3.3.1 Unbuffered Output Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
18.3.3.2 Buffered Output Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
18.3.4 Pulse Width Modulation (PWM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
18.3.4.1 Unbuffered PWM Signal Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
18.3.4.2 Buffered PWM Signal Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
18.3.4.3 PWM Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
18.4 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
18.5 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
18.5.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
18.5.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
18.6 TIMB During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
18.7 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
18.7.1 TIMB Clock Pin (PTD4/ATD12/TBCLK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
18.7.2 TIMB Channel I/O Pins (PTF5/TBCH1–PTF4/TBCH0) . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
18.8 I/O Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
18.8.1 TIMB Status and Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
18.8.2 TIMB Counter Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
18.8.3 TIMB Counter Modulo Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
18.8.4 TIMB Channel Status and Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
18.8.5 TIMB Channel Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
16 Freescale Semiconductor
Chapter 19
Development Support
19.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
19.2 Break Module (BRK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
19.2.1 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
19.2.1.1 Flag Protection During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
19.2.1.2 TIM and PIT During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
19.2.1.3 COP During Break Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
19.2.2 Break Module Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
19.2.2.1 Break Status and Control Register (BRKSCR). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
19.2.2.2 Break Address Registers (BRKH and BRKL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
19.2.3 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
19.2.3.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
19.2.3.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
19.3 Monitor Module (MON) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
19.3.1 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
19.3.1.1 Monitor Mode Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
19.3.1.2 Monitor Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
19.3.1.3 Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
19.3.1.4 Break Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
19.3.1.5 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
19.3.2 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
19.3.2.1 Baud Rate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Chapter 20
Electrical Specifications
20.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
20.2 Maximum Ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
20.3 Functional Operating Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
20.4 Thermal Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
20.5 5.0 Volt DC Electrical Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
20.6 Control Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
20.7 ADC Characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
20.8 5.0 Vdc ± 0.5 V Serial Peripheral Interface (SPI) Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
20.9 CGM Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
20.10 CGM Component Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
20.11 CGM Acquisition/Lock Time Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
20.12 RAM Memory Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
20.13 EEPROM Memory Characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Chapter 21
Ordering Information and Mechanical Specifications
21.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
21.2 MC Order Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
21.3 Package Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Freescale Semiconductor 17
Table of Contents
18 Freescale Semiconductor
Chapter 1
General Description
1.1 Introduction
The MC68HC08AZ32A is a member of the low-cost, high-performance M68HC08 Family of 8-bit
microcontroller units (MCUs). All MCUs in the Family use the enhanced M68HC08 central processor unit
(CPU08) and are available with a variety of modules, memory sizes and types, and package types.
1.2 Features
Features include the following:
• High-performance M68HC08 architecture
• Fully upward-compatible object code with M6805, M146805, and M68HC05 Families
• 8.4-MHz internal bus frequency at 125°C
• MSCAN08 controller (scalable CAN) (implementing CAN 2.0b protocol as defined in BOSCH
specification September, 1991)
• Available in 64-pin quad flat pack (QFP)
• 32,256 bytes user read-only memory (ROM)
• User ROM data security(1)
• 512 bytes of on-chip electrically erasable programmable read-only memory (EEPROM) with
security feature
• 1 Kbyte of on-chip random-access memory (RAM)
• Serial peripheral interface (SPI) module
• Serial communications interface (SCI) module
• 16-bit timer interface module (TIMA) with six input capture/output compare channels
• 16-bit timer interface module (TIMB) with two input capture/output compare channels
• Programmable interrupt timer (PIT)
• Clock generator module (CGM)
• 8-bit, 15-channel analog-to-digital convertor (ADC)
• 5-bit keyboard interrupt module (KBI)
1. No security feature is absolutely secure. However, Freescale’s strategy is to make reading or copying the ROM/EEPROM data
difficult for unauthorized users.
Freescale Semiconductor 19
General Description
20 Freescale Semiconductor
Features
M68HC08 CPU
DDRA
PTA
SERIAL COMMUNICATIONS PTA7–PTA0
CPU ARITHMETIC/LOGIC INTERFACE MODULE
REGISTERS UNIT (ALU) RxCAN
DDRB
TxCAN PTB7/ATD7–
PTB
PTB0/ATD0
CONTROL AND STATUS REGISTERS MSCAN08 CONTROLLER
MODULE
PTC5–PTC3
DDRC
PTC
USER RAM — 1024 BYTES BREAK PTC2/MCLK
MODULE
PTC1–PTC0
USER EEPROM — 512 BYTES
LOW-VOLTAGE INHIBIT PTD7
MODULE PTD6/ATD14/TACLK
USER ROM — 32,256 BYTES PTD5/ATD13
DDRD
PTD
PTD4/ATD12/TBCLK
COMPUTER OPERATING PROPERLY
MODULE PTD3/ATD11–
MONITOR ROM — 256 BYTES PTD0/ATD8
DDRE
PTE4/SS
PTE
CLOCK GENERATOR
OSC2 MODULE TIMER B INTERFACE PTE3/TACH1
CGMXFC MODULE PTE2/TACH0
(2 CHANNELS) PTE1/RxD
PTE0/TxD
RST SYSTEM INTEGRATION
MODULE SERIAL PERIPHERAL INTERFACE
MODULE PTF6
PTF5/TBCH1–
DDRF
PTF
IRQ PTF4/TBCHO
IRQ MODULE ANALOG-TO-DIGITAL CONVERTER
MODULE PTF3/TACH5–
PTF0/TACH2
POWER-ON RESET PROGRAMMABLE INTERRUPT TIMER
DDRG
MODULE PTG2/KBD2–
PTG
MODULE
PTG0/KBD0
KEYBOARD INTERRUPT
MODULE DDRH PTH1/KBD4–
VDD PTH PTH0/KBD3
VREFH
VSS
POWER AVSS/VREFL
VSSA VDDAREF
VDDA
Freescale Semiconductor 21
General Description
PTD6/ATD14/TACLK
PTD4/ATD12/TBCLK
PTD5/ATD13
PTC2/MCLK
PTH1/KBD4
CGMXFC
VREFH
OSC1
OSC2
64 PTC5
PTC3
PTC1
PTC0
PTD7
VSSA
vDDA
49
63
62
61
60
59
58
57
56
55
54
53
52
51
50
PTC4 1 48 PTH0/KBD3
IRQ 2 47 PTD3/ATD11
RST 3 46 PTD2/ATD10
PTF0/TACH2 4 45 AVSS/VREFL
PTF1/TACH3 5 44 VDDAREF
PTF2/TACH4 6 43 PTD1/ATD9
PTF3/TACH5 7 42 PTD0/ATD8
PTF4/TBCH0 8 41 PTB7/ATD7
RxCAN 9 40 PTB6/ATD6
TxCAN 10 39 PTB5/ATD5
PTF5/TBCH1 11 38 PTB4/ATD4
PTF6 12 37 PTB3/ATD3
PTE0/TxD 13 36 PTB2/ATD2
PTE1/RxD 14 35 PTB1/ATD1
PTE2/TACH0 15 34 PTB0/ATD0
PTE3/TACH1 16 33 PTA7
18
19
20
21
22
23
24
25
26
27
28
29
30
31
PTE4/SS 17
PTA6 32
PTE6/MOSI
PTE5/MISO
PTE7/SPSCK
VSS
VDD
PTG0/KBD0
PTG1/KBD1
PTG2/KBD2
PTA0
PTA1
PTA2
PTA3
PTA4
PTA5
22 Freescale Semiconductor
Pin Assignments
MCU
VDD VSS
C1
0.1 µF
C2
VDD
Freescale Semiconductor 23
General Description
24 Freescale Semiconductor
Clocks
1.4 Clocks
Details of the clock connections to each of the modules on the MC68HC08AZ32A are shown in Table 1-3.
A short description of each clock source is also given in Table 1-2.
Freescale Semiconductor 25
General Description
26 Freescale Semiconductor
Clocks
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 includes:
• 1024 bytes of RAM
• 32,256 bytes of user ROM
• 512 bytes of EEPROM
• 52 bytes of user-defined vectors
• 256 bytes of monitor ROM
The following definitions apply to the memory map representation of reserved and unimplemented
locations.
• Reserved — Accessing a reserved location can have unpredictable effects on MCU operation.
• Unimplemented — Accessing an unimplemented location can cause an illegal address reset
(within the constraints as outlined in Chapter 15 System Integration Module (SIM)).
$0000
↓ I/O REGISTERS (80 BYTES)
$004F
$0050
↓ RAM (1024 BYTES)
$044F
$0450
↓ UNIMPLEMENTED (176 BYTES)
$04FF
$0500
↓ CAN CONTROL AND MESSAGE BUFFERS (128 BYTES)
$057F
$0580
↓ UNIMPLEMENTED (640 BYTES)
$07FF
$0800
↓ EEPROM (512 BYTES)
$09FF
$0A00
↓ UNIMPLEMENTED (30,108 BYTES)
$7FFF
Freescale Semiconductor 29
Memory
$8000
↓ ROM (32,256 BYTES)
$FDFF
$FE00 SIM BREAK STATUS REGISTER (SBSR)
$FE01 SIM RESET STATUS REGISTER (SRSR)
$FE02 RESERVED
$FE03 SIM BREAK FLAG CONTROL REGISTER (SBFCR)
$FE04
↓ RESERVED
$FE08
$FE09 MORB
$FE0A RESERVED
$FE0B RESERVED
$FE0C BREAK ADDRESS REGISTER HIGH (BRKH)
$FE0D BREAK ADDRESS REGISTER LOW (BRKL)
$FE0E BREAK STATUS AND CONTROL REGISTER (BRKSCR)
$FE0F LVI STATUS REGISTER (LVISR)
$FE10 EEPROM EEDIVH NONVOLATILE REGISTER (EEDIVHNVR)
$FE11 EEPROM EEDIVL NONVOLATILE REGISTER (EEDIVLNVR)
$FE12
↓ RESERVED (8 BYTES)
$FE19
$FE1A EEPROM EEDIVH REGISTER (EEDIVH)
$FE1B EEPROM EEDIVL REGISTER (EEDIVL)
$FE1C EEPROM NONVOLATILE REGISTER (EENVR)
$FE1D EEPROM CONTROL REGISTER (EECR)
$FE1E RESERVED
$FE1F EEPROM ARRAY CONFIGURATION (EEACR)
$FE20
↓ MONITOR ROM (256 BYTES)
$FF1F
$FF20
↓ UNIMPLEMENTED (160 BYTES)
$FFBF
$FFC0
↓ RESERVED (12 BYTES)
$FFCB
$FFCC
↓ VECTORS (52 BYTES)
$FFFF
30 Freescale Semiconductor
I/O Section
Port A Data Register Read: PTA7 PTA6 PTA5 PTA4 PTA3 PTA2 PTA1 PTA0
$0000 (PTA) Write:
See page 155. Reset: Unaffected by reset
Port B Data Register Read: PTB7 PTB6 PTB25 PTB4 PTB3 PTB2 PTB1 PTB0
$0001 (PTB) Write:
See page 157. Reset: Unaffected by reset
Port D Data Register Read: PTD7 PTD6 PTD5 PTD4 PTD3 PTD2 PTD1 PTD0
$0003 (PTD) Write:
See page 161. Reset: Unaffected by reset
$0004 Data Direction Register A Read: DDRA7 DDRA6 DDRA5 DDRA4 DDRA3 DDRA2 DDRA1 DDRA0
(DDRA) Write:
See page 155. 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 157. 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 162. Reset: 0 0 0 0 0 0 0 0
Port E Data Register Read: PTE7 PTE6 PTE5 PTE4 PTE3 PTE2 PTE1 PTE0
$0008 (PTE) Write:
See page 163. Reset: Unaffected by reset
Freescale Semiconductor 31
Memory
Data Direction Register E Read: DDRE7 DDRE6 DDRE5 DDRE4 DDRE3 DDRE2 DDRE1 DDRE0
$000C (DDRE) Write:
See page 164. 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 230. Reset: 0 0 1 0 1 0 0 0
SCI Control Register 1 Read: LOOPS ENSCI TXINV M WAKE ILTY PEN PTY
$0013 (SCC1) Write:
See page 186. Reset: 0 0 0 0 0 0 0 0
SCI Control Register 2 Read: SCTIE TCIE SCRIE ILIE TE RE RWU SBK
$0014 (SCC2) Write:
See page 188. Reset: 0 0 0 0 0 0 0 0
32 Freescale Semiconductor
I/O Section
SCI Baud Rate Register Read: SCP1 SCP0 R SCR2 SCR1 SCR0
$0019 (SCBR) Write:
See page 194. Reset: 0 0 0 0 0 0 0 0
PLL Programming Register Read: MUL7 MUL6 MUL5 MUL4 VRS7 VRS6 VRS5 VRS4
$001E (PPG) Write:
See page 71. Reset: 0 1 1 0 0 1 1 0
Mask Option Register A Read: LVISTOP ROMSEC LVIRST LVIPWR SSREC COPRS STOP COPD
$001F (MORA) Write:
See page 109. Reset: Unaffected by reset
Freescale Semiconductor 33
Memory
34 Freescale Semiconductor
I/O Section
ADC Data Register Read: AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0
$0039 (ADR) Write:
See page 59. Reset: Indeterminate after reset
$003B Read:
↓ Unimplemented Write:
$003F Reset:
Freescale Semiconductor 35
Memory
36 Freescale Semiconductor
Additional Status and Control Registers
Freescale Semiconductor 37
Memory
EEDIV Divider Low Read: EEDIV7 EEDIV6 EEDIV5 EEDIV4 EEDIV3 EE2DIV EEDIV1 EEDIV0
$FE1B Register (EEDIVL) Write:
See page 49. Reset: Contents of EEDIVLNVR ($FE11)
Read:
EEPROM Nonvolatile R R R EEPRTCT EEPB3 EEPB2 EEPB1 EEPB0
$FE1C Register (EENVR) Write:
See page 49.
Reset: PV = Programmed value or 1 in the erased state.
Read: 0
EEPROM Control Register R EEOFF EERAS1 EERAS0 ELAT AUTO EEPGM
$FE1D (EECR) Write:
See page 46.
Reset: 0 0 0 0 0 0 0 0
EEPROM Array Read: R R R EEPRTCT EEBP3 EEBP2 EEBP1 EEBP0
Configuration Register
$FE1F Write:
(EEACR)
See page 47. Reset: Contents of EENVR ($FE1C)
38 Freescale Semiconductor
Memory
39 Freescale Semiconductor
Memory
40 Freescale Semiconductor
Read-Only Memory (ROM)
During a subroutine call, the CPU uses 2 bytes of the stack to store the return address. The stack pointer
decrements during pushes and increments during pulls.
NOTE
Care should be taken when using nested subroutines. The CPU may
overwrite data in the RAM during a subroutine or during the interrupt
stacking operation.
1. No security feature is absolutely secure. However, Freescale’s strategy is to make reading or copying the ROM difficult for
unauthorized users.
Freescale Semiconductor 41
Memory
EENVR and EEDIVNVR are nonvolatile EEPROM registers. They are programmed and erased in the
same way as EEPROM bytes. The contents of these registers are loaded into their respective volatile
registers during a MCU reset. The values in these read/write volatile registers define the EEPROM
configurations.
For EENVR, the corresponding volatile register is the EEPROM array configuration register (EEACR). For
the EEDIVNVR (two 8-bit registers: EEDIVHNVR and EEDIVLNVR), the corresponding volatile register
is the EEPROM divider register (EEDIV: EEDIVH and EEDIVL).
42 Freescale Semiconductor
Electrically Erasable Programmable Read-Only Memory (EEPROM)
These bits are effective after a reset or a upon read of the EENVR register. The block protect configuration
can be modified by erasing/programming the corresponding bits in the EENVR register and then reading
the EENVR register. Please see 2.7.3.2 EEPROM Array Configuration Register for more information.
NOTE
Once EEDIVSECD in the EEDIVHNVR is programmed to 0 and after a
system reset, the EEDIV security feature is permanently enabled because
the EEDIVSECD bit in the EEDIVH is always loaded with 0 thereafter. Once
this security feature is armed, erase and program mode are disabled for
EEDIVHNVR and EEDIVLNVR. Modifications to the EEDIVH and EEDIVL
registers are also disabled. Therefore, be cautious when programming a
value into the EEDIVHNVR.
Freescale Semiconductor 43
Memory
NOTE
None of the bit locations are actually programmed more than once although
the byte was programmed eight times.
When this technique is utilized, a program/erase cycle is defined as multiple program sequences (up to
eight) to a unique location followed by a single erase operation.
44 Freescale Semiconductor
Electrically Erasable Programmable Read-Only Memory (EEPROM)
B. If more than one valid EEPROM write occurs, the last address and data
will be latched overriding the previous address and data. Once data is
written to the desired address, do not read EEPROM locations other than
the written location. (Reading an EEPROM location returns the latched data
and causes the read address to be latched.)
C. The EEPGM bit cannot be set if the EELAT bit is cleared or a non-valid
EEPROM address is latched. This is to ensure proper programming
sequence. Once EEPGM is set, do not read any EEPROM locations;
otherwise, the current program cycle will be unsuccessful. When EEPGM
is set, the on-board programming sequence will be activated.
D. The delay time for the EEPGM bit to be cleared in AUTO mode is less
than tEEPGM. However, on other MCUs, this delay time may be different.
For forward compatibility, software should not make any dependency on
this delay time.
E. Any attempt to clear both EEPGM and EELAT bits with a single
instruction will only clear EEPGM. This is to allow time for removal of high
voltage from the EEPROM array.
Freescale Semiconductor 45
Memory
the written location. (Reading an EEPROM location returns the latched data
and causes the read address to be latched.)
C. The EEPGM bit cannot be set if the EELAT bit is cleared or a non-valid
EEPROM address is latched. This is to ensure proper programming
sequence. Once EEPGM is set, do not read any EEPROM locations;
otherwise, the current program cycle will be unsuccessful. When EEPGM
is set, the on-board programming sequence will be activated.
D. The delay time for the EEPGM bit to be cleared in AUTO mode is less
than tEEBYTE /tEEBLOCK/tEEBULK. However, on other MCUs, this delay time
may be different. For forward compatibility, software should not make any
dependency on this delay time.
E. Any attempt to clear both EEPGM and EELAT bits with a single
instruction will only clear EEPGM. This is to allow time for removal of high
voltage from the EEPROM array.
Bit 7— Unused
This read/write bit is software programmable but has no functionality.
EEOFF — EEPROM Power Down
This read/write bit disables the EEPROM module for lower power consumption. Any attempts to
access the array will give unpredictable results. Reset clears this bit.
1 = Disable EEPROM array
0 = Enable EEPROM array
EERAS1 and EERAS0 — Erase/Program Mode Select Bits
These read/write bits set the erase modes. Reset clears these bits.
46 Freescale Semiconductor
Electrically Erasable Programmable Read-Only Memory (EEPROM)
Freescale Semiconductor 47
Memory
48 Freescale Semiconductor
Electrically Erasable Programmable Read-Only Memory (EEPROM)
NOTE
The EENVR will leave the factory programmed with $F0 such that the full
array is available and unprotected.
Freescale Semiconductor 49
Memory
These two registers are protected from erase and program operations if the EEDIVSECD is set to 1 in the
EEDIVH (see 2.7.3.4 EEPROM Timebase Divider Register) or programmed to a 1 in the EEDIVHNVR.
NOTE
Once EEDIVSECD in the EEDIVHNVR is programmed to 0 and after a
system reset, the EEDIV security feature is permanently enabled because
the EEDIVSECD bit in the EEDIVH is always loaded with 0 thereafter. Once
this security feature is armed, erase and program mode are disabled for
EEDIVHNVR and EEDIVLNVR. Modifications to the EEDIVH and EEDIVL
registers are also disabled. Therefore, care should be taken before
programming a value into the EEDIVHNVR.
50 Freescale Semiconductor
Electrically Erasable Programmable Read-Only Memory (EEPROM)
Freescale Semiconductor 51
Memory
52 Freescale Semiconductor
Chapter 3
Analog-to-Digital Converter (ADC) Module
3.1 Introduction
This section describes the 8-bit analog-to-digital converter (ADC) module.
3.2 Features
Features include:
• 15 channels with multiplexed Input
• Linear successive approximation
• 8-bit resolution
• Single or continuous conversion
• Conversion complete flag or conversion complete interrupt
• Selectable ADC clock
Freescale Semiconductor 53
Analog-to-Digital Converter (ADC) Module
M68HC08 CPU
DDRA
PTA
SERIAL COMMUNICATIONS PTA7–PTA0
CPU ARITHMETIC/LOGIC INTERFACE MODULE
REGISTERS UNIT (ALU) RxCAN
DDRB
TxCAN PTB7/ATD7–
PTB
PTB0/ATD0
CONTROL AND STATUS REGISTERS MSCAN08 CONTROLLER
MODULE
PTC5–PTC3
DDRC
PTC
USER RAM — 1024 BYTES BREAK PTC2/MCLK
MODULE
PTC1–PTC0
USER EEPROM — 512 BYTES
LOW-VOLTAGE INHIBIT PTD7
MODULE PTD6/ATD14/TACLK
USER ROM — 32,256 BYTES PTD5/ATD13
DDRD
PTD
PTD4/ATD12/TBCLK
COMPUTER OPERATING PROPERLY
MODULE PTD3/ATD11–
MONITOR ROM — 256 BYTES PTD0/ATD8
DDRE
PTE4/SS
PTE
CLOCK GENERATOR
OSC2 MODULE TIMER B INTERFACE PTE3/TACH1
CGMXFC MODULE PTE2/TACH0
(2 CHANNELS) PTE1/RxD
PTE0/TxD
RST SYSTEM INTEGRATION
MODULE SERIAL PERIPHERAL INTERFACE
MODULE PTF6
PTF5/TBCH1–
DDRF
PTF
IRQ PTF4/TBCHO
IRQ MODULE ANALOG-TO-DIGITAL CONVERTER
MODULE PTF3/TACH5–
PTF0/TACH2
POWER-ON RESET PROGRAMMABLE INTERRUPT TIMER
DDRG
MODULE PTG2/KBD2–
PTG
MODULE
PTG0/KBD0
KEYBOARD INTERRUPT
MODULE DDRH PTH1/KBD4–
VDD PTH PTH0/KBD3
VREFH
VSS
POWER AVSS/VREFL
VSSA VDDAREF
VDDA
54 Freescale Semiconductor
Functional Description
INTERNAL
DATA BUS
READ DDRB/DDRB
ADC CHANNEL x
READ PTB/PTD
DISABLE
AIEN COCO
ADC CLOCK
CGMXCLK
CLOCK
GENERATOR
BUS CLOCK
ADIV[2:0] ADICLK
Freescale Semiconductor 55
Analog-to-Digital Converter (ADC) Module
3.4 Interrupts
When the AIEN bit is set, the ADC module is capable of generating a CPU interrupt after each ADC
conversion. A CPU interrupt is generated if the COCO bit (ADC status and control register, $0038) is at 0.
The COCO bit is not used as a conversion complete flag when interrupts are enabled.
56 Freescale Semiconductor
I/O Registers
Address: $0038
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 = Unimplemented
Freescale Semiconductor 57
Analog-to-Digital Converter (ADC) Module
In interrupt mode (AIEN = 1), COCO is a read-only bit that is not set at the end of a conversion. It
always reads as a 0.
1 = Conversion completed (AIEN = 0)
0 = Conversion not completed (AIEN = 0) or CPU interrupt enabled
(AIEN = 1)
NOTE
The write function of the COCO bit is reserved. When writing to the ADSCR
register, always have a 0 in the COCO bit position.
AIEN — ADC Interrupt Enable Bit
When this bit is set, an interrupt is generated at the end of an ADC conversion. The interrupt signal is
cleared when the data register is read or the status/control register is written. Reset clears the AIEN bit.
1 = ADC interrupt enabled
0 = ADC interrupt disabled
ADCO — ADC Continuous Conversion Bit
When set, the ADC will convert samples continuously and update the ADR register at the end of each
conversion. Only one conversion is allowed when this bit is cleared. Reset clears the ADCO bit.
1 = Continuous ADC conversion
0 = One ADC conversion
ADCH[4:0] — ADC Channel Select Bits
ADCH4, ADCH3, ADCH2, ADCH1, and ADCH0 form a 5-bit field which is used to select one of 15 ADC
channels. Channel selection is detailed in Table 3-1. Care should be taken when using a port pin as
both an analog and a digital input simultaneously to prevent switching noise from corrupting the analog
signal.
The ADC subsystem is turned off when the channel select bits are all set to one. This feature allows
for reduced power consumption for the MCU when the ADC is not used. Reset sets these bits.
NOTE
Recovery from the disabled state requires one conversion cycle to stabilize.
58 Freescale Semiconductor
I/O Registers
Freescale Semiconductor 59
Analog-to-Digital Converter (ADC) Module
NOTE
During the conversion process, changing the ADC clock will result in an
incorrect conversion.
60 Freescale Semiconductor
Chapter 4
Clock Generator Module (CGM)
4.1 Introduction
The clock generator module (CGM) generates the crystal clock signal, CGMXCLK, which operates at the
frequency of the crystal. The CGM also generates the base clock signal, CGMOUT, from which the
system clocks are derived. CGMOUT is based on either the crystal clock divided by two or the
phase-locked loop (PLL) clock, CGMVCLK, divided by two. The PLL is a frequency generator designed
for use with 1-MHz to 8-MHz crystals or ceramic resonators. The PLL can generate an 8-MHz bus
frequency without using high-frequency crystals.
4.2 Features
Features include:
• Phase-locked loop with output frequency in integer multiples of the crystal reference
• Programmable hardware voltage-controlled oscillator (VCO) for low-jitter operation
• Automatic bandwidth control mode for low-jitter operation
• Automatic frequency lock detector
• CPU interrupt on entry or exit from locked condition
Freescale Semiconductor 61
Clock Generator Module (CGM)
CGMXCLK
OSC1
CLOCK A CGMOUT
SELECT ÷2
CIRCUIT B S*
*When S = 1,
CGMRDV CGMRCLK CGMOUT = B
BCS
PTC3
VDDA CGMXFC VSS
VRS7–VRS4 MONITOR MODE
USER MODE
PLL ANALOG
MUL7–MUL4
PLL Programming Register Read: MUL7 MUL6 MUL5 MUL4 VRS7 VRS6 VRS5 VRS4
$001E (PPG) Write:
See page 71. Reset: 0 1 1 0 0 1 1 0
= Unimplemented
62 Freescale Semiconductor
Functional Description
4.3.2.1 Circuits
The PLL consists of these circuits:
• Voltage-controlled oscillator (VCO)
• Modulo VCO frequency divider
• Phase detector
• Loop filter
• Lock detector
The operating range of the VCO is programmable for a wide range of frequencies and for maximum
immunity to external noise, including supply and CGMXFC noise. The VCO frequency is bound to a range
from roughly one-half to twice the center-of-range frequency, fCGMVRS. Modulating the voltage on the
CGMXFC pin changes the frequency within this range. By design, fCGMVRS is equal to the nominal
center-of-range frequency, fNOM, (4.9152 MHz) times a linear factor L or (L)fNOM.
CGMRCLK is the PLL reference clock, a buffered version of CGMXCLK. CGMRCLK runs at a frequency,
fCGMRCLK, and is fed to the PLL through a buffer. The buffer output is the final reference clock, CGMRDV,
running at a frequency fCGMRDV = fCGMRCLK.
The VCO’s output clock, CGMVCLK, running at a frequency fCGMVCLK, is fed back through a
programmable modulo divider. The modulo divider reduces the VCO clock by a factor, N. The divider’s
output is the VCO feedback clock, CGMVDV, running at a frequency fCGMVDV = fCGMVCLK/N. 4.3.2.4
Programming the PLL for more information.
The phase detector then compares the VCO feedback clock, CGMVDV, with the final reference clock,
CGMRDV. A correction pulse is generated based on the phase difference between the two signals. The
loop filter then slightly alters the dc voltage on the external capacitor connected to CGMXFC based on
the width and direction of the correction pulse. The filter can make fast or slow corrections depending on
its mode, as described in 4.3.2.2 Acquisition and Tracking Modes. The value of the external capacitor and
the reference frequency determines the speed of the corrections and the stability of the PLL.
Freescale Semiconductor 63
Clock Generator Module (CGM)
The lock detector compares the frequencies of the VCO feedback clock, CGMVDV, and the final
reference clock, CGMRDV. Therefore, the speed of the lock detector is directly proportional to the final
reference frequency, fCGMRDV. The circuit determines the mode of the PLL and the lock condition based
on this comparison.
64 Freescale Semiconductor
Functional Description
32 MHz
Example: N = -------------------- = 8
4 MHz
4. Calculate the VCO frequency, fCGMVCLK.
f CGMVCLK = N × f CGMRCLK
Example: fCGMVCLK = 8 × 4 MHz = 32 MHz
Freescale Semiconductor 65
Clock Generator Module (CGM)
5. Calculate the bus frequency, fBUS, and compare fBUS with fBUSDES.
f CGMVCLK
f Bus = ----------------------------
4
32 MHz
Example: f BUS = -------------------- = 8 MHz
4
6. If the calculated fBUS is not within the tolerance limits of your application, select another fBUSDES
or another fRCLK.
7. Using the value 4.9152 MHz for fNOM, calculate the VCO linear range multiplier, L. The linear range
multiplier controls the frequency range of the PLL.
⎛ f CGMVCLK⎞
L = round ⎜ ----------------------------⎟
⎝ f NOM ⎠
32 MHz
Example: L = -------------------------------- = 7
4.9152 MHz
8. Calculate the VCO center-of-range frequency, fCGMVRS. The center-of-range frequency is the
midpoint between the minimum and maximum frequencies attainable by the PLL.
fCGMVRS = L × fNOM
Example: fCGMVRS = 7 × 4.9152 MHz = 34.4 MHz
NOTE
f NOM
For proper operation: f CGMVRS – f CGMVCLK ≤ -------------- .
2
Exceeding the recommended maximum bus frequency or VCO frequency
can crash the MCU.
9. Program the PLL registers accordingly:
a. In the upper four bits of the PLL programming register (PPG), program the binary equivalent
of N.
b. In the lower four bits of the PLL programming register (PPG), program the binary equivalent
of L.
66 Freescale Semiconductor
Functional Description
The BCS bit in the PLL control register (PCTL) selects which clock drives CGMOUT. The VCO clock
cannot be selected as the base clock source if the PLL is not turned on. The PLL cannot be turned off if
the VCO clock is selected. The PLL cannot be turned on or off simultaneously with the selection or
deselection of the VCO clock. The VCO clock also cannot be selected as the base clock source if the
factor L is programmed to a 0. This value would set up a condition inconsistent with the operation of the
PLL, so that the PLL would be disabled and the crystal clock would be forced as the source of the base
clock.
SIMOSCEN
CGMXCLK
VDDA
VSS
OSC1
OSC2
CGMXFC
VDD
RS* CF
RB CBYP
X1
C1 C2
*RS can be 0 (shorted) when used with
higher-frequency crystals.
Refer to manufacturer’s data.
Freescale Semiconductor 67
Clock Generator Module (CGM)
Routing should be done with great care to minimize signal cross talk and noise. See 20.11 CGM
Acquisition/Lock Time Information for routing information and more information on the filter capacitor’s
value and its effects on PLL performance.
68 Freescale Semiconductor
CGM Registers
Freescale Semiconductor 69
Clock Generator Module (CGM)
Address: $001D
Bit 7 6 5 4 3 2 1 Bit 0
Read: LOCK 0 0 0 0
AUTO ACQ XLD
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
70 Freescale Semiconductor
CGM Registers
Freescale Semiconductor 71
Clock Generator Module (CGM)
1101 13
1110 14
1111 15
4.6 Interrupts
When the AUTO bit is set in the PLL bandwidth control register (PBWC), the PLL can generate a CPU
interrupt request every time the LOCK bit changes state. The PLLIE bit in the PLL control register (PCTL)
enables CPU interrupt requests from the PLL. PLLF, the interrupt flag in the PCTL, becomes set whether
CPU interrupt requests are enabled or not. When the AUTO bit is clear, CPU interrupt requests from the
PLL are disabled and PLLF reads as 0.
Software should read the LOCK bit after a PLL CPU interrupt request to see if the request was due to an
entry into lock or an exit from lock. When the PLL enters lock, the VCO clock, CGMVCLK, divided by two
can be selected as the CGMOUT source by setting BCS in the PCTL. When the PLL exits lock, the VCO
clock frequency is corrupt, and appropriate precautions should be taken. If the application is not frequency
sensitive, CPU interrupt requests should be disabled to prevent PLL interrupt service routines from
impeding software performance or from exceeding stack limitations.
NOTE
Software can select the CGMVCLK divided by two as the CGMOUT source
even if the PLL is not locked (LOCK = 0). Therefore, software should make
sure the PLL is locked before setting the BCS bit.
72 Freescale Semiconductor
Low-Power Modes
Freescale Semiconductor 73
Clock Generator Module (CGM)
time varies according to the original error in the output. Minor errors may not even be registered. Typical
PLL applications prefer to use this definition because the system requires the output frequency to be
within a certain tolerance of the desired frequency regardless of the size of the initial error.
The discrepancy in these definitions makes it difficult to specify an acquisition or lock time for a typical
PLL. Therefore, the definitions for acquisition and lock times for this module are:
• Acquisition time, tACQ, is the time the PLL takes to reduce the error between the actual output
frequency and the desired output frequency to less than the tracking mode entry tolerance, ∆TRK.
Acquisition time is based on an initial frequency error, (fDES – fORIG)/fDES, of not more than ±100%.
In automatic bandwidth control mode (see 4.3.2.3 Manual and Automatic PLL Bandwidth Modes),
acquisition time expires when the ACQ bit becomes set in the PLL bandwidth control register
(PBWC).
• Lock time, tLock, is the time the PLL takes to reduce the error between the actual output frequency
and the desired output frequency to less than the lock mode entry tolerance, ∆Lock. Lock time is
based on an initial frequency error, (fDES – fORIG)/fDES, of not more than ±100%. In automatic
bandwidth control mode, lock time expires when the LOCK bit becomes set in the PLL bandwidth
control register (PBWC). (See 4.3.2.3 Manual and Automatic PLL Bandwidth Modes).
Obviously, the acquisition and lock times can vary according to how large the frequency error is and may
be shorter or longer in many cases.
74 Freescale Semiconductor
Acquisition/Lock Time Specifications
For acceptable values of CFact, (see 20.9 CGM Operating Conditions). For the value of VDDA, choose the
voltage potential at which the MCU is operating. If the power supply is variable, choose a value near the
middle of the range of possible supply values.
This equation does not always yield a commonly available capacitor size, so round to the nearest
available size. If the value is between two different sizes, choose the higher value for better stability.
Choosing the lower size may seem attractive for acquisition time improvement, but the PLL may become
unstable. Also, always choose a capacitor with a tight tolerance (±20% or better) and low dissipation.
V DDA
t ACQ = ⎛ --------------⎞ ⎛ --------------⎞
8
⎝ f RDV ⎠ ⎝ K ACQ⎠
V DDA
t AL = ⎛ --------------⎞ ⎛ -------------⎞
4
⎝ f RDV ⎠ ⎝ K TRK⎠
t Lock = t ACQ + t AL
NOTE
The inverse proportionality between the lock time and the reference
frequency.
In automatic bandwidth control mode, the acquisition and lock times are quantized into units based on the
reference frequency. (See 4.3.2.3 Manual and Automatic PLL Bandwidth Modes). A certain number of
clock cycles, nACQ, is required to ascertain that the PLL is within the tracking mode entry tolerance, ∆TRK,
before exiting acquisition mode. A certain number of clock cycles, nTRK, is required to ascertain that the
PLL is within the lock mode entry tolerance, ∆Lock. Therefore, the acquisition time, tACQ, is an integer
Freescale Semiconductor 75
Clock Generator Module (CGM)
multiple of nACQ/fCGMRDV, and the acquisition to lock time, tAL, is an integer multiple of nTRK/fCGMRDV.
Also, since the average frequency over the entire measurement period must be within the specified
tolerance, the total time usually is longer than tLock as calculated above.
In manual mode, it is usually necessary to wait considerably longer than tLock before selecting the PLL
clock (see 4.3.3 Base Clock Selector Circuit), because the factors described in 4.9.2 Parametric
Influences on Reaction Time, may slow the lock time considerably.
When defining a limit in software for the maximum lock time, the value must allow for variation due to all
of the factors mentioned in this section, especially due to the CF capacitor and application specific
influences.
The calculated lock time is only an indication and it is the customer’s responsibility to allow enough of a
guard band for their application. Prior to finalizing any software and while determining the maximum lock
time, take into account all device to device differences. Typically, applications set the maximum lock time
as an order of magnitude higher than the measured value. This is considered sufficient for all such device
to device variation.
Freescale recommends measuring the lock time of the application system by utilizing dedicated software,
running in FLASH, EEPROM, or RAM. This should toggle a port pin when the PLL is first configured
and switched on, then again when it goes from acquisition to lock mode and finally again when the PLL
lock bit is set. The resultant waveform can be captured on an oscilloscope and used to determine
the typical lock time for the microcontroller and the associated external application circuit. For example,
see Figure 4-7
tLock
tACQ tAL
NOTE
The filter capacitor should be fully discharged prior to making any
measurements.
76 Freescale Semiconductor
Chapter 5
Computer Operating Properly (COP) Module
5.1 Introduction
This section describes the computer operating properly (COP) module, 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 periodically clearing the COP counter.
Freescale Semiconductor 77
Computer Operating Properly (COP) Module
SIM
STOP INSTRUCTION
INTERNAL RESET SOURCES(1)
RESET VECTOR FETCH
COPCTL WRITE
COP MODULE
RESET CLEAR
COPCTL WRITE COP COUNTER
COPS
5.3.1 CGMXCLK
CGMXCLK is the crystal oscillator output signal. The CGMXCLK frequency is equal to the crystal
frequency.
78 Freescale Semiconductor
COP Control Register (COPCTL)
5.5 Interrupts
The COP does not generate CPU interrupt requests.
Freescale Semiconductor 79
Computer Operating Properly (COP) Module
80 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 81
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
82 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 83
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
84 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 85
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
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
86 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 87
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 0 – – – IX2 D8 ee ff 4
EOR opr,X
Exclusive OR M with A A ← (A ⊕ M) 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
88 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 INH 58 1
LSL opr,X (Same as ASL)
C 0 – – IX1 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
MOV #opr,opr Move 0 – – – IMD 6E ii dd 4
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 – – –
ORA opr,X IX1 EA ff 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 89
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
90 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 91
92
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
External Interrupt (IRQ) Module
7.1 Introduction
The external interrupt (IRQ) module provides the nonmaskable interrupt input.
7.2 Features
Features include:
• Dedicated external interrupt pins (IRQ)
• IRQ interrupt control bit
• Hysteresis buffer
• Programmable edge-only or edge and level interrupt sensitivity
• Automatic interrupt acknowledge
ACK
INTERNAL ADDRESS BUS
VDD
IRQF
CLR
D Q SYNCHRO- IRQ
NIZER INTERRUPT
IRQ CK
REQUEST
IRQ
LATCH
IMASK
MODE
HIGH TO MODE
VOLTAGE SELECT
DETECT LOGIC
Freescale Semiconductor 93
External Interrupt (IRQ) Module
M68HC08 CPU
DDRA
PTA
SERIAL COMMUNICATIONS PTA7–PTA0
CPU ARITHMETIC/LOGIC INTERFACE MODULE
REGISTERS UNIT (ALU) RxCAN
DDRB
TxCAN PTB7/ATD7–
PTB
PTB0/ATD0
CONTROL AND STATUS REGISTERS MSCAN08 CONTROLLER
MODULE
PTC5–PTC3
DDRC
PTC
USER RAM — 1024 BYTES BREAK PTC2/MCLK
MODULE
PTC1–PTC0
USER EEPROM — 512 BYTES
LOW-VOLTAGE INHIBIT PTD7
MODULE PTD6/ATD14/TACLK
USER ROM — 32,256 BYTES PTD5/ATD13
DDRD
PTD
PTD4/ATD12/TBCLK
COMPUTER OPERATING PROPERLY
MODULE PTD3/ATD11–
MONITOR ROM — 256 BYTES PTD0/ATD8
DDRE
PTE4/SS
PTE
CLOCK GENERATOR
OSC2 MODULE TIMER B INTERFACE PTE3/TACH1
CGMXFC MODULE PTE2/TACH0
(2 CHANNELS) PTE1/RxD
PTE0/TxD
RST SYSTEM INTEGRATION
MODULE SERIAL PERIPHERAL INTERFACE
MODULE PTF6
PTF5/TBCH1–
DDRF
PTF
IRQ PTF4/TBCHO
IRQ MODULE ANALOG-TO-DIGITAL CONVERTER
MODULE PTF3/TACH5–
PTF0/TACH2
POWER-ON RESET PROGRAMMABLE INTERRUPT TIMER
DDRG
MODULE PTG2/KBD2–
PTG
MODULE
PTG0/KBD0
KEYBOARD INTERRUPT
MODULE DDRH PTH1/KBD4–
VDD PTH PTH0/KBD3
VREFH
VSS
POWER AVSS/VREFL
VSSA VDDAREF
VDDA
94 Freescale Semiconductor
IRQ Pin
Interrupt signals on the IRQ pin are latched into the IRQ latch. An interrupt latch remains set until one of
the following occurs:
• Vector fetch — a vector fetch automatically generates an interrupt acknowledge signal which
clears the latch that caused the vector fetch.
• Software clear — software can clear an interrupt latch by writing to the appropriate acknowledge
bit in the interrupt status and control register (ISCR). Writing a 1 to the ACK bit clears the IRQ latch.
• Reset — a reset automatically clears the interrupt latch
The external interrupt pin is falling-edge-triggered and is software-configurable to be both falling-edge and
low-level-triggered. The MODE bit in the ISCR controls the triggering sensitivity of the IRQ pin.
When an interrupt pin is edge-triggered only, the interrupt latch remains set until a vector fetch, software
clear, or reset occurs.
When an interrupt pin is both falling-edge and low-level-triggered, the interrupt latch remains set until both
of the following occur:
• Vector fetch or software clear
• Return of the interrupt pin to a high level
The vector fetch or software clear may occur before or after the interrupt pin returns to a high level. 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 ISCR masks all external interrupt requests. A latched interrupt request is
not presented to the interrupt priority logic unless the corresponding IMASK bit is clear.
NOTE
The interrupt mask (I) in the condition code register (CCR) masks all
interrupt requests, including external interrupt requests. See Figure 7-4.
Freescale Semiconductor 95
External Interrupt (IRQ) Module
FROM RESET
YES
I BIT SET?
NO
YES
INTERRUPT?
NO
FETCH NEXT
INSTRUCTION
SWI YES
INSTRUCTION?
NO
RTI YES
INSTRUCTION? UNSTACK CPU REGISTERS
NO
EXECUTE INSTRUCTION
96 Freescale Semiconductor
IRQ Module During Break Interrupts
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 ISCR 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.
The BIH or BIL instruction is used 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: $001A
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0 IRQF 0
IMASK MODE
Write: ACK
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
Freescale Semiconductor 97
External Interrupt (IRQ) Module
98 Freescale Semiconductor
Chapter 8
Keyboard Interrupt (KBD) Module
8.1 Introduction
The keyboard interrupt module (KBD) provides five independently maskable external interrupt pins.
8.2 Features
Features include:
• Five 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
• Automatic interrupt acknowledge
• Exit from low-power modes
Freescale Semiconductor 99
Keyboard Interrupt (KBD) Module
M68HC08 CPU
DDRA
PTA
SERIAL COMMUNICATIONS PTA7–PTA0
CPU ARITHMETIC/LOGIC INTERFACE MODULE
REGISTERS UNIT (ALU) RxCAN
DDRB
TxCAN PTB7/ATD7–
PTB
PTB0/ATD0
CONTROL AND STATUS REGISTERS MSCAN08 CONTROLLER
MODULE
PTC5–PTC3
DDRC
PTC
USER RAM — 1024 BYTES BREAK PTC2/MCLK
MODULE
PTC1–PTC0
USER EEPROM — 512 BYTES
LOW-VOLTAGE INHIBIT PTD7
MODULE PTD6/ATD14/TACLK
USER ROM — 32,256 BYTES PTD5/ATD13
DDRD
PTD
PTD4/ATD12/TBCLK
COMPUTER OPERATING PROPERLY
MODULE PTD3/ATD11–
MONITOR ROM — 256 BYTES PTD0/ATD8
DDRE
PTE4/SS
PTE
CLOCK GENERATOR
OSC2 MODULE TIMER B INTERFACE PTE3/TACH1
CGMXFC MODULE PTE2/TACH0
(2 CHANNELS) PTE1/RxD
PTE0/TxD
RST SYSTEM INTEGRATION
MODULE SERIAL PERIPHERAL INTERFACE
MODULE PTF6
PTF5/TBCH1–
DDRF
PTF
IRQ PTF4/TBCHO
IRQ MODULE ANALOG-TO-DIGITAL CONVERTER
MODULE PTF3/TACH5–
PTF0/TACH2
POWER-ON RESET PROGRAMMABLE INTERRUPT TIMER
DDRG
MODULE PTG2/KBD2–
PTG
MODULE
PTG0/KBD0
KEYBOARD INTERRUPT
MODULE DDRH PTH1/KBD4–
VDD PTH PTH0/KBD3
VREFH
VSS
POWER AVSS/VREFL
VSSA VDDAREF
VDDA
INTERNAL BUS
VECTOR FETCH
KBD0 DECODER
ACKK
VDD
RESET KEYF
TO PULLUP . CLR
D Q
ENABLE
SYNCHRONIZER
. CK
KB0IE
.
KEYBOARD IMASKK
KBD4 INTERRUPT FF KEYBOARD
INTERRUPT
REQUEST
TO PULLUP MODEK
ENABLE
KB4IE
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 (KBSCR). 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 also can
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 KBI vector address.
• Return of all enabled keyboard interrupt pins to a high level. As long as any enabled keyboard
interrupt pin is low, the keyboard interrupt remains set.
The vector fetch or software clear and the return of all enabled keyboard interrupt pins to a high level 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 low.
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.
9.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 to the LVI trip voltage.
9.2 Features
Features include:
• Programmable LVI reset
• Programmable power consumption
• Digital filtering of VDD pin level
NOTE
If a low-voltage interrupt (LVI) occurs during programming of EEPROM
memory, then adequate programming time may not have been allowed to
ensure the integrity and retention of the data. It is the responsibility of the
user to ensure that in the event of an LVI any addresses being programmed
receive specification programming conditions.
VDD
LVIPWR
FROM MORA
Stop Mode
Filter Bypass
ANLGTRIP LVIOUT
LVISTOP
FROM MORA
With the LVIPWR bit in the MORA register at a 1 and the LVISTOP bit at a 0, the LVI module will be
inactive after a STOP instruction.
NOTE
The LVI feature is intended to provide the safe shutdown of the
microcontroller and thus protection of related circuitry prior to any
application VDD voltage collapsing completely to an unsafe level. Is is not
intended that users operate the microcontroller at lower than the specified
operating voltage, VDD.
10.1 Introduction
This section describes the mask options and the mask option registers. The mask options are hardwired
connections specified at the same time as the ROM code, which allow the user to customize the MCU.
The options control the enable or disable of the following functions:
• Resets caused by the LVI module
• Power to the LVI module
• Stop mode recovery time (32 CGMXCLK cycles or 4096 CGMXCLK cycles)
• ROM security(1)
• STOP instruction
• Computer operating properly (COP) module enable
• EEPROM read protection(1)
• COP time-out period
• EEPROM reference clock source
1. No security feature is absolutely secure. However, Freescale’s strategy is to make reading or copying the ROM/EEPROM data
difficult for unauthorized users.
Address: $FE09
Bit 7 6 5 4 3 2 1 Bit 0
Read: EEDIVCLK 0 EESEC EEMONSEC AZ32A 0 0 0
Write:
Reset: Unaffected by reset
= Unimplemented
11.1 Introduction
The MSCAN08 is the specific implementation of the MSCAN concept targeted for the Freescale
M68HC08 Microcontroller Family. The module is a communication controller implementing the CAN 2.0
A/B protocol as defined in the BOSCH specification dated September 1991.
The CAN protocol was primarily, but not exclusively, designed to be used as a vehicle serial data bus,
meeting the specific requirements of this field: real-time processing, reliable operation in the
electromagnetic interference (EMI) environment of a vehicle, cost-effectiveness and required bandwidth.
MSCAN08 utilizes an advanced buffer arrangement, resulting in a predictable real-time behavior, and
simplifies the application software.
11.2 Features
Basic features are:
• Modular architecture
• Implementation of the CAN Protocol — Version 2.0A/B
– Standard and extended data frames
– 0–8 bytes data length
– Programmable bit rate up to 1 Mbps depending on the actual bit timing and the clock jitter of
the PLL
• Support for remote frames
• Double-buffered receive storage scheme
• Triple-buffered transmit storage scheme with internal prioritization using a local priority concept
• Flexible maskable identifier filter supports alternatively one full size extended identifier filter, two
16-bit filters, or four 8-bit filters
• Programmable wakeup functionality with integrated low-pass filter
• Programmable loop-back mode supports self-test operation
• Separate signalling and interrupt capabilities for all CAN receiver and transmitter error states
(warning, error passive, bus off)
• Programmable MSCAN08 clock source either CPU bus cock or crystal oscillator output
• Programmable link to on-chip timer interface module (TIMB) for time-stamping and network
synchronization
• Low-power sleep mode
M68HC08 CPU
DDRA
PTA
SERIAL COMMUNICATIONS PTA7–PTA0
CPU ARITHMETIC/LOGIC INTERFACE MODULE
REGISTERS UNIT (ALU) RxCAN
DDRB
TxCAN PTB7/ATD7–
PTB
PTB0/ATD0
CONTROL AND STATUS REGISTERS MSCAN08 CONTROLLER
MODULE
PTC5–PTC3
DDRC
PTC
USER RAM — 1024 BYTES BREAK PTC2/MCLK
MODULE
PTC1–PTC0
USER EEPROM — 512 BYTES
LOW-VOLTAGE INHIBIT PTD7
MODULE PTD6/ATD14/TACLK
USER ROM — 32,256 BYTES PTD5/ATD13
DDRD
PTD
PTD4/ATD12/TBCLK
COMPUTER OPERATING PROPERLY
MODULE PTD3/ATD11–
MONITOR ROM — 256 BYTES PTD0/ATD8
DDRE
PTE4/SS
PTE
CLOCK GENERATOR
OSC2 MODULE TIMER B INTERFACE PTE3/TACH1
CGMXFC MODULE PTE2/TACH0
(2 CHANNELS) PTE1/RxD
PTE0/TxD
RST SYSTEM INTEGRATION
MODULE SERIAL PERIPHERAL INTERFACE
MODULE PTF6
PTF5/TBCH1–
DDRF
PTF
IRQ PTF4/TBCHO
IRQ MODULE ANALOG-TO-DIGITAL CONVERTER
MODULE PTF3/TACH5–
PTF0/TACH2
POWER-ON RESET PROGRAMMABLE INTERRUPT TIMER
DDRG
MODULE PTG2/KBD2–
PTG
MODULE
PTG0/KBD0
KEYBOARD INTERRUPT
MODULE DDRH PTH1/KBD4–
VDD PTH PTH0/KBD3
VREFH
VSS
POWER AVSS/VREFL
VSSA VDDAREF
VDDA
CAN STATION 1
CAN NODE 1 CAN NODE 2 CAN NODE N
MCU
CAN CONTROLLER
(MSCAN08)
TxCAN RxCAN
TRANSCEIVER
CAN_H CAN_L
C A N BUS
11.4.1 Background
Modern application layer software is built under two fundamental assumptions:
1. Any CAN node is able to send out a stream of scheduled messages without releasing the bus
between two messages. Such nodes will arbitrate for the bus right after sending the previous
message and will only release the bus in case of lost arbitration.
2. The internal message queue within any CAN node is organized as such that the highest priority
message will be sent out first if more than one message is ready to be sent.
Above behavior cannot be achieved with a single transmit buffer. That buffer must be reloaded right after
the previous message has been sent. This loading process lasts a definite amount of time and has to be
completed within the inter-frame sequence (IFS) to be able to send an uninterrupted stream of messages.
Even if this is feasible for limited CAN bus speeds, it requires that the CPU reacts with short latencies to
the transmit interrupt.
A double buffer scheme would de-couple the re-loading of the transmit buffers from the actual message
being sent and as such reduces the reactiveness requirements on the CPU. Problems may arise if the
sending of a message would be finished just while the CPU re-loads the second buffer. In that case, no
buffer would then be ready for transmission and the bus would be released.
At least three transmit buffers are required to meet the first of the above requirements under all
circumstances. The MSCAN08 has three transmit buffers.
The second requirement calls for some sort of internal prioritization which the MSCAN08 implements with
the local priority concept described in 11.4.2 Receive Structures.
RxFG RXF
Tx0 TXE
PRIO
Tx1 TXE
PRIO
Tx2 TXE
PRIO
All three buffers have a 13-byte data structure similar to the outline of the receive buffers (see 11.12
Programmer’s Model of Message Storage). An additional transmit buffer priority register (TBPR) contains
an 8-bit local priority field (PRIO) (see 11.12.5 Transmit Buffer Priority Registers).
To transmit a message, the CPU08 has to identify an available transmit buffer which is indicated by a set
transmit buffer empty (TXE) flag in the MSCAN08 transmitter flag register (CTFLG) (see 11.13.7
MSCAN08 Transmitter Flag Register).
The CPU08 then stores the identifier, the control bits, and the data content into one of the transmit buffers.
Finally, the buffer has to be flagged ready for transmission by clearing the TXE flag.
The MSCAN08 then will schedule the message for transmission and will signal the successful
transmission of the buffer by setting the TXE flag. A transmit interrupt is generated(1) when TXE is set and
can be used to drive the application software to re-load the buffer.
In case more than one buffer is scheduled for transmission when the CAN bus becomes available for
arbitration, the MSCAN08 uses the local priority setting of the three buffers for prioritization. For this
purpose, every transmit buffer has an 8-bit local priority field (PRIO). The application software sets this
field when the message is set up. The local priority reflects the priority of this particular message relative
to the set of messages being emitted from this node. The lowest binary value of the PRIO field is defined
as the highest priority.
The internal scheduling process takes place whenever the MSCAN08 arbitrates for the bus. This is also
the case after the occurrence of a transmission error.
When a high priority message is scheduled by the application software, it may become necessary to abort
a lower priority message being set up in one of the three transmit buffers. As messages that are already
under transmission cannot be aborted, the user has to request the abort by setting the corresponding
abort request flag (ABTRQ) in the transmission control register (CTCR). The MSCAN08 will then grant
the request, if possible, by setting the corresponding abort request acknowledge (ABTAK) and the TXE
flag in order to release the buffer and by generating a transmit interrupt. The transmit interrupt handler
software can tell from the setting of the ABTAK flag whether the message was actually aborted
(ABTAK = 1) or sent (ABTAK = 0).
1. The transmit interrupt will occur only if not masked. Also, a polling scheme can be applied on TXE.
plus the RTR and IDE bits of CAN 2.0A/B messages. This mode implements a single filter for a full
length CAN 2.0B compliant extended identifier. Figure 11-4 shows how the 32-bit filter bank
(CIDAR0–CIDAR3, CIDMR0–CIDMR3) produces a filter 0 hit.
2. Two identifier acceptance filters, each to be applied to a) the 14 most significant bits of the
extended identifier plus the SRR and the IDE bits of CAN2.0B messages, or b) the 11 bits of the
identifier plus the RTR and IDE bits of CAN 2.0A/B messages. Figure 11-5 shows how the 32-bit
filter bank (CIDAR0–CIDAR3, CIDMR0–CIDMR3) produces filter 0 and 1 hits.
3. Four identifier acceptance filters, each to be applied to the first eight bits of the identifier. This mode
implements four independent filters for the first eight bits of a CAN 2.0A/B compliant standard
identifier. Figure 11-6 shows how the 32-bit filter bank (CIDAR0-3, CIDMR0-3) produces filter 0 to
3 hits.
4. Closed filter. No CAN message will be copied into the foreground buffer RxFG, and the RXF flag
will never be set.
ID28 IDR0 ID21 ID20 IDR1 ID15 ID14 IDR2 ID7 ID6 IDR3 RTR
ID10 IDR0 ID3 ID2 IDR1 IDE ID10 IDR2 ID3 ID10 IDR3 ID3
AM7 CIDMR0 AM0 AM7 CIDMR1 AM0 AM7 CIDMR2 AM0 AM7 CIDMR3 AM0
AC7 CIDAR0 AC0 AC7 CIDAR1 AC0 AC7 CIDAR2 AC0 AC7 CIDAR3 AC0
ID28 IDR0 ID21 ID20 IDR1 ID15 ID14 IDR2 ID7 ID6 IDR3 RTR
ID10 IDR0 ID3 ID2 IDR1 IDE ID10 IDR2 ID3 ID10 IDR3 ID3
ID28 IDR0 ID21 ID20 IDR1 ID15 ID14 IDR2 ID7 ID6 IDR3 RTR
ID10 IDR0 ID3 ID2 IDR1 IDE ID10 IDR2 ID3 ID10 IDR3 ID3
11.5.1 MSCAN Extended ID Rejected if Stuff Bit Between ID16 and ID15
For 32-bit and 16-bit identifier acceptance modes, an extended ID CAN frame with a stuff bit between
ID16 and ID15 can be erroneously rejected, depending on IDAR0, IDAR1, and IDMR1.
Extended IDs (ID28–ID0) which generate a stuff bit between ID16 and ID15:
IDAR0 IDAR1 IDAR2 IDAR3
******** ***1111x xxxxxxxx xxxxxxxx
where: x = 0 or 1 (don't care)
* = pattern for ID28 to ID18 (see the following).
Affected extended IDs (ID28 - ID18) patterns:
a) xxxxxxxxx01 exceptions: 00000000001 01111100001
xxxx1000001 exception: 11111000001
b) xxxxx100000 exception: 01111100000
c) xxxx0111111 exception: 00000111111
d) x0111110000
e) 10000000000
f) 11111111111
g) 10000011111
When an affected ID is received, an incorrect value is compared to the 2nd byte of the filter (IDAR1 and
IDAR5, plus IDAR3 and IDAR7 in 16-bit mode). This incorrect value is the shift register contents before
ID15 is shifted in (i.e., right shifted by 1).
Workaround
If the problematic IDs cannot be avoided, the workaround is to mask certain bits with IDMR1 (and
IDMR5, plus IDMR3 and IDMR7 in 16-bit mode).
Example 1: to receive the message IDs
xxxx xxxx x011 111x xxxx xxxx xxxx xxxx
IDMR1 etc. must be 111x xxx1, i.e. ID20, 19, 18, 15 must be masked.
Example 2: to receive the message IDs
xxxx 0111 1111 111x xxxx xxxx xxxx xxxx
IDMR1 etc. must be 1xxx xxx1, i.e. ID20 and ID15 must be masked.
In general, using IDMR1 etc. 1111 xxx1, i.e. masking ID20, ID19, ID18, SRR, ID15, hides the
problem.
11.6 Interrupts
The MSCAN08 supports four interrupt vectors mapped onto eleven different interrupt sources, any of
which can be individually masked (for details see 11.13.5 MSCAN08 Receiver Flag Register (CRFLG) to
11.13.8 MSCAN08 Transmitter Control Register).
• Transmit Interrupt: At least one of the three transmit buffers is empty (not scheduled) and can be
loaded to schedule a message for transmission. The TXE flags of the empty message buffers are
set.
• Receive Interrupt: A message has been received successfully and loaded into the foreground
receive buffer. This interrupt will be emitted immediately after receiving the EOF symbol. The RXF
flag is set.
• Wakeup Interrupt: An activity on the CAN bus occurred during MSCAN08 internal sleep mode or
power-down mode (provided SLPAK = WUPIE = 1).
• Error Interrupt: An overrun, error, or warning condition occurred. The receiver flag register
(CRFLG) will indicate one of the following conditions:
– Overrun: An overrun condition as described in 11.4.2 Receive Structures has occurred.
– Receiver Warning: The receive error counter has reached the CPU warning limit of 96.
– Transmitter Warning: The transmit error counter has reached the CPU warning limit of 96.
– Receiver Error Passive: The receive error counter has exceeded the error passive limit of 127
and MSCAN08 has gone to error passive state.
– Transmitter Error Passive: The transmit error counter has exceeded the error passive limit of
127 and MSCAN08 has gone to error passive state.
– Bus Off: The transmit error counter has exceeded 255 and MSCAN08 has gone to bus off state.
MSCAN08 RUNNING
MCU SLPRQ = 0
or MSCAN08 SLPAK = 0 MCU
MSCAN08
After wakeup, the MSCAN08 waits for 11 consecutive recessive bits to synchronize to the bus. As a
consequence, if the MSCAN08 is woken by a CAN frame, this frame is not received. The receive message
buffers (RxFG and RxBG) contain messages if they were received before sleep mode was entered. All
pending actions are executed upon wakeup: copying of RxBG into RxFG, message aborts, and message
transmissions. If the MSCAN08 is still in bus-off state after sleep mode was left, it continues counting the
128*11 consecutive recessive bits.
CGMXCLK
OSC ÷2
CGMOUT
(TO SIM)
BCS
PLL ÷2
CGM
MSCAN08
(2 * BUS FREQUENCY.)
÷2
PRESCALER MSCANCLK
(1 .. 64)
CLKSRC
The clock source bit (CLKSRC) in the MSCAN08 module control register (CMCR1) (see 11.13.1
MSCAN08 Module Control Register 0) defines whether the MSCAN08 is connected to the output of the
crystal oscillator or to the PLL output.
The clock source has to be chosen such that the tight oscillator tolerance requirements (up to 0.4%) of
the CAN protocol are met.
NOTE
If the system clock is generated from a PLL, it is recommended to select the
crystal clock source rather than the system clock source due to jitter
considerations, especially at faster CAN bus rates.
A programmable prescaler is used to generate out of the MSCAN08 clock the time quanta (Tq) clock. A
time quantum is the atomic unit of time handled by the MSCAN08.
fMSCANCLK
fTq =
Presc value
The synchronization jump width (SJW) can be programmed in a range of 1 to 4 time quanta by setting the
SJW parameter.
The above parameters can be set by programming the bus timing registers, CBTR0 and CBTR1. See
11.13.3 MSCAN08 Bus Timing Register 0 and 11.13.4 MSCAN08 Bus Timing Register 1.
NOTE
It is the user’s responsibility to make sure that the bit timing settings are in
compliance with the CAN standard,
Table 11-8 gives an overview on the CAN conforming segment settings and the related parameter values.
1. For further explanation of the underlying concepts please refer to ISO/DIS 11 519-1, Section 10.3.
NRZ SIGNAL
1 4 ... 16 2 ... 8
$0509 RESERVED
$050D 5 BYTES
$0518 RESERVED
$053F 40 BYTES
$0540
RECEIVE BUFFER
$054F
$0550
TRANSMIT BUFFER 0
$055F
$0560
TRANSMIT BUFFER 1
$056F
$0570
TRANSMIT BUFFER 2
$057F
Read:
$05b1 IDR1 ID20 ID19 ID18 SRR (=1) IDE (=1) ID17 ID16 ID15
Write:
Read:
$05b2 IDR2 ID14 ID13 ID12 ID11 ID10 ID9 ID8 ID7
Write:
Read:
$05b3 IDR3 ID6 ID5 ID4 ID3 ID2 ID1 ID0 RTR
Write:
Read:
$05b4 DSR0 DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
Write:
Read:
$05b5 DSR1 DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
Write:
Read:
$05b6 DSR2 DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
Write:
Read:
$05b7 DSR3 DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
Write:
Read:
$05b8 DSR4 DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
Write:
Read:
$05b9 DSR5 DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
Write:
Read:
$05bA DSR6 DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
Write:
Read:
$05bB DSR7 DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
Write:
Read:
$05bC DLR DLC3 DLC2 DLC1 DLC0
Write:
= Unimplemented
Figure 11-12. Receive/Transmit Message Buffer Extended Identifier (IDRn)
Read:
$05b1 IDR1 ID2 ID1 ID0 RTR IDE (=0)
Write:
Read:
$05b2 IDR2
Write:
Read:
$05b3 IDR3
Write:
= Unimplemented
0 0 0 0 0
0 0 0 1 1
0 0 1 0 2
0 0 1 1 3
0 1 0 0 4
0 1 0 1 5
0 1 1 0 6
0 1 1 1 7
1 0 0 0 8
Read: 0 0 0 0 0
$0501 CMCR1 LOOPB WUPM CLKSRC
Write:
Read:
$0502 CBTR0 SJW1 SJW0 BRP5 BRP4 BRP3 BRP2 BRP1 BRP0
Write:
Read:
$0503 CBTR1 SAMP TSEG22 TSEG21 TSEG20 TSEG13 TSEG12 TSEG11 TSEG10
Write:
Read:
$0504 CRFLG WUPIF RWRNIF TWRNIF RERRIF TERRIF BOFFIF OVRIF RXF
Write:
Read:
$0505 CRIER WUPIE RWRNIE TWRNIE RERRIE TERRIE BOFFIE OVRIE RXFIE
Write:
Read: 0 0
$0507 CTCR ABTRQ2 ABTRQ1 ABTRQ0 TXEIE2 TXEIE1 TXEIE0
Write:
Read:
$0509 Reserved R R R R R R R R
Write:
Read:
$050E CRXERR RXERR7 RXERR6 RXERR5 RXERR4 RXERR3 RXERR2 RXERR1 RXERR0
Write:
Read:
$050F CTXERR TXERR7 TXERR6 TXERR5 TXERR4 TXERR3 TXERR2 TXERR1 TXERR0
Write:
Read:
$0510 CIDAR0 AC7 AC6 AC5 AC4 AC3 AC2 AC1 AC0
Write:
Read:
$0511 CIDAR1 AC7 AC6 AC5 AC4 AC3 AC2 AC1 AC0
Write:
Read:
$0512 CIDAR2 AC7 AC6 AC5 AC4 AC3 AC2 AC1 AC0
Write:
Read:
$0513 CIDAR3 AC7 AC6 AC5 AC4 AC3 AC2 AC1 AC0
Write:
Read:
$0514 CIDMR0 AM7 AM6 AM5 AM4 AM3 AM2 AM1 AM0
Write:
= Unimplemented R = Reserved
Figure 11-15. MSCAN08 Control Register Structure
Read:
$0516 CIDMR2 AM7 AM6 AM5 AM4 AM3 AM2 AM1 AM0
Write:
Read:
$0517 CIDMR3 AM7 AM6 AM5 AM4 AM3 AM2 AM1 AM0
Write:
= Unimplemented R = Reserved
Figure 11-15. MSCAN08 Control Register Structure (Continued)
The following registers enter and stay in their hard reset state:
CMCR0, CRFLG, CRIER, CTFLG, and CTCR.
The registers CMCR1, CBTR0, CBTR1, CIDAC, CIDAR0–CIDAR3, and CIDMR0–CIDMR3 can only
be written by the CPU when the MSCAN08 is in soft reset state. The values of the error counters are
not affected by soft reset.
When this bit is cleared by the CPU, the MSCAN08 tries to synchronize to the CAN bus. If the
MSCAN08 is not in bus-off state, it will be synchronized after 11 recessive bits on the bus; if the
MSCAN08 is in bus-off state, it continues to wait for 128 occurrences of 11 recessive bits.
Clearing SFTRES and writing to other bits in CMCR0 must be in separate instructions.
1 = MSCAN08 in soft reset state
0 = Normal operation
0 1 2 Tq cycle
1 0 3 Tq cycle
1 1 4 Tq cycle
NOTE
The CBTR0 register can be written only if the SFTRES bit in the MSCAN08
module control register is set.
NOTE
The CBTR1 register can only be written if the SFTRES bit in the MSCAN08
module control register is set.
Table 11-8. Time Segment Values
Time Time
TSEG13 TSEG12 TSEG11 TSEG10 TSEG22 TSEG21 TSEG20
Segment 1 Segment 2
0 0 0 0 1 Tq Cycle(1) 0 0 0 1 Tq Cycle(1)
0 0 0 1 2 Tq Cycles(1) 0 0 1 2 Tq Cycles
0 0 1 0 3Tq Cycles(1) . . . .
0 0 1 1 4 Tq Cycles . . . .
. . . . . 1 1 1 8Tq Cycles
. . . . .
1 1 1 1 16 Tq Cycles
1. This setting is not valid. Please refer to Table 11-4 for valid settings.
1. Condition to set the flag: RWRNIF = (96 → REC) & RERRIF & TERRIF & BOFFIF
2. Condition to set the flag: TWRNIF = (96 → TEC) & RERRIF & TERRIF & BOFFIF
3. Condition to set the flag: RERRIF = (127 → REC → 255) & BOFFIF
1. Condition to set the flag: TERRIF = (128 → TEC → 255) & BOFFIF
The IDHIT indicators are always related to the message in the foreground buffer. When a message gets
copied from the background to the foreground buffer, the indicators are updated as well.
NOTE
The CIDAC register can be written only if the SFTRES bit in the CMCR0 is
set.
This read-only register reflects the status of the MSCAN08 receive error counter.
Address: $050F
Bit 7 6 5 4 3 2 1 Bit 0
Read: TXERR7 TXERR6 TXERR5 TXERR4 TXERR3 TXERR2 TXERR1 TXERR0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
This read-only register reflects the status of the MSCAN08 transmit error counter.
NOTE
Both error counters may only be read when in sleep or soft reset mode.
12.1 Introduction
This section describes the programmable interrupt timer (PIT) which is a periodic interrupt timer whose
counter is clocked internally via software programmable options. Figure 12-1 is a block diagram of the
PIT.
For further information regarding timers on M68HC08 Family devices, please consult the HC08 Timer
Reference Manual (Freescale document order number TIM08RM/AD).
12.2 Features
Features include:
• Programmable PIT clock input
• Free-running or modulo up-count operation
• PIT counter stop and reset bits
INTERNAL
BUS CLOCK PRESCALER PRESCALER SELECT
CSTOP
PPS2 PPS1 PPS0
CRST
M68HC08 CPU
DDRA
PTA
SERIAL COMMUNICATIONS PTA7–PTA0
CPU ARITHMETIC/LOGIC INTERFACE MODULE
REGISTERS UNIT (ALU) RxCAN
DDRB
TxCAN PTB7/ATD7–
PTB
PTB0/ATD0
CONTROL AND STATUS REGISTERS MSCAN08 CONTROLLER
MODULE
PTC5–PTC3
DDRC
PTC
USER RAM — 1024 BYTES BREAK PTC2/MCLK
MODULE
PTC1–PTC0
USER EEPROM — 512 BYTES
LOW-VOLTAGE INHIBIT PTD7
MODULE PTD6/ATD14/TACLK
USER ROM — 32,256 BYTES PTD5/ATD13
DDRD
PTD
PTD4/ATD12/TBCLK
COMPUTER OPERATING PROPERLY
MODULE PTD3/ATD11–
MONITOR ROM — 256 BYTES PTD0/ATD8
DDRE
PTE4/SS
PTE
CLOCK GENERATOR
OSC2 MODULE TIMER B INTERFACE PTE3/TACH1
CGMXFC MODULE PTE2/TACH0
(2 CHANNELS) PTE1/RxD
PTE0/TxD
RST SYSTEM INTEGRATION
MODULE SERIAL PERIPHERAL INTERFACE
MODULE PTF6
PTF5/TBCH1–
DDRF
PTF
IRQ PTF4/TBCHO
IRQ MODULE ANALOG-TO-DIGITAL CONVERTER
MODULE PTF3/TACH5–
PTF0/TACH2
POWER-ON RESET PROGRAMMABLE INTERRUPT TIMER
DDRG
MODULE PTG2/KBD2–
PTG
MODULE
PTG0/KBD0
KEYBOARD INTERRUPT
MODULE DDRH PTH1/KBD4–
VDD PTH PTH0/KBD3
VREFH
VSS
POWER AVSS/VREFL
VSSA VDDAREF
VDDA
Address: $004B
Bit 7 6 5 4 3 2 1 Bit 0
Read: POF 0 0
POIE PSTOP PPS2 PPS1 PPS0
Write: 0 PRST
Reset: 0 0 1 0 0 0 0 0
= Unimplemented
Address: $004C
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: $004D
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
= Unimplemented
Address: $004E
Bit 7 6 5 4 3 2 1 Bit 0
Read:
Bit 15 14 13 12 11 10 9 Bit 8
Write:
Reset: 1 1 1 1 1 1 1 1
Address: $004F
Bit 7 6 5 4 3 2 1 Bit 0
Read:
Bit 7 6 5 4 3 2 1 Bit 0
Write:
Reset: 1 1 1 1 1 1 1 1
13.1 Introduction
Fifty bidirectional input-output (I/O) pins form eight parallel ports. All I/O pins are programmable as inputs
or outputs.
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.
13.2 Port A
Port A is an 8-bit general-purpose bidirectional I/O 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
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
RESET
13.3 Port B
Port B is an 8-bit special function port that shares all of its pins with the analog-to- digital converter (ADC).
Address: $0001
Bit 7 6 5 4 3 2 1 Bit 0
Read:
PTB7 PTB6 PTB5 PTB4 PTB3 PTB2 PTB1 PTB0
Write:
Reset: Unaffected by reset
Alternative Functions: ATD7 ATD6 ATD5 ATD4 ATD3 ATD2 ATD1 ATD0
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
13.4 Port C
Port C is a 6-bit general-purpose bidirectional I/O port.
Address: $0002
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0
PTC5 PTC4 PTC3 PTC2 PTC1 PTC0
Write:
Reset: Unaffected by reset
Alternative Functions: MCLK
= Unimplemented
Address: $0006
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0
MCLKEN DDRC5 DDRC4 DDRC3 DDRC2 DDRC1 DDRC0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
RESET
13.5 Port D
Port D is an 8 -bit special function port that shares seven of it’s pins with the ADC module and two with
the TIMA and TIMB modules
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
ATD14 ATD13 ATD12 ATD11 ATD10 ATD9 ATD8
Alternative Functions:
TACLK TBCLK
RESET
13.6 Port E
Port E is an 8-bit special function port that shares two of its pins with the TIMA, two of its pins with the
serial communications interface module (SCI), and four of its pins with the serial peripheral interface
module (SPI).
Address: $0008
Bit 7 6 5 4 3 2 1 Bit 0
Read:
PTE7 PTE6 PTE5 PTE4 PTE3 PTE2 PTE1 PTE0
Write:
Reset: Unaffected by reset
Alternative Functions: SPSCK MOSI MISO SS TACH1 TACH0 RxD TxD
Address: $000C
Bit 7 6 5 4 3 2 1 Bit 0
Read:
DDRE7 DDRE6 DDRE5 DDRE4 DDRE3 DDRE2 DDRE1 DDRE0
Write:
Reset: 0 0 0 0 0 0 0 0
13.7 Port F
Port F is a 7-bit special function port that shares four of its pins with TIMA and two of its pins with TIMB.
Address: $0009
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0
PTF6 PTF5 PTF4 PTF3 PTF2 PTF1 PTF0
Write:
Reset: Unaffected by reset
Alternative Functions: TBCH1 TBCH0 TACH5 TACH4 TACH3 TACH2
= Unimplemented
Address: $000D
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0
DDRF6 DDRF5 DDRF4 DDRF3 DDRF2 DDRF1 DDRF0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
RESET
13.8 Port G
Port G is a 3-bit special function port that shares all of its pins with the KBD.
Address: $000A
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0 0
PTG2 PTG1 PTG0
Write:
Reset: Unaffected by reset
Alternative Functions: KBD2 KBD1 KBD0
= Unimplemented
Address: $000E
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0 0
DDRG2 DDRG1 DDRG0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
RESET
When bit DDRGx is a 1, reading address $000A reads the PTGx data latch. When bit DDRGx is a 0,
reading address $000A reads the voltage level on the pin. The data latch can always be written,
regardless of the state of its data. Table 13-7 summarizes the operation of the port G pins.
13.9 Port H
Port H is a 2-bit special function port that shares all of its pins with the KBD.
Address: $000B
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0 0 0
PTH1 PTH0
Write:
Reset: Unaffected by reset
Alternative Functions: KBD4 KBD3
= Unimplemented
Address: $000F
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0 0 0
DDRH1 DDRH0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
RESET
14.1 Introduction
This section describes the serial communications interface module (SCI), which allows high-speed
asynchronous communications with peripheral devices and other MCUs.
14.2 Features
Features include:
• Full duplex operation
• Standard mark/space non-return-to-zero (NRZ) format
• 32 programmable baud rates
• Programmable 8-bit or 9-bit character length
• Separately enabled transmitter and receiver
• Separate receiver and transmitter 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
M68HC08 CPU
DDRA
PTA
SERIAL COMMUNICATIONS PTA7–PTA0
CPU ARITHMETIC/LOGIC INTERFACE MODULE
REGISTERS UNIT (ALU) RxCAN
DDRB
TxCAN PTB7/ATD7–
PTB
PTB0/ATD0
CONTROL AND STATUS REGISTERS MSCAN08 CONTROLLER
MODULE
PTC5–PTC3
DDRC
PTC
USER RAM — 1024 BYTES BREAK PTC2/MCLK
MODULE
PTC1–PTC0
USER EEPROM — 512 BYTES
LOW-VOLTAGE INHIBIT PTD7
MODULE PTD6/ATD14/TACLK
USER ROM — 32,256 BYTES PTD5/ATD13
DDRD
PTD
PTD4/ATD12/TBCLK
COMPUTER OPERATING PROPERLY
MODULE PTD3/ATD11–
MONITOR ROM — 256 BYTES PTD0/ATD8
DDRE
PTE4/SS
PTE
CLOCK GENERATOR
OSC2 MODULE TIMER B INTERFACE PTE3/TACH1
CGMXFC MODULE PTE2/TACH0
(2 CHANNELS) PTE1/RxD
PTE0/TxD
RST SYSTEM INTEGRATION
MODULE SERIAL PERIPHERAL INTERFACE
MODULE PTF6
PTF5/TBCH1–
DDRF
PTF
IRQ PTF4/TBCHO
IRQ MODULE ANALOG-TO-DIGITAL CONVERTER
MODULE PTF3/TACH5–
PTF0/TACH2
POWER-ON RESET PROGRAMMABLE INTERRUPT TIMER
DDRG
MODULE PTG2/KBD2–
PTG
MODULE
PTG0/KBD0
KEYBOARD INTERRUPT
MODULE DDRH PTH1/KBD4–
VDD PTH PTH0/KBD3
VREFH
VSS
POWER AVSS/VREFL
VSSA VDDAREF
VDDA
INTERNAL BUS
TRANSMITTER
INTERRUPT
INTERRUPT
INTERRUPT
RECEIVER
CONTROL
CONTROL
CONTROL
ERROR
RECEIVE TRANSMIT
RxD SHIFT REGISTER SHIFT REGISTER TxD
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 WAKE
RPF
ILTY
PRE- BAUD RATE PEN
CGMXCLK ÷4 SCALER GENERATOR PTY
÷ 16 DATA SELECTION
CONTROL
14.4.2 Transmitter
Figure 14-5 shows the structure of the SCI transmitter.
INTERNAL BUS
PRE- BAUD
÷4 SCALER DIVIDER
÷ 16 SCI DATA REGISTER
CGMXCLK
SCP1
11-BIT
START
STOP
SCP0 TRANSMIT
SHIFT REGISTER
SCR1
H 8 7 6 5 4 3 2 1 0 L TxD
SCR2
SCR0
MSB
TRANSMITTER CPU INTERRUPT REQUEST
TXINV
M
LOAD FROM SCDR
PEN PARITY
SHIFT ENABLE
(ALL ZEROS)
GENERATION
(ALL ONES)
PREAMBLE
PTY
BREAK
T8
TRANSMITTER
CONTROL LOGIC
SCTE SBK
SCTE
LOOPS
SCTIE
SCTIE ENSCI
TC
TC TE
TCIE
TCIE
14.4.3 Receiver
Figure 14-6 shows the structure of the SCI receiver.
INTERNAL BUS
SCR1
SCP1 SCR2 SCI DATA REGISTER
SCP0 SCR0
PRE- BAUD
÷4 ÷ 16
START
SCALER DIVIDER
STOP
11-BIT
RECEIVE SHIFT REGISTER
CGMXCLK
DATA
RxD H 8 7 6 5 4 3 2 1 0 L
RECOVERY
ALL ONES
ALL ZEROS
BKF
MSB
RPF
ERROR CPU INTERRUPT REQUEST
M
CPU INTERRUPT REQUEST
SCRF RWU
WAKE WAKEUP
IDLE
ILTY LOGIC
PEN PARITY R8
PTY CHECKING
IDLE
ILIE
ILIE
SCRF
SCRIE
SCRIE
OR
OR
ORIE
ORIE
NF
NF
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
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.
Table 14-2. Start Bit Verification
RT3, RT5, and RT7 Start Bit
Noise Flag
Samples Verification
000 Yes 0
001 Yes 1
010 Yes 1
011 No 0
100 Yes 1
101 No 0
110 No 0
111 No 0
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.
Table 14-3. Data Bit Recovery
RT8, RT9, and RT10 Data Bit
Noise Flag
Samples Determination
000 0 0
001 0 1
010 0 1
011 1 1
100 0 1
101 1 1
110 1 1
111 1 0
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 Framing Error
Noise Flag
Samples 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
Figure 14-8. Slow Data
The maximum percent difference between the receiver count and the transmitter count of a slow 8-bit
character with no errors is
154 – 147
-------------------------- × 100 = 4.54%
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-8, the receiver counts 170 RT cycles at the point
when the count of the transmitting device is
10 bit times × 16 RT cycles + 3 RT cycles = 163 RT cycles.
The maximum percent difference between the receiver count and the transmitter count of a slow 9-bit
character with no errors is
170 – 163
-------------------------- × 100 = 4.12%
170
RECEIVER
RT CLOCK RT1
RT2
RT3
RT4
RT5
RT6
RT7
RT8
RT9
RT10
RT11
RT12
RT13
RT14
RT15
RT16
DATA
SAMPLES
Figure 14-9. Fast Data
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
• Idle input line condition — When the WAKE bit is clear, an idle character on the RxD pin wakes the
receiver from the standby state by clearing the RWU bit. The idle character that wakes the receiver
does not set the receiver idle bit, IDLE, or the SCI receiver full bit, SCRF. The idle line type bit,
ILTY, determines whether the receiver begins counting 1s as idle character bits after the start bit
or after the stop bit.
NOTE
With the WAKE bit clear, setting the RWU bit after the RxD pin has been
idle may cause the receiver to wake up immediately.
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
R8 — Received Bit 8
When the SCI 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 SCI 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 SCI 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 has no effect on the T8 bit.
ORIE — Receiver Overrun Interrupt Enable Bit
This read/write bit enables SCI error CPU interrupt requests generated by the receiver overrun bit, OR.
1 = SCI error CPU interrupt requests from OR bit enabled
0 = SCI error CPU interrupt requests from OR bit disabled
NEIE — Receiver Noise Error Interrupt Enable Bit
This read/write bit enables SCI error CPU interrupt requests generated by the noise error bit, NE.
Reset clears NEIE.
1 = SCI error CPU interrupt requests from NE bit enabled
0 = SCI error CPU interrupt requests from NE bit disabled
FEIE — Receiver Framing Error Interrupt Enable Bit
This read/write bit enables SCI error CPU interrupt requests generated by the framing error bit, FE.
Reset clears FEIE.
1 = SCI error CPU interrupt requests from FE bit enabled
0 = SCI error CPU interrupt requests from FE bit disabled
PEIE — Receiver Parity Error Interrupt Enable Bit
This read/write bit enables SCI receiver CPU interrupt requests generated by the parity error bit, PE.
Reset clears PEIE.
1 = SCI error CPU interrupt requests from PE bit enabled
0 = SCI error CPU interrupt requests from PE bit disabled
receive 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 SCI 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
00 1 000 1 76,800
00 1 001 2 38,400
00 1 010 4 19,200
00 1 011 8 9600
00 1 100 16 4800
00 1 101 32 2400
00 1 110 64 1200
00 1 111 128 600
01 3 000 1 25,600
01 3 001 2 12,800
01 3 010 4 6400
01 3 011 8 3200
01 3 100 16 1600
01 3 101 32 800
01 3 110 64 400
01 3 111 128 200
10 4 000 1 19,200
10 4 001 2 9600
10 4 010 4 4800
10 4 011 8 2400
10 4 100 16 1200
10 4 101 32 600
10 4 110 64 300
10 4 111 128 150
11 13 000 1 5908
11 13 001 2 2954
11 13 010 4 1477
11 13 011 8 739
11 13 100 16 369
11 13 101 32 185
11 13 110 64 92
11 13 111 128 46
15.1 Introduction
This section describes the system integration module, which supports up to 24 external and/or internal
interrupts. Together with the CPU, the SIM controls all MCU activities. A block diagram of the SIM is
shown in Figure 15-2. Table 15-1 is a summary of the SIM I/O registers. The SIM is a system state
controller that coordinates CPU and exception timing.
The SIM is responsible for:
• Bus clock generation and control for CPU and peripherals
– Stop/wait/reset/break entry and recovery
– Internal clock control
• Master reset control, including power-on reset (POR) and computer operating properly (COP)
timeout
• Interrupt control:
– Acknowledge timing
– Arbitration control timing
– Vector address generation
• CPU enable/disable timing
A block diagram of the SIM is shown in Figure 15-2.
Figure 15-3 is a summary of the SIM input/output (I/O) registers.
Table 15-1 shows the internal signal names used in this section.
M68HC08 CPU
DDRA
PTA
SERIAL COMMUNICATIONS PTA7–PTA0
CPU ARITHMETIC/LOGIC INTERFACE MODULE
REGISTERS UNIT (ALU) RxCAN
DDRB
TxCAN PTB7/ATD7–
PTB
PTB0/ATD0
CONTROL AND STATUS REGISTERS MSCAN08 CONTROLLER
MODULE
PTC5–PTC3
DDRC
PTC
USER RAM — 1024 BYTES BREAK PTC2/MCLK
MODULE
PTC1–PTC0
USER EEPROM — 512 BYTES
LOW-VOLTAGE INHIBIT PTD7
MODULE PTD6/ATD14/TACLK
USER ROM — 32,256 BYTES PTD5/ATD13
DDRD
PTD
PTD4/ATD12/TBCLK
COMPUTER OPERATING PROPERLY
MODULE PTD3/ATD11–
MONITOR ROM — 256 BYTES PTD0/ATD8
DDRE
PTE4/SS
PTE
CLOCK GENERATOR
OSC2 MODULE TIMER B INTERFACE PTE3/TACH1
CGMXFC MODULE PTE2/TACH0
(2 CHANNELS) PTE1/RxD
PTE0/TxD
RST SYSTEM INTEGRATION
MODULE SERIAL PERIPHERAL INTERFACE
MODULE PTF6
PTF5/TBCH1–
DDRF
PTF
IRQ PTF4/TBCHO
IRQ MODULE ANALOG-TO-DIGITAL CONVERTER
MODULE PTF3/TACH5–
PTF0/TACH2
POWER-ON RESET PROGRAMMABLE INTERRUPT TIMER
DDRG
MODULE PTG2/KBD2–
PTG
MODULE
PTG0/KBD0
KEYBOARD INTERRUPT
MODULE DDRH PTH1/KBD4–
VDD PTH PTH0/KBD3
VREFH
VSS
POWER AVSS/VREFL
VSSA VDDAREF
VDDA
MODULE STOP
MODULE WAIT
STOP/WAIT CPU STOP (FROM CPU)
CONTROL CPU WAIT (FROM CPU)
SIMOSCEN (TO CGM)
÷2
RESET
CGMXCLK
OSC1 SIM COUNTER
CLOCK A CGMOUT
SELECT ÷2 ÷2 BUS CLOCK
CGMVCLK CIRCUIT B S* GENERATORS
*When S = 1,
CGMOUT = B
PLL
BCS SIM
PTC3
MONITOR MODE
USER MODE
CGM
CGMOUT
RST
IRST
32 CYCLES 32 CYCLES
CGMXCLK
OSC1
PORRST
4096 32 32
CYCLES CYCLES CYCLES
CGMXCLK
CGMOUT
RST
15.4.1 Interrupts
At the beginning of an interrupt, the CPU saves the CPU register contents onto 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-9
shows interrupt entry timing, and Figure 15-10 shows interrupt recovery timing.
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 may take precedence, regardless of priority, until the latched
interrupt is serviced (or the I bit is cleared). See Figure 15-10.
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
CLI
INT1 PSHH
INT2 PSHH
15.4.2 Reset
All reset sources always have equal and highest priority and cannot be arbitrated.
R/W
NOTE: Previous data can be operand data or the WAIT opcode, depending on the last instruction.
EXITSTOPWAIT
32 32
CYCLES CYCLES
RST
CGMXCLK
The break module is inactive in stop mode. The STOP instruction does not affect break module register
states.
The SIM counter is held in reset from the execution of the STOP instruction until the beginning of stop
recovery. It is then used to time the recovery period.
Figure 15-15 shows stop mode entry timing.
NOTE
To minimize stop current, all pins configured as inputs should be driven to
a logic 1 or logic 0.
CPUSTOP
R/W
NOTE: Previous data can be operand data or the STOP opcode, depending on the last instruction.
CGMXCLK
INTERRUPT
Address: $FE01
Bit 7 6 5 4 3 2 1 Bit 0
Read: POR PIN COP ILOP ILAD 0 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 module (SPI), which allows full-duplex, synchronous,
serial communications with peripheral devices.
16.2 Features
Features 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 with CPU service:
– 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
• I2C (inter-integrated circuit) compatibility
M68HC08 CPU
DDRA
PTA
SERIAL COMMUNICATIONS PTA7–PTA0
CPU ARITHMETIC/LOGIC INTERFACE MODULE
REGISTERS UNIT (ALU) RxCAN
DDRB
TxCAN PTB7/ATD7–
PTB
PTB0/ATD0
CONTROL AND STATUS REGISTERS MSCAN08 CONTROLLER
MODULE
PTC5–PTC3
DDRC
PTC
USER RAM — 1024 BYTES BREAK PTC2/MCLK
MODULE
PTC1–PTC0
USER EEPROM — 512 BYTES
LOW-VOLTAGE INHIBIT PTD7
MODULE PTD6/ATD14/TACLK
USER ROM — 32,256 BYTES PTD5/ATD13
DDRD
PTD
PTD4/ATD12/TBCLK
COMPUTER OPERATING PROPERLY
MODULE PTD3/ATD11–
MONITOR ROM — 256 BYTES PTD0/ATD8
DDRE
PTE4/SS
PTE
CLOCK GENERATOR
OSC2 MODULE TIMER B INTERFACE PTE3/TACH1
CGMXFC MODULE PTE2/TACH0
(2 CHANNELS) PTE1/RxD
PTE0/TxD
RST SYSTEM INTEGRATION
MODULE SERIAL PERIPHERAL INTERFACE
MODULE PTF6
PTF5/TBCH1–
DDRF
PTF
IRQ PTF4/TBCHO
IRQ MODULE ANALOG-TO-DIGITAL CONVERTER
MODULE PTF3/TACH5–
PTF0/TACH2
POWER-ON RESET PROGRAMMABLE INTERRUPT TIMER
DDRG
MODULE PTG2/KBD2–
PTG
MODULE
PTG0/KBD0
KEYBOARD INTERRUPT
MODULE DDRH PTH1/KBD4–
VDD PTH PTH0/KBD3
VREFH
VSS
POWER AVSS/VREFL
VSSA VDDAREF
VDDA
INTERNAL BUS
SHIFT REGISTER
BUS CLOCK
7 6 5 4 3 2 1 0 MISO
÷2
MOSI
CLOCK ÷8 RECEIVE DATA REGISTER
DIVIDER ÷ 32 PIN
÷ 128 CONTROL
LOGIC
CLOCK SPSCK
SPMSTR SPE SELECT
CLOCK M
LOGIC S
SS
SPR1 SPR0
MODFEN SPWOM
TRANSMITTER CPU INTERRUPT REQUEST ERRIE
SPI
CONTROL SPTIE
SPRIE
RECEIVER/ERROR CPU INTERRUPT REQUEST
SPE
SPRF
SPTE
OVRF
MODF
MISO MISO
SHIFT REGISTER
MOSI MOSI
SHIFT REGISTER
SPSCK SPSCK
BAUD RATE
GENERATOR SS SS
VDD
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 particular 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 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.5 Transmission Formats.
If the write to the data register is late, the SPI transmits the data already in the shift register from the
previous transmission.
NOTE
SPSCK must be in the proper idle state before the slave is enabled to
prevent SPSCK from appearing as a clock edge.
SCK CYCLE #
(FOR REFERENCE) 1 2 3 4 5 6 7 8
SCK (CPOL = 0)
SCK (CPOL = 1)
MOSI
(FROM MASTER) MSB BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 LSB
MISO
(FROM SLAVE) MSB BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 LSB
SS (TO SLAVE)
CAPTURE STROBE
SCK CYCLE #
(FOR REFERENCE) 1 2 3 4 5 6 7 8
MOSI MSB
(FROM MASTER) BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 LSB
MISO
MSB BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 LSB
(FROM SLAVE)
SS (TO SLAVE)
CAPTURE STROBE
WRITE
TO SPDR INITIATION DELAY
BUS
CLOCK
SCK
(CPHA = 1)
SCK
(CPHA =0)
SCK CYCLE
NUMBER 1 2 3
⎮
⎮
⎩
WRITE
TO SPDR
BUS
CLOCK
SPRF
OVRF
READ SPSCR 2 5
READ SPDR 3 7
1 BYTE 1 SETS SPRF BIT. 5 CPU READS SPSCR WITH SPRF BIT SET 8 BYTE 4 FAILS TO SET SPRF BIT BECAUSE
AND OVRF BIT CLEAR. OVRF BIT IS SET. BYTE 4 IS LOST.
2 CPU READS SPSCR WITH SPRF BIT SET
AND OVRF BIT CLEAR. 6 BYTE 3 SETS OVRF BIT. BYTE 3 IS LOST.
3 CPU READS BYTE 1 IN SPDR, 7
CLEARING SPRF BIT. CPU READS BYTE 2 IN SPDR, CLEARING SPRF BIT,
BUT NOT OVRF BIT.
4 BYTE 2 SETS SPRF BIT.
SPRF
OVRF
READ SPSCR 2 4 6 9 12 14
READ SPDR 3 8 10 13
1 BYTE 1 SETS SPRF BIT. 5 BYTE 2 SETS SPRF BIT. 10 CPU READS BYTE 2 SPDR,
CLEARING OVRF BIT.
2 CPU READS SPSCR WITH SPRF BIT SET 6 CPU READS SPSCR WITH SPRF BIT SET
AND OVRF BIT CLEAR. AND OVRF BIT CLEAR. 11 BYTE 4 SETS SPRF BIT.
3 CPU READS BYTE 1 IN SPDR, 7 BYTE 3 SETS OVRF BIT. BYTE 3 IS LOST. 12 CPU READS SPSCR.
CLEARING SPRF BIT.
8 CPU READS BYTE 2 IN SPDR, CLEARING SPFR BIT. 13 CPU READS BYTE 4 IN SPDR,
4 CPU READS SPSCR AGAIN CLEARING SPRF BIT.
TO CHECK OVRF BIT. 9 CPU READS SPSCR AGAIN TO CHECK OVRF BIT.
14 CPU READS SPSCR AGAIN
TO CHECK OVRF BIT.
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 16.5 Transmission Formats.
NOTE
When CPHA = 0, a MODF occurs if a slave is selected (SS is low) and later
deselected (SS is high) even if no SPSCK is sent to that slave. This
happens because SS at 0 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 deselected with no transmission occurring.
Therefore, MODF does not occur since a transmission was never begun.
In a slave SPI (MSTR = 0), the MODF bit 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 toggling 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 a
transmission has begun.
To clear the MODF flag, read the SPSCR and then write to the SPCR register. This entire clearing
procedure must occur with no MODF condition existing or else the flag will not be cleared.
16.6 Interrupts
Four SPI status flags can be enabled to generate CPU interrupt requests. See Table 16-2 and
Figure 16-10.
Table 16-2. SPI Interrupts
Flag Request
SPTE (transmitter empty) SPI transmitter CPU interrupt request (SPTIE = 1)
SPRF (receiver full) SPI receiver CPU interrupt request (SPRIE = 1)
OVRF (overflow) SPI receiver/error interrupt request (SPRIE = 1, ERRIE = 1)
MODF (mode fault) SPI receiver/error interrupt request (SPRIE = 1, ERRIE = 1, MODFEN = 1)
The SPI transmitter interrupt enable bit (SPTIE) enables the SPTE flag to generate transmitter CPU
interrupt requests.
The SPI receiver interrupt enable bit (SPRIE) enables the SPRF bit to generate receiver CPU interrupt
requests, provided that the SPI is enabled (SPE = 1).
The error interrupt enable bit (ERRIE) enables both the MODF and OVRF flags 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
flag is enabled to generate receiver/error CPU interrupt requests.
SPI TRANSMITTER
CPU INTERRUPT REQUEST
SPRIE SPRF
SPI RECEIVER/ERROR
CPU INTERRUPT REQUEST
ERRIE
MODF
OVRF
Two sources in the SPI status and control register can generate CPU interrupt requests:
• SPI receiver full bit (SPRF) — the SPRF bit 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 can generate an SPI receiver/error CPU interrupt request.
• SPI transmitter empty (SPTE) — the SPTE bit 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 can generate an SPTE CPU interrupt request.
WRITE TO SPDR 1 3 8
SPTE 2 5 10
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
PU WRITES BYTE 1 TO SPDR, CLEARING 5 BYTE 2 TRANSFERS FROM TRANSMIT DATA 10 BYTE 3 TRANSFERS FROM TRANSMIT
PTE BIT. REGISTER TO SHIFT REGISTER, SETTING DATA REGISTER TO SHIFT REGISTER,
SPTE BIT. SETTING SPTE BIT.
YTE 1 TRANSFERS FROM TRANSMIT DATA
EGISTER TO SHIFT REGISTER, 6 CPU READS SPSCR WITH SPRF BIT SET. 11 CPU READS SPSCR WITH SPRF BIT SET.
ETTING SPTE BIT.
7 CPU READS SPDR, CLEARING SPRF BIT. 12 CPU READS SPDR, CLEARING SPRF BIT.
PU WRITES BYTE 2 TO SPDR, QUEUEING 8
YTE 2 AND CLEARING SPTE BIT. CPU WRITES BYTE 3 TO SPDR, QUEUEING
BYTE 3 AND CLEARING SPTE BIT.
RST INCOMING BYTE TRANSFERS FROM SHIFT 9 SECOND INCOMING BYTE TRANSFERS FROM
HIFT REGISTER TO RECEIVE DATA REGISTER, SHIFT REGISTER TO RECEIVE DATA REGISTER,
ETTING SPRF BIT. SETTING SPRF BIT.
The SPI has limited inter-integrated circuit (I2C) capability (requiring software support) as a master in a
single-master environment. To communicate with I2C peripherals, MOSI becomes an open-drain output
when the SPWOM bit in the SPI control register is set. In I2C communication, the MOSI and MISO pins
are connected to a bidirectional pin from the I2C peripheral and through a pullup resistor to VDD.
MASTER SS
SLAVE SS
(CPHA = 0)
SLAVE SS
(CPHA = 1)
When an SPI is configured as a slave, the SS pin is always configured as an input. It cannot be used as
a general purpose I/O regardless of the state of the MODFEN control bit. However, the MODFEN bit can
still prevent the state of the SS from creating a MODF error. See 16.12.2 SPI Status and Control Register
(SPSCR).
NOTE
A 1 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
transmission has already begun.
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.5.7 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 the MODFEN bit
is low 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. With MODFEN high, it 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 data register. See Table 16-3.
Table 16-3. SPI Configuration
SPE SPMSTR MODFEN SPI CONFIGURATION STATE OF SS LOGIC
General-purpose I/O;
0 X 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
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
When CPHA = 1 for a slave, the first edge of the SPSCK indicates the beginning of the transmission.
The same applies when SS is high for a slave. The MISO pin is held in a high-impedance state, and
the incoming SPSCK is ignored. In certain cases, it may also cause the MODF flag to be set. See
16.5.7 Mode Fault Error. A 1 on the SS pin does not affect the state of the SPI state machine in any
way.
SPWOM — SPI Wired-OR Mode
This read/write bit disables the pull-up devices on pins SPSCK, MOSI, and MISO so that those pins
become open-drain outputs.
1 = Wired-OR SPSCK, MOSI, and MISO pins
0 = Normal push-pull SPSCK, MOSI, and MISO pins
SPE — SPI Enable
This read/write bit enables the SPI module. Clearing SPE causes a partial reset of the SPI. See 16.8
Resetting the SPI. Reset clears the SPE bit.
1 = SPI module enabled
0 = SPI module disabled
SPTIE— SPI Transmit Interrupt Enable
This read/write bit enables CPU interrupt requests generated by the SPTE bit. SPTE is set when a byte
transfers from the transmit data register to the shift register. Reset clears the SPTIE bit.
1 = SPTE CPU interrupt requests enabled
0 = SPTE CPU interrupt requests disabled
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
During an SPRF CPU interrupt, the CPU clears SPRF by reading the SPI status and control register
with SPRF set and then reading the SPI data register. Any read of the SPI data register clears the
SPRF bit.
Reset clears the SPRF bit.
1 = Receive data register full
0 = Receive data register not full
ERRIE — Error Interrupt Enable
This read-only bit enables the MODF and OVRF flags to generate CPU interrupt requests. Reset
clears the ERRIE bit.
1 = MODF and OVRF can generate CPU interrupt requests
0 = MODF and OVRF cannot generate CPU interrupt requests
OVRF — Overflow Flag
This clearable, read-only flag is set if software does not read the byte in the receive data register before
the next byte enters the shift register. In an overflow condition, the byte already in the receive data
register is unaffected, and the byte that shifted in last is lost. Clear the OVRF bit by reading the SPI
status and control register with OVRF set and then reading the SPI data register. Reset clears the
OVRF flag.
1 = Overflow
0 = No overflow
MODF — Mode Fault
This clearable, ready-only flag is set in a slave SPI if the SS pin goes high during a transmission. In a
master SPI, the MODF flag is set if the SS pin goes low at any time. Clear the MODF bit by reading
the SPI status and control register with MODF set and then writing to the SPI data register. Reset
clears the MODF bit.
1 = SS pin at inappropriate logic level
0 = SS pin at appropriate logic level
SPTE — SPI Transmitter Empty
This clearable, read-only flag is set each time the transmit data register transfers a byte into the shift
register. SPTE generates an SPTE CPU interrupt request if the SPTIE bit in the SPI control register is
set also.
NOTE
The SPI data register should not be written to unless the SPTE bit is high.
For an idle master or idle slave that has no data loaded into its transmit buffer, the SPTE will be set
again within two bus cycles since 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. The SPTE indicates when the next write can occur.
Reset sets the SPTE bit.
1 = Transmit data register empty
0 = Transmit data register not empty
MODFEN — Mode Fault Enable
This read/write bit, when set to 1, allows the MODF flag to be set. If the MODF flag is set, clearing the
MODFEN does not clear the MODF flag. If the SPI is enabled as a master and the MODFEN bit is low,
then the SS pin is available as a general purpose I/O.
If the MODFEN bit is set, then this pin is not available as a general purpose I/O. When the SPI is
enabled as a slave, the SS pin is not available as a general purpose I/O regardless of the value of
MODFEN. See 16.11.4 SS (Slave Select).
If the MODFEN bit is low, the level of the SS pin does not affect the operation of an enabled SPI
configured as a master. For an enabled SPI configured as a slave, having MODFEN low only prevents
the MODF flag from being set. It does not affect any other part of SPI operation. See 16.5.7 Mode Fault
Error.
SPR1 and SPR0 — SPI Baud Rate Select
In master mode, these read/write bits select one of four baud rates as shown in Table 16-4. SPR1 and
SPR0 have no effect in slave mode. Reset clears SPR1 and SPR0.
Table 16-4. SPI Master Baud Rate Selection
SPR1:SPR0 Baud Rate Divisor (BD)
0 0 2
0 1 8
1 0 32
1 1 128
where:
CGMOUT = base clock output of the clock generator module (CGM)
BD = baud rate divisor
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: Indeterminate after reset
17.1 Introduction
This section describes the timer interface module (TIMA). The TIMA is a 6-channel timer that provides a
timing reference with input capture, output compare, and pulse-width-modulation functions. Figure 17-2
is a block diagram of the TIMA.
For further information regarding timers on M68HC08 family devices, please consult the HC08 Timer
Reference Manual, Freescale order number TIM08RM/AD.
17.2 Features
Features of the TIMA include:
• Six 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 TIMA clock input
– Seven frequency internal bus clock prescaler selection
– External TIMA clock input (4 MHz maximum frequency)
• Free-running or modulo up-count operation
• Toggle any channel pin on overflow
• TIMA counter stop and reset bits
M68HC08 CPU
DDRA
PTA
SERIAL COMMUNICATIONS PTA7–PTA0
CPU ARITHMETIC/LOGIC INTERFACE MODULE
REGISTERS UNIT (ALU) RxCAN
DDRB
TxCAN PTB7/ATD7–
PTB
PTB0/ATD0
CONTROL AND STATUS REGISTERS MSCAN08 CONTROLLER
MODULE
PTC5–PTC3
DDRC
PTC
USER RAM — 1024 BYTES BREAK PTC2/MCLK
MODULE
PTC1–PTC0
USER EEPROM — 512 BYTES
LOW-VOLTAGE INHIBIT PTD7
MODULE PTD6/ATD14/TACLK
USER ROM — 32,256 BYTES PTD5/ATD13
DDRD
PTD
PTD4/ATD12/TBCLK
COMPUTER OPERATING PROPERLY
MODULE PTD3/ATD11–
MONITOR ROM — 256 BYTES PTD0/ATD8
DDRE
PTE4/SS
PTE
CLOCK GENERATOR
OSC2 MODULE TIMER B INTERFACE PTE3/TACH1
CGMXFC MODULE PTE2/TACH0
(2 CHANNELS) PTE1/RxD
PTE0/TxD
RST SYSTEM INTEGRATION
MODULE SERIAL PERIPHERAL INTERFACE
MODULE PTF6
PTF5/TBCH1–
DDRF
PTF
IRQ PTF4/TBCHO
IRQ MODULE ANALOG-TO-DIGITAL CONVERTER
MODULE PTF3/TACH5–
PTF0/TACH2
POWER-ON RESET PROGRAMMABLE INTERRUPT TIMER
DDRG
MODULE PTG2/KBD2–
PTG
MODULE
PTG0/KBD0
KEYBOARD INTERRUPT
MODULE DDRH PTH1/KBD4–
VDD PTH PTH0/KBD3
VREFH
VSS
POWER AVSS/VREFL
VSSA VDDAREF
VDDA
TCLK
PTD6/ATD14/TACLK
INTERNAL PRESCALER SELECT
BUS CLOCK PRESCALER
TSTOP
PS2 PS1 PS0
TRST
transition. The polarity of the active edge is programmable. The level transition which triggers the counter
transfer is defined by the corresponding input edge bits (ELSxB and ELSxA in TASC0 through TASC5
control registers with x referring to the active channel number). When an active edge occurs on the pin of
an input capture channel, the TIMA latches the contents of the TIMA counter into the TIMA channel
registers, TACHxH–TACHxL. Input captures can generate TIMA CPU interrupt requests. Software can
determine that an input capture event has occurred by enabling input capture interrupts or by polling the
status flag bit.
The free-running counter contents are transferred to the TIMA channel register (TACHxH–TACHxL see
17.8.5 TIMA Channel Registers) on each proper signal transition regardless of whether the TIMA channel
flag (CH0F–CH5F in TASC0–TASC5 registers) is set or clear. When the status flag is set, a CPU interrupt
is generated if enabled. The value of the count latched or “captured” is the time of the event. Because this
value is stored in the input capture register 2 bus cycles after the actual event occurs, user software can
respond to this event at a later time and determine the actual time of the event. However, this must be
done prior to another input capture on the same pin; otherwise, the previous time value will be lost.
By recording the times for successive edges on an incoming signal, software can determine the period
and/or pulse width of the signal. To measure a period, two successive edges of the same polarity are
captured. To measure a pulse width, two alternate polarity edges are captured. Software should track the
overflows at the 16-bit module counter to extend its range.
Another use for the input capture function is to establish a time reference. In this case, an input capture
function is used in conjunction with an output compare function. For example, to activate an output signal
a specified number of clock cycles after detecting an input event (edge), use the input capture function to
record the time at which the edge occurred. A number corresponding to the desired delay is added to this
captured value and stored to an output compare register (see 17.8.5 TIMA Channel Registers). Because
both input captures and output compares are referenced to the same 16-bit modulo counter, the delay
can be controlled to the resolution of the counter independent of software latencies.
Reset does not affect the contents of the TIMA channel register (TACHxH–TACHxL).
Use the following methods to synchronize unbuffered changes in the output compare value on channel x:
• When changing to a smaller value, enable channel x output compare interrupts and write the new
value in the output compare interrupt routine. The output compare interrupt occurs at the end of
the current output compare pulse. The interrupt routine has until the end of the counter overflow
period to write the new value.
• When changing to a larger output compare value, enable TIMA overflow interrupts and write the
new value in the TIMA overflow interrupt routine. The TIMA overflow interrupt occurs at the end of
the current counter overflow 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 counter
overflow period.
PERIOD
PULSE
WIDTH
PTEx/TCHx
• When changing to a longer pulse width, enable TIMA overflow interrupts and write the new value
in the TIMA overflow interrupt routine. The TIMA 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.
Setting the channel x maximum duty cycle bit (CHxMAX) and setting the TOVx bit generates a 100% duty
cycle output (see 17.8.4 TIMA Channel Status and Control Registers).
17.4 Interrupts
The following TIMA sources can generate interrupt requests:
• TIMA overflow flag (TOF) — The TOF bit is set when the TIMA counter reaches the modulo value
programmed in the TIMA counter modulo registers. The TIMA overflow interrupt enable bit, TOIE,
enables TIMA overflow CPU interrupt requests. TOF and TOIE are in the TIMA status and control
register.
• TIMA channel flags (CH5F–CH0F) — The CHxF bit is set when an input capture or output compare
occurs on channel x. Channel x TIMA CPU interrupt requests are controlled by the channel x
interrupt enable bit, CHxIE.
Address: $0020
Bit 7 6 5 4 3 2 1 Bit 0
Read: TOF 0 0
TOIE TSTOP PS2 PS1 PS0
Write: 0 TRST R
Reset: 0 0 1 0 0 0 0 0
R = Reserved
Setting MS0B disables the channel 1 status and control register and reverts TACH1 pin to
general-purpose I/O.
Setting MS2B disables the channel 3 status and control register and reverts TACH3 pin to
general-purpose I/O.
Setting MS4B disables the channel 5 status and control register and reverts TACH5 pin to
general-purpose I/O.
Reset clears the MSxB bit.
1 = Buffered output compare/PWM operation enabled
0 = Buffered output compare/PWM operation disabled
MSxA — Mode Select Bit A
When ELSxB:A ≠ 00, this read/write bit selects either input capture operation or unbuffered output
compare/PWM operation. See Table 17-2.
1 = Unbuffered output compare/PWM operation
0 = Input capture operation
When ELSxB:A = 00, this read/write bit selects the initial output level of the TACHx pin once PWM,
output compare mode or input capture mode is enabled. See Table 17-2. Reset clears the MSxA bit.
1 = Initial output level low
0 = Initial output level high
NOTE
Before changing a channel function by writing to the MSxB or MSxA bit, set
the TSTOP and TRST bits in the TIMA status and control register (TASC).
ELSxB and ELSxA — Edge/Level Select Bits
When channel x is an input capture channel, these read/write bits control the active edge-sensing logic
on channel x.
When channel x is an output compare channel, ELSxB and ELSxA control the channel x output
behavior when an output compare occurs.
When ELSxB and ELSxA are both clear, channel x is not connected to port E or port F and pin
PTEx/TACHx or pin PTFx/TACHx is available as a general-purpose I/O pin. However, channel x is at
a state determined by these bits and becomes transparent to the respective pin when PWM, input
capture mode or output compare operation mode is enabled. Table 17-2 shows how ELSxB and
ELSxA work. Reset clears the ELSxB and ELSxA bits.
NOTE
Before enabling a TIMA channel register for input capture operation, make
sure that the PTEx/TACHx pin or PTFx/TACHx pin is stable for at least two
bus clocks.
TOVx — Toggle-On-Overflow Bit
When channel x is an output compare channel, this read/write bit controls the behavior of the channel
x output when the TIMA counter overflows. When channel x is an input capture channel, TOVx has no
effect. Reset clears the TOVx bit.
1 = Channel x pin toggles on TIMA counter overflow.
0 = Channel x pin does not toggle on TIMA counter overflow.
NOTE
When TOVx is set, a TIMA counter overflow takes precedence over a
channel x output compare if both occur at the same time.
PERIOD
TCHx
CHxMAX
18.1 Introduction
This section describes the timer interface module (TIMB). The TIMB is a 2-channel timer that provides a
timing reference with input capture, output compare, and pulse width modulation functions. Figure 18-2
is a block diagram of the TIMB.
For further information regarding timers on M68HC08 family devices, please consult the HC08 Timer
Reference Manual, Freescale document order number TIM08RM/AD.
18.2 Features
Features 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 TIMB clock input
– Seven frequency internal bus clock prescaler selection
– External TIMB clock input (4 MHz maximum frequency)
• Free-running or modulo up-count operation
• Toggle any channel pin on overflow
• TIMB counter stop and reset bits
M68HC08 CPU
DDRA
PTA
SERIAL COMMUNICATIONS PTA7–PTA0
CPU ARITHMETIC/LOGIC INTERFACE MODULE
REGISTERS UNIT (ALU) RxCAN
DDRB
TxCAN PTB7/ATD7–
PTB
PTB0/ATD0
CONTROL AND STATUS REGISTERS MSCAN08 CONTROLLER
MODULE
PTC5–PTC3
DDRC
PTC
USER RAM — 1024 BYTES BREAK PTC2/MCLK
MODULE
PTC1–PTC0
USER EEPROM — 512 BYTES
LOW-VOLTAGE INHIBIT PTD7
MODULE PTD6/ATD14/TACLK
USER ROM — 32,256 BYTES PTD5/ATD13
DDRD
PTD
PTD4/ATD12/TBCLK
COMPUTER OPERATING PROPERLY
MODULE PTD3/ATD11–
MONITOR ROM — 256 BYTES PTD0/ATD8
DDRE
PTE4/SS
PTE
CLOCK GENERATOR
OSC2 MODULE TIMER B INTERFACE PTE3/TACH1
CGMXFC MODULE PTE2/TACH0
(2 CHANNELS) PTE1/RxD
PTE0/TxD
RST SYSTEM INTEGRATION
MODULE SERIAL PERIPHERAL INTERFACE
MODULE PTF6
PTF5/TBCH1–
DDRF
PTF
IRQ PTF4/TBCHO
IRQ MODULE ANALOG-TO-DIGITAL CONVERTER
MODULE PTF3/TACH5–
PTF0/TACH2
POWER-ON RESET PROGRAMMABLE INTERRUPT TIMER
DDRG
MODULE PTG2/KBD2–
PTG
MODULE
PTG0/KBD0
KEYBOARD INTERRUPT
MODULE DDRH PTH1/KBD4–
VDD PTH PTH0/KBD3
VREFH
VSS
POWER AVSS/VREFL
VSSA VDDAREF
VDDA
TCLK
PTD4/ATD12/TBCLK
INTERNAL PRESCALER SELECT
BUS CLOCK PRESCALER
TSTOP
PS2 PS1 PS0
TRST
respond to this event at a later time and determine the actual time of the event. However, this must be
done prior to another input capture on the same pin; otherwise, the previous time value will be lost.
By recording the times for successive edges on an incoming signal, software can determine the period
and/or pulse width of the signal. To measure a period, two successive edges of the same polarity are
captured. To measure a pulse width, two alternate polarity edges are captured. Software should track the
overflows at the 16-bit module counter to extend its range.
Another use for the input capture function is to establish a time reference. In this case, an input capture
function is used in conjunction with an output compare function. For example, to activate an output signal
a specified number of clock cycles after detecting an input event (edge), use the input capture function to
record the time at which the edge occurred. A number corresponding to the desired delay is added to this
captured value and stored to an output compare register (see 18.8.5 TIMB Channel Registers). Because
both input captures and output compares are referenced to the same 16-bit modulo counter, the delay
can be controlled to the resolution of the counter independent of software latencies.
Reset does not affect the contents of the input capture channel register (TBCHxH–TBCHxL).
PERIOD
PULSE
WIDTH
PTEx/TCHx
The value in the TIMB channel registers determines the pulse width of the PWM output. The pulse width
of an 8-bit PWM signal is variable in 256 increments. Writing $0080 (128) to the TIMB channel registers
produces a duty cycle of 128/256 or 50%.
18.4 Interrupts
The following TIMB sources can generate interrupt requests:
• TIMB overflow flag (TOF) — The TOF bit is set when the TIMB counter value reaches the value in
the TIMB counter modulo registers. The TIMB overflow interrupt enable bit, TOIE, enables TIMB
overflow CPU interrupt requests. TOF and TOIE are in the TIMB status and control register.
• TIMB channel flags (CH1F–CH0F) — The CHxF bit is set when an input capture or output compare
occurs on channel x. Channel x TIMB CPU interrupt requests are controlled by the channel x
interrupt enable bit, CHxIE.
Address: $0040
Bit 7 6 5 4 3 2 1 Bit 0
Read: TOF 0 0
TOIE TSTOP PS2 PS1 PS0
Write: 0 TRST R
Reset: 0 0 1 0 0 0 0 0
R = Reserved
NOTE
Reset the TIMB counter before writing to the TIMB counter modulo registers.
PERIOD
TCHx
CHxMAX
19.1 Introduction
This section describes the break module, the monitor read-only memory (MON), and the monitor mode
entry methods.
M68HC08 CPU
DDRA
PTA
SERIAL COMMUNICATIONS PTA7–PTA0
CPU ARITHMETIC/LOGIC INTERFACE MODULE
REGISTERS UNIT (ALU) RxCAN
DDRB
TxCAN PTB7/ATD7–
PTB
PTB0/ATD0
CONTROL AND STATUS REGISTERS MSCAN08 CONTROLLER
MODULE
PTC5–PTC3
DDRC
PTC
USER RAM — 1024 BYTES BREAK PTC2/MCLK
MODULE
PTC1–PTC0
USER EEPROM — 512 BYTES
LOW-VOLTAGE INHIBIT PTD7
MODULE PTD6/ATD14/TACLK
USER ROM — 32,256 BYTES PTD5/ATD13
DDRD
PTD
PTD4/ATD12/TBCLK
COMPUTER OPERATING PROPERLY
MODULE PTD3/ATD11–
MONITOR ROM — 256 BYTES PTD0/ATD8
DDRE
PTE4/SS
PTE
CLOCK GENERATOR
OSC2 MODULE TIMER B INTERFACE PTE3/TACH1
CGMXFC MODULE PTE2/TACH0
(2 CHANNELS) PTE1/RxD
PTE0/TxD
RST SYSTEM INTEGRATION
MODULE SERIAL PERIPHERAL INTERFACE
MODULE PTF6
PTF5/TBCH1–
DDRF
PTF
IRQ PTF4/TBCHO
IRQ MODULE ANALOG-TO-DIGITAL CONVERTER
MODULE PTF3/TACH5–
PTF0/TACH2
POWER-ON RESET PROGRAMMABLE INTERRUPT TIMER
DDRG
MODULE PTG2/KBD2–
PTG
MODULE
PTG0/KBD0
KEYBOARD INTERRUPT
MODULE DDRH PTH1/KBD4–
VDD PTH PTH0/KBD3
VREFH
VSS
POWER AVSS/VREFL
VSSA VDDAREF
VDDA
IAB[15:8]
8-BIT COMPARATOR
IAB[15:0]
CONTROL BKPT
(TO SIM)
8-BIT COMPARATOR
IAB[7:0]
Address: $FE0E
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0 0 0
BRKE BRKA
Write: R R R R R R
Reset: 0 0 0 0 0 0 0 0
R = Reserved
Figure 19-4. Break Status and Control Register (BRKSCR)
BRKE — Break Enable Bit
This read/write bit enables breaks on break address register matches. Clear BRKE by writing a 0 to
bit 7. Reset clears the BRKE bit.
1 = Breaks enabled on 16-bit address match
0 = Breaks disabled on 16-bit address match
BRKA — Break Active Bit
This read/write status and control bit is set when a break address match occurs. Writing a 1 to BRKA
generates a break interrupt. Clear BRKA by writing a 0 to it before exiting the break routine. Reset
clears the BRKA bit.
1 = Break address match
0 = No break address match
Address: $FE0C
Bit 7 6 5 4 3 2 1 Bit 0
Read:
BIT 15 BIT 13 BIT 13 BIT 12 BIT 11 BIT 10 BIT 9 BIT 8
Write:
Reset: 0 0 0 0 0 0 0 0
Figure 19-5. Break Address Register (BRKH)
Address: $FE0D
Bit 7 6 5 4 3 2 1 Bit 0
Read:
BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0
Write:
Reset: 0 0 0 0 0 0 0 0
Figure 19-6. Break Address Register (BRKL)
1. No security feature is absolutely secure. However, Freescale’s strategy is to make reading or copying the ROM/EEPROM data
difficult for unauthorized users
POR RESET
NO
IRQ = VTST?
YES
CONDITIONS
FROM Table 19-1
PTA0 = 1, NO
PTC0 = 1, AND
PTC1 = 0?
YES
HOST SENDS
8 SECURITY BYTES
IS RESET YES
POR?
NO
ARE ALL
YES NO
SECURITY BYTES
CORRECT?
DEBUGGING
AND EEPROM EXECUTE
PROGRAMMING MONITOR CODE
(IF EEPROM
IS ENABLED)
1
5
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
19.3.1.5 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 3 = Cancel command delay, 11 bit times
2 = Data return delay, approximately 2 bit times 4 = Wait 1 bit time before sending next byte.
A brief description of each monitor mode command is given in Table 19-3 through Table 19-8.
Table 19-3. READ (Read Memory) Command
Description Read byte from memory
Operand 2-byte address in high-byte:low-byte order
Data Returned Returns contents of specified address
Opcode $4A
Command Sequence
SENT TO MONITOR
ECHO RETURN
ECHO
ECHO RETURN
ECHO
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 ROM 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 ROM locations and execute code from ROM. 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-14.
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 ROM location returns an invalid value and trying to execute code from ROM 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.
If the security sequence fails, the device should be reset by a power-on reset and brought up in monitor
mode to attempt another entry.
VDD
RST
COMMAND
BYTE 1
BYTE 2
BYTE 8
FROM HOST
PA0
4 1 3 1 1 2 3 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
3 = Wait 1 bit time before sending next byte
4 = Wait until clock is stable and monitor runs
WARNING
Care should be taken when setting the baud rate since incorrect baud
rate setting can result in communications failure.
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).
NOTE
For applications which use the LVI, Freescale guarantee the functionality of
the device down to the LVI trip point (VLVI) within the constraints outlined in
Chapter 9 Low-Voltage Inhibit (LVI) Module).
Input high voltage (all ports, IRQ, RST, OSC1) VIH 0.7 x VDD VDD V
Input low voltage (all ports, IRQ, RST, OSC1) VIL VSS 0.3 x VDD V
Capacitance COut — 12
pF
Ports (as input or output) CIn — 8
1. VDD = 5.0 Vdc ± 0.5 V, VSS = 0 Vdc, TA = –40°C to TA (MAX), unless otherwise noted.
2. Run (Operating) IDD measured using external square wave clock source (fBUS = 8.4 MHz). All inputs 0.2 V from rail. No
dc loads. Less than 100 pF on all outputs. CL = 20 pF on OSC2. All ports configured as inputs. OSC2 capacitance
linearly affects run IDD. Measured with all modules enabled.
3. Although IDD is proportional to bus frequency, a current of several mA is present even at very low frequencies.
4. Wait IDD measured using external square wave clock source (fBus = 8.4 MHz). All inputs 0.2 Vdc from rail. No dc loads.
Less than 100 pF on all outputs, CL = 20 pF on OSC2. All ports configured as inputs. OSC2 capacitance linearly affects
wait IDD. Measured with all modules enabled.
5. Stop IDD measured with OSC1 = VSS.
6. When subjected to a Human Body Model (HBM) ESD event as specified in AEC Q100-002 these pins may exhibit
recoverable leakage values within the specification indicated.
7. Maximum is highest voltage that POR is guaranteed.
8. Maximum is highest voltage that POR is possible.
9. If minimum VDD is not reached before the internal POR reset is released, RST must be driven low externally until
minimum VDD is reached.
10. See Chapter 5 Computer Operating Properly (COP) Module. VTST applied to RST.
11. See monitor mode description within Chapter 5 Computer Operating Properly (COP) Module. VTST applied to IRQ or
RST.
1. VDD = 5.0 Vdc ± 0.5 V, VSS = 0 Vdc, TA = –40°C to TA (MAX), unless otherwise noted.
2. Refer to Table 17-2. Mode, Edge, and Level Selection, Table 18-2. Mode, Edge, and Level Selection, and supporting notes.
3. The minimum period tTLTL or tILIL should not be less than the number of cycles it takes to execute the capture interrupt
service routine plus t CYC.
4. The minimum pulse width to wake up the MSCAN module is guaranteed by design but not tested.
Operating frequency(3)
Master fBUS(M) fBUS/128 fBUS/2 MHz
Slave fBus(S) dc fBUS
Cycle time
1 Master tCYC(M) 2 128 tCYC
Slave tCYC(S) 1 —
2 Enable lead time tLead 15 — ns
3 Enable lag time tLag 15 — ns
Clock (SCK) high time
4 Master tW(SCKH)M 100 — ns
Slave tW(SCKH)S 50 —
SS
(INPUT) SS pin of master held high.
1
SCK (CPOL = 0) 5
(OUTPUT) NOTE
4
SCK (CPOL = 1) 5
(OUTPUT) NOTE
4
6 7
MISO
(INPUT) MSB IN BITS 6–1 LSB IN
10 11 10 11
MOSI
(OUTPUT) MASTER MSB OUT BITS 6–1 MASTER LSB OUT
12 13
NOTE: This first clock edge is generated internally, but is not seen at the SCK pin.
SS
(INPUT) SS pin of master held high.
1
SCK (CPOL = 0) 5
(OUTPUT) NOTE
4
SCK (CPOL = 1) 5
(OUTPUT) NOTE
4
6 7
MISO
(INPUT) MSB IN BITS 6–1 LSB IN
10 11 10 11
MOSI
(OUTPUT) MASTER MSB OUT BITS 6–1 MASTER LSB OUT
12 13
NOTE: This last clock edge is generated internally, but is not seen at the SCK pin.
SS
(INPUT)
1 3
SCK (CPOL = 0) 11
5
(INPUT) 4
2
SCK (CPOL = 1) 5
(INPUT)
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
SCK (CPOL = 0) 5
(INPUT) 4
2 3
SCK (CPOL = 1) 5
(INPUT)
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
(8 x VDDA) /
Manual mode time to stable(3) tACQ —
(fCGMXCLK x KACQ)
— s
(4 x VDDA) /
Manual stable to lock time(3) tAL —
(fCGMXCLK x KTRK)
— s
(4 x VDDA) /
Automatic stable to lock time(3) tAL nTRK/fCGMXCLK
(fCGMXCLK x KTRK)
— s
1. VDD = 5.0 Vdc ± 0.5 V, VSS = 0 Vdc, TA = –40°C to TA(MAX), unless otherwise noted.
2. Conditions for typical and maximum values are for run mode with fCGMXCLK = 8 MHz, fBUSDES = 8 MHz, N = 4, L = 7, dis-
charged CF = 15 nF, VDD = 5 Vdc.
3. If CF is chosen correctly.
4. Guaranteed but not tested. Refer to 4.3.2 Phase-Locked Loop Circuit (PLL) for guidance on the use of the PLL.
5. N = VCO frequency multiplier.
1. Programming a byte more times than the specified maximum may affect the data integrity of that byte. The byte must be
erased before it can be programmed again.
2. Typical endurance was evaluated for this product family. For additional information on how Freescale defines Typical En-
durance, please refer to Engineering Bulletin EB619.
3. Typical data retention values are based on intrinsic capability of the technology measured at high temperature and de-rated
to 25°C using the Arrhenius equation. For additional information on how Freescale defines Typical Data Retention, please
refer to Engineering Bulletin EB618.
21.1 Introduction
This section provides ordering information for the MC68HC08AZ32A along with the dimensions for the
64-pin quad flat pack (QFP)
The following figure shows the latest package drawing at the time of this publication. To make sure that
you have the latest package specifications, contact your local Freescale sales office
MC68HC08AZ32A X XX E
Pb-FREE
FAMILY
PACKAGE DESIGNATOR
TEMPERATURE RANGE
bus clock — The bus clock is derived from the CGMOUT output from the CGM. The bus clock frequency,
fop, is equal to the frequency of the oscillator output, CGMXCLK, divided by four.
byte — A set of eight bits.
C — The carry/borrow bit in the condition code register. The CPU08 sets the carry/borrow bit when an
addition operation produces a carry out of bit 7 of the accumulator or when a subtraction operation
requires a borrow. Some logical operations and data manipulation instructions also clear or set the
carry/borrow bit (as in bit test and branch instructions and shifts and rotates).
CCR — See “condition code register.”
central processor unit (CPU) — The primary functioning unit of any computer system. The CPU controls
the execution of instructions.
CGM — See “clock generator module (CGM).”
clear — To change a bit from logic 1 to logic 0; the opposite of set.
clock — A square wave signal used to synchronize events in a computer.
clock generator module (CGM) — A module in the M68HC08 Family. The CGM generates a base clock
signal from which the system clocks are derived. The CGM may include a crystal oscillator circuit and
or phase-locked loop (PLL) circuit.
comparator — A device that compares the magnitude of two inputs. A digital comparator defines the
equality or relative differences between two binary numbers.
computer operating properly module (COP) — A counter module in the M68HC08 Family that resets
the MCU if allowed to overflow.
condition code register (CCR) — An 8-bit register in the CPU08 that contains the interrupt mask bit and
five bits that indicate the results of the instruction just executed.
control bit — One bit of a register manipulated by software to control the operation of the module.
control unit — One of two major units of the CPU. The control unit contains logic functions that
synchronize the machine and direct various operations. The control unit decodes instructions and
generates the internal control signals that perform the requested operations. The outputs of the
control unit drive the execution unit, which contains the arithmetic logic unit (ALU), CPU registers, and
bus interface.
COP — See "computer operating properly module (COP)."
counter clock — The input clock to the TIM counter. This clock is the output of the TIM prescaler.
CPU — See “central processor unit (CPU).”
CPU08 — The central processor unit of the M68HC08 Family.
CPU clock — The CPU clock is derived from the CGMOUT output from the CGM. The CPU clock
frequency is equal to the frequency of the oscillator output, CGMXCLK, divided by four.
CPU cycles — A CPU cycle is one period of the internal bus clock, normally derived by dividing a crystal
oscillator source by two or more so the high and low times will be equal. The length of time required
to execute an instruction is measured in CPU clock cycles.
phase-locked loop (PLL) — A oscillator circuit in which the frequency of the oscillator is synchronized
to a reference signal.
PLL — See "phase-locked loop (PLL)."
pointer — Pointer register. An index register is sometimes called a pointer register because its contents
are used in the calculation of the address of an operand, and therefore points to the operand.
polarity — The two opposite logic levels, logic 1 and logic 0, which correspond to two different voltage
levels, VDD and VSS.
polling — Periodically reading a status bit to monitor the condition of a peripheral device.
port — A set of wires for communicating with off-chip devices.
prescaler — A circuit that generates an output signal related to the input signal by a fractional scale factor
such as 1/2, 1/8, 1/10 etc.
program — A set of computer instructions that cause a computer to perform a desired operation or
operations.
program counter (PC) — A 16-bit register in the CPU08. The PC register holds the address of the next
instruction or operand that the CPU will use.
pull — An instruction that copies into the accumulator the contents of a stack RAM location. The stack
RAM address is in the stack pointer.
pullup — A transistor in the output of a logic gate that connects the output to the logic 1 voltage of the
power supply.
pulse-width — The amount of time a signal is on as opposed to being in its off state.
pulse-width modulation (PWM) — Controlled variation (modulation) of the pulse width of a signal with
a constant frequency.
push — An instruction that copies the contents of the accumulator to the stack RAM. The stack RAM
address is in the stack pointer.
PWM period — The time required for one complete cycle of a PWM waveform.
RAM — Random access memory. All RAM locations can be read or written by the CPU. The contents of
a RAM memory location remain valid until the CPU writes a different value or until power is turned off.
RC circuit — A circuit consisting of capacitors and resistors having a defined time constant.
read — To copy the contents of a memory location to the accumulator.
register — A circuit that stores a group of bits.
reserved memory location — A memory location that is used only in special factory test modes. Writing
to a reserved location has no effect. Reading a reserved location returns an unpredictable value.
reset — To force a device to a known condition.
ROM — Read-only memory. A type of memory that can be read but cannot be changed (written). The
contents of ROM must be specified before manufacturing the MCU.
SCI — See "serial communication interface module (SCI)."
serial — Pertaining to sequential transmission over a single line.
serial communications interface module (SCI) — A module in the M68HC08 Family that supports
asynchronous communication.
V —The overflow bit in the condition code register of the CPU08. The CPU08 sets the V bit when a two's
complement overflow occurs. The signed branch instructions BGT, BGE, BLE, and BLT use the
overflow bit.
variable — A value that changes during the course of program execution.
VCO — See "voltage-controlled oscillator."
vector — A memory location that contains the address of the beginning of a subroutine written to service
an interrupt or reset.
voltage-controlled oscillator (VCO) — A circuit that produces an oscillating output signal of a frequency
that is controlled by a dc voltage applied to a control input.
waveform — A graphical representation in which the amplitude of a wave is plotted against time.
wired-OR — Connection of circuit outputs so that if any output is high, the connection point is high.
word — A set of two bytes (16 bits).
write — The transfer of a byte of data from the CPU to a memory location.
X — The lower byte of the index register (H:X) in the CPU08.
Z — The zero bit in the condition code register of the CPU08. The CPU08 sets the zero bit when an
arithmetic operation, logical operation, or data manipulation produces a result of $00.
Section altered significantly to better align module descriptions across groups within
EEPROM Freescale using 0.5µ TSMC/SST FLASH. Numerous additions submitted by
applications engineering for further clarification of functional operation.
Corrected clock signal names and associated timing parameters for consistency and to
Clock Generator Module
match signal naming conventions.
(CGM)
Additional textual description added to Reaction Time Calculation subsection.
System Integration Module (SIM) Corrected various type errors in SBSR and SBFCR register bit descriptions
Modified Figure 11-1 - Monitor Mode Circuit based upon recommendations from
applications engineering.
Monitor ROM (MON)
Corrected type errors.
Corrected Figure 11-6 - Monitor Mode Entry Timing.
Low Voltage Inhibit (LVI) Corrected functional description and revised Figure 13-1 - LVI Module Block Diagram
MC68HC08AZ32A
Rev. 2, 07/2005