MOTOROLA MC68HC705C4A

MC68HC705C4A
MC68HSC705C4A
Technical Data
M68HC05
Microcontrollers
MC68HC705C4A/D
Rev. 3, 5/2002
WWW.MOTOROLA.COM/SEMICONDUCTORS
MC68HC705C4A
MC68HSC705C4A
Technical Data
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://www.motorola.com/semiconductors/
The following revision history table summarizes changes contained in
this document. For your convenience, the page number designators
have been linked to the appropriate location.
Motorola and the Stylized M Logo are registered trademarks of Motorola, Inc.
digital dna is a trademark of Motorola, Inc.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
© Motorola, Inc., 2002
Technical Data
3
Technical Data
Revision History
Date
Revision
Level
May, 2002
3.0
Technical Data
4
Description
Corrected World Wide Web address
Page
Number(s)
N/A
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
List of Sections
Section 1. General Description . . . . . . . . . . . . . . . . . . . . 21
Section 2. Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Section 3. Central Processor Unit (CPU) . . . . . . . . . . . . 43
Section 4. Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Section 5. Resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Section 6. Low-Power Modes. . . . . . . . . . . . . . . . . . . . . . 67
Section 7. Parallel Input/Output (I/O). . . . . . . . . . . . . . . . 73
Section 8. Capture/Compare Timer . . . . . . . . . . . . . . . . . 85
Section 9. EPROM/OTPROM (PROM) . . . . . . . . . . . . . . . 99
Section 10. Serial Communications Interface (SCI). . . 115
Section 11. Serial Peripheral Interface (SPI). . . . . . . . . 133
Section 12. Instruction Set . . . . . . . . . . . . . . . . . . . . . . . 147
Section 13. Electrical Specifications. . . . . . . . . . . . . . . 165
Section 14. Mechanical Specifications . . . . . . . . . . . . . 185
Section 15. Ordering Information . . . . . . . . . . . . . . . . . 189
Appendix A. MC68HSC705C4A . . . . . . . . . . . . . . . . . . . 191
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
List of Sections
Technical Data
5
List of Sections
Technical Data
6
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
List of Sections
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Table of Contents
Section 1. General Description
1.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.3
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.4
Programmable Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.5
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.6
Pin Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.7
Pin Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
1.7.1
VDD and VSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1.7.2
OSC1 and OSC2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
1.7.3
External Reset Pin (RESET) . . . . . . . . . . . . . . . . . . . . . . . .32
1.7.4
External Interrupt Request Pin (IRQ) . . . . . . . . . . . . . . . . . . 32
1.7.5
Input Capture Pin (TCAP) . . . . . . . . . . . . . . . . . . . . . . . . . . 32
1.7.6
Output Compare Pin (TCMP) . . . . . . . . . . . . . . . . . . . . . . . .33
1.7.7
Port A I/O Pins (PA7–PA0). . . . . . . . . . . . . . . . . . . . . . . . . . 33
1.7.8
Port B I/O Pins (PB7–PB0). . . . . . . . . . . . . . . . . . . . . . . . . . 33
1.7.9
Port C I/O Pins (PC7–PC0) . . . . . . . . . . . . . . . . . . . . . . . . . 33
1.7.10 Port D I/O Pins (PD7 and PD5–PD0) . . . . . . . . . . . . . . . . . . 33
Section 2. Memory
2.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.3
Memory Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.4
Input/Output (I/O) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.5
RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Table of Contents
Technical Data
7
Table of Contents
2.6
EPROM/OTPROM (PROM) . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.7
Bootloader ROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Section 3. Central Processor Unit (CPU)
3.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.3
CPU Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.3.1
Accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.3.2
Index Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.3.3
Stack Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.3.4
Program Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.3.5
Condition Code Register . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.4
Arithmetic/Logic Unit (ALU) . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Section 4. Interrupts
4.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.3
Interrupt Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.3.1
Software Interrupt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.3.2
External Interrupt (IRQ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.3.3
Port B Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
4.3.4
Capture/Compare Timer Interrupts . . . . . . . . . . . . . . . . . . .56
4.3.5
SCI Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
4.3.6
SPI Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.4
Interrupt Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .60
Section 5. Resets
Technical Data
8
5.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Table of Contents
MOTOROLA
Table of Contents
5.3
Reset Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.3.1
Power-On Reset (POR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.3.2
External Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.3.3
Computer Operating Properly (COP) Watchdog Reset . . . . 64
Section 6. Low-Power Modes
6.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.3
Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.3.1
SCI During Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69
6.3.2
SPI During Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.3.3
COP Watchdog in Stop Mode . . . . . . . . . . . . . . . . . . . . . . . 70
6.4
Wait Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.5
Data-Retention Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Section 7. Parallel Input/Output (I/O)
7.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.3
Port A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.3.1
Port A Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.3.2
Data Direction Register A. . . . . . . . . . . . . . . . . . . . . . . . . . . 75
7.3.3
Port A Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
7.4
Port B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.4.1
Port B Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.4.2
Data Direction Register B. . . . . . . . . . . . . . . . . . . . . . . . . . . 78
7.4.3
Port B Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
7.5
Port C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
7.5.1
Port C Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
7.5.2
Data Direction Register C. . . . . . . . . . . . . . . . . . . . . . . . . . . 82
7.5.3
Port C Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
7.6
Port D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Table of Contents
Technical Data
9
Table of Contents
Section 8. Capture/Compare Timer
8.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
8.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
8.3
Timer Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
8.3.1
Input Capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
8.3.2
Output Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89
8.4
Timer I/O Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .90
8.4.1
Timer Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
8.4.2
Timer Status Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
8.4.3
Timer Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
8.4.4
Alternate Timer Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . 94
8.4.5
Input Capture Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
8.4.6
Output Compare Registers. . . . . . . . . . . . . . . . . . . . . . . . . . 96
Section 9. EPROM/OTPROM (PROM)
9.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
9.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
9.3
EPROM/OTPROM (PROM) Programming . . . . . . . . . . . . . . . 100
9.3.1
Program Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
9.3.2
Preprogramming Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
9.4
PROM Programming Routines . . . . . . . . . . . . . . . . . . . . . . . . 107
9.4.1
Program and Verify PROM. . . . . . . . . . . . . . . . . . . . . . . . . 107
9.4.2
Verify PROM Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . .108
9.4.3
Secure PROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
9.4.4
Secure PROM and Verify . . . . . . . . . . . . . . . . . . . . . . . . . . 109
9.4.5
Secure PROM and Dump. . . . . . . . . . . . . . . . . . . . . . . . . . 109
9.4.6
Load Program into RAM and Execute . . . . . . . . . . . . . . . . 110
9.4.7
Execute Program in RAM. . . . . . . . . . . . . . . . . . . . . . . . . . 111
9.4.8
Dump PROM Contents. . . . . . . . . . . . . . . . . . . . . . . . . . . .111
9.5
Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
9.5.1
Option Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
9.5.2
Mask Option Register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
9.5.3
Mask Option Register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
9.6
Technical Data
10
EPROM Erasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Table of Contents
MOTOROLA
Table of Contents
Section 10. Serial Communications Interface (SCI)
10.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
10.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
10.3
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
10.4
SCI Data Format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
10.5 SCI Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
10.5.1 Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
10.5.2 Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
10.6 SCI I/O Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
10.6.1 SCI Data Register (SCDR). . . . . . . . . . . . . . . . . . . . . . . . . 123
10.6.2 SCI Control Register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . .124
10.6.3 SCI Control Register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . .125
10.6.4 SCI Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
10.6.5 Baud Rate Register (Baud) . . . . . . . . . . . . . . . . . . . . . . . . 130
Section 11. Serial Peripheral Interface (SPI)
11.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
11.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
11.3
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
11.4 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
11.4.1 Pin Functions in Master Mode . . . . . . . . . . . . . . . . . . . . . . 137
11.4.2 Pin Functions in Slave Mode . . . . . . . . . . . . . . . . . . . . . . .138
11.5
Multiple-SPI Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
11.6
Serial Clock Polarity and Phase . . . . . . . . . . . . . . . . . . . . . . .140
11.7 SPI Error Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
11.7.1 Mode Fault Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141
11.7.2 Write Collision Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
11.7.3 Overrun Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
11.8
SPI Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Table of Contents
Technical Data
11
Table of Contents
11.9 SPI I/O Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
11.9.1 SPI Data Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
11.9.2 SPI Control Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
11.9.3 SPI Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Section 12. Instruction Set
12.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
12.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
12.3 Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
12.3.1 Inherent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
12.3.2 Immediate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
12.3.3 Direct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
12.3.4 Extended . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
12.3.5 Indexed, No Offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
12.3.6 Indexed, 8-Bit Offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
12.3.7 Indexed, 16-Bit Offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
12.3.8 Relative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
12.4 Instruction Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
12.4.1 Register/Memory Instructions. . . . . . . . . . . . . . . . . . . . . . .152
12.4.2 Read-Modify-Write Instructions . . . . . . . . . . . . . . . . . . . . . 153
12.4.3 Jump/Branch Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . 154
12.4.4 Bit Manipulation Instructions . . . . . . . . . . . . . . . . . . . . . . .156
12.4.5 Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
12.5
Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
12.6
Opcode Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Section 13. Electrical Specifications
Technical Data
12
13.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
13.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
13.3
Maximum Ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
13.4
Operating Temperature Range. . . . . . . . . . . . . . . . . . . . . . . . 167
13.5
Thermal Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Table of Contents
MOTOROLA
Table of Contents
13.6
Power Considerations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
13.7
5.0-Volt DC Electrical Characteristics. . . . . . . . . . . . . . . . . . .169
13.8
3.3-Volt DC Electrical Characteristics . . . . . . . . . . . . . . . . . .170
13.9
5.0-Volt Control Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
13.10 3.3-Volt Control Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
13.11 5.0-Volt Serial Peripheral Interface (SPI) Timing . . . . . . . . . . 179
13.12 3.3-Volt Serial Peripheral Interface (SPI) Timing . . . . . . . . . . 181
Section 14. Mechanical Specifications
14.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
14.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
14.3
40-Pin Plastic Dual In-Line Package (PDIP). . . . . . . . . . . . . .186
14.4
42-Pin Shrink Dual In-Line Package (SDIP) . . . . . . . . . . . . . .186
14.5
44-Lead Plastic-Leaded Chip Carrier (PLCC) . . . . . . . . . . . . 187
14.6
44-Pin Quad Flat Pack (QFP). . . . . . . . . . . . . . . . . . . . . . . . . 188
Section 15. Ordering Information
15.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
15.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
15.3
MCU Order Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Appendix A. MC68HSC705C4A
A.1
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
A.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
A.3
5.0-Volt High-Speed DC Electrical Characteristics. . . . . . . . .192
A.4
3.3-Volt High-Speed DC Electrical Characteristics . . . . . . . . 193
A.5
5.0-Volt High-Speed Control Timing . . . . . . . . . . . . . . . . . . . . 194
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Table of Contents
Technical Data
13
Table of Contents
A.6
3.3-Volt High-Speed Control Timing . . . . . . . . . . . . . . . . . . . . 194
A.7
5.0-Volt High-Speed SPI Timing. . . . . . . . . . . . . . . . . . . . . . .195
A.8
3.3-Volt High-Speed SPI Timing. . . . . . . . . . . . . . . . . . . . . . .197
A.9
Ordering Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Index
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Technical Data
14
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Table of Contents
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
List of Figures
Figure
Title
1-1
1-2
1-3
1-4
1-5
1-6
1-7
1-8
1-9
1-10
1-11
Option Register (Option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
40-Pin PDIP Pin Assignments . . . . . . . . . . . . . . . . . . . . . . . 26
44-Lead PLCC Pin Assignments . . . . . . . . . . . . . . . . . . . . . 27
44-Pin QFP Pin Assignments . . . . . . . . . . . . . . . . . . . . . . . .27
42-Pin SDIP Pin Assignments . . . . . . . . . . . . . . . . . . . . . . . 28
Bypassing Layout Recommendation . . . . . . . . . . . . . . . . . . 29
Crystal Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2-Pin Ceramic Resonator . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3-Pin Ceramic Resonator Connections . . . . . . . . . . . . . . . . 31
External Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2-1
2-2
Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
I/O Register Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3-1
3-2
3-3
3-4
3-5
3-6
Programming Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Accumulator (A) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Index Register (X) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Stack Pointer (SP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Program Counter (PC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .47
Condition Code Register (CCR) . . . . . . . . . . . . . . . . . . . . . . 48
4-1
4-2
4-3
4-4
4-5
External Interrupt Internal Function Diagram . . . . . . . . . . . . 54
External Interrupt Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Port B I/O Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Interrupt Stacking Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Reset and Interrupt Processing Flowchart . . . . . . . . . . . . . . 62
5-1
COP Watchdog Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Page
List of Figures
Technical Data
15
List of Figures
Figure
Technical Data
16
Title
Page
6-1
6-2
Stop/Wait Mode Function Flowchart . . . . . . . . . . . . . . . . . . 68
COP Watchdog in Stop Mode Flowchart
(NCOPE = 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71
7-1
7-2
7-3
7-4
7-5
7-6
7-7
7-8
7-9
7-10
Port A Data Register (PORTA). . . . . . . . . . . . . . . . . . . . . . . 74
Data Direction Register A (DDRA) . . . . . . . . . . . . . . . . . . . .75
Port A I/O Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Port B Data Register (PORTB). . . . . . . . . . . . . . . . . . . . . . . 77
Data Direction Register B (DDRB) . . . . . . . . . . . . . . . . . . . .78
Port B I/O Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Port C Data Register (PORTC) . . . . . . . . . . . . . . . . . . . . . . 81
Data Direction Register C (DDRC) . . . . . . . . . . . . . . . . . . . .82
Port C I/O Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Port D Fixed Input Register (PORTD) . . . . . . . . . . . . . . . . . 84
8-1
8-2
8-3
8-4
8-5
8-6
8-7
8-8
8-9
8-10
8-11
8-12
Timer Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Timer I/O Register Summary . . . . . . . . . . . . . . . . . . . . . . . .87
Input Capture Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Output Compare Operation . . . . . . . . . . . . . . . . . . . . . . . . . 89
Timer Control Register (TCR) . . . . . . . . . . . . . . . . . . . . . . . 90
Timer Status Register (TSR) . . . . . . . . . . . . . . . . . . . . . . . .92
Timer Registers (TRH and TRL) . . . . . . . . . . . . . . . . . . . . . 93
Timer Register Reads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Alternate Timer Registers (ATRH and ATRL) . . . . . . . . . . . 94
Alternate Timer Register Reads . . . . . . . . . . . . . . . . . . . . . . 95
Input Capture Registers (ICRH and ICRL) . . . . . . . . . . . . . . 96
Output Compare Registers (OCRH and OCRL). . . . . . . . . .96
9-1
9-2
9-3
9-4
9-5
9-6
EPROM/OTPROM Programming Flowchart . . . . . . . . . . . 101
PROM Programming Circuit . . . . . . . . . . . . . . . . . . . . . . . . 102
Program Register (PROG) . . . . . . . . . . . . . . . . . . . . . . . . . 105
Option Register (Option) . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Mask Option Register 1 (MOR1) . . . . . . . . . . . . . . . . . . . . 113
Mask Option Register 2 (MOR2) . . . . . . . . . . . . . . . . . . . . 114
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
List of Figures
MOTOROLA
List of Figures
Figure
Title
10-1
10-2
10-3
10-4
10-5
10-6
10-7
10-8
10-9
SCI Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .116
SCI Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
SCI Transmitter I/O Register Summary . . . . . . . . . . . . . . . 119
SCI Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
SCI Data Register (SCDR). . . . . . . . . . . . . . . . . . . . . . . . . 123
SCI Control Register 1 (SCCR1) . . . . . . . . . . . . . . . . . . . . 124
SCI Control Register 2 (SCCR2) . . . . . . . . . . . . . . . . . . . . 125
SCI Status Register (SCSR) . . . . . . . . . . . . . . . . . . . . . . .128
Baud Rate Register (Baud) . . . . . . . . . . . . . . . . . . . . . . . . 130
11-1
11-2
11-3
11-4
11-5
11-6
11-7
11-8
11-9
SPI Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
SPI I/O Register Summary . . . . . . . . . . . . . . . . . . . . . . . . . 136
Master/Slave Connections . . . . . . . . . . . . . . . . . . . . . . . . . 137
One Master and Three Slaves Block Diagram . . . . . . . . . . 139
Two Master/Slaves and Three Slaves Block Diagram . . . . 140
SPI Clock/Data Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . .140
SPI Data Register (SPDR) . . . . . . . . . . . . . . . . . . . . . . . . . 143
SPI Control Register (SPCR) . . . . . . . . . . . . . . . . . . . . . . .143
SPI Status Register (SPSR) . . . . . . . . . . . . . . . . . . . . . . . . 145
13-1
13-2
13-3
Equivalent Test Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Typical Voltage Compared to Current . . . . . . . . . . . . . . . . 171
Typical Current versus Internal
Frequency for Run and Wait Modes . . . . . . . . . . . . . . . 173
Total Current Drain versus Frequency . . . . . . . . . . . . . . . . 174
Timer Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Stop Recovery Timing Diagram . . . . . . . . . . . . . . . . . . . . . 177
Power-On Reset and External Reset Timing Diagram. . . . 178
SPI Master Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
SPI Slave Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184
13-4
13-5
13-6
13-7
13-8
13-9
14-1
14-2
MC68HC705C4AP Package Dimensions
(Case #711). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
MC68HC705C4AB Package Dimensions
(Case #858). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Page
List of Figures
Technical Data
17
List of Figures
Figure
14-3
14-4
Technical Data
18
Title
Page
MC68HC705C4AFN Package Dimensions
(Case #777). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
MC68HC705C4AFB Package Dimensions
(Case #824E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
List of Figures
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
List of Tables
Table
Title
4-1
Reset/Interrupt Vector Addresses . . . . . . . . . . . . . . . . . . . . . 60
7-1
7-2
7-3
Port A Pin Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Port B Pin Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Port C Pin Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
9-1
9-2
MC68HC05PGMR PCB Reference Designators . . . . . . . . .100
PROM Programming Routines . . . . . . . . . . . . . . . . . . . . . . .104
10-1
10-2
10-3
Baud Rate Generator Clock Prescaling . . . . . . . . . . . . . . . . 130
Baud Rate Selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Baud Rate Selection Examples . . . . . . . . . . . . . . . . . . . . . . 132
11-1
SPI Clock Rate Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
12-1
12-2
12-3
12-4
12-5
12-6
12-7
Register/Memory Instructions. . . . . . . . . . . . . . . . . . . . . . . . 152
Read-Modify-Write Instructions . . . . . . . . . . . . . . . . . . . . . . 153
Jump and Branch Instructions . . . . . . . . . . . . . . . . . . . . . . .155
Bit Manipulation Instructions. . . . . . . . . . . . . . . . . . . . . . . . . 156
Control Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Opcode Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164
15-1
MC68HC705C4A Order Numbers . . . . . . . . . . . . . . . . . . . . 189
A-1
MC68HSC705C4A Order Numbers . . . . . . . . . . . . . . . . . . . 199
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Page
Technical Data
List of Tables
19
List of Tables
Technical Data
20
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
List of Tables
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 1. General Description
1.1 Contents
1.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.3
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.4
Programmable Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.5
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.6
Pin Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.7
Pin Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
1.7.1
VDD and VSS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1.7.2
OSC1 and OSC2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
1.7.2.1
Crystal Resonator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1.7.2.2
Ceramic Resonator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1.7.2.3
External Clock Signal. . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
1.7.3
External Reset Pin (RESET) . . . . . . . . . . . . . . . . . . . . . . . .32
1.7.4
External Interrupt Request Pin (IRQ) . . . . . . . . . . . . . . . . . . 32
1.7.5
Input Capture Pin (TCAP) . . . . . . . . . . . . . . . . . . . . . . . . . . 32
1.7.6
Output Compare Pin (TCMP) . . . . . . . . . . . . . . . . . . . . . . . .33
1.7.7
Port A I/O Pins (PA7–PA0). . . . . . . . . . . . . . . . . . . . . . . . . . 33
1.7.8
Port B I/O Pins (PB7–PB0). . . . . . . . . . . . . . . . . . . . . . . . . . 33
1.7.9
Port C I/O Pins (PC7–PC0) . . . . . . . . . . . . . . . . . . . . . . . . . 33
1.7.10 Port D I/O Pins (PD7 and PD5–PD0) . . . . . . . . . . . . . . . . . . 33
1.2 Introduction
The MC68HC705C4A is a member of the low-cost, high-performance
M68HC05 Family of 8-bit microcontroller units (MCUs). The M68HC05
Family is based on the customer-specified integrated circuit (CSIC)
design strategy. All MCUs in the family use the M68HC05 central
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
General Description
Technical Data
21
General Description
processor unit (CPU) and are available with a variety of subsystems,
memory sizes and types, and package types.
The MC68HC705C4A is similar to the MC68HC705C8A. The major
differences are that the MC68HC705C4A has less RAM and ROM, no
selectable memory configurations, no clock monitor reset function, and
only one computer operating properly (COP) watchdog timer. The
MC68HSC705C4A, introduced in Appendix A. MC68HSC705C4A, is
an enhanced, high-speed version of the MC68HC705C4A.
1.3 Features
Features of the MC68HC705C4A include:
NOTE:
Technical Data
22
•
M68HC05 central processor unit (CPU)
•
On-chip oscillator with crystal/ceramic resonator
•
Memory-mapped input/output (I/O)
•
Computer operating properly (COP) watchdog timer
•
Selectable port B external interrupt capability
•
High current drive on pin C7 (PC7)
•
24 bidirectional I/O lines and 7 input-only lines
•
Serial communications interface (SCI) system
•
Serial peripheral interface (SPI) system
•
Bootstrap capability
•
Power-saving stop, wait, and data-retention modes
•
Single 3.0-volt to 5.5-volt supply (2-volt data-retention mode)
•
Fully static operation
•
Software-programmable external interrupt sensitivity
A line over a signal name indicates an active low signal. For example,
RESET is active high and RESET is active low. Any reference to voltage,
current, or frequency specified in the following sections will refer to the
nominal values. The exact values and their tolerance or limits are
specified in Section 13. Electrical Specifications.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
General Description
MOTOROLA
General Description
Programmable Options
1.4 Programmable Options
These options are programmable in the mask option registers:
•
Enabling of port B pullup devices (see 9.5.2 Mask Option
Register 1)
•
Enabling of non-programmable COP watchdog (see 9.5.3 Mask
Option Register 2)
These options are programmable in the option register (shown in
Figure 1-1):
•
PROM security(1)
•
External interrupt sensitivity
Address:
$1FDF
Bit 7
6
5
4
3
0
0
0
0
SEC*
0
0
0
0
*
Read:
2
1
Bit 0
IRQ
0
1
0
Write:
Reset:
= Unimplemented
U
U = Unaffected
*Implemented as an EPROM cell
Figure 1-1. Option Register (Option)
SEC — Security Bit
This bit is implemented as an EPROM cell and is not affected by
reset.
1 = Bootloader disabled; MCU operates only in single-chip mode.
0 = Security off; bootloader can be enabled.
1. No security feature is absolutely secure. However, Motorola’s strategy is to make reading or
copying the PROM difficult for unauthorized users.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
General Description
Technical Data
23
General Description
IRQ — Interrupt Request Pin Sensitivity Bit
IRQ is set only by reset, but can be cleared by software. This bit can
be written only once.
1 = IRQ pin is both negative edge- and level-sensitive.
0 = IRQ pin is negative edge-sensitive only.
Bits 7–4 and 0 — Not used; always read 0
Bit 2 — Unaffected by reset; reads either 1 or 0
1.5 Block Diagram
Figure 1-2 shows the structure of the MC68HC705C4A.
1.6 Pin Assignments
The MC68HC705C4A is available in four packages:
•
40-pin plastic dual in-line package (PDIP)
•
44-lead plastic-leaded chip carrier (PLCC)
•
44-pin quad flat pack (QFP)
•
42-pin shrink dual in-line package (SDIP)
The pin assignments for these packages are shown in Figure 1-3,
Figure 1-4, Figure 1-5, and Figure 1-6.
Technical Data
24
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
General Description
MOTOROLA
General Description
Pin Assignments
PA0
EPROM/OTPROM — 4144 BYTES
PA1
PA2
PORT A
PROGRAM REGISTER
DATA DIRECTION A
VPP
EPROM PROGRAMMING
CONTROL
PA3
PA4
PA5
PA6
PA7
OPTION
REGISTER
RAM — 176 BYTES
BOOT ROM — 240 BYTES
PB1*
PB2*
PORT B
DATA DIRECTION B
PB0*
PB3*
PB4*
PB5*
PB6*
PB7*
RESET
PC0
M68HC05 CPU
CPU REGISTERS
ACCUMULATOR
INDEX REGISTER
0
0
0
0
0
1
1
PC1
PC2
PORT C
CPU
CONTROL
DATA DIRECTION C
IRQ
ARITHMETIC
LOGIC UNIT
PC3
PC4
PC5
PC6
STACK POINTER
PC7†
PROGRAM COUNTER
CONDITION CODE REGISTER
1
1
1
H
I
N
Z
PD7
C
RDI (PD0)
SCI
OSC1
OSCILLATOR
PORT D
OSC2
INTERNAL
PROCESSOR
CLOCK
÷2
TDO (PD1)
MISO (PD2)
MOSI (PD3)
SPI
SCK (PD4)
SS (PD5)
COP WATCHDOG
BAUD RATE
GENERATOR
VDD
VSS
POWER
16-BIT
CAPTURE/COMPARE
TIMER SYSTEM
TCMP
TCAP
* Port B pins also function as external interrupts.
† PC7 has a high current sink and source capability.
Figure 1-2. Block Diagram
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
General Description
Technical Data
25
General Description
RESET
1
40
VDD
IRQ
2
39
OSC1
VPP
3
38
OSC2
PA7
4
37
TCAP
PA6
5
36
PD7
PA5
6
35
TCMP
PA4
7
34
PD5/SS
PA3
8
33
PD4/SCK
PA2
9
32
PD3/MOSI
PA1
10
31
PD2/MISO
PA0
11
30
PD1/TDO
PB0
12
29
PD0/RDI
PB1
13
28
PC0
PB2
14
27
PC1
PB3
15
26
PC2
PB4
16
25
PC3
PB5
17
24
PC4
PB6
18
23
PC5
PB7
19
22
PC6
VSS
20
21
PC7
Figure 1-3. 40-Pin PDIP Pin Assignments
Technical Data
26
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
General Description
MOTOROLA
PA6
PA7
VPP
NC
IRQ
RESET
VDD
OSC1
OSC2
TCAP
NC
5
4
3
2
1
44
43
42
41
40
28
PD7
TCMP
PD5/SS
PD4/SCK
PD3/MOSI
PD2/MISO
PD1/TDO
PD0/RDI
PC0
PC1
PC2
PC3
25
PC6
27
24
PC7
PC4
23
NC
26
22
VSS
PC5
21
PB7
20
PB6
NC
18
PA1
PA0
PB0
PB1
PB2
PB3
PB4
37
36
35
34
33
32
31
30
29
10
11
12
13
14
15
16
17
19
PA3
PA2
39
38
7
8
9
PB5
PA5
PA4
6
General Description
Pin Assignments
PD7
PC3
PC2
PC1
PC0
PD0/RDI
PD1/TDO
PD2/MISO
PD3/MOSI
PD4/SCK
PD5/SS
TCMP
Figure 1-4. 44-Lead PLCC Pin Assignments
33 32 31 30 29 28 27 26 25 24 23
34
22
NC
TCAP
35
21
PC4
OSC2
36
20
PC5
OSC1
37
19
PC6
VDD
38
18
PC7
NC
39
17
VSS
PB5
PB4
2
3
4
5
6
7
8
9
12
10 11
PB3
PA6
PA7
44
1
PB2
PB6
13
PB1
14
43
PB0
42
VPP
PA0
IRQ
PA1
PB7
PA2
NC
15
PA3
16
41
PA4
40
PA5
NC
RESET
Figure 1-5. 44-Pin QFP Pin Assignments
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
General Description
Technical Data
27
General Description
RESET
1
42
VDD
IRQ
2
41
OSC1
VPP
3
40
OSC2
PA7
4
39
TCAP
PA6
5
38
PD7
PA5
6
37
TCMP
PA4
7
36
PD5/SS
PA3
8
35
PD4/SCK
PA2
9
34
PD3/MOSI
PA1
10
33
PD2/MISO
PA0
11
32
PD1/TDO
PB0
12
31
PD0/RDI
PB1
13
30
PC0
PB2
14
29
PC1
PB3
15
28
PC2
NC
16
27
NC
PB4
17
26
PC3
PB5
18
25
PC4
PB6
19
24
PC5
PB7
20
23
PC6
VSS
21
22
PC7
Figure 1-6. 42-Pin SDIP Pin Assignments
Technical Data
28
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
General Description
MOTOROLA
General Description
Pin Functions
1.7 Pin Functions
The following paragraphs describe the MC68HC705C4A signals.
1.7.1 VDD and VSS
VDD and VSS are the power supply and ground pins. The MCU operates
from a single power supply.
Very fast signal transitions occur on the MCU pins, placing high
short-duration current demands on the power supply. To prevent noise
problems, take special care to provide good power supply bypassing at
the MCU. Place bypass capacitors as close to the MCU as possible, as
shown in Figure 1-7.
V+
VDD
+
MCU
C1
C2
VSS
Figure 1-7. Bypassing Layout Recommendation
1.7.2 OSC1 and OSC2
The OSC1 and OSC2 pins are the control connections for the 2-pin
on-chip oscillator. The oscillator can be driven by:
NOTE:
•
Crystal resonator
•
Ceramic resonator
•
External clock signal
The frequency of the internal oscillator is fOSC. The MCU divides the
internal oscillator output by two to produce the internal clock with a
frequency of fOP.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
General Description
Technical Data
29
General Description
1.7.2.1 Crystal Resonator
The circuit in Figure 1-8 shows a crystal oscillator circuit for an AT-cut,
parallel resonant crystal. Follow the crystal supplier’s recommendations,
because the crystal parameters determine the external component
values required to provide reliable startup and maximum stability. The
load capacitance values used in the oscillator circuit design should
account for all stray layout capacitances. To minimize output distortion,
mount the crystal and capacitors as close as possible to the pins.
MCU
OSC1
22 pF∗
∗
10 MΩ∗
XTAL
2 MHz
OSC2
22 pF∗
Starting value only. Follow crystal supplier’s
recommendations regarding component
values that will provide reliable startup and
maximum stability.
Figure 1-8. Crystal Connections
NOTE:
Use an AT-cut crystal and not a strip or tuning fork crystal. The MCU
might overdrive or have the incorrect characteristic impedance for a strip
or tuning fork crystal.
1.7.2.2 Ceramic Resonator
To reduce cost, use a ceramic resonator instead of a crystal. Use the
circuit shown in Figure 1-9 for a 2-pin ceramic resonator or the circuit
shown in Figure 1-10 for a 3-pin ceramic resonator, and follow the
resonator manufacturer’s recommendations.
The external component values required for maximum stability and
reliable starting depend upon the resonator parameters. The load
capacitance values used in the oscillator circuit design should include all
Technical Data
30
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
General Description
MOTOROLA
General Description
Pin Functions
stray layout capacitances. To minimize output distortion, mount the
resonator and capacitors as close as possible to the pins.
MCU
OSC1
C
R
CERAMIC
RESONATOR
OSC2
C
Figure 1-9. 2-Pin Ceramic Resonator
NOTE:
The bus frequency (fOP) is one-half the external or crystal frequency
(fOSC), while the processor clock cycle (tCYC) is two times the fOSC
period.
MCU
OSC1
OSC2
CERAMIC
RESONATOR
Figure 1-10. 3-Pin Ceramic
Resonator Connections
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
General Description
Technical Data
31
General Description
1.7.2.3 External Clock Signal
An external clock from another CMOS-compatible device can drive the
OSC1 input, with the OSC2 pin unconnected, as Figure 1-11 shows.
OSC2
OSC1
MCU
EXTERNAL
CMOS CLOCK
Figure 1-11. External Clock
NOTE:
The bus frequency (fOP) is one-half the external frequency (fOSC) while
the processor clock cycle is two times the fOSC period.
1.7.3 External Reset Pin (RESET)
A logic 0 on the RESET pin forces the MCU to a known startup state. The
RESET pin contains an internal Schmitt trigger as part of its input to
improve noise immunity. See Section 5. Resets.
1.7.4 External Interrupt Request Pin (IRQ)
The IRQ pin is an asynchronous external interrupt pin. The IRQ pin
contains an internal Schmitt trigger as part of its input to improve noise
immunity. See 4.3.2 External Interrupt (IRQ).
1.7.5 Input Capture Pin (TCAP)
The TCAP pin is the input capture pin for the on-chip capture/compare
timer. The TCAP pin contains an internal Schmitt trigger as part of its
input to improve noise immunity. See Section 8. Capture/Compare
Timer.
Technical Data
32
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
General Description
MOTOROLA
General Description
Pin Functions
1.7.6 Output Compare Pin (TCMP)
The TCMP pin is the output compare pin for the on-chip
capture/compare timer. See Section 8. Capture/Compare Timer.
1.7.7 Port A I/O Pins (PA7–PA0)
These eight I/O lines comprise port A, a general-purpose, bidirectional
I/O port. The pins are programmable as either inputs or outputs under
software control of the data direction registers. See 7.3 Port A.
1.7.8 Port B I/O Pins (PB7–PB0)
These eight I/O pins comprise port B, a general-purpose, bidirectional
I/O port. The pins are programmable as either inputs or outputs under
software control of the data direction registers. Port B pins also can be
configured to function as external interrupts. See 7.4 Port B.
1.7.9 Port C I/O Pins (PC7–PC0)
These eight I/O pins comprise port C, a general-purpose, bidirectional
I/O port. The pins are programmable as either inputs or outputs under
software control of the data direction registers. PC7 has a high current
sink and source capability See 7.5 Port C.
1.7.10 Port D I/O Pins (PD7 and PD5–PD0)
These seven lines comprise port D, a fixed input port. All special
functions that are enabled (SPI and SCI) affect this port. See 7.6 Port D.
NOTE:
Connecting the VPP pin (programming voltage) to VSS (ground) could
result in damage to the MCU.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
General Description
Technical Data
33
General Description
Technical Data
34
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
General Description
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 2. Memory
2.1 Contents
2.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.3
Memory Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.4
Input/Output (I/O) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.5
RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.6
EPROM/OTPROM (PROM) . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.7
Bootloader ROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.2 Introduction
This section describes the organization of the on-chip memory.
2.3 Memory Map
The central processor unit (CPU) can address eight Kbytes of memory
and input/output (I/O) registers. The program counter typically advances
one address at a time through memory, reading the program instructions
and data. The programmable read-only memory (PROM) portion of
memory — either one-time programmable read-only memory
(OTPROM) or erasable programmable read-only memory (EPROM) —
holds the program instructions, fixed data, user-defined vectors,
and interrupt service routines. The RAM portion of memory holds
variable data.
I/O registers are memory-mapped so that the CPU can access their
locations in the same way that it accesses all other memory locations.
The shared stack area is used during processing of an interrupt or
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Memory
35
Memory
subroutine call to save the CPU state. The stack pointer decrements
during pushes and increments during pulls.
Figure 2-1 is a memory map of the MCU. Addresses $0000–$001F,
shown in Figure 2-2, contain most of the control, status, and data
registers. Additional I/O registers have these addresses:
•
$1FDF, option register
•
$1FF0, mask option register 1 (MOR1)
•
$1FF1, mask option register 2 (MOR2)
2.4 Input/Output (I/O)
The first 32 addresses of memory space, from $0000 to $001F, are the
I/O section. These are the addresses of the I/O control registers, status
registers, and data registers. See Figure 2-2 for more information.
2.5 RAM
The 176 addresses from $0050–$00FF are RAM locations. The CPU
uses the top 64 RAM addresses, $00C0–00FF, as the stack. Before
processing an interrupt, the CPU uses five bytes of the stack to save the
contents of the CPU registers. During a subroutine call, the CPU uses
two bytes of the stack to store the return address. The stack pointer
decrements when the CPU stores a byte on the stack and increments
when the CPU retrieves a byte from the stack.
NOTE:
Be careful when using nested subroutines or multiple interrupt levels.
The CPU can overwrite data in the stack RAM during a subroutine or
during the interrupt stacking operation.
Technical Data
36
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Memory
MOTOROLA
Memory
EPROM/OTPROM (PROM)
2.6 EPROM/OTPROM (PROM)
An MCU with a quartz window has a maximum of 4144 bytes of EPROM.
The quartz window allows the EPROM erasure with ultraviolet light. In
an MCU without a quartz window, the EPROM cannot be erased and
serves a maximum 4144 bytes of OTPROM. See Section 9.
EPROM/OTPROM (PROM).
2.7 Bootloader ROM
The 240 bytes at addresses $1F00–$1FEF are reserved ROM
addresses that contain the instructions for the bootloader functions. See
Section 9. EPROM/OTPROM (PROM).
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Memory
37
Memory
$0000
I/O REGISTERS
32 BYTES
$001F
$0020
$002F
$0030
USER PROM
48 BYTES
$004F
$0050
RAM
176 BYTES
$00BF
$00C0
STACK
64 BYTES
$00FF
$0100
USER PROM
4144 BYTES
PORT A DATA REGISTER
PORT B DATA REGISTER
PORT C DATA REGISTER
PORT D DATA REGISTER
PORT A DATA DIRECTION REGISTER
PORT B DATA DIRECTION REGISTER
PORT C DATA DIRECTION REGISTER
UNUSED
UNUSED
UNUSED
SPI CONTROL REGISTER
SPI STATUS REGISTER
SPI DATA REGISTER
SCI BAUD RATE REGISTER
SCI CONTROL REGISTER 1
SCI CONTROL REGISTER 2
SCI STATUS REGISTER
SCI DATA REGISTER
TIMER CONTROL REGISTER
TIMER STATUS REGISTER
INPUT CAPTURE REGISTER (HIGH)
INPUT CAPTURE REGISTER (LOW)
OUTPUT COMPARE REGISTER (HIGH)
OUTPUT COMPARE REGISTER (LOW)
COUNTER REGISTER (HIGH)
COUNTER REGISTER (LOW)
ALTERNATE COUNTER REGISTER (HIGH)
ALTERNATE COUNTER REGISTER (LOW)
PROM PROGRAMMING REGISTER
UNUSED
UNUSED
UNUSED
$0000
$0001
$0002
$0003
$0004
$0005
$0006
$0007
$0008
$0009
$000A
$000B
$000C
$000D
$000E
$000F
$0010
$0011
$0012
$0013
$0014
$0015
$0016
$0017
$0018
$0019
$001A
$001B
$001C
$001D
$001E
$001F
UNUSED
UNUSED
SPI INTERRUPT VECTOR (HIGH)
SPI INTERRUPT VECTOR (LOW)
SCI INTERRUPT VECTOR (HIGH)
SCI INTERRUPT VECTOR (LOW)
TIMER INTERRUPT VECTOR (HIGH)
TIMER INTERRUPT VECTOR (LOW)
EXTERNAL INTERRUPT VECTOR (HIGH)
EXTERNAL INTERRUPT VECTOR (LOW)
SOFTWARE INTERRUPT VECTOR (HIGH)
SOFTWARE INTERRUPT VECTOR (LOW)
RESET VECTOR (HIGH)
RESET VECTOR (LOW)
$1FF2
$1FF3
$1FF4
$1FF5
$1FF6
$1FF7
$1FF8
$1FF9
$1FFA
$1FFB
$1FFC
$1FFD
$1FFE
$1FFF
$10FF
$1100
$1EFF
$1F00
$1FDE
$1FDF
$1FE0
$1FEF
$1FF0
$1FF1
$1FF2
$1FFF
UNUSED
3584 BYTES
BOOTLOADER ROM
240 BYTES
OPTION REGISTER
BOOT ROM VECTORS
16 BYTES
MASK OPTION REGISTER 1
MASK OPTION REGISTER 2
USER PROM VECTORS
12 BYTES
Figure 2-1. Memory Map
Technical Data
38
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Memory
MOTOROLA
Memory
Bootloader ROM
Addr.
Register Name
Read:
Port A Data Register
(PORTA) Write:
See page 74.
Reset:
$0000
Read:
Port B Data Register
(PORTB) Write:
See page 77.
Reset:
$0001
Read:
Port C Data Register
(PORTC) Write:
See page 81.
Reset:
$0002
$0003
Read:
Port D Fixed Input Register
(PORTD) Write:
See page 84.
Reset:
$0004
$0005
$0006
Bit 7
6
5
4
3
2
1
Bit 0
PA7
PA6
PA5
PA4
PA3
PA2
PA1
PA0
PB2
PB1
PB0
PC2
PC1
PC0
MISO
TDO
RDI
Unaffected by reset
PB7
PB6
PC7
PC6
Unimplemented
$0009
Unimplemented
PC5
SS
PD7
PC4
PC3
SCK
MOSI
Unaffected by reset
DDRA6
DDRA5
DDRA4
DDRA3
DDRA2
DDRA1
DDRA0
0
0
0
0
0
0
0
DDRB6
DDRB5
DDRB4
DDRB3
DDRB2
DDRB1
DDRB0
0
0
0
0
0
0
0
DDRC5
DDRC4
DDRC3
DDRC2
DDRC1
DDRC0
0
0
0
0
0
0
Read:
Port C Data Direction
DDRC7 DDRC6
Register (DDRC) Write:
See page 82.
Reset:
0
0
$0008
PB3
Unaffected by reset
Read:
Port B Data Direction
DDRB7
Register (DDRB) Write:
See page 78.
Reset:
0
Unimplemented
PB4
Unaffected by reset
Read:
Port A Data Direction
DDRA7
Register (DDRA) Write:
See page 75.
Reset:
0
$0007
PB5
= Unimplemented
U = Unaffected
Figure 2-2. I/O Register Summary (Sheet 1 of 4)
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Memory
39
Memory
Addr.
Register Name
Read:
SPI Control Register
(SPCR) Write:
See page 143.
Reset:
$000A
Read:
SPI Status Register
(SPSR) Write:
See page 145.
Reset:
$000B
Read:
SPI Data Register
(SPDR) Write:
See page 143.
Reset:
$000C
Read:
Baud Rate Register
(Baud) Write:
See page 130.
Reset:
$000D
$000E
$000F
Read:
SCI Control Register 1
(SCCR1) Write:
See page 124.
Reset:
Read:
SCI Control Register 2
(SCCR2) Write:
See page 125.
Reset:
6
4
3
2
1
Bit 0
SPIE
SPE
MSTR
CPOL
CPHA
SPR1
SPR0
0
0
0
U
U
U
U
SPIF
WCOL
MODF
0
0
0
Bit 7
Bit 6
Bit 3
BIt 2
Bit 1
Bit 0
Read:
SCI Data Register
(SCDR) Write:
See page 123.
Reset:
$0011
Read:
Timer Control Register
(TCR) Write:
See page 90.
Reset:
5
SCR2
SCR1
SCR0
U
U
U
Bit 5
Bit 4
Unaffected by reset
SCP1
SCP0
0
0
U
U
U
R8
T8
M
WAKE
U
U
U
U
TIE
TCIE
RIE
ILIE
TE
RE
RWU
SBK
0
0
0
0
0
0
0
0
TC
RDRF
IDLE
OR
NF
FE
1
0
0
0
0
0
U
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Read: TDRE
SCI Status Register
(SCSR) Write:
See page 128.
Reset:
1
$0010
$0012
Bit 7
Bit 7
Unaffected by reset
ICIE
OCIE
TOIE
0
0
0
IEDG
OLVL
0
0
0
0
0
0
U
0
= Unimplemented
U = Unaffected
Figure 2-2. I/O Register Summary (Sheet 2 of 4)
Technical Data
40
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Memory
MOTOROLA
Memory
Bootloader ROM
Addr.
Register Name
$0014
$0015
$0017
6
5
4
3
2
1
Bit 0
ICF
OCF
TOF
0
0
0
0
0
U
U
U
0
0
0
0
0
Read: Bit 15
Input Capture Register
High (ICRH) Write:
See page 96.
Reset:
Bit 14
Bit 13
Bit 12
Bit 11
Bit 10
Bit 9
Bit 8
Read:
Input Capture Register
Low (ICRL) Write:
See page 96.
Reset:
Bit 6
Bit 2
Bit 1
Bit 0
Bit 10
Bit 9
Bit 8
Bit 2
Bit 1
Bit 0
Bit 10
Bit 9
Bit 8
Bit 2
Bit 1
Bit 0
Bit 10
Bit 9
Bit 8
Bit 2
Bit 1
Bit 0
Read:
Timer Status Register
(TSR) Write:
See page 92.
Reset:
$0013
$0016
Bit 7
Unaffected by reset
Bit 7
$0018
$0019
$001A
$001B
Bit 4
Bit 3
Unaffected by reset
Output Compare Register Read:
Bit 15
High (OCRH)
Write:
See page 96.
Reset:
Read:
Output Compare Register
Low (OCRL) Write:
See page 96.
Reset:
Bit 5
Bit 14
Bit 13
Bit 12
Bit 11
Unaffected by reset
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Unaffected by reset
Read: Bit 15
Timer Register High
(TRH) Write:
See page 93.
Reset:
Bit 14
Read:
Timer Register Low
(TRL) Write:
See page 93.
Reset:
Bit 6
Bit 13
Bit 12
Bit 11
Reset initializes TRH to $FF
Bit 7
Bit 5
Bit 4
Bit 3
Reset initializes TRL to $FC
Read: Bit 15
Alternate Timer Register
High (ATRH) Write:
See page 94.
Reset:
Bit 14
Read:
Alternate Timer Register
Low (ATRL) Write:
See page 94.
Reset:
Bit 6
Bit 13
Bit 12
Bit 11
Reset initializes ATRH to $FF
Bit 7
Bit 5
Bit 4
Bit 3
Reset initializes ATRL to $FC
= Unimplemented
U = Unaffected
Figure 2-2. I/O Register Summary (Sheet 3 of 4)
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Memory
41
Memory
Addr.
$001C
Register Name
Read:
EPROM Programming
Register (PROG) Write:
See page 105.
Reset:
$001D
Unimplemented
$001E
Unimplemented
$001F
Unimplemented
$1FDF
Read:
Option Register
(Option) Write:
See page 112.
Reset:
Bit 7
6
5
4
3
2
1
Bit 0
0
0
0
0
0
LAT
0
PGM
0
0
0
0
0
0
0
0
0
0
0
0
SEC*
IRQ
0
0
0
0
0
*
U
1
0
PBPU6
PBPU5
PBPU4
PBPU3
PBPU2
PBPU1
PBPU0/
COPC
*Implemented as an EPROM cell
$1FF0
$1FF1
Read:
Mask Option Register 1
PBPU7
(MOR1) Write:
See page 113.
Reset:
Unaffected by reset
Read:
Mask Option Register 2
(MOR2) Write:
See page 114.
Reset:
NCOPE
Unaffected by reset
= Unimplemented
U = Unaffected
Figure 2-2. I/O Register Summary (Sheet 4 of 4)
Technical Data
42
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Memory
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 3. Central Processor Unit (CPU)
3.1 Contents
3.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.3
CPU Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.3.1
Accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.3.2
Index Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.3.3
Stack Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.3.4
Program Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.3.5
Condition Code Register . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.4
Arithmetic/Logic Unit (ALU) . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.2 Introduction
This section describes the central processor unit (CPU) registers.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Central Processor Unit (CPU)
Technical Data
43
Central Processor Unit (CPU)
3.3 CPU Registers
Figure 3-1 shows the five CPU registers:
•
Accumulator (A)
•
Index register (X)
•
Stack pointer (SP)
•
Program counter (PC)
•
Condition code register (CCR)
These are hard-wired registers within the CPU and are not part of the
memory map.
Bit 7
6
5
4
3
2
1
Bit 0
ACCUMULATOR (A)
Bit 7
6
5
4
3
2
1
Bit 0
INDEX REGISTER (X)
Bit 12 11
10
9
8
7
6
0
0
0
0
1
1
Bit 12 11
10
9
8
7
6
0
5
4
3
2
1
Bit 0
STACK POINTER (SP)
5
4
3
2
1
Bit 0
PROGRAM COUNTER (PC)
Bit 7
6
5
4
3
2
1
Bit 0
1
1
1
H
I
N
Z
C
CONDITION CODE REGISTER (CCR)
HALF-CARRY FLAG
INTERRUPT MASK
NEGATIVE FLAG
ZERO FLAG
CARRY/BORROW FLAG
Figure 3-1. Programming Model
Technical Data
44
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Central Processor Unit (CPU)
MOTOROLA
Central Processor Unit (CPU)
CPU Registers
3.3.1 Accumulator
The accumulator (A) shown in Figure 3-2 is a general-purpose 8-bit
register. The CPU uses the accumulator to hold operands and results of
arithmetic and non-arithmetic operations.
Bit 7
6
5
4
3
2
1
Bit 0
Read:
Write:
Reset:
Unaffected by reset
Figure 3-2. Accumulator (A)
3.3.2 Index Register
In the indexed addressing modes, the CPU uses the byte in the index
register (X) to determine the conditional address of the operand (Figure
3-3). For more information on indexed addressing, see 12.3.5 Indexed,
No Offset, 12.3.6 Indexed, 8-Bit Offset, and 12.3.7 Indexed, 16-Bit
Offset.
Bit 7
6
5
4
3
2
1
Bit 0
Read:
Write:
Reset:
Unaffected by reset
Figure 3-3. Index Register (X)
The 8-bit index register also can serve as a temporary data storage
location.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Central Processor Unit (CPU)
Technical Data
45
Central Processor Unit (CPU)
3.3.3 Stack Pointer
The stack pointer (SP) shown in Figure 3-4 is a 13-bit register that
contains the address of the next free location on the stack. During a reset
or after the reset stack pointer (RSP) instruction, the stack pointer
initializes to $00FF. The address in the stack pointer decrements as data
is pushed onto the stack and increments as data is pulled from the stack.
Read:
Bit 12
11
10
9
8
7
6
0
0
0
0
0
1
1
0
0
0
0
0
1
1
5
4
3
2
1
Bit 0
1
1
1
1
1
1
Write:
Reset:
= Unimplemented
Figure 3-4. Stack Pointer (SP)
The seven most significant bits of the stack pointer are fixed
permanently at 0000011, so the stack pointer produces addresses from
$00C0 to $00FF. If subroutines and interrupts use more than 64 stack
locations, the stack pointer wraps around to address $00FF and begins
writing over the previously stored data. A subroutine uses two stack
locations. An interrupt uses five locations.
Technical Data
46
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Central Processor Unit (CPU)
MOTOROLA
Central Processor Unit (CPU)
CPU Registers
3.3.4 Program Counter
The program counter (PC) shown in Figure 3-5 is a 13-bit register that
contains the address of the next instruction or operand to be fetched.
Normally, the address in the program counter automatically increments
to the next sequential memory location every time an instruction or
operand is fetched. Jump, branch, and interrupt operations load the
program counter with an address other than that of the next sequential
location.
Bit 12
11
10
9
8
7
6
5
4
3
2
1
Bit 0
Read:
Write:
Reset:
Loaded with reset vector from $1FFE and $1FFF
Figure 3-5. Program Counter (PC)
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Central Processor Unit (CPU)
Technical Data
47
Central Processor Unit (CPU)
3.3.5 Condition Code Register
The condition code register (CCR) shown in Figure 3-6 is an 8-bit
register whose three most significant bits are permanently fixed at 111.
The condition code register contains the interrupt mask and four bits that
indicate the results of prior instructions. Functions of the condition code
register are described here.
Read:
Bit 7
6
5
1
1
1
4
3
2
1
Bit 0
H
I
N
Z
C
U
1
U
U
U
Write:
Reset:
1
1
1
= Unimplemented
U = Unaffected
Figure 3-6. Condition Code Register (CCR)
H — Half-Carry Bit (H)
The CPU sets the half-carry flag when a carry occurs between bits 3
and 4 of the accumulator during an add without carry (ADD) or add
with carry (ADC) operation. The half-carry bit is required for
binary-coded decimal (BCD) arithmetic operations. Reset has no
affect on the half-carry flag.
I — Interrupt Mask
Setting the interrupt mask (I) disables interrupts. If an interrupt
request occurs while the interrupt mask is a logic 0, the CPU saves
the CPU registers on the stack, sets the interrupt mask, and then
fetches the interrupt vector. If an interrupt request occurs while the
interrupt mask is set, the interrupt request is latched. The CPU
processes the latched interrupt as soon as the interrupt mask is
cleared again.
A return from interrupt (RTI) instruction pulls the CPU registers from
the stack, restoring the interrupt mask to its cleared state. After a
reset, the interrupt mask is set and can be cleared only by a clear
interrupt mask bit (CLI), STOP, or WAIT instruction.
Technical Data
48
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Central Processor Unit (CPU)
MOTOROLA
Central Processor Unit (CPU)
Arithmetic/Logic Unit (ALU)
N — Negative Flag
The CPU sets the negative flag when an arithmetic operation, logical
operation, or data manipulation produces a negative result (bit 7 in the
results is a logic 1). Reset has no effect on the negative flag.
Z — Zero Flag
The CPU sets the zero flag when an arithmetic operation, logical
operation, or data manipulation produces a result of $00. Reset has
no effect on the zero flag.
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 logical operations and data
manipulation instructions also clear or set the carry/borrow bit. Reset
has no effect on the carry/borrow flag.
3.4 Arithmetic/Logic Unit (ALU)
The arithmetic/logic unit (ALU) performs the arithmetic and logical
operations defined by the instruction set. The binary arithmetic circuits
decode instructions and set up the ALU for the selected operation. Most
binary arithmetic is based on the addition algorithm, carrying out
subtraction as negative addition. Multiplication is not performed as a
discrete operation but as a chain of addition and shift operations within
the ALU. The multiply instruction requires 11 internal clock cycles to
complete this chain of operations.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Central Processor Unit (CPU)
Technical Data
49
Central Processor Unit (CPU)
Technical Data
50
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Central Processor Unit (CPU)
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 4. Interrupts
4.1 Contents
4.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.3
Interrupt Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.3.1
Software Interrupt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.3.2
External Interrupt (IRQ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.3.3
Port B Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
4.3.4
Capture/Compare Timer Interrupts . . . . . . . . . . . . . . . . . . .56
4.3.5
SCI Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
4.3.6
SPI Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.4
Interrupt Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .60
4.2 Introduction
This section describes how interrupts temporarily change the normal
processing sequence.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Interrupts
51
Interrupts
4.3 Interrupt Sources
These sources can generate interrupts:
•
Software interrupt (SWI) instructions
•
External interrupt pin (IRQ)
•
Port B pins
•
Capture/compare timer:
– Input capture
– Output compare
– Timer overflow
•
Serial communications interface (SCI):
– SCI transmit data register empty
– SCI transmission complete
– SCI receive data register full
– SCI receiver overrun
– SCI receiver input idle
•
Serial peripheral interface (SPI):
– SPI transmission complete
– SPI mode fault
– SPI overrun
The IRQ pin, port B pins, timer, SCI, and SPI can be masked (disabled)
by setting the I bit of the condition code register (CCR). The software
interrupt (SWI) instruction is non-maskable.
An interrupt temporarily changes the program sequence to process a
particular event. An interrupt does not stop the execution of the
instruction in progress but takes effect when the current instruction
completes its execution. Interrupt processing automatically saves the
central processor unit (CPU) registers on the stack and loads the
program counter with a user-defined vector address.
4.3.1 Software Interrupt
The software interrupt instruction (SWI) causes a non-maskable
interrupt.
Technical Data
52
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Interrupts
MOTOROLA
Interrupts
Interrupt Sources
4.3.2 External Interrupt (IRQ)
An interrupt signal on the IRQ pin latches an external interrupt request.
After completing the current instruction, the CPU tests these bits:
•
IRQ latch
•
I bit in the condition code register
Setting the I bit in the condition code register disables external interrupts.
If the IRQ latch is set and the I bit is clear, the CPU then begins the
interrupt sequence. The CPU clears the IRQ latch while it fetches the
interrupt vector, so that another external interrupt request can be latched
during the interrupt service routine. As soon as the I bit is cleared during
the return from interrupt (RTI), the CPU can recognize the new interrupt
request. Figure 4-1 shows the logic for external interrupts.
Figure 4-1 shows an external interrupt functional diagram. Figure 4-2
shows an external interrupt timing diagram for the interrupt line. The
timing diagram illustrates two treatments of the interrupt line to the
processor.
•
Two single pulses on the interrupt line are spaced far enough
apart to be serviced. The minimum time between pulses is a
function of the length of the interrupt service.
Once a pulse occurs, the next pulse normally should not occur
until an RTI occurs. This time (tILIL) is obtained by adding 19
instruction cycles to the total number of cycles needed to complete
the service routine (not including the RTI instruction).
•
NOTE:
Many interrupt lines are wire-ORed to the IRQ line. If the interrupt
line remains low after servicing an interrupt, then the CPU
continues to recognize an interrupt.
The internal interrupt latch is cleared in the first part of the interrupt
service routine. Therefore, a new external interrupt pulse could be
latched and serviced as soon as the I bit is cleared.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Interrupts
53
Interrupts
EDGE- AND LEVEL-SENSITIVE TRIGGER
OPTION REGISTER
VDD
D
EXTERNAL
INTERRUPT
REQUEST
Q
I BIT (CCR)
IRQ LATCH
INTERRUPT
PIN
C
Q
POR
R
INTERNAL RESET (COP)
EXTERNAL RESET
EXTERNAL INTERRUPT BEING SERVICED
(VECTOR FETCH)
Figure 4-1. External Interrupt Internal Function Diagram
tILIL
tILIH
IRQ PIN
a. Edge-Sensitive Trigger Condition. The minimum pulse width (tILIH) is either 125 ns (fOP = 2.1 MHz)
or 250 ns (fOP = 1 MHz). The period tILIL should not be less than the number of tCYC cycles it takes to
execute the interrupt service routine plus 19 tCYC cycles.
IRQ1
tILIH
.
.
.
NORMALLY
USED WITH
WIRED-OR
CONNECTION
IRQn
IRQ
(INTERNAL)
b. Level-Sensitive Trigger Condition. If the interrupt line remains low after servicing an interrupt, then the
CPU continues to recognize an interrupt.
Figure 4-2. External Interrupt Timing
Technical Data
54
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Interrupts
MOTOROLA
Interrupts
Interrupt Sources
The IRQ pin is negative edge-triggered only or negative edge- and low
level-triggered, depending on the external interrupt triggering mask
option selected.
When the edge- and level-triggering mask option is selected:
•
A falling edge or a low level on the IRQ pin latches an external
interrupt request.
•
As long as the IRQ pin is low, an external interrupt request is
present, and the CPU continues to execute the interrupt service
routine. The edge- and level-sensitive trigger option allows
connection to the IRQ pin of multiple wired-OR interrupt sources.
When the edge-triggering mask option is selected:
NOTE:
•
A falling edge on the IRQ pin latches an external interrupt request.
•
A subsequent external interrupt request can be latched only after
the voltage level on the IRQ pin returns to logic 1 and then falls
again to logic 0.
If the IRQ pin is not in use, connect it to the VDD pin.
4.3.3 Port B Interrupts
When these three conditions are true, a port B pin (PBx) acts as an
external interrupt pin:
1. The corresponding port B pullup bit (PBPUx) in mask option
register 1 (MOR1) is programmed to a logic 1.
2. The corresponding port B data direction bit (DDRBx) in data
direction register B is a logic 0.
3. The clear interrupt mask (CLI) instruction has cleared the I bit in
the condition code register.
MOR1 is an erasable, programmable read-only memory (EPROM)
register that enables the port B pullup device. (See 9.5.2 Mask Option
Register 1.) Data from MOR1 is latched on the rising edge of the voltage
on the RESET pin.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Interrupts
55
Interrupts
Port B external interrupt pins can be falling-edge sensitive only or both
falling-edge and low-level sensitive, depending on the state of the IRQ
bit in the option register at location $1FDF.
When the IRQ bit is a logic 1, a falling edge or a low level on a port B
external interrupt pin latches an external interrupt request. As long as
any port B external interrupt pin is low, an external interrupt request is
present, and the CPU continues to execute the interrupt service routine.
When the IRQ bit is a logic 0, a falling-edge only on a port B external
interrupt pin latches an external interrupt request. A subsequent port B
external interrupt request can be latched only after the voltage level of
the previous port B external interrupt signal returns to a logic 1 and then
falls again to a logic 0.
Figure 4-3 shows the port B input/output (I/O) logic.
4.3.4 Capture/Compare Timer Interrupts
The capture/compare timer can generate these interrupts:
•
Input capture interrupt
•
Output compare interrupt
•
Timer overflow interrupt
Setting the I bit in the condition code register disables all interrupts
except for SWI and timer interrupts.
•
Input Capture Interrupt — The input capture flag bit (ICF)
indicates a transfer from the timer registers to the input capture
registers. ICF becomes set when an active edge occurs on the
TCAP pin. ICF generates an interrupt request if the input capture
interrupt enable bit (ICIE) is set also.
•
Output Compare Interrupt — The output compare flag bit (OCF)
indicates a transfer of the output level bit (OLVL) to the TCMP pin.
OCF becomes set when the 16-bit counter counts up to the value
programmed in the output compare registers. OCF generates an
interrupt request if the output compare interrupt enable bit (OCIE)
is set also.
Technical Data
56
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Interrupts
MOTOROLA
Interrupts
Interrupt Sources
VDD
PBPU7
FROM MOR1
READ $0005
INTERNAL DATA BUS
WRITE $0005
RESET
WRITE $0001
DATA DIRECTION
REGISTER B
BIT DDRB7
PORT B DATA
REGISTER
BIT PB7
PB7
READ $0001
IRQ
FROM OPTION
REGISTER
VDD
D
FROM OTHER
PORT B PINS
C
EXTERNAL
INTERRUPT
REQUEST
Q
R
Q
I BIT
FROM CCR
IRQ
RESET
EXTERNAL INTERRUPT VECTOR FETCH
Figure 4-3. Port B I/O Logic
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Interrupts
57
Interrupts
•
Timer Overflow Interrupt — The timer overflow flag bit (TOF)
becomes set when the 16-bit counter rolls over from $FFFF to
$0000. TOF generates an interrupt request if the timer overflow
interrupt enable bit (TOIE) is set also.
4.3.5 SCI Interrupts
The SCI can generate these interrupts:
•
Transmit data register empty interrupt
•
Transmission complete interrupt
•
Receive data register full interrupt
•
Receiver overrun interrupt
•
Receiver input idle interrupt
Setting the I bit in the condition code register disables all SCI interrupts.
•
SCI Transmit Data Register Empty Interrupt — The transmit
data register empty bit (TDRE) indicates that the SCI data register
is ready to receive a byte for transmission. TDRE becomes set
when data in the SCI data register transfers to the transmit shift
register. TDRE generates an interrupt request if the transmit
interrupt enable bit (TIE) is set also.
•
SCI Transmission Complete Interrupt — The transmission
complete bit (TC) indicates the completion of an SCI transmission.
TC becomes set when the TDRE bit becomes set and no data,
preamble, or break character is being transmitted. TC generates
an interrupt request if the transmission complete interrupt enable
bit (TCIE) is set also.
•
SCI Receive Data Register Full Interrupt — The receive data
register full bit (RDRF) indicates that a byte is ready to be read in
the SCI data register. RDRF becomes set when the data in the
receive shift register transfers to the SCI data register. RDRF
generates an interrupt request if the receive interrupt enable bit
(RIE) is set also.
Technical Data
58
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Interrupts
MOTOROLA
Interrupts
Interrupt Sources
•
SCI Receiver Overrun Interrupt — The overrun bit (OR)
indicates that a received byte is lost because software has not
read the previously received byte. OR becomes set when a byte
shifts into the receive shift register before software reads the word
already in the SCI data register. OR generates an interrupt
request if the receive interrupt enable bit (RIE) is set also.
•
SCI Receiver Input Idle Interrupt — The receiver input idle bit
(IDLE) indicates that the SCI receiver input is not receiving data.
IDLE becomes set when 10 or 11 consecutive logic ones appear
on the receiver input. IDLE generates an interrupt request if the
idle line interrupt enable bit (ILIE) is set also.
4.3.6 SPI Interrupts
The SPI can generate these interrupts:
•
SPI transmission complete interrupt
•
SPI mode fault interrupt
Setting the I bit in the condition code register disables all SPI interrupts.
•
SPI Transmission Complete Interrupt — The SPI flag bit (SPIF)
in the SPI status register indicates the completion of an SPI
transmission. SPIF becomes set when a byte shifts into or out of
the SPI data register. SPIF generates an interrupt request if the
SPIE bit is set also.
•
SPI Mode Fault Interrupt — The mode fault bit (MODF) in the SPI
status register indicates an SPI mode error. MODF becomes set
when a logic 0 occurs on the PD5/SS pin while the master bit
(MSTR) in the SPI control register is set. MODF generates an
interrupt request if the SPIE bit is set also.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Interrupts
59
Interrupts
4.4 Interrupt Processing
The CPU takes these actions to begin servicing an interrupt:
1. Stores the CPU registers on the stack in the order shown
in Figure 4-4
2. Sets the I bit in the condition code register to prevent further
interrupts
3. Loads the program counter with the contents of the appropriate
interrupt vector locations as shown in Table 4-1.
Table 4-1. Reset/Interrupt Vector Addresses
Function
Source
Local
Mask
Global
Mask
Priority
(1 = Highest)
Vector
Address
None
None
1
$1FFE–$1FFF
None
None
Same priority
as any
instruction
$1FFC–$1FFD
None
I bit
2
$1FFA–$1FFB
I bit
3
$1FF8–$1FF9
I bit
4
$1FF6–$1FF7
I bit
5
$1FF4–$1FF5
Power-on logic
Reset
RESET pin
Software
interrupt
(SWI)
External
interrupt
Timer
interrupts
User code
IRQ pin
Port B pins
ICF bit
ICIE bit
OCF bit
OCIE bit
TOF bit
TOIE bit
TDRE bit
TCIE bit
TC bit
SCI
interrupts
RDRF bit
RIE bit
OR bit
IDLE bit
SPI
interrupts
ILIE bit
SPIF bit
SPIE
MODF bit
Technical Data
60
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Interrupts
MOTOROLA
Interrupts
Interrupt Processing
The return-from-interrupt (RTI) instruction causes the CPU to recover
the CPU registers from the stack as shown in Figure 4-4.
$00C0 (BOTTOM OF STACK)
$00C1
$00C2
UNSTACKING
ORDER
•
•
•
•
•
•
5
1
CONDITION CODE REGISTER
4
2
ACCUMULATOR
3
3
INDEX REGISTER
2
4
PROGRAM COUNTER (HIGH BYTE)
1
5
PROGRAM COUNTER (LOW BYTE)
STACKING
ORDER
•
•
•
•
•
•
$00FD
$00FE
$00FF (TOP OF STACK)
Figure 4-4. Interrupt Stacking Order
NOTE:
If more than one interrupt request is pending, the CPU fetches the vector
of the higher priority interrupt first. A higher priority interrupt does not
interrupt a lower priority interrupt service routine unless the lower priority
interrupt service routine clears the I bit. Table 4-1 for a priority listing.
Figure 4-5 shows the sequence of events caused by an interrupt.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Interrupts
61
Interrupts
FROM
RESET
YES
I BIT IN
CCR REGISTER
SET?
NO
EXTERNAL
IRQ
INTERRUPT?
YES
CLEAR IRQ REQUEST LATCH
NO
TIMER
INTERRUPT?
YES
NO
SCI
INTERRUPT?
YES
NO
SPI
INTERRUPT?
YES
NO
1. STACK PC, X, A, CCR
2. SET I BIT
3. LOAD PC WITH VECTOR
SWI: $1FFC–$1FFD
IRQ: $1FFA–$1FFB
TIMER: $1FF8–$1FF9
SCI: $1FF6–$1FF7
SPI: $1FF4–$1FF5
FETCH NEXT
INSTRUCTION
SWI
INSTRUCTION?
YES
NO
RTI
INSTRUCTION?
YES
RESTORE REGISTERS FROM STACK:
CCR, A, X, PC
NO
EXECUTE INSTRUCTION
Figure 4-5. Reset and Interrupt Processing Flowchart
Technical Data
62
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Interrupts
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 5. Resets
5.1 Contents
5.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.3
Reset Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.3.1
Power-On Reset (POR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.3.2
External Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.3.3
Computer Operating Properly (COP)
Watchdog Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.2 Introduction
This section describes how resets initialize the MCU.
5.3 Reset Sources
A reset immediately stops the operation of the instruction being
executed, initializes certain control bits, and loads the program counter
with a user-defined reset vector address. These conditions produce a
reset:
•
Power-on reset (POR) — Initial power up
•
External reset — A logic 0 applied to the RESET pin
•
Internal computer operating properly (COP) watchdog timer reset
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Resets
63
Resets
5.3.1 Power-On Reset (POR)
A positive transition on the VDD pin generates a power-on reset (POR).
The POR is strictly for the power-up condition and cannot be used to
detect drops in power supply voltage.
A 4064 tCYC (internal clock cycle) delay after the oscillator becomes
active allows the clock generator to stabilize. If the RESET pin is at
logic 0 at the end of 4064 tCYC, the MCU remains in the reset condition
until the signal on the RESET pin goes to logic 1.
5.3.2 External Reset
The minimum time required for the MCU to recognize a reset is 1 1/2
tCYC. A Schmitt trigger senses the logic level at the RESET pin.
5.3.3 Computer Operating Properly (COP) Watchdog Reset
A timeout of the 18-stage ripple counter in the computer operating
properly (COP) watchdog timer generates a reset. The COP watchdog
timer, once enabled, is part of a software error detection system and
must be cleared periodically to start a new timeout period. The timeout
period is 65.536 ms when fOSC = 4 MHz. The timeout period is a direct
function of the crystal frequency. The equation is:
Timeout period =
NOTE:
262,144
fOSC
A COP timeout does not pull the RESET pin low.
For information on the COP watchdog timer in low-power modes, refer
to Section 6. Low-Power Modes.
Technical Data
64
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Resets
MOTOROLA
Resets
Reset Sources
Two memory locations control operation of the COP watchdog:
•
COP Enable Bit (NCOPE) in Mask Option Register 2
(MOR2) — Programming the NCOPE bit in MOR2 to a logic 1
enables the COP watchdog. See 9.5.3 Mask Option Register 2.
•
COP Clear Bit (COPC) at Address $1FF0 — To clear the COP
watchdog and start a new COP timeout period, write a logic 0 to
bit 0 of address $1FF0. Reading address $1FF0 returns the mask
option register 1 (MOR1) data at that location. See 9.5.2 Mask
Option Register 1.
Figure 5-1 is a diagram of the COP.
COP WATCHDOG (MC68HC05C4A TYPE)
NCOPE
COPC
INTERNAL
CLOCK
(fOP )
÷2 ÷2 ÷2 ÷2 ÷2 ÷2 ÷2 ÷2 ÷2 ÷2 ÷2 ÷2
÷2 ÷2 ÷2 ÷2 ÷2
RESET
Figure 5-1. COP Watchdog Diagram
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Resets
65
Resets
Technical Data
66
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Resets
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 6. Low-Power Modes
6.1 Contents
6.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.3
Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.3.1
SCI During Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69
6.3.2
SPI During Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.3.3
COP Watchdog in Stop Mode . . . . . . . . . . . . . . . . . . . . . . . 70
6.4
Wait Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.5
Data-Retention Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
6.2 Introduction
This section describes the three low-power modes:
•
Stop mode
•
Wait mode
•
Data-retention mode
6.3 Stop Mode
The STOP instruction places the microcontroller unit (MCU) in its lowest
power consumption mode. In the stop mode, the internal oscillator is
turned off, halting all internal processing including timer, serial
communications interface (SCI), and master mode serial peripheral
interface (SPI) operation.
See Figure 6-1.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Low-Power Modes
Technical Data
67
Low-Power Modes
STOP
WAIT
STOP OSCILLATOR
AND ALL CLOCKS
CLEAR I BIT
OSCILLATOR ACTIVE
TIMER, SCI, AND SPI
CLOCKS ACTIVE
CPU CLOCKS STOPPED
CLEAR I BIT
RESET
RESET
NO
NO
EXTERNAL
INTERRUPT
(IRQ)
NO
YES
YES
YES
EXTERNAL
INTERRUPT
(IRQ)
YES
YES
TURN ON OSCILLATOR
WAIT FOR TIME
DELAY TO STABILIZE
1. FETCH RESET VECTOR
OR
2. SERVICE INTERRUPT:
a. STACK
b. SET I BIT
c. VECTOR TO
INTERRUPT ROUTINE
NO
INTERNAL TIMER
INTERRUPT
NO
RESTART CPU CLOCK
YES
1. FETCH RESET VECTOR
OR
2. SERVICE INTERRUPT:
a. STACK
b. SET I BIT
c. VECTOR TO
INTERRUPT ROUTINE
INTERNAL SCI
INTERRUPT
NO
YES
INTERNAL SPI
INTERRUPT
NO
Figure 6-1. Stop/Wait Mode Function Flowchart
During stop mode, the I bit in the condition code register (CCR) is
cleared to enable external interrupts. All other registers and memory
remain unaltered. All input/output (I/O) lines remain unchanged. The
processor can be brought out of stop mode only by an external interrupt
or reset.
Technical Data
68
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Low-Power Modes
MOTOROLA
Low-Power Modes
Stop Mode
6.3.1 SCI During Stop Mode
When the MCU enters stop mode, the baud rate generator stops, halting
all SCI activity. If the STOP instruction is executed during a transmitter
transfer, that transfer is halted. If a low input to the IRQ pin is used to exit
stop mode, the transfer resumes.
If the SCI receiver is receiving data and stop mode is entered, received
data sampling stops because the baud rate generator stops, and all
subsequent data is lost. Therefore, all SCI transfers should be in the idle
state when the STOP instruction is executed.
6.3.2 SPI During Stop Mode
When the MCU enters the stop mode, the baud rate generator stops,
terminating all master mode SPI operations. If the STOP instruction is
executed during an SPI transfer, that transfer halts until the MCU exits
the stop mode by a low signal on the IRQ pin. If reset is used to exit stop
mode, the SPI control and status bits are cleared, and the SPI is
disabled.
If the MCU is in slave mode when the STOP instruction is executed, the
slave SPI continues to operate and can still accept data and clock
information in addition to transmitting its own data back to a master
device. At the end of a possible transmission with a slave SPI in stop
mode, no flags are set until a low on the IRQ pin wakes up the MCU.
NOTE:
Although a slave SPI in stop mode can exchange data with a master SPI,
the status bits of a slave SPI are inactive in stop mode.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Low-Power Modes
Technical Data
69
Low-Power Modes
6.3.3 COP Watchdog in Stop Mode
The STOP instruction has these effects on the computer operating
properly (COP) watchdog:
•
Turns off the oscillator and the COP watchdog counter
•
Clears the COP watchdog counter
If the RESET pin brings the MCU out of stop mode, the COP watchdog
begins counting immediately. The reset function clears the COP counter
again after the 4064-tCYC clock stabilization delay.
If the IRQ pin brings the MCU out of stop mode, the COP watchdog
begins counting immediately. The IRQ function does not clear the COP
counter again after the 4064-tCYC clock stabilization delay.
See Figure 6-2.
6.4 Wait Mode
The WAIT instruction places the MCU in an intermediate
power-consumption mode. All CPU activity is suspended, but the
oscillator, capture/compare timer, SCI, and SPI remain active. Any
interrupt or reset brings the MCU out of wait mode. See Figure 6-1.
The WAIT instruction has these effects on the CPU:
•
Clears the I bit in the condition code register, enabling interrupts
•
Stops the CPU clock, but allows the internal clock to drive the
capture/compare timer, SCI, and SPI
The WAIT instruction does not affect any other registers or I/O lines. The
capture/compare timer, SCI, and SPI can be enabled to allow a periodic
exit from wait mode.
The COP watchdog is active during wait mode. Software must
periodically bring the MCU out of wait mode to clear the COP watchdog.
Technical Data
70
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Low-Power Modes
MOTOROLA
Low-Power Modes
Wait Mode
STOP
CLEAR I BIT IN CCR
CLEAR COP COUNTER
TURN OFF INTERNAL OSCILLATOR
TURN OFF COP COUNTER
EXTERNAL
RESET?
YES
NO
NO
EXTERNAL
INTERRUPT?
TURN ON INTERNAL OSCILLATOR
TURN ON COP WATCHDOG
YES
TURN ON INTERNAL OSCILLATOR
TURN ON COP WATCHDOG
END OF
STABILIZATION
DELAY?
YES
NO
END OF
STABILIZATION
DELAY?
YES
NO
CLEAR COP COUNTER
TURN ON INTERNAL CLOCK
TURN ON INTERNAL CLOCK
1. LOAD PC WITH RESET VECTOR
OR
2. SERVICE INTERRUPT:
a. SAVE CPU REGISTERS ON STACK
b. SET I BIT IN CCR
c. LOAD PC WITH INTERRUPT VECTOR
1. LOAD PC WITH RESET VECTOR
OR
2. SERVICE INTERRUPT:
a. SAVE CPU REGISTERS ON STACK
b. SET I BIT IN CCR
c. LOAD PC WITH INTERRUPT VECTOR
Figure 6-2. COP Watchdog in Stop Mode Flowchart (NCOPE = 1)
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Low-Power Modes
Technical Data
71
Low-Power Modes
6.5 Data-Retention Mode
In data-retention mode, the MCU retains random-access memory (RAM)
contents and central processor unit (CPU) register contents at VDD
voltages as low as 2.0 Vdc. The data-retention feature allows the MCU
to remain in a low power-consumption state during which it retains data,
but the CPU cannot execute instructions.
To put the MCU in data-retention mode:
1. Drive the RESET pin to logic 0.
2. Lower VDD voltage. The RESET pin must remain low continuously
during data-retention mode.
To take the MCU out of data-retention mode:
1. Return VDD to normal operating voltage.
2. Return the RESET pin to logic 1.
Technical Data
72
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Low-Power Modes
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 7. Parallel Input/Output (I/O)
7.1 Contents
7.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.3
Port A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.3.1
Port A Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.3.2
Data Direction Register A. . . . . . . . . . . . . . . . . . . . . . . . . . . 75
7.3.3
Port A Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
7.4
Port B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.4.1
Port B Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.4.2
Data Direction Register B. . . . . . . . . . . . . . . . . . . . . . . . . . . 78
7.4.3
Port B Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
7.5
Port C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
7.5.1
Port C Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
7.5.2
Data Direction Register C. . . . . . . . . . . . . . . . . . . . . . . . . . . 82
7.5.3
Port C Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
7.6
Port D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
7.2 Introduction
This section describes the programming of ports A, B, C, and D.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Parallel Input/Output (I/O)
Technical Data
73
Parallel Input/Output (I/O)
7.3 Port A
Port A is an 8-bit, general-purpose, bidirectional input/output (I/O) port.
7.3.1 Port A Data Register
The port A data register (PORTA) shown in Figure 7-1 contains a data
latch for each of the eight port A pins. When a port A pin is programmed
to be an output, the state of its data register bit determines the state of
the output pin. When a port A pin is programmed to be an input, reading
the port A data register returns the logic state of the pin.
Address:
$0000
Bit 7
6
5
4
3
2
1
Bit 0
PA7
PA6
PA5
PA4
PA3
PA2
PA1
PA0
Read:
Write:
Reset:
Unaffected by reset
Figure 7-1. Port A Data Register (PORTA)
PA7–PA0 — Port A Data Bits
These read/write bits are software programmable. Data direction of
each bit is under the control of the corresponding bit in data direction
register A. Reset has no effect on port A data.
Technical Data
74
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Parallel Input/Output (I/O)
MOTOROLA
Parallel Input/Output (I/O)
Port A
7.3.2 Data Direction Register A
The contents of data direction register A (DDRA) shown in Figure 7-2
determine whether each port A pin is an input or an output. Writing a
logic 1 to a DDRA bit enables the output buffer for the associated port A
pin; a logic 0 disables the output buffer. A reset clears all DDRA bits,
configuring all port A pins as inputs.
Address:
$0004
Bit 7
6
5
4
3
2
1
Bit 0
DDRA7
DDRA6
DDRA5
DDRA4
DDRA3
DDRA2
DDRA1
DDRA0
0
0
0
0
0
0
0
0
Read:
Write:
Reset:
Figure 7-2. Data Direction Register A (DDRA)
DDRA7–DDRA0 — Port A Data Direction Bits
These read/write bits control port A data direction. Reset clears bits
DDRA7–DDRA0.
1 = Corresponding port A pin configured as output
0 = Corresponding port A pin configured as input
NOTE:
Avoid glitches on port A pins by writing to the port A data register before
changing DDRA bits from logic 0 to logic 1.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Parallel Input/Output (I/O)
Technical Data
75
Parallel Input/Output (I/O)
7.3.3 Port A Logic
Figure 7-3 is a diagram of the port A I/O logic.
READ $0004
WRITE $0004
DATA DIRECTION
REGISTER A
BIT DDRAx
INTERNAL DATA BUS
RESET
PORT A DATA
REGISTER
BIT PAx
WRITE $0000
PAx
READ $0000
Figure 7-3. Port A I/O Logic
When a port A pin is programmed to be an output, the state of its data
register bit determines the state of the output pin. When a port A pin is
programmed to be an input, reading the port A data register returns the
logic state of the pin.
The data latch can always be written, regardless of the state of its DDRA
bit. Table 7-1 summarizes the operation of the port A pins.
Table 7-1. Port A Pin Functions
Accesses to DDRA
DDRA Bit
Accesses to PORTA
I/O Pin Mode
Read/Write
Read
Write
0
Input, Hi-Z(1)
DDRA7–DDRA0
Pin
PA7–PA0(2)
1
Output
DDRA7–DDRA0
PA7–PA0
PA7–PA0
1. Hi-Z = high impedance
2. Writing affects data register but does not affect input.
NOTE:
Technical Data
76
To avoid excessive current draw, tie all unused input pins to VDD or VSS
or change I/O pins to outputs by writing to DDRA in user code as early
as possible.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Parallel Input/Output (I/O)
MOTOROLA
Parallel Input/Output (I/O)
Port B
7.4 Port B
Port B is an 8-bit, general-purpose, bidirectional I/O port. Port B pins can
also be configured to function as external interrupts. The port B pullup
devices are enabled in mask option register 1 (MOR1). See 9.5.2 Mask
Option Register 1 and 4.3.3 Port B Interrupts.
7.4.1 Port B Data Register
The port B data register (PORTB) shown in Figure 7-4 contains a data
latch for each of the eight port B pins.
Address:
$0001
Bit 7
6
5
4
3
2
1
Bit 0
PB7
PB6
PB5
PB4
PB3
PB2
PB1
PB0
Read:
Write:
Reset:
Unaffected by reset
Figure 7-4. Port B Data Register (PORTB)
PB7–PB0 — Port B Data Bits
These read/write bits are software programmable. Data direction of
each bit is under the control of the corresponding bit in data direction
register B. Reset has no effect on port B data.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Parallel Input/Output (I/O)
Technical Data
77
Parallel Input/Output (I/O)
7.4.2 Data Direction Register B
The contents of data direction register B (DDRB) shown in Figure 7-5
determine whether each port B pin is an input or an output. Writing a
logic 1 to a DDRB bit enables the output buffer for the associated port B
pin; a logic 0 disables the output buffer. A reset clears all DDRB bits,
configuring all port B pins as inputs. If the pullup devices are enabled by
mask option, setting a DDRB bit to a logic 1 turns off the pullup device
for that pin.
Address:
$0005
Bit 7
6
5
4
3
2
1
Bit 0
DDRB7
DDRB6
DDRB5
DDRB4
DDRB3
DDRB2
DDRB1
DDRB0
0
0
0
0
0
0
0
0
Read:
Write:
Reset:
Figure 7-5. Data Direction Register B (DDRB)
DDRB7–DDRB0 — Port B Data Direction Bits
These read/write bits control port B data direction. Reset clears bits
DDRB7–DDRB0.
1 = Corresponding port B pin configured as output
0 = Corresponding port B pin configured as input
NOTE:
Technical Data
78
Avoid glitches on port B pins by writing to the port B data register before
changing DDRB bits from logic 0 to logic 1.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Parallel Input/Output (I/O)
MOTOROLA
Parallel Input/Output (I/O)
Port B
7.4.3 Port B Logic
Figure 7-6 shows the port B I/O logic.
VDD
PBPU7
FROM MOR1
READ $0005
INTERNAL DATA BUS
WRITE $0005
RESET
WRITE $0001
DATA DIRECTION
REGISTER B
BIT DDRB7
PORT B DATA
REGISTER
BIT PB7
PB7
READ $0001
IRQ
FROM OPTION
REGISTER
VDD
D
EXTERNAL
INTERRUPT
REQUEST
Q
IRQ
LATCH
Q
C
R
FROM OTHER
PORT B PINS
I BIT
FROM CCR
IRQ
RESET
EXTERNAL INTERRUPT VECTOR FETCH
Figure 7-6. Port B I/O Logic
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Parallel Input/Output (I/O)
Technical Data
79
Parallel Input/Output (I/O)
When a port B pin is programmed as an output, reading the port bit reads
the value of the data latch and not the voltage on the pin itself. When a
port B pin is programmed as an input, reading the port bit reads the
voltage level on the pin. The data latch can always be written, regardless
of the state of its DDRB bit.
Table 7-2. Port B Pin Functions
Accesses to DDRB
DDRB Bit
Accesses to PORTB
I/O Pin Mode
Read/Write
Read
Write
0
Input, Hi-Z(1)
DDRB7–DDRB0
Pin
PB7–PB0(2)
1
Output
DDRB7–DDRB0
PB7–PB0
PB7–PB0
1. Hi-Z = high impedance
2. Writing affects data register but does not affect input.
NOTE:
Technical Data
80
To avoid excessive current draw, tie all unused input pins to VDD or VSS,
or for I/O pins change to outputs by writing to DDRB in user code as early
as possible.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Parallel Input/Output (I/O)
MOTOROLA
Parallel Input/Output (I/O)
Port C
7.5 Port C
Port C is an 8-bit, general-purpose, bidirectional I/O port. PC7 has a high
current sink and source capability.
7.5.1 Port C Data Register
The port C data register (PORTC) shown in Figure 7-7 contains a data
latch for each of the eight port C pins. When a port C pin is programmed
to be an output, the state of its data register bit determines the state of
the output pin. When a port C pin is programmed to be an input, reading
the port C data register returns the logic state of the pin.
Address:
$0002
Bit 7
6
5
4
3
2
1
Bit 0
PC7
PC6
PC5
PC4
PC3
PC2
PC1
PC0
Read:
Write:
Reset:
Unaffected by reset
Figure 7-7. Port C Data Register (PORTC)
PC7–PC0 — Port C Data Bits
These read/write bits are software programmable. Data direction of
each bit is under the control of the corresponding bit in data direction
register C. PC7 has a high current sink and source capability. Reset
has no effect on port C data.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Parallel Input/Output (I/O)
Technical Data
81
Parallel Input/Output (I/O)
7.5.2 Data Direction Register C
The contents of data direction register C (DDRC) shown in Figure 7-8
determine whether each port C pin is an input or an output. Writing a
logic 1 to a DDRC bit enables the output buffer for the associated port C
pin; a logic 0 disables the output buffer. A reset clears all DDRC bits,
configuring all port C pins as inputs.
Address:
$0006
Bit 7
6
5
4
3
2
1
Bit 0
DDRC7
DDRC6
DDRC5
DDRC4
DDRC3
DDRC2
DDRC1
DDRC0
0
0
0
0
0
0
0
0
Read:
Write:
Reset:
Figure 7-8. Data Direction Register C (DDRC)
DDRC7–DDRC0 — Port C Data Direction Bits
These read/write bits control port C data direction. Reset clears bits
DDRC7–DDRC0.
1 = Corresponding port C pin configured as output
0 = Corresponding port C pin configured as input
NOTE:
Technical Data
82
Avoid glitches on port C pins by writing to the port C data register before
changing DDRC bits from logic 0 to logic 1.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Parallel Input/Output (I/O)
MOTOROLA
Parallel Input/Output (I/O)
Port C
7.5.3 Port C Logic
Figure 7-9 shows port C I/O logic.
READ $0006
WRITE $0006
DATA DIRECTION
REGISTER C
BIT DDRCx
INTERNAL DATA BUS
RESET
PORT C DATA
REGISTER
BIT PCx
WRITE $0002
PCx
READ $0002
Figure 7-9. Port C I/O Logic
When a port C pin is programmed as an output, reading the port bit reads
the value of the data latch and not the voltage on the pin. When a port C
pin is programmed as an input, reading the port bit reads the voltage
level on the pin. The data latch can always be written, regardless of the
state of its DDRC bit. Table 7-1 summarizes the operation of the port C
pins.
Table 7-3. Port C Pin Functions
Accesses to DDRC
DDRC Bit
Accesses to PORTC
I/O Pin Mode
Read/Write
Read
Write
0
Input, Hi-Z(1)
DDRC7–DDRC0
Pin
PC7–PC0(2)
1
Output
DDRC7–DDRC0
PC7–PC0
PC7–PC0
1. Hi-Z = high impedance
2. Writing affects data register but does not affect input.
NOTE:
To avoid excessive current draw, tie all unused input pins to VDD or VSS
or change I/O pins to outputs by writing to DDRC in user code as early
as possible.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Parallel Input/Output (I/O)
Technical Data
83
Parallel Input/Output (I/O)
7.6 Port D
Port D is a 7-bit, special-purpose, input-only port that has no data
register. Reading address $0003 returns the logic states of the port D
pins.
Port D shares pins PD5–PD2 with the serial peripheral interface module
(SPI). When the SPI is enabled, PD5–PD2 read as logic 0s. When the
SPI is disabled, reading address $0003 returns the logic states of the
PD5–PD2 pins.
Port D shares pins PD1 and PD0 with the SCI module. When the SCI is
enabled, PD1 and PD0 read as logic 0s. When the SCI is disabled,
reading address $0003 returns the logic states of the PD1 and PD0 pins.
Address:
$0003
Bit 7
Read:
PD7
6
5
4
3
2
1
Bit 0
SS
SCK
MOSI
MISO
TDO
RDI
Write:
Reset:
Unaffected by reset
= Unimplemented
Figure 7-10. Port D Fixed Input Register (PORTD)
Technical Data
84
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Parallel Input/Output (I/O)
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 8. Capture/Compare Timer
8.1 Contents
8.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
8.3
Timer Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
8.3.1
Input Capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
8.3.2
Output Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89
8.4
Timer I/O Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .90
8.4.1
Timer Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
8.4.2
Timer Status Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
8.4.3
Timer Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
8.4.4
Alternate Timer Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . 94
8.4.5
Input Capture Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
8.4.6
Output Compare Registers. . . . . . . . . . . . . . . . . . . . . . . . . . 96
8.2 Introduction
This section describes the operation of the 16-bit capture/compare timer.
Figure 8-1 shows the structure of the timer module. Figure 8-2 is a
summary of the timer input/output (I/O) registers.
8.3 Timer Operation
The core of the capture/compare timer is a 16-bit free-running counter.
The counter is the timing reference for the input capture and output
compare functions. The input capture and output compare functions can
latch the times at which external events occur, measure input
waveforms, and generate output waveforms and timing delays. Software
can read the value in the counter at any time without affecting the
counter sequence.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Capture/Compare Timer
Technical Data
85
Capture/Compare Timer
TCAP
EDGE
SELECT/
DETECT
LOGIC
ICRH ($0014)
ICRL ($0015)
TRH ($0018)
TRL ($0019)
ATRH ($001A)
÷4
OVERFLOW
16-BIT COUNTER
INTERNAL CLOCK (XTAL ÷ 2)
PIN
CONTROL
LOGIC
16-BIT COMPARATOR
OCRH ($0016)
ATRL ($001B)
TCMP
OCRL ($0017)
$0012
TIMER CONTROL REGISTER
TOF
OCF
ICF
OLVL
IEDG
TOIE
OCIE
ICIE
TIMER
INTERRUPT
REQUEST
TIMER STATUS REGISTER
$0013
INTERNAL DATA BUS
Figure 8-1. Timer Block Diagram
Because of the 16-bit timer architecture, the I/O registers for the input
capture and output compare functions are pairs of 8-bit registers.
Because the counter is 16 bits long and preceded by a fixed
divide-by-four prescaler, the counter rolls over every 262,144 internal
clock cycles. Timer resolution with a 4-MHz crystal is 2 µs.
Technical Data
86
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Capture/Compare Timer
MOTOROLA
Capture/Compare Timer
Timer Operation
Addr.
Register Name
Bit 7
6
5
4
3
2
1
Bit 0
ICIE
OCIE
TOIE
0
0
0
IEDG
OLVL
0
0
0
0
0
0
U
0
ICF
OCF
TOF
0
0
0
0
0
U
U
U
0
0
0
0
0
Read: Bit 15
Input Capture Register
High (ICRH) Write:
See page 96.
Reset:
Bit 14
Bit 13
Bit 12
Bit 11
Bit 10
Bit 9
Bit 8
Read:
Input Capture Register
Low (ICRL) Write:
See page 96.
Reset:
Bit 6
Bit 2
Bit 1
Bit 0
Read:
Timer Control Register
(TCR) Write:
See page 90.
Reset:
$0012
Read:
Timer Status Register
(TSR) Write:
See page 92.
Reset:
$0013
$0014
$0015
Bit 7
$0016
$0017
Read:
Output Compare Register
Low (OCRL) Write:
See page 96.
Reset:
$0019
$001A
$001B
Bit 5
Bit 4
Bit 3
Unaffected by reset
Read:
Output Compare Register
Bit 15
High (OCRH) Write:
See page 96.
Reset:
$0018
Unaffected by reset
Bit 14
Bit 13
Bit 12
Bit 11
Bit 10
Bit 9
Bit 8
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Read: Bit 15
Timer Register High
(TRH) Write:
See page 93.
Reset:
Bit 14
Bit 13
Bit 12
Bit 11
Bit 10
Bit 9
Bit 8
Read:
Timer Register Low
(TRL) Write:
See page 93.
Reset:
Bit 6
Bit 2
Bit 1
Bit 0
Bit 10
Bit 9
Bit 8
Bit 2
Bit 1
Bit 0
Reset initializes TRH to $FF
Bit 7
Bit 5
Bit 4
Bit 3
Reset initializes TRL to $FC
Read: Bit 15
Alternate Timer Register
High (ATRH) Write:
See page 94.
Reset:
Bit 14
Read:
Alternate Timer Register
Low (ATRL) Write:
See page 94.
Reset:
Bit 6
Bit 13
Bit 12
Bit 11
Reset initializes ATRH to $FF
Bit 7
Bit 5
Bit 4
Bit 3
Reset initializes ATRL to $FC
= Unimplemented
U = Unaffected
Figure 8-2. Timer I/O Register Summary
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Capture/Compare Timer
Technical Data
87
Capture/Compare Timer
8.3.1 Input Capture
The input capture function can record the time at which an external event
occurs. When the input capture circuitry detects an active edge on the
input capture pin (TCAP), it latches the contents of the timer registers
into the input capture registers. The polarity of the active edge is
programmable.
Latching values into the input capture registers at successive edges of
the same polarity measures the period of the input signal on the TCAP
pin. Latching the counter values at successive edges of opposite polarity
measures the pulse width of the signal. Figure 8-3 shows the logic of the
input capture function.
15
$0018
8
TIMER REGISTER HIGH
TCAP
EDGE
SELECT/DETECT
LOGIC
0
TIMER REGISTER LOW
8
15
LATCH
$0019
7
7
0
INPUT CAPTURE REGISTER HIGH
INPUT CAPTURE REGISTER LOW
$0014
$0015
TOF
OCF
ICF
OLVL
TOIE
OCIE
TIMER CONTROL REGISTER
TIMER STATUS REGISTER
$0012
$0013
IEDG
ICIE
TIMER
INTERRUPT
REQUEST
Figure 8-3. Input Capture Operation
Technical Data
88
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Capture/Compare Timer
MOTOROLA
Capture/Compare Timer
Timer Operation
8.3.2 Output Compare
The output compare function can generate an output signal when the
16-bit counter reaches a selected value. Software writes the selected
value into the output compare registers. On every fourth internal clock
cycle the output compare circuitry compares the value of the counter to
the value written in the output compare registers. When a match occurs,
the timer transfers the programmable output level bit (OLVL) from the
timer control register to the output compare pin (TCMP).
Software can use the output compare register to measure time periods,
to generate timing delays, or to generate a pulse of specific duration or
a pulse train of specific frequency and duty cycle on the TCMP pin.
Figure 8-4 shows the logic of the output compare function.
15
0
COUNTER LOW BYTE
COUNTER HIGH BYTE
PIN
CONTROL
LOGIC
16-BIT COMPARATOR
8
15
TCMP
0
7
OUTPUT COMPARE REGISTER HIGH
OUTPUT COMPARE REGISTER LOW
$0016
$0017
TOF
OCF
ICF
TOIE
OCIE
ICIE
TIMER
INTERRUPT
REQUEST
TIMER STATUS REGISTER
TIMER STATUS REGISTER
$0012
$0013
Figure 8-4. Output Compare Operation
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Capture/Compare Timer
Technical Data
89
Capture/Compare Timer
8.4 Timer I/O Registers
These registers control and monitor the timer operation:
•
Timer control register (TCR)
•
Timer status register (TSR)
•
Timer registers (TRH and TRL)
•
Alternate timer registers (ATRH and ATRL)
•
Input capture registers (ICRH and ICRL)
•
Output compare registers (OCRH and OCRL)
8.4.1 Timer Control Register
The timer control register as shown in Figure 8-5 performs these
functions:
•
Enables input capture interrupts
•
Enables output compare interrupts
•
Enables timer overflow interrupts
•
Controls the active edge polarity of the TCAP signal
•
Controls the active level of the TCMP output
Address:
$0012
Bit 7
6
5
4
3
2
1
Bit 0
ICIE
OCIE
TOIE
0
0
0
IEDG
OLVL
0
0
0
0
0
0
U
0
Read:
Write:
Reset:
U = Unaffected
Figure 8-5. Timer Control Register (TCR)
Technical Data
90
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Capture/Compare Timer
MOTOROLA
Capture/Compare Timer
Timer I/O Registers
ICIE — Input Capture Interrupt Enable Bit
This read/write bit enables interrupts caused by an active signal on
the TCAP pin. Reset clears the ICIE bit.
1 = Input capture interrupts enabled
0 = Input capture interrupts disabled
OCIE — Output Compare Interrupt Enable Bit
This read/write bit enables interrupts caused by an active signal on
the TCMP pin. Reset clears the OCIE bit.
1 = Output compare interrupts enabled
0 = Output compare interrupts disabled
TOIE — Timer Overflow Interrupt Enable Bit
This read/write bit enables interrupts caused by a timer overflow.
Reset clears the TOIE bit.
1 = Timer overflow interrupts enabled
0 = Timer overflow interrupts disabled
IEDG — Input Edge Bit
The state of this read/write bit determines whether a positive or
negative transition on the TCAP pin triggers a transfer of the contents
of the timer register to the input capture registers. Reset has no effect
on the IEDG bit.
1 = Positive edge (low-to-high transition) triggers input capture
0 = Negative edge (high-to-low transition) triggers input capture
OLVL — Output Level Bit
The state of this read/write bit determines whether a logic 1 or a
logic 0 appears on the TCMP pin when a successful output compare
occurs. Reset clears the OLVL bit.
1 = TCMP goes high on output compare
0 = TCMP goes low on output compare
Bits 4–2 — Not used; these bits always read 0
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Capture/Compare Timer
Technical Data
91
Capture/Compare Timer
8.4.2 Timer Status Register
This read-only register shown in Figure 8-6 contains flags for these
events:
•
An active signal on the TCAP pin, transferring the contents of the
timer registers to the input capture registers
•
A match between the 16-bit counter and the output compare
registers, transferring the OLVL bit to the TCMP pin
•
A timer rollover from $FFFF to $0000
Address:
Read:
$0013
Bit 7
6
5
4
3
2
1
Bit 0
ICF
OCF
TOF
0
0
0
0
0
U
U
U
0
0
0
0
0
Write:
Reset:
= Unimplemented
U = Unaffected
Figure 8-6. Timer Status Register (TSR)
ICF — Input Capture Flag
The ICF bit is set automatically when an edge of the selected polarity
occurs on the TCAP pin. Clear the ICF bit by reading the timer status
register with ICF set and then reading the low byte ($0015) of the
input capture registers. Reset has no effect on ICF.
1 = Input capture
0 = No input capture
OCF — Output Compare Flag
The OCF bit is set automatically when the value of the timer registers
matches the contents of the output compare registers. Clear the OCF
bit by reading the timer status register with OCF set and then reading
the low byte ($0017) of the output compare registers. Reset has no
effect on OCF.
1 = Output compare
0 = No output compare
Technical Data
92
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Capture/Compare Timer
MOTOROLA
Capture/Compare Timer
Timer I/O Registers
TOF — Timer Overflow Flag
The TOF bit is set automatically when the 16-bit counter rolls over
from $FFFF to $0000. Clear the TOF bit by reading the timer status
register with TOF set and then reading the low byte ($0019) of the
timer registers. Reset has no effect on TOF.
1 = Timer overflow
0 = No timer overflow
Bits 4–0 — Not used; these bits always read 0
8.4.3 Timer Registers
The read-only timer registers shown in Figure 8-7 contain the current
high and low bytes of the 16-bit counter. Reading TRH before reading
TRL causes TRL to be latched until TRL is read. Reading TRL after
reading the timer status register clears the timer overflow flag bit (TOF).
Writing to the timer registers has no effect.
Bit 7
6
5
4
3
2
1
Bit 0
11
10
9
Bit 8
2
1
Bit 0
Register Name and Address: Timer Register High — $0018
Read:
Bit 15
14
13
12
Write:
Reset:
Reset initializes TRH to $FF
Register Name and Address: Timer Register Low — $0019
Read:
Bit 7
6
5
4
3
Write:
Reset:
Reset initializes TRL to $FC
= Unimplemented
Figure 8-7. Timer Registers (TRH and TRL)
Reading TRH returns the current value of the high byte of the counter
and causes the low byte to be latched into a buffer, as shown in
Figure 8-8. The buffer value remains fixed even if the high byte is read
more than once. Reading TRL reads the transparent low byte buffer and
completes the read sequence of the timer registers.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Capture/Compare Timer
Technical Data
93
Capture/Compare Timer
INTERNAL DATA BUS
7
0
LATCH
15
$0018
8
TIMER REGISTER HIGH
LOW BYTE BUFFER
7
0
TIMER REGISTER LOW
$0019
READ TRH
Figure 8-8. Timer Register Reads
NOTE:
To prevent interrupts from occurring between readings of TRH and TRL,
set the interrupt mask (I bit) in the condition code register before reading
TRH, and clear the mask after reading TRL.
8.4.4 Alternate Timer Registers
The alternate timer registers shown in Figure 8-9 contain the current
high and low bytes of the 16-bit counter. Reading ATRH before reading
ATRL causes ATRL to be latched until ATRL is read. Reading does not
affect the timer overflow flag (TOF). Writing to the alternate timer
registers has no effect.
Bit 7
6
5
4
3
2
1
Bit 0
10
9
Bit 8
2
1
Bit 0
Register Name and Address: Alternate Timer Register High — $001A
Read:
Bit 15
14
13
12
11
Write:
Reset:
Reset initializes ATRH to $FF
Register Name and Address: Alternate Timer Register Low — $001B
Read:
Bit 7
6
5
4
3
Write:
Reset:
Reset initializes ATRL to $FC
= Unimplemented
Figure 8-9. Alternate Timer Registers (ATRH and ATRL)
Technical Data
94
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Capture/Compare Timer
MOTOROLA
Capture/Compare Timer
Timer I/O Registers
Reading ATRH returns the current value of the high byte of the counter
and causes the low byte to be latched into a buffer, as shown in
Figure 8-10.
INTERNAL DATA BUS
7
LATCH
15
$001A
8
ALTERNATE TIMER REGISTER HIGH
0
LOW BYTE BUFFER
7
0
ALTERNATE TIMER REGISTER LOW
$001B
READ ATRH
Figure 8-10. Alternate Timer Register Reads
NOTE:
To prevent interrupts from occurring between readings of ATRH and
ATRL, set the interrupt mask (I bit) in the condition code register before
reading ATRH, and clear the mask after reading ATRL.
8.4.5 Input Capture Registers
When a selected edge occurs on the TCAP pin, the current high and low
bytes of the 16-bit counter are latched into the read-only input capture
registers shown in Figure 8-11. Reading ICRH before reading ICRL
inhibits further captures until ICRL is read. Reading ICRL after reading
the timer status register clears the input capture flag (ICF). Writing to the
input capture registers has no effect.
NOTE:
To prevent interrupts from occurring between readings of ICRH and
ICRL, set the interrupt mask (I bit) in the condition code register before
reading ICRH and clear the mask after reading ICRL.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Capture/Compare Timer
Technical Data
95
Capture/Compare Timer
Bit 7
6
5
4
3
2
1
Bit 0
10
9
Bit 8
2
1
Bit 0
Register Name and Address: Input Capture Register High — $0014
Read:
Bit 15
14
13
12
11
Write:
Reset:
Unaffected by reset
Register Name and Address: Input Capture Register Low — $0015
Read:
Bit 7
6
5
4
3
Write:
Reset:
Unaffected by reset
= Unimplemented
Figure 8-11. Input Capture Registers (ICRH and ICRL)
8.4.6 Output Compare Registers
When the value of the 16-bit counter matches the value in the read/write
output compare registers shown in Figure 8-12, the planned TCMP pin
action takes place. Writing to OCRH before writing to OCRL inhibits
timer compares until OCRL is written. Reading or writing to OCRL after
reading the timer status register clears the output compare flag
(OCF).
Bit 7
6
5
4
3
2
1
Bit 0
Bit 10
Bit 9
Bit 8
Bit 2
Bit 1
Bit 0
Register Name and Address: Output Compare Register High — $0016
Read:
Bit 15
Bit 14
Bit 13
Bit 12
Bit 11
Write:
Reset:
Unaffected by reset
Register Name and Address: Output Compare Register Low — $0017
Read:
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Write:
Reset:
Unaffected by reset
Figure 8-12. Output Compare Registers (OCRH and OCRL)
Technical Data
96
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Capture/Compare Timer
MOTOROLA
Capture/Compare Timer
Timer I/O Registers
To prevent OCF from being set between the time it is read and the time
the output compare registers are updated, use this procedure:
1. Disable interrupts by setting the I bit in the condition code register.
2. Write to OCRH. Compares are now inhibited until OCRL is written.
3. Clear bit OCF by reading the timer status register (TSR).
4. Enable the output compare function by writing to OCRL.
5. Enable interrupts by clearing the I bit in the condition code register.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Capture/Compare Timer
Technical Data
97
Capture/Compare Timer
Technical Data
98
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Capture/Compare Timer
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 9. EPROM/OTPROM (PROM)
9.1 Contents
9.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
9.3
EPROM/OTPROM (PROM) Programming . . . . . . . . . . . . . . . 100
9.3.1
Program Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
9.3.2
Preprogramming Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
9.4
PROM Programming Routines . . . . . . . . . . . . . . . . . . . . . . . . 107
9.4.1
Program and Verify PROM. . . . . . . . . . . . . . . . . . . . . . . . . 107
9.4.2
Verify PROM Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . .108
9.4.3
Secure PROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
9.4.4
Secure PROM and Verify . . . . . . . . . . . . . . . . . . . . . . . . . . 109
9.4.5
Secure PROM and Dump. . . . . . . . . . . . . . . . . . . . . . . . . . 109
9.4.6
Load Program into RAM and Execute . . . . . . . . . . . . . . . . 110
9.4.7
Execute Program in RAM. . . . . . . . . . . . . . . . . . . . . . . . . . 111
9.4.8
Dump PROM Contents. . . . . . . . . . . . . . . . . . . . . . . . . . . .111
9.5
Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
9.5.1
Option Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
9.5.2
Mask Option Register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
9.5.3
Mask Option Register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
9.6
EPROM Erasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
EPROM/OTPROM (PROM)
Technical Data
99
EPROM/OTPROM (PROM)
9.2 Introduction
This section describes erasable, programmable read-only
memory/one-time programmable read-only memory (EPROM/OTPROM
(PROM)) programming.
9.3 EPROM/OTPROM (PROM) Programming
The internal PROM can be programmed efficiently using the Motorola
MC68HC05PGMR-2 programmer board, which can be purchased from
a Motorola-authorized distributor. The user can program the
microcontroller unit (MCU) using this printed circuit board (PCB) in
conjunction with an EPROM device already programmed with user code.
Only standalone programming is discussed in this section. For more
information concerning the MC68HC05PGMR and its usages, contact a
local Motorola representative for a copy of the MC68HC05PGMR
Programmer Board User’s Manual #2, Motorola document order number
MC68HC05PGMR2/D1.
Refer to Figure 9-1 for an EPROM programming flowchart. Figure 9-2
provides a schematic of the MC68HC05PGMR PCB with the reference
designators defined in Table 9-1.
Table 9-1. MC68HC05PGMR PCB Reference Designators
Reference
Designators
Device
Type
Ground
+5 V
+12 V
–12 V
VPP
U1
2764
14, 20
1, 26, 27, 28
—
—
—
8 K x 8-bit EPROM
U2
MCU
20
40
—
—
3
40-pin DIP socket
U3
MCU
22
44
—
—
4
44-lead PLCC socket
U4
MC145406
9
16
1
8
—
Driver/receiver
VR1
NMA0512S
2.5
1
6
4
—
DC-DC converter
Technical Data
100
Notes
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
EPROM/OTPROM (PROM)
MOTOROLA
EPROM/OTPROM (PROM)
EPROM/OTPROM (PROM) Programming
START
APPLY VPP
NTRYS = 0
START AT BEGINNING
OF MEMORY
LAT = 1
WRITE PROM DATA
PGM = 1
WAIT 1 ms
PGM = 0
LAT = 0
YES
WRITE
ADDITIONAL
BYTE
NO
NTRYS = NTRYS + 1
NO
NTRYS = 2
YES
VPP OFF
END
Figure 9-1. EPROM/OTPROM Programming Flowchart
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
EPROM/OTPROM (PROM)
Technical Data
101
EPROM/OTPROM (PROM)
VR1 NMA0512S
DC-DC CONVERTER
(OPTIONAL)
S1
OFF
A
+5 V
ON
P1
+5 V
4
+12 V
2
–12 V
3
+V
6
OFF
1
VCC
5
0V
–V
4
GND
2
5
GND
1
+ C1
100 µF
40
VDD
+12 V
ON
VPP
R15
10 K
39
B
OSC1
-12 V
3
D1
1N4001
38
C
OSC2
VPP
VPP
1
RESET
+5 V
16
RXD
E
IRQ
9
37
P3
3
D
2
14
3
F
TCAP
30
PD1
36
PD1
G
PD7
35
2
TXD
15
2
29
PD0
+12 V
U1
2764
A0
A1
+5 V
–12 V
VPP
A3
NC
A4
27
PGM
A5
VCC
A6
28
CTS
5
C5
0.1 µF
DSR
6
(A0)
PA0
PD5
11
9
(A1)
PA1
PD4
10
(A2)
PA2
9
PD3
PA2
7
(A3)
PA3
8
6
(A4)
PA4
7
5
(A5)
PA5
6
4
(A6)
PA6
5
3
(A7)
PA7
4
PD2
PA6
PC5
20
GND
1
(A8)
25
(A9)
24
(A10)
21
(A11)
23
(A12)
2
PB0
12
(D1)
PB1
D3
A9
A10
13
(D2)
PB2
14
15
(D3)
PB3
15
16
(D4)
PB4
16
17
(D5)
PB5
17
A12
D6
OE
D7
18
(D6)
PB6
18
PC1
PB2
PC2
19
(D7)
PB7
19
28
(A8)
27
(A9)
26
(A10)
25
(A11)
24
(A12)
PC3
PC4
PB5
PB6
GND
Notes:
1. The asterisk (*) denotes option T
command only.
2. Unless otherwise specified, resistors are in ohms,
±5% 1/4 W; capacitors are in µF; voltages are dc.
PB1
PB4
D5
22
PC0
PB3
D4
A11
PB0
13
D2
M
N
PC6
12
D1
A8
GND
7
(D0)
D0
CE
23
22
PA7
11
20
DTR
L
U2
PA4 40-PIN DIP
SOCKET
PA5
DCD
8
K
31
PA3
A7
J
32
PA1
8
I
33
PA0
A2
1
26
34
PD0
10
U4
MC145406
8
1
H
TCMP
14
21
PC7
PB7
O
VSS
20
P
Q
(ENABLE)
3. Device type numbers shown in circuit are for
reference only. Device type number varies
with manufacturer.
R
S
Figure 9-2. PROM Programming Circuit
Technical Data
102
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
EPROM/OTPROM (PROM)
MOTOROLA
EPROM/OTPROM (PROM)
EPROM/OTPROM (PROM) Programming
R3 10 K
R2
J1
3 2 1
+5 V
A
NC
B
+12 V
NC
NC
NC
NC
2.7 K
C
R5
C2
1.0 µF
+5 V
10 M
Y1
C4
22 pF
1
NC
10 K
R1
S2
3
38
39
40
OUT
RESET
R13
10 K
R4
10 K
+5 V
C3
22 pF
2.0 MHz
IRQ
+5 V
D
P2
2
E
F
S3
G
S4
S5
S6
H
PD5
I
34
PD4
J
33
PD3
K
+5 V
+5 V
R10*
470
1 2
VERF
R9
10 K
DS2*
TCMP
PB0
(VERF)
(PROG)
NC
PROG
R11*
470
(A5)
(A4)
(A3)
(A2)
(A1)
(A0)
(D0)
(D1)
(D2)
(D3)
(D4)
7
8
9
10
11
12
13
14
15
16
17
PA5
PA4
PA3
PA2
PA1
PA0
PB0
PB1
PB2
PB3
PB4
NC
PB1
PB2
PB3
PB4
PB5
C6
0.1 µF
39
38
37
36
35
34
33
32
31
30
29
PD5
PD4
PD3
PD2
PD1
PD0
(A8)
(A9)
(A10)
18
19
20
21
22
23
24
(PROG) 25
(VERF) 26
(A12) 27
(A11) 28
(D5)
(D6)
(D7)
O
PD7
TCMP
PD5
PD4
PD3
PD2
PD1
PD0
PC0
PC1
PC2
U3
44-LEAD PLCC
SOCKET
NC
PB5
PB6
PB7
VSS
NC
PC7
PC6
PC5
+5 V
36
TCAP
+5 V
DS1*
31
R12
10 K
J2
PC4
PC3
N
R6
10 K
6 (A6)
PA6
5 (A7)
PA7
VPP 4
3
NC
2
IRQ
1
RESET
VDD 44
43
OSC1
42
OSC2
41
TCAP
40
NC
M
R7
10 K
R8
10 K
32
PD2
PD7
L
NC
NC
P
PB6
PB7
PA0
PA1
PA2
PA3
PA4
PA5
PA6
PA7
PC0
PC1
PC2
PC3
PC4
PD1
PD0
PC5
Q
R
PC6
PC7
S
VSS
37
35
12
13
14
15
16
17
18
19
11
10
9
8
7
6
5
4
28
27
26
25
24
30
29
23
22
21
20
Figure 9-2. PROM Programming Circuit (Continued)
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
EPROM/OTPROM (PROM)
Technical Data
103
EPROM/OTPROM (PROM)
To program the PROM MCU, the MCU is installed in the PCB, along with
an EPROM device programmed with user code; the MCU is then
subjected to a series of routines. The routines necessary to program,
verify, and secure the PROM MCU are:
•
Program and verify PROM
•
Verify PROM contents only
•
Secure PROM and verify
•
Secure PROM and dump through serial communication interface
(SCI)
Other board routines available to the user are:
•
Load program into random-access memory (RAM) and execute
•
Execute program in RAM
•
Dump PROM contents (binary upload)
The user first configures the MCU for the bootstrap mode of operations
by installing a fabricated jumper across pins 1 and 2 of the board’s mode
select header, J1. Next, the board’s mode switches (S3, S4, S5, and S6)
are set to determine the routine to be executed after the next reset, as
shown in Table 9-2.
Table 9-2. PROM Programming Routines
Routine
Technical Data
104
S3
S4
S5
S6
Program and verify PROM
Off
Off
Off
Off
Verify PROM contents (only)
Off
Off
On
Off
Secure PROM contents and verify
On
Off
On
Off
Secure PROM contents and dump
On
On
On
Off
Load program into RAM and execute
Off
On
Off
Off
Execute program in RAM
Off
Off
Off
On
Dump PROM contents
Off
On
On
Off
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
EPROM/OTPROM (PROM)
MOTOROLA
EPROM/OTPROM (PROM)
EPROM/OTPROM (PROM) Programming
9.3.1 Program Register
The program register shown in Figure 9-3 is used for PROM
programming.
Address:
$001C
Bit 7
6
5
4
3
2
1
Bit 0
0
0
0
0
0
LAT
0
PGM
0
0
0
0
0
0
0
0
Read:
Write:
Reset:
Figure 9-3. Program Register (PROG)
LAT — Latch Enable Bit
This bit is both readable and writable.
1 = Enables PROM data and address bus latches for programming
on the next byte write cycle
0 = Latch disabled. PROM data and address buses are unlatched
for normal CPU operations.
PGM — Program Bit
If LAT is cleared, PGM cannot be set.
1 = Enables VPP power to the PROM for programming
0 = VPP is disabled.
Bits 1 and 3−7 — Not used; always read 0
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
EPROM/OTPROM (PROM)
Technical Data
105
EPROM/OTPROM (PROM)
9.3.2 Preprogramming Steps
Before programming the PROM using an MC68HC05PGMR PCB in
standalone mode, the user should ensure that:
CAUTION:
•
A jumper is installed on pins 1 and 2 of mode select header J1.
•
An EPROM is programmed with the necessary user code.
•
The erasure window (if any) of the device to be programmed is
covered.
•
VDD of +5 Vdc is available on the board.
•
VPP is available on the board.
If the VPP level at the MCU exceeds +16 Vdc, then the MC68HC705C4A
MCU device will suffer permanent damage.
Once those conditions are met, the user should take these steps before
beginning programming:
1. Remove the VPP power source.
2. Set switch 1 in the OFF position (removes VDD).
3. Place the programmed EPROM in socket U1.
4. Insert the erased PROM MCU device to be programmed in the
proper socket:
a. MC68HC705C8S or MC68HC705C8P in socket U2 (40-pin
DIP) or
b. MC68HC705C8FN in socket U3 (44-pin PLCC) with the
device notch at the upper right corner of the socket.
5. Set switch S2 in the RESET position.
NOTE:
Technical Data
106
No PROM MCU should be inserted in or removed from its board socket
(U2 or U3) while VPP (P1, slot 5) or VDD (switch 1) is active on the board.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
EPROM/OTPROM (PROM)
MOTOROLA
EPROM/OTPROM (PROM)
PROM Programming Routines
9.4 PROM Programming Routines
The routines described in this subsection are necessary to program,
verify, and secure the PROM device and other routines available to the
user.
9.4.1 Program and Verify PROM
The program and verify PROM routine copies the contents of the
external EPROM into the MCU PROM with direct correspondence
between the addresses. Memory addresses in the MCU that are not
implemented in PROM are skipped. Unprogrammed addresses in the
EPROM being copied should contain $00 bytes to speed up the
programming process.
To run the program and verify the PROM routine on the PROM MCU,
take these steps:
1. Set switch 1 in the ON position (restores VDD).
2. Restore the VPP power source.
3. Set switches S3, S4, S5, and S6 in the OFF position (selects
proper routine).
4. Set switch 2 in the OUT position (routine is activated).
The red light-emitting diode (LED) is illuminated, showing that the
programming part of the routine is running. The LED goes out
when programming is finished. The verification part of the routine
now begins. When the green LED is illuminated, verification is
successfully completed and the routine is finished.
5. Set switch 2 in the RESET position.
At this point, if no other MCU is to be programmed or secured, remove
VPP power from the board. If another routine is to be performed on the
MCU being programmed, the user can then set switches S3, S4, S5, and
S6 to the positions necessary to select the next routine and begin the
routine by setting switch 2 to the OUT position. If no other routine is to
be performed, remove VDD from the board and remove the MCU from
the programming socket.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
EPROM/OTPROM (PROM)
Technical Data
107
EPROM/OTPROM (PROM)
9.4.2 Verify PROM Contents
The verify PROM contents routine is normally run automatically after the
PROM is programmed. Direct entry to this routine causes the PROM
contents of the MCU to be compared to the contents of the external
memory locations of the EPROM at the same addresses.
To invoke the verify PROM contents routine of the MCU, take these
steps:
1. Set switch 1 in the ON position (restores VDD).
2. Connect VPP to VDD.
3. Set switches S3, S4, and S6 in the OFF position.
4. Set S5 in the ON position.
5. Set switch 2 in the OUT position (routine is activated).
The red LED is not illuminated during this routine, since no
programming takes place. If verification fails, the routine halts with
the failing address in the external memory bus. When the green
LED is illuminated, verification is completed successfully and the
routine is finished.
6. Set switch 2 in the RESET position.
At this point, if another routine is to be performed on the MCU being
programmed, the user can set switches S3, S4, S5, and S6 to the
positions necessary to select the next routine and move switch S2 to the
OUT position to start the routine. If no other routine is to be performed,
remove VDD from the board and remove the MCU from the programming
socket.
9.4.3 Secure PROM
The secure PROM routines are used after the PROM is successfully
programmed and verified. Only the SEC bit of the option register
($1FDF) is programmed, but VPP is necessary. Once this bit is
programmed, PROM is secure and can be neither verified nor dumped.
Technical Data
108
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
EPROM/OTPROM (PROM)
MOTOROLA
EPROM/OTPROM (PROM)
PROM Programming Routines
9.4.4 Secure PROM and Verify
This routine is used after the PROM is programmed successfully to
verify the contents of the MCU PROM against the contents of the
EPROM and then to secure the PROM. To accomplish this routine, take
these steps:
1. Set switch 1 in the ON position (restores VDD).
2. Restore VPP power to the programming board.
3. Set switches S4 and S6 in the OFF position.
4. Set switches S3 and S5 in the ON position.
5. Set switch 2 in the OUT position (routine is activated).
Execution time for this routine is about one second.
6. Set switch 2 in the RESET position when the routine is completed.
No LED is illuminated during this routine. Further, the end of the routine
does not mean that the SEC bit was verified. To ensure that security is
properly enabled, attempt to perform another verify routine. If the green
LED does not light, the PROM has been secured properly.
9.4.5 Secure PROM and Dump
This routine is used after the PROM is successfully programmed to
dump the contents of the MCU PROM through the SCI (binary upload)
and then to secure the PROM. To accomplish this routine, take these
steps:
1. Set switch 1 in the ON position (restores VDD).
2. Restore VPP power to the programming board.
3. Set switch S6 in the OFF position.
4. Set switches S3, S4, and S5 in the ON position.
5. Set switch 2 in the OUT position (routine is activated).
Execution time for this routine is about one second.
6. Set switch 2 in the RESET position when the routine is completed.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
EPROM/OTPROM (PROM)
Technical Data
109
EPROM/OTPROM (PROM)
No LED is illuminated during this routine. Further, the end of the routine
does not mean that the SEC bit was verified. To ensure that security is
properly enabled, attempt to perform another verify routine. If the green
LED does not light, the PROM has been secured properly.
9.4.6 Load Program into RAM and Execute
In the load program in random-access memory (RAM) and execute
routine, user programs are loaded via the serial communications
interface (SCI) port and then executed. Data is loaded sequentially
starting at address $0050. After the last byte is loaded, control is
transferred to the RAM program starting at $0051. The first byte loaded
is the count of the total number of bytes in the program plus the count
byte. The program starts at location $0051 in RAM. During initialization,
the SCI is configured for eight data bits and one stop bit. The baud rate
is 4800 with a 2-MHz crystal or 9600 with a 4-MHz crystal.
To load a program into RAM and execute it, take these steps:
1. Set switch 1 in the ON position (restores VDD).
2. Connect VPP to VDD.
3. Set switches S3, S5, and S6 in the OFF position.
4. Set switch S4 in the ON position.
5. Set switch 2 in the OUT position (routine is activated).
The downloaded program starts executing as soon as the last byte is
received by the SCI.
Execution of the routine can be held off by setting the byte count in the
count byte (the first byte loaded) to a value greater than the number of
bytes to be loaded. After loading the last byte, the firmware waits for
more data. Program execution does not begin. At this point, placing
switch 2 in the RESET position resets the MCU with the RAM data intact.
Any other routine can be entered, including the one to execute the
program in RAM, simply by setting switches S3–S6 as necessary to
select the desired routine, then setting switch 2 in the OUT position.
Technical Data
110
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
EPROM/OTPROM (PROM)
MOTOROLA
EPROM/OTPROM (PROM)
PROM Programming Routines
9.4.7 Execute Program in RAM
This routine allows the MCU to transfer control to a program previously
loaded in RAM. This program is executed once bootstrap mode is
entered, if switch S6 is in the ON position and switch 2 is in the OUT
position, without any firmware initialization. The program must start at
location $0051 to be compatible with the load program in RAM routine.
To run the execute program in RAM routine, take these steps:
1. Set switch 1 in the ON position (restores VDD).
2. Connect VPP to VDD.
3. Set switch S6 in the OFF position.
4. Switches S3, S4, and S5 can be in either position.
5. Set switch 2 in the OUT position (routine is activated).
9.4.8 Dump PROM Contents
In the dump PROM contents routine, the PROM contents are dumped
sequentially to the SCI output, provided the PROM has not been
secured. The first location sent is $0020 and the last location sent is
$1FFF. Unused locations are skipped so that no gaps exist in the data
stream. The external memory address lines indicate the current location
being sent. Data is sent with eight data bits and one stop bit at 4800 baud
with a 2-MHz crystal or 9600 baud with a 4-MHz crystal.
To run the dump PROM contents routine, take these steps:
1. Set switch 1 in the ON position (restores VDD).
2. Connect VPP to VDD.
3. Set switches S3 and S6 in the OFF position.
4. Set switches S4 and S5 in the ON position.
5. Set switch 2 in the OUT position (routine is activated).
6. Once PROM dumping is complete, set switch 2 in the RESET
position.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
EPROM/OTPROM (PROM)
Technical Data
111
EPROM/OTPROM (PROM)
9.5 Control Registers
This subsection describes three registers that control:
•
Memory configuration
•
PROM security
•
IRQ edge or level sensitivity
•
Port B pullups
•
Non-programmable computer operating properly (COP) watchdog
timer enable/disable
9.5.1 Option Register
The option register (option) shown in Figure 9-4 is used to select the
IRQ sensitivity, enable the PROM security, and select the memory
configuration.
Address:
$1FDF
Bit 7
6
5
4
3
0
0
0
0
SEC*
0
0
0
0
*
Read:
2
1
Bit 0
IRQ
0
1
0
Write:
Reset:
= Unimplemented
U
U = Unaffected
*Implemented as an EPROM cell
Figure 9-4. Option Register (Option)
SEC — Security Bit
This bit is implemented as an EPROM cell and is not affected by
reset.
1 = Security enabled.
0 = Security off; bootloader able to be enabled
Technical Data
112
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
EPROM/OTPROM (PROM)
MOTOROLA
EPROM/OTPROM (PROM)
Control Registers
IRQ — Interrupt Request Pin Sensitivity Bit
IRQ is set only by reset, but can be cleared by software. This bit can
only be written once.
1 = IRQ pin is both negative edge- and level-sensitive.
0 = IRQ pin is negative edge-sensitive only.
Bits 7–4 and 0 — Not used; always read 0
Bit 2 — Unaffected by reset; reads either 1 or 0
9.5.2 Mask Option Register 1
The mask option register 1 (MOR1) shown in Figure 9-5 is an EPROM
register that enables the port B pullup devices. Data from MOR1 is
latched on the rising edge of the voltage on the RESET pin. (See 4.3.3
Port B Interrupts.)
Address:
$1FF0
Bit 7
6
5
4
3
2
1
Bit 0
PBPU7
PBPU6
PBPU5
PBPU4
PBPU3
PBPU2
PBPU1
PBPU0/
COPC
0
0
0
Read:
Write:
Reset:
Erased:
Unaffected by reset
0
0
0
0
0
Figure 9-5. Mask Option Register 1 (MOR1)
PBPU7–PBPU0/COPC — Port B Pullup Enable Bits 7–0
These EPROM bits enable the port B pullup devices.
1 = Port B pullups enabled
0 = Port B pullups disabled
NOTE:
PBPU0/COPC programmed to a 1 enables the port B pullup bit. This bit
is also used to clear the COP. Writing to this bit to clear the COP will not
affect the state of the port B pullup (bit 0). (See 5.3.3 Computer
Operating Properly (COP) Watchdog Reset.)
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
EPROM/OTPROM (PROM)
Technical Data
113
EPROM/OTPROM (PROM)
9.5.3 Mask Option Register 2
The mask option register 2 (MOR2) shown in Figure 9-6 is an EPROM
register that enables the non-programmable COP watchdog. Data from
MOR2 is latched on the rising edge of the voltage on the RESET pin.
(See 5.3.3 Computer Operating Properly (COP) Watchdog
Reset.)
Address:
$1FF1
Bit 7
6
5
4
3
2
1
Bit 0
Read:
NCOPE
Write:
Reset:
Erased:
Unaffected by reset
0
0
0
0
0
0
0
0
= Unimplemented
Figure 9-6. Mask Option Register 2 (MOR2)
NCOPE— Non-Programmable COP Watchdog Enable Bit
This EPROM bit enables the non-programmable COP watchdog.
1 = Non-programmable COP watchdog enabled
0 = Non-programmable COP watchdog disabled
9.6 EPROM Erasing
The erased state of an EPROM or OTPROM byte is $00. EPROM
devices can be erased by exposure to a high intensity ultraviolet (UV)
light with a wave length of 2537 Å. The recommended erasure dosage
(UV intensity on a given surface area times exposure time) is 15
Ws/cm2. UV lamps should be used without short-wave filters, and the
EPROM device should be positioned about one inch from the UV
source.
OTPROM devices are shipped in an erased state. Once programmed,
they cannot be erased. Electrical erasing procedures cannot be
performed on either EPROM or OTPROM devices.
Technical Data
114
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
EPROM/OTPROM (PROM)
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 10. Serial Communications Interface (SCI)
10.1 Contents
10.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
10.3
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
10.4
SCI Data Format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
10.5 SCI Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
10.5.1 Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
10.5.2 Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
10.6 SCI I/O Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
10.6.1 SCI Data Register (SCDR). . . . . . . . . . . . . . . . . . . . . . . . . 123
10.6.2 SCI Control Register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . .124
10.6.3 SCI Control Register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . .125
10.6.4 SCI Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
10.6.5 Baud Rate Register (Baud) . . . . . . . . . . . . . . . . . . . . . . . . 130
10.2 Introduction
The serial communications interface (SCI) module allows high-speed
asynchronous communication with peripheral devices and other
microcontroller units (MCUs).
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Communications Interface (SCI)
Technical Data
115
Serial Communications Interface (SCI)
10.3 Features
Features of the SCI module include:
•
Standard mark/space non-return-to-zero format
•
Full-duplex operation
•
32 programmable baud rates
•
Programmable 8-bit or 9-bit character length
•
Separately enabled transmitter and receiver
•
Two receiver wakeup methods:
– Idle line wakeup
– Address mark wakeup
•
Interrupt-driven operation capability with five interrupt flags:
– Transmitter data register empty
– Transmission complete
– Receiver data register full
– Receiver overrun
– Idle receiver input
•
Receiver framing error detection
•
1/16 bit-time noise detection
10.4 SCI Data Format
The SCI uses the standard non-return-to-zero mark/space data format
illustrated in Figure 10-1.
8-BIT DATA FORMAT
(BIT M IN SCCR1 CLEAR)
START
BIT
BIT 0
BIT 1
BIT 2
BIT 3
BIT 4
BIT 5
BIT 6
BIT 7
STOP
BIT
BIT 6
BIT 7
BIT 8
NEXT
START
BIT
9-BIT DATA FORMAT
(BIT M IN SCCR1 SET)
START
BIT
BIT 0
BIT 1
BIT 2
BIT 3
BIT 4
BIT 5
STOP
BIT
NEXT
START
BIT
Figure 10-1. SCI Data Format
Technical Data
116
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Communications Interface (SCI)
MOTOROLA
Serial Communications Interface (SCI)
SCI Operation
10.5 SCI Operation
The SCI allows full-duplex, asynchronous, RS232 or RS422 serial
communication between the MCU and remote devices, including other
MCUs. The transmitter and receiver of the SCI operate independently,
although they use the same baud-rate generator. Operation of the SCI
transmitter and receiver is described here.
10.5.1 Transmitter
Figure 10-2 shows the structure of the SCI transmitter. Figure 10-3 is a
summary of the SCI transmitter input/output (I/O) registers.
•
Character Length — The transmitter can accommodate either
8-bit or 9-bit data. The state of the M bit in SCI control register 1
(SCCR1) determines character length. When transmitting 9-bit
data, bit T8 in SCCR1 is the ninth bit (bit 8).
•
Character Transmission — During transmission, the transmit shift
register shifts a character out to the PD1/TDO pin. The SCI data
register (SCDR) is the write-only buffer between the internal data
bus and the transmit shift register.
Writing a logic 1 to the TE bit in SCI control register 2 (SCCR2) and
then writing data to the SCDR begins the transmission. At the start
of a transmission, transmitter control logic automatically loads the
transmit shift register with a preamble of logic 1s. After the
preamble shifts out, the control logic transfers the SCDR data into
the shift register. A logic 0 start bit automatically goes into the least
significant bit (LSB) position of the shift register, and a logic 1 stop
bit goes into the most significant bit (MSB) position.
When the data in the SCDR transfers to the transmit shift register,
the transmit data register empty (TDRE) flag in the SCI status
register (SCSR) becomes set. The TDRE flag indicates that the
SCDR can accept new data from the internal data bus.
When the shift register is not transmitting a character, the
PD1/TDO pin goes to the idle condition, logic 1. If software clears
the TE bit during the idle condition, and while TDRE is set, the
transmitter relinquishes control of the PD1/TDO pin.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Communications Interface (SCI)
Technical Data
117
Serial Communications Interface (SCI)
SCDR ($0011)
1X
BAUD RATE
CLOCK
TRANSMIT SHIFT REGISTER
PIN BUFFER
AND CONTROL
SCSR ($0010)
INTERNAL DATA BUS
TDRE
TC
RDRF
IDLE
OR
NF
FE
M
WAKE
R8
T8
TRANSMITTER
CONTROL LOGIC
SCCR1 ($000E)
PD1/
TDO
BREAK (ALL LOGIC ZEROS)
PREAMBLE (ALL LOGIC ONES)
SHIFT ENABLE
LOAD FROM SCDR
H 8 7 6 5 4 3 2 1 0 L
TDRE
TIE
TIE
TCIE
RIE
ILIE
TE
RE
RWU
SBK
SCI RECEIVE
REQUESTS
TC
TCIE
SCCR2 ($000F)
SCI INTERRUPT
REQUEST
Figure 10-2. SCI Transmitter
Technical Data
118
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Communications Interface (SCI)
MOTOROLA
Serial Communications Interface (SCI)
SCI Operation
Addr.
$000D
$000E
$000F
$0010
$0011
Register Name
Bit 7
Read:
Baud Rate Register
(Baud) Write:
See page 130.
Reset:
Read:
SCI Control Register 1
(SCCR1) Write:
See page 124.
Reset:
Read:
SCI Control Register 2
(SCCR2) Write:
See page 125.
Reset:
6
4
3
SCP1
SCP0
0
0
U
2
1
Bit 0
SCR2
SCR1
SCR0
U
U
U
U
U
R8
T8
M
WAKE
U
U
U
U
TIE
TCIE
RIE
ILIE
TE
RE
RWU
SBK
0
0
0
0
0
0
0
0
TC
RDRF
IDLE
OR
NF
FE
1
0
0
0
0
0
U
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Read: TDRE
SCI Status Register
(SCSR) Write:
See page 128.
Reset:
1
Read:
SCI Data Register
(SCDR) Write:
See page 123.
Reset:
5
Bit 7
Unaffected by reset
= Unimplemented
U = Unaffected
Figure 10-3. SCI Transmitter I/O Register Summary
•
Break Characters — Writing a logic 1 to the SBK bit in SCCR2
loads the shift register with a break character. A break character
contains all logic 0s and has no start and stop bits. Break
character length depends on the M bit in SCCR1. As long as SBK
is at logic 1, transmitter logic continuously loads break characters
into the shift register. After software clears the SBK bit, the shift
register finishes transmitting the last break character and then
transmits at least one logic 1. The automatic logic 1 at the end of
a break character is to guarantee the recognition of the start bit of
the next character.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Communications Interface (SCI)
Technical Data
119
Serial Communications Interface (SCI)
•
Idle Characters — An idle character contains all logic 1s and has
no start or stop bits. Idle character length depends on the M bit in
SCCR1. The preamble is a synchronizing idle character that
begins every transmission.
Clearing the TE bit during a transmission relinquishes the
PD1/TDO pin after the last character to be transmitted is shifted
out. The last character may already be in the shift register, or
waiting in the SCDR, or it may be a break character generated by
writing to the SBK bit. Toggling TE from logic 0 to logic 1 while the
last character is in transmission generates an idle character (a
preamble) that allows the receiver to maintain control of the
PD1/TDO pin.
•
Transmitter Interrupts — These sources can generate SCI
transmitter interrupt requests:
– Transmit Data Register Empty (TDRE) — The TDRE bit in the
SCSR indicates that the SCDR has transferred a character to
the transmit shift register. TDRE is a source of SCI interrupt
requests. The transmission complete interrupt enable bit
(TCIE) in SCCR2 is the local mask for TDRE interrupts.
– Transmission Complete (TC) — The TC bit in the SCSR
indicates that both the transmit shift register and the SCDR are
empty and that no break or idle character has been generated.
TC is a source of SCI interrupt requests. The transmission
complete interrupt enable bit (TCIE) in SCCR2 is the local
mask for TC interrupts.
10.5.2 Receiver
Figure 10-4 shows the structure of the SCI receiver. Refer to
Figure 10-3 for a summary of the SCI receiver I/O registers.
•
Technical Data
120
Character Length — The receiver can accommodate either 8-bit
or 9-bit data. The state of the M bit in SCI control register 1
(SCCR1) determines character length. When receiving 9-bit data,
bit R8 in SCCR1 is the ninth bit (bit 8).
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Communications Interface (SCI)
MOTOROLA
16X
BAUD RATE
CLOCK
PD0/
RDI
PIN BUFFER
AND CONTROL
STOP
÷16
DATA
RECOVERY
RECEIVE SHIFT REGISTER
8 7 6 5 4 3 2 1 0
DISABLE
DRIVER
IDLE MSB RDRF OR
RE
M
SCCR1 ($000E)
IDLE
OR
NF
FE
TDRE
TC
RDRF
M
WAKE
T8
WAKEUP
LOGIC
R8
INTERNAL DATA BUS
START
Serial Communications Interface (SCI)
SCI Operation
SCSR ($0010)
SCDR ($0011)
RDRF
IDLE
SCI TRANSMIT
REQUESTS
ILIE
OR
TCIE
RIE
ILIE
TE
RE
RWU
SBK
TIE
RIE
INTERNAL DATA BUS
RIE
SCCR2 ($000F)
SCI INTERRUPT
REQUEST
Figure 10-4. SCI Receiver
•
Character Reception — During reception, the receive shift register
shifts characters in from the PD0/RDI pin. The SCI data register
(SCDR) is the read-only buffer between the internal data bus and
the receive shift register.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Communications Interface (SCI)
Technical Data
121
Serial Communications Interface (SCI)
After a complete character shifts into the receive shift register, the
data portion of the character is transferred to the SCDR, setting
the receive data register full (RDRF) flag. The RDRF flag can be
used to generate an interrupt.
•
Receiver Wakeup — So that the MCU can ignore transmissions
intended only for other receivers in multiple-receiver systems, the
MCU can be put into a standby state. Setting the receiver wakeup
enable (RWU) bit in SCI control register 2 (SCCR2) puts the MCU
into a standby state during which receiver interrupts are disabled.
Either of two conditions on the PD0/RDI pin can bring the MCU out
of the standby state:
– Idle input line condition — If the PD0/RDI pin is at logic 1 long
enough for 10 or 11 logic 1s to shift into the receive shift
register, receiver interrupts are again enabled.
– Address mark — If a logic 1 occurs in the most significant bit
position of a received character, receiver interrupts are again
enabled.
The state of the WAKE bit in SCCR1 determines which of the two
conditions wakes up the MCU.
•
Receiver Noise Immunity — The data recovery logic samples
each bit 16 times to identify and verify the start bit and to detect
noise. Any conflict between noise detection samples sets the
noise flag (NF) in the SCSR. The NF bit is set at the same time
that the RDRF bit is set.
•
Framing Errors — If the data recovery logic does not detect a logic
1 where the stop bit should be in an incoming character, it sets the
framing error (FE) bit in the SCSR. The FE bit is set at the same
time that the RDRF bit is set.
•
Receiver Interrupts — These sources can generate SCI receiver
interrupt requests:
– Receive Data Register Full (RDRF) — The RDRF bit in the
SCSR indicates that the receive shift register has transferred a
character to the SCDR.
Technical Data
122
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Communications Interface (SCI)
MOTOROLA
Serial Communications Interface (SCI)
SCI I/O Registers
– Receiver Overrun (OR) — The OR bit in the SCSR indicates
that the receive shift register shifted in a new character before
the previous character was read from the SCDR.
– Idle Input (IDLE) — The IDLE bit in the SCSR indicates that 10
or 11 consecutive logic 1s shifted in from the PD0/RDI pin.
10.6 SCI I/O Registers
These I/O registers control and monitor SCI operation:
•
SCI data register (SCDR)
•
SCI control register 1 (SCCR1)
•
SCI control register 2 (SCCR2)
•
SCI status register (SCSR)
10.6.1 SCI Data Register (SCDR)
The SCI data register (SCDR) shown in Figure 10-5 is the buffer for
characters received and for characters transmitted.
Address:
$0011
Bit 7
6
5
4
3
2
1
Bit 0
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Read:
Write:
Reset:
Unaffected by reset
Figure 10-5. SCI Data Register (SCDR)
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Communications Interface (SCI)
Technical Data
123
Serial Communications Interface (SCI)
10.6.2 SCI Control Register 1
SCI control register 1 (SCCR1) shown in Figure 10-6 has these
functions:
•
Stores ninth SCI data bit received and ninth SCI data bit
transmitted
•
Controls SCI character length
•
Controls SCI wakeup method
Address:
$000E
Bit 7
6
R8
U
5
4
3
T8
M
WAKE
U
U
U
2
1
Bit 0
Read:
Write:
Reset:
= Unimplemented
U = Unaffected
Figure 10-6. SCI Control Register 1 (SCCR1)
R8 — Bit 8 (Received)
When the SCI is receiving 9-bit characters, R8 is the ninth bit of the
received character. R8 receives the ninth bit at the same time that the
SCDR receives the other eight bits. Reset has no effect on the R8 bit.
T8 — Bit 8 (Transmitted)
When the SCI is transmitting 9-bit characters, T8 is the ninth bit of the
transmitted character. T8 is loaded into the transmit shift register at
the same time that SCDR is loaded into the transmit shift register.
Reset has no effect on the T8 bit.
M — Character Length Bit
This read/write bit determines whether SCI characters are eight or
nine bits long. The ninth bit can be used as an extra stop bit, as a
receiver wakeup signal, or as a mark or space parity bit. Reset has no
effect on the M bit.
1 = 9-bit SCI characters
0 = 8-bit SCI characters
Technical Data
124
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Communications Interface (SCI)
MOTOROLA
Serial Communications Interface (SCI)
SCI I/O Registers
WAKE — Wakeup Bit
This read/write bit determines which condition wakes up the SCI: a
logic 1 (address mark) in the most significant bit position of a received
character or an idle condition of the PD0/RDI pin. Reset has no effect
on the WAKE bit.
1 = Address mark wakeup
0 = Idle line wakeup
10.6.3 SCI Control Register 2
SCI control register 2 (SCCR2) shown in Figure 10-7 has these
functions:
•
Enables the SCI receiver and SCI receiver interrupts
•
Enables the SCI transmitter and SCI transmitter interrupts
•
Enables SCI receiver idle interrupts
•
Enables SCI transmission complete interrupts
•
Enables SCI wakeup
•
Transmits SCI break characters
Address:
$000F
Bit 7
6
5
4
3
2
1
Bit 0
TIE
TCIE
RIE
ILIE
TE
RE
RWU
SBK
0
0
0
0
0
0
0
0
Read:
Write:
Reset:
Figure 10-7. SCI Control Register 2 (SCCR2)
TIE — Transmit Interrupt Enable Bit
This read/write bit enables SCI interrupt requests when the TDRE bit
becomes set. Reset clears the TIE bit.
1 = TDRE interrupt requests enabled
0 = TDRE interrupt requests disabled
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Communications Interface (SCI)
Technical Data
125
Serial Communications Interface (SCI)
TCIE — Transmission Complete Interrupt Enable Bit
This read/write bit enables SCI interrupt requests when the TC bit
becomes set. Reset clears the TCIE bit.
1 = TC interrupt requests enabled
0 = TC interrupt requests disabled
RIE — Receive Interrupt Enable Bit
This read/write bit enables SCI interrupt requests when the RDRF bit
or the OR bit becomes set. Reset clears the RIE bit.
1 = RDRF interrupt requests enabled
0 = RDRF interrupt requests disabled
ILIE — Idle Line Interrupt Enable Bit
This read/write bit enables SCI interrupt requests when the IDLE bit
becomes set. Reset clears the ILIE bit.
1 = IDLE interrupt requests enabled
0 = IDLE interrupt requests disabled
TE — Transmit Enable Bit
Setting this read/write bit begins the transmission by sending a
preamble of 10 or 11 logic 1s from the transmit shift register to the
PD1/TDO pin. Reset clears the TE bit.
1 = Transmission enabled
0 = Transmission disabled
RE — Receive Enable Bit
Setting this read/write bit enables the receiver. Clearing the RE bit
disables the receiver and receiver interrupts but does not affect the
receiver interrupt flags. Reset clears the RE bit.
1 = Receiver enabled
0 = Receiver disabled
Technical Data
126
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Communications Interface (SCI)
MOTOROLA
Serial Communications Interface (SCI)
SCI I/O Registers
RWU — Receiver Wakeup Enable Bit
This read/write bit puts the receiver in a standby state. Typically, data
transmitted to the receiver clears the RWU bit and returns the receiver
to normal operation. The WAKE bit in SCCR1 determines whether an
idle input or an address mark brings the receiver out of the standby
state. Reset clears the RWU bit.
1 = Standby state
0 = Normal operation
SBK — Send Break Bit
Setting this read/write bit continuously transmits break codes in the
form of 10-bit or 11-bit groups of logic 0s. Clearing the SBK bit stops
the break codes and transmits a logic 1 as a start bit. Reset clears the
SBK bit.
1 = Break codes being transmitted
0 = No break codes being transmitted
10.6.4 SCI Status Register
The SCI status register (SCSR) shown in Figure 10-8 contains flags to
signal these conditions:
•
Transfer of SCDR data to transmit shift register complete
•
Transmission complete
•
Transfer of receive shift register data to SCDR complete
•
Receiver input idle
•
Receiver overrun
•
Noisy data
•
Framing error
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Communications Interface (SCI)
Technical Data
127
Serial Communications Interface (SCI)
Address:
Read:
$0010
Bit 7
6
5
4
3
2
1
TDRE
TC
RDRF
IDLE
OR
NF
FE
1
1
0
0
0
0
0
Bit 0
Write:
Reset:
= Unimplemented
U
U = Unaffected
Figure 10-8. SCI Status Register (SCSR)
TDRE — Transmit Data Register Empty Bit
This clearable, read-only bit is set when the data in the SCDR
transfers to the transmit shift register. TDRE generates an interrupt
request if the TIE bit in SCCR2 is also set. Clear the TDRE bit by
reading the SCSR with TDRE set and then writing to the SCDR. Reset
sets the TDRE bit. Software must initialize the TDRE bit to logic 0 to
avoid an instant interrupt request when turning on the transmitter.
1 = SCDR data transferred to transmit shift register
0 = SCDR data not transferred to transmit shift register
TC — Transmission Complete Bit
This clearable, read-only bit is set when the TDRE bit is set and no
data, preamble, or break character is being transmitted. TC generates
an interrupt request if the TCIE bit in SCCR2 is also set. Clear the TC
bit by reading the SCSR with TC set and then writing to the SCDR.
Reset sets the TC bit. Software must initialize the TC bit to logic 0 to
avoid an instant interrupt request when turning on the transmitter.
1 = No transmission in progress
0 = Transmission in progress
RDRF — Receive Data Register Full Bit
This clearable, read-only bit is set when the data in the receive shift
register transfers to the SCI data register. RDRF generates an
interrupt request if the RIE bit in SCCR2 is also set. Clear the RDRF
bit by reading the SCSR with RDRF set and then reading the SCDR.
Reset clears the RDRF bit.
1 = Received data available in SCDR
0 = Received data not available in SCDR
Technical Data
128
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Communications Interface (SCI)
MOTOROLA
Serial Communications Interface (SCI)
SCI I/O Registers
IDLE — Receiver Idle Bit
This clearable, read-only bit is set when 10 or 11 consecutive logic 1s
appear on the receiver input. IDLE generates an interrupt request if
the ILIE bit in SCCR2 is also set. Clear the IDLE bit by reading the
SCSR with IDLE set, and then reading the SCDR. Reset clears the
IDLE bit.
1 = Receiver input idle
0 = Receiver input not idle
OR — Receiver Overrun Bit
This clearable, read-only bit is set if the SCDR is not read before the
receive shift register receives the next word. OR generates an
interrupt request if the RIE bit in SCCR2 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 the SCSR with OR set and then reading
the SCDR. Reset clears the OR bit.
1 = Receiver shift register full and RDRF = 1
0 = No receiver overrun
NF — Receiver Noise Flag
This clearable, read-only bit is set when noise is detected in data
received in the SCI data register. Clear the NF bit by reading the
SCSR and then reading the SCDR. Reset clears the NF bit.
1 = Noise detected in SCDR
0 = No noise detected in SCDR
FE — Receiver Framing Error Bit
This clearable, read-only flag is set when a logic 0 is located where a
stop bit should be in the character shifted into the receive shift
register. If the received word causes both a framing error and an
overrun error, the OR bit is set and the FE bit is not set. Clear the FE
bit by reading the SCSR and then reading the SCDR. Reset clears the
FE bit.
1 = Framing error
0 = No framing error
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Communications Interface (SCI)
Technical Data
129
Serial Communications Interface (SCI)
10.6.5 Baud Rate Register (Baud)
The baud rate register (baud) shown in Figure 10-9 selects the baud
rate for both the receiver and the transmitter.
Address:
$000D
Bit 7
6
5
4
SCP1
SCP0
0
0
3
2
1
Bit 0
SCR2
SCR1
SCR0
U
U
U
Read:
Write:
Reset:
U
U
= Unimplemented
U
U = Unaffected
Figure 10-9. Baud Rate Register (Baud)
SCP1 and SCP0 — SCI Prescaler Select Bits
These read/write bits control prescaling of the baud rate generator
clock, as shown in Table 10-1. Resets clear both SCP1 and SCP0.
Table 10-1. Baud Rate Generator Clock Prescaling
Technical Data
130
SCP[1:0]
Baud Rate Generator Clock
00
Internal clock ÷ 1
01
Internal clock ÷ 3
10
Internal clock ÷ 4
11
Internal clock
÷ 13
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Communications Interface (SCI)
MOTOROLA
Serial Communications Interface (SCI)
SCI I/O Registers
SCR2–SCR0 — SCI Baud Rate Select Bits
These read/write bits select the SCI baud rate, as shown in
Table 10-2. Reset has no effect on the SCR2–SCR0 bits.
Table 10-2. Baud Rate Selection
SCR[2:1:0]
SCI Baud Rate (Baud)
000
Prescaled clock
÷1
001
Prescaled clock
÷2
010
Prescaled clock
÷4
011
Prescaled clock
÷8
100
Prescaled clock
÷ 16
101
Prescaled clock ÷ 32
110
Prescaled clock ÷ 64
111
Prescaled clock ÷ 128
Table 10-3 shows all possible SCI baud rates derived from crystal
frequencies of 2 MHz, 4 MHz, and 4.194304 MHz.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Communications Interface (SCI)
Technical Data
131
Serial Communications Interface (SCI)
Table 10-3. Baud Rate Selection Examples
SCI Baud Rate
Technical Data
132
SCP[1:0]
SCR[2:1:0]
00
fOSC = 2 MHz
fOSC = 4 MHz
fOSC = 4.194304 MHz
000
62.50 Kbaud
125 Kbaud
131.1 Kbaud
00
001
31.25 Kbaud
62.50 Kbaud
65.54 Kbaud
00
010
15.63 Kbaud
31.25 Kbaud
32.77 Kbaud
00
011
7813 baud
15.63 Kbaud
16.38 Kbaud
00
100
3906 baud
7813 baud
8192 baud
00
101
1953 baud
3906 baud
4096 baud
00
110
976.6 baud
1953 baud
2048 baud
00
111
488.3 baud
976.6 baud
1024 baud
01
000
20.83 Kbaud
41.67 Kbaud
43.69 Kbaud
01
001
10.42 Kbaud
20.83 Kbaud
21.85 Kbaud
01
010
5208 baud
10.42 Kbaud
10.92 Kbaud
01
011
2604 baud
5208 baud
5461 baud
01
100
1302 baud
2604 baud
2731 baud
01
101
651.0 baud
1302 baud
1365 baud
01
110
325.5 baud
651.0 baud
682.7 baud
01
111
162.8 baud
325.5 baud
341.3 baud
10
000
15.63 Kbaud
31.25 Kbaud
32.77 Kbaud
10
001
7813 baud
15.63 Kbaud
16.38 Kbaud
10
010
3906 baud
7813 baud
8192 baud
10
011
1953 baud
3906 baud
4906 baud
10
100
976.6 baud
1953 baud
2048 baud
10
101
488.3 baud
976.6 baud
1024 baud
10
110
244.1 baud
488.3 baud
512.0 baud
10
111
122.1 baud
244.1 baud
256.0 baud
11
000
4808 baud
9615 baud
10.08 Kbaud
11
001
2404 baud
4808 baud
5041 baud
11
010
1202 baud
2404 baud
2521 baud
11
011
601.0 baud
1202 baud
1260 baud
11
100
300.5 baud
601.0 baud
630.2 baud
11
101
150.2 baud
300.5 baud
315.1 baud
11
110
75.12 baud
150.2 baud
157.5 baud
11
111
37.56 baud
75.12 baud
78.77 baud
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Communications Interface (SCI)
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 11. Serial Peripheral Interface (SPI)
11.1 Contents
11.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
11.3
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
11.4 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
11.4.1 Pin Functions in Master Mode . . . . . . . . . . . . . . . . . . . . . . 137
11.4.2 Pin Functions in Slave Mode . . . . . . . . . . . . . . . . . . . . . . .138
11.5
Multiple-SPI Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
11.6
Serial Clock Polarity and Phase . . . . . . . . . . . . . . . . . . . . . . .140
11.7 SPI Error Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
11.7.1 Mode Fault Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141
11.7.2 Write Collision Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
11.7.3 Overrun Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
11.8
SPI Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142
11.9 SPI I/O Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
11.9.1 SPI Data Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
11.9.2 SPI Control Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
11.9.3 SPI Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
11.2 Introduction
The serial peripheral interface (SPI) module allows full-duplex,
synchronous, serial communication with peripheral devices.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Peripheral Interface (SPI)
Technical Data
133
Serial Peripheral Interface (SPI)
11.3 Features
Features of the SPI include:
•
Full-duplex operation
•
Master and slave modes
•
Four programmable master mode frequencies (1.05 MHz
maximum)
•
2.1-MHz maximum slave mode frequency
•
Serial clock with programmable polarity and phase
•
End of transmission interrupt flag
•
Write collision error flag
•
Bus contention error flag
Figure 11-1 shows the structure of the SPI module. Figure 11-2 is a
summary of the SPI input/output (I/O) registers.
Technical Data
134
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Peripheral Interface (SPI)
MOTOROLA
Serial Peripheral Interface (SPI)
Features
INTERNAL
CLOCK
(XTAL ÷2)
S
M
M
7 6 5 4 3 2 1 0
S
PIN CONTROL LOGIC
SPI SHIFT REGISTER
DIVIDER
÷2
÷4
÷16
÷32
SHIFT
CLOCK
SPDR ($000C)
SPI CLOCK (MASTER)
PD4/
SCK
PD5/
SS
MSTR
SPE
DWOM
SPR0
SPR1
CPOL
CPHA
MSTR
DWOM
SPE
SPIE
MODF
SPIF
WCOL
S
MSTR
SPE
SPIE
SPI CONTROL
PD3/
MOSI
M
CLOCK
LOGIC
SPR0
SPR1
SELECT
PD2/
MISO
SPCR ($000A)
SPSR ($000B)
SPI INTERRUPT
REQUEST
INTERNAL
DATA BUS
Figure 11-1. SPI Block Diagram
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Peripheral Interface (SPI)
Technical Data
135
Serial Peripheral Interface (SPI)
Addr.
$000A
$000B
$000C
Register Name
Read:
SPI Control Register
(SPCR) Write:
See page 143.
Reset:
Read:
SPI Status Register
(SPSR) Write:
See page 145.
Reset:
Read:
SPI Data Register
(SPDR) Write:
See page 143.
Reset:
Bit 7
6
SPIE
5
4
3
2
1
Bit 0
SPE
MSTR
CPOL
CPHA
SPR1
SPR0
0
0
0
U
U
U
U
SPIF
WCOL
MODF
0
0
0
Bit 7
Bit 6
Bit 3
BIt 2
Bit 1
Bit 0
Bit 5
Bit 4
Unaffected by reset
= Unimplemented
U = Unaffected
Figure 11-2. SPI I/O Register Summary
11.4 Operation
The master/slave SPI allows full-duplex, synchronous, serial
communication between the MCU and peripheral devices, including
other microcontroller units (MCUs). As the 8-bit shift register of a master
SPI transmits each byte to another device, a byte from the receiving
device enters the master SPI shift register. A clock signal from the
master SPI synchronizes data transmission.
Only a master SPI can initiate transmissions. Software begins the
transmission from a master SPI by writing to the SPI data register
(SPDR). The SPDR does not buffer data being transmitted from the SPI.
Data written to the SPDR goes directly into the shift register and begins
the transmission immediately under the control of the serial clock. The
transmission ends after eight cycles of the serial clock when the SPI flag
(SPIF) becomes set. At the same time that SPIF becomes set, the data
shifted into the master SPI from the receiving device transfers to the
SPDR. The SPDR buffers data being received by the SPI. Before the
master SPI sends the next byte, software must clear the SPIF bit by
reading the SPSR and then accessing the SPDR.
Technical Data
136
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Peripheral Interface (SPI)
MOTOROLA
Serial Peripheral Interface (SPI)
Operation
In a slave SPI, data enters the shift register under the control of the serial
clock from the master SPI. After a byte enters the shift register of a slave
SPI, it transfers to the SPDR. To prevent an overrun condition, slave
software must then read the byte in the SPDR before another byte enters
the shift register and is ready to transfer to the SPDR.
Figure 11-3 shows how a master SPI exchanges data with a slave SPI.
PD3/MOSI
SPI SHIFT REGISTER
7 6 5 4 3 2 1 0
PD2/MISO
SPI SHIFT REGISTER
7 6 5 4 3 2 1 0
PD5/SS
SPDR ($000C)
SPDR ($000C)
PD4/SCK
MASTER MCU
SLAVE MCU
Figure 11-3. Master/Slave Connections
11.4.1 Pin Functions in Master Mode
Setting the MSTR bit in the SPI control register (SPCR) configures the
SPI for operation in master mode. The master-mode functions of the SPI
pins are:
•
PD4/SCK (serial clock) — In master mode, the PD4/SCK pin is the
synchronizing clock output.
•
PD3/MOSI (master output, slave input) — In master mode, the
PD3/MOSI pin is the serial output.
•
PD2/MISO (master input, slave output) — In master mode, the
PD2/MISO pin is configured as the serial input.
•
PD5/SS (slave select) — In master mode, the PD5/SS pin protects
against driver contention caused by the simultaneous operation of
two SPIs in master mode. A logic 0 on the PD5/SS pin of a master
SPI disables the SPI, clears the MSTR bit, and sets the mode-fault
flag (MODF).
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Peripheral Interface (SPI)
Technical Data
137
Serial Peripheral Interface (SPI)
11.4.2 Pin Functions in Slave Mode
Clearing the MSTR bit in the SPCR configures the SPI for operation in
slave mode. The slave-mode functions of the SPI pins are:
•
PD4/SCK (serial clock) — In slave mode, the PD4/SCK pin is the
input for the synchronizing clock signal from the master SPI.
•
PD3/MOSI (master output, slave input) — In slave mode, the
PD3/MOSI pin is the serial input.
•
PD2/MISO (master input, slave output) — In slave mode, the
PD2/MISO pin is the serial output.
•
PD5/SS (slave select) — In slave mode, the PD5/SS pin enables
the SPI for data and serial clock reception from a master SPI.
When CPHA = 0, the shift clock is the OR of SS with SCK. In this clock
phase mode, SS must go high between successive characters in an SPI
message. When CPHA = 1, SS may be left low for several SPI
characters. In cases with only one SPI slave MCU, the slave MCU SS
line can be tied to VSS as long as CPHA = 1 clock modes are used.
The WCOL flag bit can be improperly set when attempting the first
transmission after a reset if these conditions are present: MSTR = 0,
CPOL = 0, CPHA = 1, SS pin = 0, and SCK pin = 1. The reset states of
the CPOL and CPHA bits are 0 and 1, respectively. Under normal
operating conditions (CPOL = 0, CPHA = 1), the SCK input will be low.
The incorrect setting of the WCOL bit can be prevented in two ways:
1. Send a dummy transmission after reset, clear the WCOL flag, and
then proceed with the real transmission.
2. Use the MSTR bit in the SPCR (SPI control register). This is
accomplished by setting the MSTR bit at the same time the CPOL
and CPHA bits are programmed to the desired logic levels. Then,
the data register can be written to if desired. After this, the MSTR
bit should be set to a logic 0, the SPE (SPI enable bit) should be
set to a logic 1, and the CPOL, CPHA, SPR1, and SPR0 bits set
to the desired logic levels. If this procedure is followed after a reset
and before the first access to the SPDR, the WCOL flag will not be
set.
Technical Data
138
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Peripheral Interface (SPI)
MOTOROLA
Serial Peripheral Interface (SPI)
Multiple-SPI Systems
Example:
LDA #$1C
STA SPCR
LDA #$4C
STA SPCR
;
;
;
;
;
;
MSTR = 1, CPOL = 1, CPHA = 1,
SPR1 = SPR0 = 0
SPI control register
MSTR = 0, SPE = 1, CPOL = 1, CPHA = 1,
SPR1 = SPR0 = 0
SPI control register
11.5 Multiple-SPI Systems
In a multiple-SPI system, all PD4/SCK pins are connected together, all
PD3/MOSI pins are connected together, and all PD2/MISO pins are
connected together.
Before a transmission, one SPI is configured as master and the rest are
configured as slaves. Figure 11-4 is a block diagram showing a single
master SPI and three slave SPIs.
Figure 11-5 is another block diagram with two master/slave SPIs and
three slave SPIs.
MASTER MCU
PD2/MISO
PD3/MOSI
PD4/SCK
PD5/SS
VDD
2
SLAVE MCU 2
SLAVE MCU 1
PD2/MISO
PD3/MOSI
PD5/SS
PD4/SCK
PD2/MISO
PD3/MOSI
PD5/SS
PD4/SCK
PD2/MISO
PD3/MOSI
PD5/SS
PD4/SCK
I/O
PORT 1
0
SLAVE MCU 0
Figure 11-4. One Master and Three Slaves Block Diagram
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Peripheral Interface (SPI)
Technical Data
139
Serial Peripheral Interface (SPI)
MASTER/SLAVE
MCU 1
MASTER/SLAVE
MCU 2
PD2/MISO
PD2/MISO
PD3/MOSI
PD3/MOSI
PD4/SCK
PD4/SCK
PD5/SS
PD5/SS
SLAVE MCU 2
SLAVE MCU 1
I/O
PORT
PD2/MISO
PD4/SCK
PD3/MOSI
PD5/SS
PD2/MISO
PD4/SCK
3
PD3/MOSI
3
PD5/SS
2
PD2/MISO
1
2
PD4/SCK
1
PD3/MOSI
0
PD5/SS
I/O
PORT
0
SLAVE MCU 0
Figure 11-5. Two Master/Slaves and Three Slaves Block Diagram
11.6 Serial Clock Polarity and Phase
To accommodate the different serial communication requirements of
peripheral devices, software can change the phase and polarity of the
SPI serial clock. The clock polarity bit (CPOL) and the clock phase bit
(CPHA), both in the SPCR, control the timing relationship between the
serial clock and the transmitted data. Figure 11-6 shows how the CPOL
and CPHA bits affect the clock/data timing.
SS
CPHA
CPOL
0
0
SCK (A)
1
0
SCK (B)
0
1
SCK (C)
1
1
SCK (D)
SDO/SDI
MSB
BIT 6
BIT 5
BIT 4
BIT 3
BIT 2
BIT 1
LSB
CAPTURE STROBE
Figure 11-6. SPI Clock/Data Timing
Technical Data
140
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Peripheral Interface (SPI)
MOTOROLA
Serial Peripheral Interface (SPI)
SPI Error Conditions
11.7 SPI Error Conditions
These conditions produce SPI system errors:
•
Bus contention caused by multiple master SPIs (mode fault error)
•
Writing to the SPDR during a transmission (write-collision error)
•
Failing to read the SPDR before the next incoming byte sets the
SPIF bit (overrun error)
11.7.1 Mode Fault Error
A mode fault error results when a logic 0 occurs on the PD5/SS pin of a
master SPI. The MCU takes these actions when a mode fault error
occurs:
•
Puts the SPI in slave mode by clearing the MSTR bit
•
Disables the SPI by clearing the SPE bit
•
Sets the MODF bit
11.7.2 Write Collision Error
Writing to the SPDR during a transmission causes a write collision error
and sets the WCOL bit in the SPSR. Either a master SPI or a slave SPI
can generate a write collision error.
•
Master — A master SPI can cause a write collision error by writing
to the SPDR while the previously written byte is still being shifted
out to the PD3/MOSI pin. The error does not affect the
transmission of the previously written byte, but the byte that
caused the error is lost.
•
Slave — A slave SPI can cause a write collision error in either of
two ways, depending on the state of the CPHA bit:
– CPHA = 0 — A slave SPI can cause a write collision error by
writing to the SPDR while the PD5/SS pin is at logic 0. The
error does not affect the byte in the SPDR, but the byte that
caused the error is lost.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Peripheral Interface (SPI)
Technical Data
141
Serial Peripheral Interface (SPI)
– CPHA = 1 — A slave SPI can cause a write collision error by
writing to the SPDR while receiving a transmission, that is,
between the first active SCK edge and the end of the eighth
SCK cycle. The error does not affect the transmission from the
master SPI, but the byte that caused the error is lost.
11.7.3 Overrun Error
Failing to read the byte in the SPDR before a subsequent byte enters the
shift register causes an overrun condition. In an overrun condition, all
incoming data is lost until software clears SPIF. The overrun condition
has no flag.
11.8 SPI Interrupts
The SPIF bit in the SPSR indicates a byte has shifted into or out of the
SPDR. The SPIF bit is a source of SPI interrupt requests. The SPI
interrupt enable bit (SPIE) in the SPCR is the local mask for SPIF
interrupts.
The MODF bit in the SPSR indicates a mode error and is a source of SPI
interrupt requests. The MODF bit is set when a logic 0 occurs on the
PD5/SS pin while the MSTR bit is set. The SPI interrupt enable bit (SPIE)
in the SPCR is the local mask for MODF interrupts.
11.9 SPI I/O Registers
These input/output (I/O) registers control and monitor SPI operation:
Technical Data
142
•
SPI data register (SPDR)
•
SPI control register (SPCR)
•
SPI status register (SPSR)
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Peripheral Interface (SPI)
MOTOROLA
Serial Peripheral Interface (SPI)
SPI I/O Registers
11.9.1 SPI Data Register
The SPDR shown in Figure 11-7 is the read buffer for characters
received by the SPI. Writing a byte to the SPDR places the byte directly
into the SPI shift register.
Address:
$000C
Bit 7
6
5
4
3
2
1
Bit 0
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Read:
Write:
Reset:
Unaffected by reset
Figure 11-7. SPI Data Register (SPDR)
11.9.2 SPI Control Register
The SPCR shown in Figure 11-8 has these functions:
•
Enables SPI interrupt requests
•
Enables the SPI
•
Configures the SPI as master or slave
•
Selects serial clock polarity, phase, and frequency
Address:
$000A
Bit 7
6
SPIE
0
5
4
3
2
1
Bit 0
SPE
MSTR
CPOL
CPHA
SPR1
SPR0
0
0
U
U
U
U
Read:
Write:
Reset:
= Unimplemented
U = Unaffected
Figure 11-8. SPI Control Register (SPCR)
SPIE — SPI Interrupt Enable Bit
This read/write bit enables SPI interrupts. Reset clears the SPIE bit.
1 = SPI interrupts enabled
0 = SPI interrupts disabled
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Peripheral Interface (SPI)
Technical Data
143
Serial Peripheral Interface (SPI)
SPI — SPI Enable Bit
This read/write bit enables the SPI. Reset clears the SPE bit.
1 = SPI enabled
0 = SPI disabled
MSTR — Master Bit
This read/write bit selects master mode operation or slave mode
operation. Reset clears the MSTR bit.
1 = Master mode
0 = Slave mode
CPOL — Clock Polarity Bit
This read/write bit determines the logic state of the PD4/SCK pin
between transmissions. To transmit data between SPIs, the SPIs
must have identical CPOL bits. Reset has no effect on the CPOL bit.
1 = PD4/SCK pin at logic 1 between transmissions
0 = PD4/SCK pin at logic 0 between transmissions
CPHA — Clock Phase Bit
This read/write bit controls the timing relationship between the serial
clock and SPI data. To transmit data between SPIs, the SPIs must
have identical CPHA bits. When CPHA = 0, the PD5/SS pin of the
slave SPI must be set to logic 1 between bytes. Reset has no effect
on the CPHA bit.
1 = Edge following first active edge on PD4/SCK latches data
0 = First active edge on PD4/SCK latches data
SPR1 and SPR0 — SPI Clock Rate Bits
These read/write bits select the master mode serial clock rate, as
shown in Table 11-1. The SPR1 and SPR0 bits of a slave SPI have
no effect on the serial clock. Reset has no effect on SPR1 and SPR0.
Table 11-1. SPI Clock Rate Selection
SPR[1:0]
SPI Clock Rate
00
÷2
Internal Clock ÷ 4
Internal Clock ÷ 16
Internal Clock ÷ 32
Internal Clock
01
10
11
Technical Data
144
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Peripheral Interface (SPI)
MOTOROLA
Serial Peripheral Interface (SPI)
SPI I/O Registers
11.9.3 SPI Status Register
The SPSR shown in Figure 11-9 contains flags to signal these
conditions:
•
SPI transmission complete
•
Write collision
•
Mode fault
Address:
Read:
$000B
Bit 7
6
5
4
SPIF
WCOL
MODF
0
0
0
3
2
1
Bit 0
Write:
Reset:
= Unimplemented
Figure 11-9. SPI Status Register (SPSR)
SPIF — SPI Flag
This clearable, read-only bit is set each time a byte shifts out of or into
the shift register. SPIF generates an interrupt request if the SPIE bit
in the SPCR is also set. Clear SPIF by reading the SPSR with SPIF
set and then reading or writing the SPDR. Reset clears the SPIF bit.
1 = Transmission complete
0 = Transmission not complete
WCOL — Write Collision Bit
This clearable, read-only flag is set when software writes to the SPDR
while a transmission is in progress. Clear the WCOL bit by reading the
SPSR with WCOL set and then reading or writing the SPDR. Reset
clears WCOL.
1 = Invalid write to SPDR
0 = No invalid write to SPDR
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Serial Peripheral Interface (SPI)
Technical Data
145
Serial Peripheral Interface (SPI)
MODF — Mode Fault Bit
This clearable, read-only bit is set when a logic 0 occurs on the
PD5/SS pin while the MSTR bit is set. MODF generates an interrupt
request if the SPIE bit is also set. Clear the MODF bit by reading the
SPSR with MODF set and then writing to the SPCR. Reset clears
MODF.
1 = PD5/SS pulled low while MSTR bit set
0 = PD5/SS not pulled low while MSTR bit set
Technical Data
146
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Serial Peripheral Interface (SPI)
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 12. Instruction Set
12.1 Contents
12.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
12.3 Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
12.3.1 Inherent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
12.3.2 Immediate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
12.3.3 Direct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
12.3.4 Extended . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
12.3.5 Indexed, No Offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
12.3.6 Indexed, 8-Bit Offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
12.3.7 Indexed, 16-Bit Offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
12.3.8 Relative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
12.4 Instruction Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
12.4.1 Register/Memory Instructions. . . . . . . . . . . . . . . . . . . . . . .152
12.4.2 Read-Modify-Write Instructions . . . . . . . . . . . . . . . . . . . . . 153
12.4.3 Jump/Branch Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . 154
12.4.4 Bit Manipulation Instructions . . . . . . . . . . . . . . . . . . . . . . .156
12.4.5 Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
12.5
Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
12.6
Opcode Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Instruction Set
Technical Data
147
Instruction Set
12.2 Introduction
The MCU instruction set has 62 instructions and uses eight addressing
modes. The instructions include all those of the M146805 CMOS Family
plus one more: the unsigned multiply (MUL) instruction. The MUL
instruction allows unsigned multiplication of the contents of the
accumulator (A) and the index register (X). The high-order product is
stored in the index register, and the low-order product is stored in the
accumulator.
12.3 Addressing Modes
The CPU uses eight addressing modes for flexibility in accessing data.
The addressing modes provide eight different ways for the CPU to find
the data required to execute an instruction.
The eight addressing modes are:
Technical Data
148
•
Inherent
•
Immediate
•
Direct
•
Extended
•
Indexed, no offset
•
Indexed, 8-bit offset
•
Indexed, 16-bit offset
•
Relative
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Instruction Set
MOTOROLA
Instruction Set
Addressing Modes
12.3.1 Inherent
Inherent instructions are those that have no operand, such as return
from interrupt (RTI) and stop (STOP). Some of the inherent instructions
act on data in the CPU registers, such as set carry flag (SEC) and
increment accumulator (INCA). Inherent instructions require no operand
address and are one byte long.
12.3.2 Immediate
Immediate instructions are those that contain a value to be used in an
operation with the value in the accumulator or index register. Immediate
instructions require no operand address and are two bytes long. The
opcode is the first byte, and the immediate data value is the second byte.
12.3.3 Direct
Direct instructions can access any of the first 256 memory locations with
two bytes. The first byte is the opcode, and the second is the low byte of
the operand address. In direct addressing, the CPU automatically uses
$00 as the high byte of the operand address.
12.3.4 Extended
Extended instructions use three bytes and can access any address in
memory. The first byte is the opcode; the second and third bytes are the
high and low bytes of the operand address.
When using the Motorola assembler, the programmer does not need to
specify whether an instruction is direct or extended. The assembler
automatically selects the shortest form of the instruction.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Instruction Set
Technical Data
149
Instruction Set
12.3.5 Indexed, No Offset
Indexed instructions with no offset are 1-byte instructions that can
access data with variable addresses within the first 256 memory
locations. The index register contains the low byte of the effective
address of the operand. The CPU automatically uses $00 as the high
byte, so these instructions can address locations $0000–$00FF.
Indexed, no offset instructions are often used to move a pointer through
a table or to hold the address of a frequently used RAM or I/O location.
12.3.6 Indexed, 8-Bit Offset
Indexed, 8-bit offset instructions are 2-byte instructions that can access
data with variable addresses within the first 511 memory locations. The
CPU adds the unsigned byte in the index register to the unsigned byte
following the opcode. The sum is the effective address of the operand.
These instructions can access locations $0000–$01FE.
Indexed 8-bit offset instructions are useful for selecting the kth element
in an n-element table. The table can begin anywhere within the first 256
memory locations and could extend as far as location 510 ($01FE). The
k value is typically in the index register, and the address of the beginning
of the table is in the byte following the opcode.
12.3.7 Indexed, 16-Bit Offset
Indexed, 16-bit offset instructions are 3-byte instructions that can access
data with variable addresses at any location in memory. The CPU adds
the unsigned byte in the index register to the two unsigned bytes
following the opcode. The sum is the effective address of the operand.
The first byte after the opcode is the high byte of the 16-bit offset; the
second byte is the low byte of the offset.
Indexed, 16-bit offset instructions are useful for selecting the kth element
in an n-element table anywhere in memory.
As with direct and extended addressing, the Motorola assembler
determines the shortest form of indexed addressing.
Technical Data
150
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Instruction Set
MOTOROLA
Instruction Set
Instruction Types
12.3.8 Relative
Relative addressing is only for branch instructions. If the branch
condition is true, the CPU finds the effective branch destination by
adding the signed byte following the opcode to the contents of the
program counter. If the branch condition is not true, the CPU goes to the
next instruction. The offset is a signed, two’s complement byte that gives
a branching range of –128 to +127 bytes from the address of the next
location after the branch instruction.
When using the Motorola assembler, the programmer does not need to
calculate the offset, because the assembler determines the proper offset
and verifies that it is within the span of the branch.
12.4 Instruction Types
The MCU instructions fall into five categories:
•
Register/memory instructions
•
Read-modify-write instructions
•
Jump/branch instructions
•
Bit manipulation instructions
•
Control instructions
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Instruction Set
Technical Data
151
Instruction Set
12.4.1 Register/Memory Instructions
These instructions operate on CPU registers and memory locations.
Most of them use two operands. One operand is in either the
accumulator or the index register. The CPU finds the other operand in
memory.
Table 12-1. Register/Memory Instructions
Instruction
Technical Data
152
Mnemonic
Add memory byte and carry bit to accumulator
ADC
Add memory byte to accumulator
ADD
AND memory byte with accumulator
AND
Bit test accumulator
BIT
Compare accumulator
CMP
Compare index register with memory byte
CPX
Exclusive OR accumulator with memory byte
EOR
Load accumulator with memory byte
LDA
Load Index register with memory byte
LDX
Multiply
MUL
OR accumulator with memory byte
ORA
Subtract memory byte and carry bit from
accumulator
SBC
Store accumulator in memory
STA
Store index register in memory
STX
Subtract memory byte from accumulator
SUB
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Instruction Set
MOTOROLA
Instruction Set
Instruction Types
12.4.2 Read-Modify-Write Instructions
These instructions read a memory location or a register, modify its
contents, and write the modified value back to the memory location or to
the register.
NOTE:
Do not use read-modify-write operations on write-only registers.
Table 12-2. Read-Modify-Write Instructions
Instruction
Mnemonic
Arithmetic shift left (same as LSL)
ASL
Arithmetic shift right
ASR
Bit clear
BCLR(1)
Bit set
BSET(1)
Clear register
CLR
Complement (one’s complement)
COM
Decrement
DEC
Increment
INC
Logical shift left (same as ASL)
LSL
Logical shift right
LSR
Negate (two’s complement)
NEG
Rotate left through carry bit
ROL
Rotate right through carry bit
ROR
Test for negative or zero
TST(2)
1. Unlike other read-modify-write instructions, BCLR and BSET use
only direct addressing.
2. TST is an exception to the read-modify-write sequence because it
does not write a replacement value.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Instruction Set
Technical Data
153
Instruction Set
12.4.3 Jump/Branch Instructions
Jump instructions allow the CPU to interrupt the normal sequence of the
program counter. The unconditional jump instruction (JMP) and the
jump-to-subroutine instruction (JSR) have no register operand. Branch
instructions allow the CPU to interrupt the normal sequence of the
program counter when a test condition is met. If the test condition is not
met, the branch is not performed.
The BRCLR and BRSET instructions cause a branch based on the state
of any readable bit in the first 256 memory locations. These 3-byte
instructions use a combination of direct addressing and relative
addressing. The direct address of the byte to be tested is in the byte
following the opcode. The third byte is the signed offset byte. The CPU
finds the effective branch destination by adding the third byte to the
program counter if the specified bit tests true. The bit to be tested and its
condition (set or clear) is part of the opcode. The span of branching is
from –128 to +127 from the address of the next location after the branch
instruction. The CPU also transfers the tested bit to the carry/borrow bit
of the condition code register.
Technical Data
154
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Instruction Set
MOTOROLA
Instruction Set
Instruction Types
Table 12-3. Jump and Branch Instructions
Instruction
Branch if carry bit clear
BCC
Branch if carry bit set
BCS
Branch if equal
BEQ
Branch if half-carry bit clear
BHCC
Branch if half-carry bit set
BHCS
Branch if higher
BHI
Branch if higher or same
BHS
Branch if IRQ pin high
BIH
Branch if IRQ pin low
BIL
Branch if lower
BLO
Branch if lower or same
BLS
Branch if interrupt mask clear
BMC
Branch if minus
BMI
Branch if interrupt mask set
BMS
Branch if not equal
BNE
Branch if plus
BPL
Branch always
BRA
Branch if bit clear
Branch never
Branch if bit set
BRCLR
BRN
BRSET
Branch to subroutine
BSR
Unconditional jump
JMP
Jump to subroutine
JSR
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Mnemonic
Instruction Set
Technical Data
155
Instruction Set
12.4.4 Bit Manipulation Instructions
The CPU can set or clear any writable bit in the first 256 bytes of
memory, which includes I/O registers and on-chip RAM locations. The
CPU can also test and branch based on the state of any bit in any of the
first 256 memory locations.
Table 12-4. Bit Manipulation Instructions
Instruction
Bit clear
BCLR
Branch if bit clear
BRCLR
Branch if bit set
BRSET
Bit set
Technical Data
156
Mnemonic
BSET
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Instruction Set
MOTOROLA
Instruction Set
Instruction Types
12.4.5 Control Instructions
These instructions act on CPU registers and control CPU operation
during program execution.
Table 12-5. Control Instructions
Instruction
Clear carry bit
CLC
Clear interrupt mask
CLI
No operation
NOP
Reset stack pointer
RSP
Return from interrupt
RTI
Return from subroutine
RTS
Set carry bit
SEC
Set interrupt mask
SEI
Stop oscillator and enable IRQ pin
STOP
Software interrupt
SWI
Transfer accumulator to index register
TAX
Transfer index register to accumulator
TXA
Stop CPU clock and enable interrupts
WAIT
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Mnemonic
Instruction Set
Technical Data
157
Instruction Set
12.5 Instruction Set Summary
#opr
opr
opr
opr,X
opr,X
,X
ADD
ADD
ADD
ADD
ADD
ADD
#opr
opr
opr
opr,X
opr,X
,X
AND #opr
AND opr
AND opr
AND opr,X
AND opr,X
AND ,X
ASL opr
ASLA
ASLX
ASL opr,X
ASL ,X
IMM
DIR
EXT
IX2
IX1
IX
ii
A9
2
B9 dd 3
C9 hh ll 4
D9 ee ff 5
E9 ff
4
F9
3
IMM
DIR
EXT
IX2
IX1
IX
AB ii
2
BB dd 3
CB hh ll 4
DB ee ff 5
EB ff
4
FB
3
—
IMM
DIR
EXT
IX2
IX1
IX
ii
A4
2
B4 dd 3
C4 hh ll 4
D4 ee ff 5
E4 ff
4
F4
3
38
48
58
68
78
dd
DIR
INH
INH
IX1
IX
DIR
INH
INH
IX1
IX
37
47
57
67
77
dd
REL
24
rr
3
DIR (b0)
DIR (b1)
DIR (b2)
DIR (b3)
— — — — —
DIR (b4)
DIR (b5)
DIR (b6)
DIR (b7)
11
13
15
17
19
1B
1D
1F
dd
dd
dd
dd
dd
dd
dd
dd
5
5
5
5
5
5
5
5
Effect
on CCR
Description
H I N Z C
A ← (A) ∧ (M)
Logical AND
C
Arithmetic Shift Right
BCC rel
Branch if Carry Bit Clear
—
—
— —
0
b7
ASR opr
ASRA
ASRX
ASR opr,X
ASR ,X
A ← (A) + (M)
Add without Carry
Arithmetic Shift Left (Same as LSL)
A ← (A) + (M) + (C)
Add with Carry
— —
b0
C
b7
— —
b0
PC ← (PC) + 2 + rel ? C = 0
Mn ← 0
— — — — —
ff
ff
Cycles
Opcode
ADC
ADC
ADC
ADC
ADC
ADC
Operation
Address
Mode
Source
Form
Operand
Table 12-6. Instruction Set Summary (Sheet 1 of 6)
5
3
3
6
5
5
3
3
6
5
BCLR n opr
Clear Bit n
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
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
BHS rel
Branch if Higher or Same
REL
24
rr
3
Technical Data
158
PC ← (PC) + 2 + rel ? C = 0
— — — — —
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Instruction Set
MOTOROLA
Instruction Set
Instruction Set Summary
Address
Mode
Opcode
Operand
Cycles
Table 12-6. Instruction Set Summary (Sheet 2 of 6)
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
—
IMM
DIR
EXT
IX2
IX1
IX
ii
A5
2
B5 dd 3
C5 hh ll 4
D5 ee ff 5
E5 ff
4
F5
3
— — — — —
REL
25
rr
3
PC ← (PC) + 2 + rel ? C ∨ Z = 1 — — — — —
REL
23
rr
3
Source
Form
Operation
Description
Effect
on CCR
H I N Z C
BIT #opr
BIT opr
BIT opr
BIT opr,X
BIT opr,X
BIT ,X
Bit Test Accumulator with Memory Byte
BLO rel
Branch if Lower (Same as BCS)
BLS rel
Branch if Lower or Same
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 ? 1 = 1
— — — — —
REL
20
rr
3
DIR (b0)
DIR (b1)
DIR (b2)
DIR (b3)
DIR (b4)
DIR (b5)
DIR (b6)
DIR (b7)
01
03
05
07
09
0B
0D
0F
dd rr
dd rr
dd rr
dd rr
dd rr
dd rr
dd rr
dd rr
5
5
5
5
5
5
5
5
(A) ∧ (M)
PC ← (PC) + 2 + rel ? C = 1
PC ← (PC) + 2 + rel ? Mn = 0
BRCLR n opr rel Branch if Bit n Clear
BRN rel
PC ← (PC) + 2 + rel ? 1 = 0
Branch Never
BSET n opr
— — — —
REL
21
rr
3
DIR (b0)
DIR (b1)
DIR (b2)
DIR (b3)
DIR (b4)
DIR (b5)
DIR (b6)
DIR (b7)
00
02
04
06
08
0A
0C
0E
dd rr
dd rr
dd rr
dd rr
dd rr
dd rr
dd rr
dd rr
5
5
5
5
5
5
5
5
DIR (b0)
DIR (b1)
DIR (b2)
DIR (b3)
— — — — —
DIR (b4)
DIR (b5)
DIR (b6)
DIR (b7)
10
12
14
16
18
1A
1C
1E
dd
dd
dd
dd
dd
dd
dd
dd
5
5
5
5
5
5
5
5
PC ← (PC) + 2; push (PCL)
SP ← (SP) – 1; push (PCH)
SP ← (SP) – 1
PC ← (PC) + rel
— — — — —
REL
AD
rr
6
PC ← (PC) + 2 + rel ? Mn = 1
BRSET n opr rel Branch if Bit n Set
— —
Mn ← 1
Set Bit n
— — — — —
— — — —
BSR rel
Branch to Subroutine
CLC
Clear Carry Bit
C←0
— — — — 0
INH
98
2
CLI
Clear Interrupt Mask
I←0
— 0 — — —
INH
9A
2
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Instruction Set
Technical Data
159
Instruction Set
CMP #opr
CMP opr
CMP opr
CMP opr,X
CMP opr,X
CMP ,X
COM opr
COMA
COMX
COM opr,X
COM ,X
CPX
CPX
CPX
CPX
CPX
CPX
#opr
opr
opr
opr,X
opr,X
,X
DEC opr
DECA
DECX
DEC opr,X
DEC ,X
EOR
EOR
EOR
EOR
EOR
EOR
#opr
opr
opr
opr,X
opr,X
,X
INC opr
INCA
INCX
INC opr,X
INC ,X
JMP opr
JMP opr
JMP opr,X
JMP opr,X
JMP ,X
Clear Byte
Compare Accumulator with Memory Byte
Complement Byte (One’s Complement)
Compare Index Register with Memory Byte
Decrement Byte
EXCLUSIVE OR Accumulator with Memory
Byte
Increment Byte
Unconditional Jump
M ← $00
A ← $00
X ← $00
M ← $00
M ← $00
3F
4F
5F
6F
7F
dd
IMM
DIR
EXT
IX2
IX1
IX
ii
A1
2
B1 dd 3
C1 hh ll 4
D1 ee ff 5
E1 ff
4
F1
3
(A) – (M)
M ← (M) = $FF – (M)
A ← (A) = $FF – (A)
X ← (X) = $FF – (X)
M ← (M) = $FF – (M)
M ← (M) = $FF – (M)
1
DIR
INH
INH
IX1
IX
33
43
53
63
73
IMM
DIR
EXT
IX2
IX1
IX
ii
A3
2
B3 dd 3
C3 hh ll 4
D3 ee ff 5
E3 ff
4
F3
3
(X) – (M)
M ← (M) – 1
A ← (A) – 1
X ← (X) – 1
M ← (M) – 1
M ← (M) – 1
DIR
INH
INH
IX1
IX
3A
4A
5A
6A
7A
—
IMM
DIR
EXT
IX2
IX1
IX
ii
A8
2
B8 dd 3
C8 hh ll 4
D8 ee ff 5
E8 ff
4
F8
3
A ← (A) ⊕ (M)
M ← (M) + 1
A ← (A) + 1
X ← (X) + 1
M ← (M) + 1
M ← (M) + 1
—
DIR
INH
INH
IX1
IX
3C
4C
5C
6C
7C
DIR
EXT
IX2
IX1
IX
BC dd 2
CC hh ll 3
DC ee ff 4
EC ff
3
FC
2
PC ← Jump Address
— — 0 1 —
— —
— —
— —
— —
— —
— —
—
— — — — —
ff
dd
ff
dd
ff
dd
ff
Cycles
DIR
INH
INH
IX1
IX
Effect
on CCR
H I N Z C
Technical Data
160
Description
Operand
CLR opr
CLRA
CLRX
CLR opr,X
CLR ,X
Operation
Opcode
Source
Form
Address
Mode
Table 12-6. Instruction Set Summary (Sheet 3 of 6)
5
3
3
6
5
5
3
3
6
5
5
3
3
6
5
5
3
3
6
5
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Instruction Set
MOTOROLA
Instruction Set
Instruction Set Summary
LDA #opr
LDA opr
LDA opr
LDA opr,X
LDA opr,X
LDA ,X
LDX #opr
LDX opr
LDX opr
LDX opr,X
LDX opr,X
LDX ,X
LSL opr
LSLA
LSLX
LSL opr,X
LSL ,X
A ← (M)
Load Accumulator with Memory Byte
ii
A6
2
B6 dd 3
C6 hh ll 4
D6 ee ff 5
E6 ff
4
F6
3
—
IMM
DIR
EXT
IX2
IX1
IX
AE ii
2
BE dd 3
CE hh ll 4
DE ee ff 5
EE ff
4
FE
3
38
48
58
68
78
dd
DIR
INH
INH
IX1
IX
0
b7
DIR
INH
INH
IX1
IX
34
44
54
64
74
dd
0 — — — 0
INH
42
NEG opr
NEGA
NEGX
NEG opr,X
NEG ,X
DIR
INH
INH
IX1
IX
30
40
50
60
70
Negate Byte (Two’s Complement)
NOP
No Operation
INH
9D
—
IMM
DIR
EXT
IX2
IX1
IX
AA ii
2
BA dd 3
CA hh ll 4
DA ee ff 5
EA ff
4
FA
3
DIR
INH
INH
IX1
IX
39
49
59
69
79
b0
0
C
b7
— —
— — 0
b0
X : A ← (X) × (A)
M ← –(M) = $00 – (M)
A ← –(A) = $00 – (A)
X ← –(X) = $00 – (X)
M ← –(M) = $00 – (M)
M ← –(M) = $00 – (M)
— —
— — — — —
A ← (A) ∨ (M)
Logical OR Accumulator with Memory
— —
C
Rotate Byte Left through Carry Bit
— —
b7
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Instruction Set
b0
ff
ff
Cycles
—
IMM
DIR
EXT
IX2
IX1
IX
— — — — —
— —
C
Logical Shift Left (Same as ASL)
Unsigned Multiply
MOTOROLA
BD dd 5
CD hh ll 6
DD ee ff 7
ED ff
6
FD
5
— —
X ← (M)
Load Index Register with Memory Byte
MUL
ROL opr
ROLA
ROLX
ROL opr,X
ROL ,X
PC ← (PC) + n (n = 1, 2, or 3)
Push (PCL); SP ← (SP) – 1
Push (PCH); SP ← (SP) – 1
PC ← Effective Address
Jump to Subroutine
Logical Shift Right
#opr
opr
opr
opr,X
opr,X
,X
DIR
EXT
IX2
IX1
IX
H I N Z C
LSR opr
LSRA
LSRX
LSR opr,X
LSR ,X
ORA
ORA
ORA
ORA
ORA
ORA
Description
Opcode
JSR opr
JSR opr
JSR opr,X
JSR opr,X
JSR ,X
Operation
Effect
on CCR
Address
Mode
Source
Form
Operand
Table 12-6. Instruction Set Summary (Sheet 4 of 6)
5
3
3
6
5
5
3
3
6
5
1
1
dd
ff
5
3
3
6
5
2
dd
ff
5
3
3
6
5
Technical Data
161
Instruction Set
Opcode
Operand
DIR
INH
INH
IX1
IX
36
46
56
66
76
dd
— — — — —
INH
9C
2
Return from Interrupt
SP ← (SP) + 1; Pull (CCR)
SP ← (SP) + 1; Pull (A)
SP ← (SP) + 1; Pull (X)
SP ← (SP) + 1; Pull (PCH)
SP ← (SP) + 1; Pull (PCL)
INH
80
9
Return from Subroutine
SP ← (SP) + 1; Pull (PCH)
SP ← (SP) + 1; Pull (PCL)
— — — — —
INH
81
6
IMM
DIR
EXT
IX2
IX1
IX
ii
A2
2
B2 dd 3
C2 hh ll 4
D2 ee ff 5
E2 ff
4
F2
3
Source
Form
Operation
Effect
on CCR
Description
H I N Z C
ROR opr
RORA
RORX
ROR opr,X
ROR ,X
Rotate Byte Right through Carry Bit
RSP
Reset Stack Pointer
SP ← $00FF
RTI
RTS
C
b7
— —
b0
ff
Cycles
Address
Mode
Table 12-6. Instruction Set Summary (Sheet 5 of 6)
5
3
3
6
5
SBC #opr
SBC opr
SBC opr
SBC opr,X
SBC opr,X
SBC ,X
Subtract Memory Byte and Carry Bit from
Accumulator
SEC
Set Carry Bit
C←1
— — — — 1
INH
99
2
SEI
Set Interrupt Mask
I←1
— 1 — — —
INH
9B
2
—
DIR
EXT
IX2
IX1
IX
B7 dd 4
C7 hh ll 5
D7 ee ff 6
E7 ff
5
F7
4
— 0 — — —
INH
8E
—
DIR
EXT
IX2
IX1
IX
BF dd 4
CF hh ll 5
DF ee ff 6
EF ff
5
FF
4
IMM
DIR
EXT
IX2
IX1
IX
ii
A0
2
B0 dd 3
C0 hh ll 4
D0 ee ff 5
E0 ff
4
F0
3
PC ← (PC) + 1; Push (PCL)
SP ← (SP) – 1; Push (PCH)
SP ← (SP) – 1; Push (X)
SP ← (SP) – 1; Push (A)
— 1 — — —
SP ← (SP) – 1; Push (CCR)
SP ← (SP) – 1; I ← 1
PCH ← Interrupt Vector High Byte
PCL ← Interrupt Vector Low Byte
INH
83
1
0
INH
97
2
STA opr
STA opr
STA opr,X
STA opr,X
STA ,X
Store Accumulator in Memory
STOP
Stop Oscillator and Enable IRQ Pin
STX opr
STX opr
STX opr,X
STX opr,X
STX ,X
SUB
SUB
SUB
SUB
SUB
SUB
#opr
opr
opr
opr,X
opr,X
,X
Store Index Register In Memory
Subtract Memory Byte from Accumulator
SWI
Software Interrupt
TAX
Transfer Accumulator to Index Register
Technical Data
162
A ← (A) – (M) – (C)
M ← (A)
M ← (X)
A ← (A) – (M)
X ← (A)
— —
— —
— —
— —
— — — — —
2
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Instruction Set
MOTOROLA
Instruction Set
Opcode Map
Test Memory Byte for Negative or Zero
TXA
Transfer Index Register to Accumulator
WAIT
Stop CPU Clock and Enable Interrupts
(M) – $00
A ← (X)
— —
—
— — — — —
—
Accumulator
Carry/borrow flag
Condition code register
Direct address of operand
Direct address of operand and relative offset of branch instruction
Direct addressing mode
High and low bytes of offset in indexed, 16-bit offset addressing
Extended addressing mode
Offset byte in indexed, 8-bit offset addressing
Half-carry flag
High and low bytes of operand address in extended addressing
Interrupt mask
Immediate operand byte
Immediate addressing mode
Inherent addressing mode
Indexed, no offset addressing mode
Indexed, 8-bit offset addressing mode
Indexed, 16-bit offset addressing mode
Memory location
Negative flag
Any bit
opr
PC
PCH
PCL
REL
rel
rr
SP
X
Z
#
∧
∨
⊕
()
–( )
←
?
:
—
— — —
DIR
INH
INH
IX1
IX
3D
4D
5D
6D
7D
dd
INH
9F
2
INH
8F
2
ff
Cycles
H I N Z C
TST opr
TSTA
TSTX
TST opr,X
TST ,X
A
C
CCR
dd
dd rr
DIR
ee ff
EXT
ff
H
hh ll
I
ii
IMM
INH
IX
IX1
IX2
M
N
n
Description
Operand
Operation
Effect
on CCR
Opcode
Source
Form
Address
Mode
Table 12-6. Instruction Set Summary (Sheet 6 of 6)
4
3
3
5
4
Operand (one or two bytes)
Program counter
Program counter high byte
Program counter low byte
Relative addressing mode
Relative program counter offset byte
Relative program counter offset byte
Stack pointer
Index register
Zero flag
Immediate value
Logical AND
Logical OR
Logical EXCLUSIVE OR
Contents of
Negation (two’s complement)
Loaded with
If
Concatenated with
Set or cleared
Not affected
12.6 Opcode Map
See Table 12-7.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Instruction Set
Technical Data
163
Bit Manipulation
MSB
LSB
0
1
2
3
4
5
7
8
MOTOROLA
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Instruction Set
6
9
A
B
C
D
E
F
Branch
Read-Modify-Write
Control
Register/Memory
DIR
DIR
REL
DIR
INH
INH
IX1
IX
INH
INH
IMM
DIR
EXT
IX2
IX1
IX
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
5
BRSET0
3
DIR
5
BRCLR0
3
DIR
5
BRSET1
3
DIR
5
BRCLR1
3
DIR
5
BRSET2
3
DIR
5
BRCLR2
3
DIR
5
BRSET3
3
DIR
5
BRCLR3
3
DIR
5
BRSET4
3
DIR
5
BRCLR4
3
DIR
5
BRSET5
3
DIR
5
BRCLR5
3
DIR
5
BRSET6
3
DIR
5
BRCLR6
3
DIR
5
BRSET7
3
DIR
5
BRCLR7
3
DIR
5
BSET0
DIR
5
BCLR0
2
DIR
5
BSET1
2
DIR
5
BCLR1
2
DIR
5
BSET2
2
DIR
5
BCLR2
2
DIR
5
BSET3
2
DIR
5
BCLR3
2
DIR
5
BSET4
2
DIR
5
BCLR4
2
DIR
5
BSET5
2
DIR
5
BCLR5
2
DIR
5
BSET6
2
DIR
5
BCLR6
2
DIR
5
BSET7
2
DIR
5
BCLR7
2
DIR
2
INH = Inherent
IMM = Immediate
DIR = Direct
EXT = Extended
5
3
NEG
BRA
DIR
REL 2
3
BRN
2
REL
3
BHI
2
REL
5
3
COM
BLS
DIR
2
REL 2
5
3
LSR
BCC
DIR
2
REL 2
3
BCS/BLO
2
REL
5
3
ROR
BNE
DIR
2
REL 2
5
3
ASR
BEQ
DIR
2
REL 2
5
3
ASL/LSL
BHCC
DIR
2
REL 2
5
3
ROL
BHCS
DIR
2
REL 2
5
3
DEC
BPL
DIR
2
REL 2
3
BMI
2
REL
5
3
INC
BMC
DIR
2
REL 2
4
3
TST
BMS
DIR
2
REL 2
3
BIL
2
REL
5
3
CLR
BIH
DIR
2
REL 2
2
1
9
RTI
INH
6
RTS
1
INH
5
6
3
3
NEG
NEG
NEGX
NEGA
IX 1
IX1 1
INH 2
INH 1
2
2
11
MUL
1
INH
10
5
6
3
3
SWI
COM
COM
COMX
COMA
INH
IX 1
IX1 1
INH 2
1
INH 1
5
6
3
3
LSR
LSR
LSRX
LSRA
IX
IX1 1
INH 2
1
INH 1
2
2
2
2
3
RORA
1
INH
3
ASRA
1
INH
3
ASLA/LSLA
1
INH
3
ROLA
1
INH
3
DECA
1
INH
6
3
ROR
RORX
IX1
1
INH 2
6
3
ASR
ASRX
IX1
1
INH 2
6
3
ASLX/LSLX ASL/LSL
IX1
1
INH 2
6
3
ROL
ROLX
IX1
1
INH 2
6
3
DEC
DECX
IX1
1
INH 2
5
ROR
1
2
IX
5
ASR
1
IX
5
ASL/LSL
1
IX
5
ROL
1
IX
5
DEC
1
IX
1
1
1
1
1
5
6
3
3
INC
INC
INCX
INCA
IX
IX1 1
INH 2
INH 1
4
5
3
3
TST
TST
TSTX
TSTA
IX
IX1 1
INH 2
1
INH 1
1
1
1
2
TAX
INH
2
CLC
INH
2
SEC
INH
2
CLI
INH
2
SEI
INH
2
RSP
INH
2
NOP
INH
2
STOP
1
INH
2
2
5
6
3
3
TXA
WAIT
CLR
CLR
CLRX
CLRA
INH
INH 1
IX 1
IX1 1
INH 2
1
INH 1
REL = Relative
IX = Indexed, No Offset
IX1 = Indexed, 8-Bit Offset
IX2 = Indexed, 16-Bit Offset
2
SUB
IMM 2
2
CMP
IMM 2
2
SBC
IMM 2
2
CPX
IMM 2
2
AND
IMM 2
2
BIT
IMM 2
2
LDA
IMM 2
2
2
EOR
IMM 2
2
ADC
2
IMM 2
2
ORA
2
IMM 2
2
ADD
2
IMM 2
2
2
6
BSR
2
REL 2
2
LDX
2
IMM 2
2
MSB
LSB
LSB of Opcode in Hexadecimal
0
3
SUB
DIR 3
3
CMP
DIR 3
3
SBC
DIR 3
3
CPX
DIR 3
3
AND
DIR 3
3
BIT
DIR 3
3
LDA
DIR 3
4
STA
DIR 3
3
EOR
DIR 3
3
ADC
DIR 3
3
ORA
DIR 3
3
ADD
DIR 3
2
JMP
DIR 3
5
JSR
DIR 3
3
LDX
DIR 3
4
STX
DIR 3
0
4
SUB
EXT
4
CMP
EXT
4
SBC
EXT
4
CPX
EXT
4
AND
EXT
4
BIT
EXT
4
LDA
EXT
5
STA
EXT
4
EOR
EXT
4
ADC
EXT
4
ORA
EXT
4
ADD
EXT
3
JMP
EXT
6
JSR
EXT
4
LDX
EXT
5
STX
EXT
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
5
SUB
IX2
5
CMP
IX2
5
SBC
IX2
5
CPX
IX2
5
AND
IX2
5
BIT
IX2
5
LDA
IX2
6
STA
IX2
5
EOR
IX2
5
ADC
IX2
5
ORA
IX2
5
ADD
IX2
4
JMP
IX2
7
JSR
IX2
5
LDX
IX2
6
STX
IX2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
4
SUB
IX1 1
4
CMP
IX1 1
4
SBC
IX1 1
4
CPX
IX1 1
4
AND
IX1 1
4
BIT
IX1 1
4
LDA
IX1 1
5
STA
IX1 1
4
EOR
IX1 1
4
ADC
IX1 1
4
ORA
IX1 1
4
ADD
IX1 1
3
JMP
IX1 1
6
JSR
IX1 1
4
LDX
IX1 1
5
STX
IX1 1
3
SUB
0
IX
3
1
CMP
IX
3
2
SBC
IX
3
3
CPX
IX
3
4
AND
IX
3
5
BIT
IX
3
LDA
6
IX
4
7
STA
IX
3
8
EOR
IX
3
9
ADC
IX
3
A
ORA
IX
3
B
ADD
IX
2
JMP
C
IX
5
D
JSR
IX
3
E
LDX
IX
4
F
STX
MSB of Opcode in Hexadecimal
5 Number of Cycles
BRSET0 Opcode Mnemonic
3
DIR Number of Bytes/Addressing Mode
MSB
LSB
IX
Instruction Set
Technical Data
164
Table 12-7. Opcode Map
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 13. Electrical Specifications
13.1 Contents
13.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
13.3
Maximum Ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
13.4
Operating Temperature Range. . . . . . . . . . . . . . . . . . . . . . . . 167
13.5
Thermal Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
13.6
Power Considerations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
13.7
5.0-Volt DC Electrical Characteristics. . . . . . . . . . . . . . . . . . .169
13.8
3.3-Volt DC Electrical Characteristics . . . . . . . . . . . . . . . . . .170
13.9
5.0-Volt Control Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
13.10 3.3-Volt Control Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
13.11 5.0-Volt Serial Peripheral Interface (SPI) Timing . . . . . . . . . . 179
13.12 3.3-Volt Serial Peripheral Interface (SPI) Timing . . . . . . . . . . 181
13.2 Introduction
This section contains electrical and timing specifications.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Electrical Specifications
Technical Data
165
Electrical Specifications
13.3 Maximum Ratings
Maximum ratings are the extreme limits to which the MCU can be
exposed without permanently damaging it.
The MCU contains circuitry to protect the inputs against damage from
high static voltages; however, do not apply voltages higher than those
shown in the table here. Keep VIn and VOut within the range
VSS ≤ (VIn or VOut) ≤ VDD. Connect unused inputs to the appropriate
voltage level, either VSS or VDD.
Rating(1)
Symbol
Value
Unit
Supply voltage
VDD
–0.3 to +7.0
V
Input voltage
VIn
VSS –0.3
to VDD +0.3
V
Programming voltage
VPP
VDD –0.3
to 16.0
Bootstrap mode (IRQ pin only)
VIn
VSS – 0.3
to 2 x VDD + 0.3
V
Current drain per pin excluding
VDD and VSS
I
25
mA
TSTG
–65 to +150
°C
Storage temperature range
1. Voltages referenced to VSS
NOTE:
Technical Data
166
This device is not guaranteed to operate properly at the maximum
ratings. Refer to 13.7 5.0-Volt DC Electrical Characteristics and
13.8 3.3-Volt DC Electrical Characteristics for guaranteed operating
conditions.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Electrical Specifications
MOTOROLA
Electrical Specifications
Operating Temperature Range
13.4 Operating Temperature Range
Rating(1)
Symbol
Value
Unit
TA
TL to TH
– 40 to + 85
°C
Symbol
Value
Unit
Operating temperature range(2)
MC68HC705C4ACB
MC68HC705C4ACFB
MC68HC705C4ACP
MC68HC705C4ACFN
1. Voltages referenced to VSS
2. C = Extended temperature range (– 40°C to + 85°C)
P = Plastic dual in-line package (PDIP)
B = Plastic shrink dual in-line package (SDIP)
FN = Plastic-leaded chip carrier (PLCC)
FB = Quad flat pack (QFP)
13.5 Thermal Characteristics
Characteristic
Thermal resistance
Plastic dual in-line package (DIP)
Plastic leaded chip carrier (PLCC)
Quad flat pack (QFP)
Plastic shrink DIP (SDIP)
60
70
95
60
θJA
°C/W
VDD = 4.5 V
VDD
Pins
R2
(SEE TABLE)
TEST
POINT
C
(SEE TABLE)
R1
(SEE TABLE)
PA7–PA0
PB7–PB0
PC7–PC0
PD4–PD1
R1
R2
C
3.26 kΩ
2.38 kΩ
50 pF
R1
R2
C
10.91 kΩ
6.32 kΩ
50 pF
6 kΩ
6 kΩ
200 pF
VDD = 3.0 V
Pins
PA7–PA0
PB7–PB0
PC7–PC0
PD4–PD1
PD7, PD5, PD0
Figure 13-1. Equivalent Test Load
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Electrical Specifications
Technical Data
167
Electrical Specifications
13.6 Power Considerations
The average chip junction temperature, TJ, in °C can be obtained from:
TJ = TA + (PD x θJA)
(1)
Where:
TA = ambient temperature in °C
θJA = package thermal resistance, junction to ambient in °C/W
PD = PINT + PI/O
PINT = ICC × VCC = chip internal power dissipation
PI/O = power dissipation on input and output pins (user-determined)
For most applications, PI/O < PINT and can be neglected.
Ignoring PI/O, the relationship between PD and TJ is approximately:
K
PD =
(2)
TJ + 273°C
Solving equations (1) and (2) for K gives:
= PD x (TA + 273°C) + θJA x (PD)2
(3)
where K is a constant pertaining to the particular part. K can be
determined from equation (3) by measuring PD (at equilibrium) for a
known TA. Using this value of K, the values of PD and TJ can be obtained
by solving equations (1) and (2) iteratively for any value of TA.
Technical Data
168
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Electrical Specifications
MOTOROLA
Electrical Specifications
5.0-Volt DC Electrical Characteristics
13.7 5.0-Volt DC Electrical Characteristics
Characteristic(1)
Symbol
Min
Typ(2)
Max
Unit
Output voltage, ILoad ≤ 10.0 µA
VOL
VOH
—
VDD – 0.1
—
—
0.1
—
V
Output high voltage
ILoad = –0.8 mA, PA7–PA0, PB7–PB0, PC6–PC0, TCMP
(see Figure 13-2)
ILoad = –1.6 mA, PD4–PD1 (see Figure 13-3)
ILoad = –5.0 mA, PC7
VOH
VDD – 0.8
—
—
—
—
—
—
Output low voltage (see Figure 13-4)
ILoad = 1.6 mA
PA7–PA0, PB7–PB0, PC6–PC0, PD4–PD1
ILoad = 20 mA, PC7
VOL
—
—
—
—
0.4
0.4
VIH
0.7 x VDD
—
VDD
V
VIL
VSS
—
0.2 x VDD
V
EPROM programming voltage
VPP
14.5
14.75
15.0
V
EPROM/OTPROM programming current
IPP
—
5
10
mA
User mode current
IPP
—
—
± 10
mA
Data-retention mode (0°C to 70°C)
VRM
2.0
—
—
V
—
—
5.0
1.95
7.0
3.0
mA
mA
—
—
5.0
5.0
50
50
µµA
µµA
IIL
—
—
± 10
µA
IIn
—
—
±1
µA
COut
CIn
—
—
—
—
12
8
pF
Input high voltage
PA7–PA0, PB7–PB0, PC7–PC0, PD5–PD0, PD7,
TCAP, IRQ, RESET, OSC1
Input low voltage
PA7–PA0, PB7–PB0, PC7–PC0, PD5–PD0, PD7,
TCAP, IRQ, RESET, OSC1
V
V
(3)
Supply current
Run(4)
Wait(5)
Stop(6)
25°C
–40°C to +85°C
I/O ports hi-z leakage current
PA7–PA0, PB7–PB0, PC7–PC0, PD4–PD1, PD7, RESET
Input current, IRQ, TCAP, OSC1, PD0, PD5
Capacitance
Ports (as input or output)
RESET, IRQ, TCAP, PD0–PD5, PD7
IDD
1. VDD = 5 V ± 10%; VSS = 0 Vdc, TA = TL to TH unless otherwise noted.
2. Typical values reflect average measurements at midpoint of voltage range at 25°C.
3. IDD measured with port B pullup devices disabled.
4. Run (operating) IDD measured using external square wave clock source (fOSC = 4.2 MHz). All inputs 0.2 V from rail. No dc
loads. Less than 50 pF on all outputs. CL = 20 pF on OSC2. OSC2 capacitance linearly affects run IDD.
5. Wait IDD measured using external square wave clock source (fOSC = 4.2 MHz). All inputs 0.2 V from rail. No dc loads. Less
than 50 pF on all outputs. CL = 20 pF on OSC2. VIL = 0.2 V, VIH = VDD – 0.2 V. All ports configured as inputs. SPI and SCI
disabled. If SPI and SCI enabled, add 10% current draw. OSC2 capacitance linearly affects wait IDD.
6. Stop IDD measured with OSC1 = V DD. All ports configured as inputs. VIL = 0.2 V, VIH = VDD – 0.2 V.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Electrical Specifications
Technical Data
169
Electrical Specifications
13.8 3.3-Volt DC Electrical Characteristics
Characteristic(1)
Symbol
Min
Typ(2)
Max
Unit
Output voltage, ILoad ≤ 10.0 µA
VOL
VOH
—
VDD – 0.1
—
—
0.1
—
V
Output high voltage
ILoad = –0.2 mA
PA7–PA0, PB7–PB0, PC6–PC0, TCMP
(see Figure 13-2)
ILoad = –0.4 mA
PD4–PD1 (see Figure 13-3)
ILoad = –1.5 mA
PC7
VOH
VDD – 0.3
—
—
—
—
—
—
Output low voltage (see Figure 13-4)
ILoad = 0.4 mA
PA7–PA0, PB7–PB0, PC6–PC0, PD4–PD1
ILoad = 6.0 mA
PC7
VOL
—
—
0.3
—
—
0.3
Input high voltage
PA7–PA0, PB7–PB0, PC7–PC0, PD5–PD0,
PD7, TCAP, IRQ, RESET, OSC1
VIH
0.7 x VDD
—
VDD
V
Input low voltage
PA7–PA0, PB7–PB0, PC7–PC0, PD5–PD0,
PD7, TCAP, IRQ, RESET, OSCI
VIL
VSS
—
0.2 x VDD
V
Data-retention mode (0°C to 70°C)
VRM
2.0
—
—
V
Supply current(3)
Run(4)
Wait(5)
Stop(6)
IDD
—
—
—
1.53
0.711
2.0
3.0
1.0
20
mA
mA
µA
I/O ports hi-z leakage current
PA7–PA0, PB7–PB0, PC7–PC0, PD4–PD1,
PD7, RESET
IIL
—
—
± 10
µA
Input current
IRQ, TCAP, OSC1, PD5, PD0
IIn
—
—
±1
µA
V
V
1. VDD = 3.3 V ± 10%; VSS = 0 Vdc, TA = TL to TH unless otherwise noted.
2. Typical values at midpoint of voltage range, 25°C only.
3. IDD measured with port B pullup devices disabled.
4. Run (operating) IDD measured using external square wave clock source (fOSC = 2.0 MHz). All inputs 0.2 V from rail. No dc
loads. Less than 50 pF on all outputs. CL = 20 pF on OSC2. OSC2 capacitance linearly affects run IDD.
5. Wait IDD measured using external square wave clock source (fOSC = 2.0 MHz). All inputs 0.2 V from rail. No dc loads. Less
than 50 pF on all outputs. C L = 20 pF on OSC2. V IL = 0.2 V, VIH = VDD – 0.2 V. All ports configured as inputs. SPI and SCI
disabled. If SPI and SCI enabled, add 10% current draw. OSC2 capacitance linearly affects wait IDD.
6. Stop IDD measured with OSC1 = V DD. All ports configured as inputs. VIL = 0.2 V; VIH = VDD – 0.2 V.
Technical Data
170
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Electrical Specifications
MOTOROLA
Electrical Specifications
3.3-Volt DC Electrical Characteristics
5.0
4.0
V DD
=5
.0 V
IOH (mA)
3.0
2.0
V DD
= 3.
0V
SEE NOTE 1
1.0
0.8
SEE NOTE 2
0.2
0
0
0.2
0.4
0.6
0.8
VDD – VOH (VOLTS)
Notes:
1. At VDD = 5.0 V, devices are specified and tested for (VDD – VOH )
≤ 800 mV @ IOH = –0.8 mA.
2. At VDD = 3.3 V, devices are specified and tested for (VDD – VOH )
≤ 300 mV @ IOH = –0.2 mA.
(a) VOH versus IOH for Ports A, B, PC6–PC0, and TCMP
8.0
6.0
IOH (mA)
V
.0
=5
V DD
4.0
2.0
1.6
V DD
.0
=3
SEE NOTE 1
V
SEE NOTE 2
0.4
0
0
0.2
0.4
0.6
VDD – VOH (VOLTS)
Notes:
1. At VDD = 5.0 V, devices are specified and tested for
(V DD – VOH) ≤ 800 mV @ IOH = –1.6 mA.
2. At VDD = 3.3 V, devices are specified and tested for
(V DD – VOH) ≤ 300 mV @ IOH = –0.4 mA.
(b) VOH versus IOH for PD4–PD1
Figure 13-2. Typical Voltage Compared to Current
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Electrical Specifications
Technical Data
171
Electrical Specifications
6.0
5.0
4.0
IOL (MA)
V DD
=5
.0
V
3.0
V DD
2.0
.0
=3
V
SEE NOTE 1
1.6
1.0
SEE NOTE 2
0.4
0
0
0.1
0.2
0.3
0.4
VOL (VOLTS)
Notes:
1. At VDD = 5.0 V, devices are specified and tested for
VOL ≤ 400 mV @ IOL = 1.6 mA.
2. At VDD = 3.3 V, devices are specified and tested for
VOL ≤ 300 mV @ IOL = 0.4 mA.
(c) VOL versus IOL for All Ports Except PC7
Figure 13-2. Typical Voltage Compared to Current (Continued)
Technical Data
172
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Electrical Specifications
MOTOROLA
Electrical Specifications
3.3-Volt DC Electrical Characteristics
2.0
1.8
1.6
=5
.0
V
1.4
DD
V
IDD (mA)
1.2
1.0
0.8
0.6
=3
0.4
.3
V
V DD
0.2
0.0
0.0
0.5
1.0
1.5
INTERNAL FREQUENCY 1 tCYC (MHz)
2.0
(a) Wait Mode
5.5
5.0
4.5
=5
.0
V
4.0
V
DD
3.5
IDD (mA)
3.0
2.5
2.0
1.5
1.0
V DD
=3
V
.3
0.5
0.0
0.0
0.5
1.0
1.5
INTERNAL FREQUENCY 1 tCYC (MHz)
2.0
(b) Run Mode
Figure 13-3. Typical Current versus Internal
Frequency for Run and Wait Modes
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Electrical Specifications
Technical Data
173
Electrical Specifications
3.0 mA
T = –40°C to 85°C
VDD = 3.3 V ± 10%
2.5 mA
SUPPLY CURRENT (IDD)
D
2.0 mA
N
RU
1.5 mA
G
TIN
RA
E
P
(O
)ID
1.0 mA
WAIT
I DD
500 mA
(20 µA)
STOP IDD
0
0
250 kHz
500 kHz
750 kHz
1 MHz
INTERNAL CLOCK FREQUENCY (XTAL ÷ 2)
(a) Maximum Current Drain versus Frequency @ 3.3 V ± 10 %
7.0 mA
T = –40°C to 85°C
VDD = 5.0 V ± 10%
6.0 mA
SUPPLY CURRENT (IDD)
5.0 mA
4.0 mA
N
RU
(O
PE
G
TIN
A
R
)ID
D
3.0 mA
WA
2.0 mA
IT I DD
1.0 mA
STOP IDD
(50 µA)
0
0
500 kHz
1 MHz
1.5 MHz
2 MHz
INTERNAL CLOCK FREQUENCY (XTAL ÷ 2)
(b) Maximum Current Drain versus Frequency @ 5 V ± 10%
Figure 13-4. Total Current Drain versus Frequency
Technical Data
174
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Electrical Specifications
MOTOROLA
Electrical Specifications
5.0-Volt Control Timing
13.9 5.0-Volt Control Timing
Characteristic(1)
Symbol
Min
Max
Unit
Frequency of operation
Crystal option
External clock option
fOSC
—
dc
4.2
4.2
MHz
Internal operating frequency
Crystal (fOSC ÷ 2)
External clock (fOSC ÷ 2)
fOP
—
dc
2.1
2.1
MHz
Cycle time (see Figure 13-7)
tCYC
480
—
ns
Crystal oscillator startup time (see Figure 13-7)
tOXOV
—
100
ms
Stop recovery startup time (crystal oscillator)
(see Figure 13-6)
tILCH
—
100
ms
tRL
8
—
tCYC
Timer
Resolution(2)
Input capture pulse width (see Figure 13-5)
Input capture pulse period (see Figure 13-5)
tRESL
tTH, tTL
tTLTL
4.0
125
(3)
—
—
—
tCYC
ns
tCYC
Interrupt pulse width low (edge-triggered)
(see Figure 4-2. External Interrupt Timing)
tILIH
125
—
ns
Interrupt pulse period
(see Figure 4-2. External Interrupt Timing)
tILIL
(4)
—
tCYC
tOH, tOL
90
—
ns
RESET pulse width (see Figure 13-7)
OSC1 pulse width
1. V DD = 5.0 Vdc ± 10%, V SS = 0 Vdc; TA = TL to TH
2. Since a 2-bit prescaler in the timer must count four internal cycles (tCYC), this is the limiting minimum factor in determining
the timer resolution.
3. The minimum period, tTLTL, should not be less than the number of cycle times it takes to execute the capture interrupt service routine plus 24 tCYC.
4. The minimum period, tILIL, should not be less than the number of cycle times it takes to execute the interrupt service routine
plus 19 tCYC.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Electrical Specifications
Technical Data
175
Electrical Specifications
13.10 3.3-Volt Control Timing
Characteristic(1)
Symbol
Min
Max
Unit
Frequency of operation
Crystal option
External clock option
fOSC
—
dc
2.0
2.0
MHz
Internal operating frequency
Crystal (fOSC ÷ 2)
External clock (fOSC ÷ 2)
fOP
—
dc
1.0
1.0
MHz
Cycle time (see Figure 13-7)
tCYC
1000
—
ns
Crystal oscillator startup time (see Figure 13-7)
tOXOV
—
100
ms
Stop recovery startup time (crystal oscillator)
(see Figure 13-6)
tILCH
—
100
ms
tRL
8
—
tCYC
Timer
Resolution(2)
Input capture pulse width (see Figure 13-5)
Input capture pulse period (see Figure 13-5)
tRESL
tTH, tTL
tTLTL
4.0
250
(3)
—
—
—
tCYC
ns
tCYC
Interrupt pulse width low (edge-triggered)
(see Figure 4-2. External Interrupt Timing)
tILIH
250
—
ns
Interrupt pulse period
(see Figure 4-2. External Interrupt Timing)
tILIL
(4)
—
tCYC
tOH, tOL
200
—
ns
RESET pulse width, excluding power-up
(see Figure 13-7)
OSC1 pulse width
1. V DD = 3.3 Vdc ± 0.3 Vdc, VSS = 0 Vdc; TA = TL to TH
2. Since a 2-bit prescaler in the timer must count four internal cycles (tCYC), this is the limiting minimum factor in determining
the timer resolution.
3. The minimum period, tTLTL, should not be less than the number of cycle times it takes to execute the capture interrupt service routine plus 24 tCYC.
4. The minimum period, tILIL, should not be less than the number of cycle times it takes to execute the interrupt service routine
plus 19 tCYC.
tTLTL*
tTH*
tTL*
EXTERNAL SIGNAL
(TCAP PIN 37)
*
Refer to timer resolution data in Figure 13-6 and Figure 13-7.
Figure 13-5. Timer Relationships
Technical Data
176
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Electrical Specifications
MOTOROLA
Electrical Specifications
3.3-Volt Control Timing
(1)
OSC1
RESET
IRQ(2)
IRQ
(3)
tRL
tILIH
tILCH
4064 tCYC
INTERNAL
CLOCK
INTERNAL
ADDRESS
BUS
1FFE
1FFE
1FFE
1FFE
1FFF(4)
RESET OR INTERRUPT
VECTOR FETCH
Notes:
1. Represents the internal gating of the OSC1 pin
2. IRQ pin edge-sensitive option
3. IRQ pin level and edge-sensitive option
4. RESET vector address shown for timing example
Figure 13-6. Stop Recovery Timing Diagram
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Electrical Specifications
Technical Data
177
Electrical Specifications
Technical Data
178
tVDDR
VDD
VDD THRESHOLD (1-2 V TYPICAL)
OSC1*
tOXOV
tCYC
MOTOROLA
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Electrical Specifications
INTERNAL
PROCESSOR
CLOCK
INTERNAL
ADDRESS
BUS **
1FFE
1FFF
NEW PC
INTERNAL
DATA
BUS ***
NEW
PCH
NEW
PCL
OP
CODE
1FFE
1FFE
1FFE
1FFE
1FFF
NEW PC
PCH
PCL
OP
CODE
tRL
RESET
* * *
* OSC1 line is not meant to represent frequency. It is only used to represent time.
** Internal timing signal and bus information are not available externally.
*** The next rising edge of the internal processor clock following the rising edge of RESET initiates the reset sequence.
Figure 13-7. Power-On Reset and External Reset Timing Diagram
Electrical Specifications
5.0-Volt Serial Peripheral Interface (SPI) Timing
13.11 5.0-Volt Serial Peripheral Interface (SPI) Timing
Number(1)
Characteristic(2)
Symbol
Min
Max
Unit
Operating frequency
Master
Slave
fOP(M)
fOP(S)
dc
dc
0.5
2.1
fOP
MHz
1
Cycle time
Master
Slave
tCYC(M)
tCYC(S)
2.0
480
—
—
tCYC
ns
2
Enable lead time
Master
Slave
tLead(M)
tLead(S)
(3)
ns
240
—
—
Enable lag time
Master
Slave
tLag(M)
tLag(S)
—
—
ns
720
3
(2)
4
Clock (SCK) high time
Master
Slave
tW(SCKH)M
tW(SCKH)S
340
190
—
—
ns
5
Clock (SCK) low time
Master
Slave
tW(SCKL)M
tW(SCKL)S
340
190
—
—
ns
6
Data setup time (inputs)
Master
Slave
tSU(M)
tSU(S)
100
100
—
—
ns
7
Data hold time (inputs)
Master
Slave
tH(M)
tH(S)
100
100
—
—
ns
8
Access time(4)
Slave
tA
0
120
ns
9
Disable time(5)
Slave
tDIS
—
240
ns
10
Data Valid time
Master (before capture edge)
Slave (after enable edge)(6)
tV(M)
tV(S)
0.25
—
—
240
tCYC(M)
ns
Continued
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Electrical Specifications
Technical Data
179
Electrical Specifications
Number(1)
Characteristic(2)
Symbol
Min
Max
Unit
tHO(M)
tHO(S)
0.25
0
—
—
tCYC(M)
ns
11
Data hold time (outputs)
Master (after capture edge)
Slave (after enable edge)
12
Rise time(7)
SPI outputs (SCK, MOSI, MISO)
SPI inputs (SCK, MOSI, MISO, SS)
tR(M)
tR(S)
—
—
100
2.0
ns
µs
13
Fall time(8)
SPI outputs (SCK, MOSI, MISO)
SPI inputs (SCK, MOSI, MISO, SS)
tF(M)
tF(S)
—
—
100
2.0
ns
µs
1. Numbers refer to dimensions in Figure 13-8. SPI Master Timing and Figure 13-9. SPI Slave Timing.
2. V DD = 5.0 Vdc ± 10%
3. Signal production depends on software.
4. Time to data active from high-impedance state
5. Hold time to high-impedance state
6. With 200 pF on all SPI pins
7. 20% of V DD to 70% of VDD; CL = 200 pF
8. 70% of V DD to 20% of VDD; CL = 200 pF
Technical Data
180
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Electrical Specifications
MOTOROLA
Electrical Specifications
3.3-Volt Serial Peripheral Interface (SPI) Timing
13.12 3.3-Volt Serial Peripheral Interface (SPI) Timing
Number(1)
Characteristic(2)
Symbol
Min
Max
Unit
Operating frequency
Master
Slave
fOP(M)
fOP(S)
dc
0.5
2.1
fOP
MHz
1
Cycle time
Master
Slave
tCYC(M)
tCYC(S)
2.0
1
—
—
tCYC
ns
2
Enable lead time
Master
Slave
tLead(M)
tLead(S)
(3)
ns
500
—
—
Enable lag time
Master
Slave
tLag(M)
tLag(S)
—
—
ns
1500
3
(2)
4
Clock (SCK) high time
Master
Slave
tW(SCKH)M
tW(SCKH)S
720
400
—
—
ns
5
Clock (SCK) low time
Master
Slave
tW(SCKL)M
tW(SCKL)S
720
400
—
—
ns
6
Data setup time (inputs)
Master
Slave
tSU(M)
tSU(S)
200
200
—
—
ns
7
Data hold time (inputs)
Master
Slave
tH(M)
tH(S)
200
200
—
—
ns
8
Access time(4)
Slave
tA
0
250
ns
9
Disable time(5)
Slave
tDIS
—
500
ns
10
Data valid time
Master (before capture edge)
Slave (after enable edge)(6)
tV(M)
tV(S)
0.25
—
—
500
tCYC(M)
ns
Continued
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Electrical Specifications
Technical Data
181
Electrical Specifications
Number(1)
Characteristic(2)
Symbol
Min
Max
Unit
tHO(M)
tHO(S)
0.25
0
—
—
tCYC(M)
ns
11
Data hold time (outputs)
Master (after capture edge)
Slave (after enable edge)
12
Rise time(7)
SPI outputs (SCK, MOSI, MISO)
SPI inputs (SCK, MOSI, MISO, SS)
tR(M)
tR(S)
—
—
200
2.0
ns
µs
13
Fall time(8)
SPI outputs (SCK, MOSI, MISO)
SPI inputs (SCK, MOSI, MISO, SS)
tF(M)
tF(S)
—
—
200
2.0
ns
µs
1. Numbers refer to dimensions in Figure 13-8. SPI Master Timing and Figure 13-9. SPI Slave Timing.
2. V DD = 3.3 Vdc ± 10%
3. Signal production depends on software.
4. Time to data active from high-impedance state
5. Hold time to high-impedance state
6. With 200 pF on all SPI pins
7. 20% of V DD to 70% of VDD; CL = 200 pF
8. 70% of V DD to 20% of VDD; CL = 200 pF
Technical Data
182
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Electrical Specifications
MOTOROLA
Electrical Specifications
3.3-Volt Serial Peripheral Interface (SPI) Timing
SS
INPUT
SS pin of master held high.
12
1
SCK (CPOL = 0)
OUTPUT
13
12
5
NOTE
4
12
SCK (CPOL = 1)
OUTPUT
13
5
NOTE
4
6
MISO
INPUT
MSB IN
BITS 6–1
10
11
MOSI
OUTPUT
7
LSB IN
10
MASTER MSB OUT
11
BITS 6–1
MASTER LSB OUT
13
12
Note: This first clock edge is generated internally, but is not seen at the SCK pin.
a) SPI Master Timing (CPHA = 0)
SS
INPUT
SS pin of master held high.
1
SCK (CPOL = 0)
OUTPUT
13
12
5
NOTE
4
12
SCK (CPOL = 1)
OUTPUT
13
5
NOTE
4
6
MISO
INPUT
MSB IN
10
BITS 6–1
11
MOSI
OUTPUT
MASTER MSB OUT
7
LSB IN
10
BITS 6–1
13
11
MASTER LSB OUT
12
Note: This last clock edge is generated internally, but is not seen at the SCK pin.
b) SPI Master Timing (CPHA = 1)
Figure 13-8. SPI Master Timing
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Electrical Specifications
Technical Data
183
Electrical Specifications
SS
INPUT
1
SCK (CPOL = 0)
(INPUT
13
12
12
13
3
11
5
4
2
SCK (CPOL = 1)
INPUT
5
4
8
MISO
INPUT
SLAVE
MSB OUT
6
MOSI
OUTPUT
BITS 6–1
7
SLAVE LSB OUT
NOTE
11
10
MSB IN
9
BITS 6–1
LSB IN
Note: Not defined, but normally MSB of character just received
a) SPI Slave Timing (CPHA = 0)
SS
INPUT
13
1
SCK (CPOL = 0)
INPUT
12
5
4
2
3
SCK (CPOL = 1)
INPUT
8
MISO
OUTPUT
MOSI
INPUT
5
4
10
NOTE
12
SLAVE
MSB OUT
6
7
13
BITS 6–1
10
MSB IN
9
SLAVE LSB OUT
11
BITS 6–1
LSB IN
Note: Not defined, but normally LSB of character previously transmitted
b) SPI Slave Timing (CPHA = 1)
Figure 13-9. SPI Slave Timing
Technical Data
184
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Electrical Specifications
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 14. Mechanical Specifications
14.1 Contents
14.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
14.3
40-Pin Plastic Dual In-Line Package (PDIP). . . . . . . . . . . . . .186
14.4
42-Pin Shrink Dual In-Line Package (SDIP) . . . . . . . . . . . . . .186
14.5
44-Lead Plastic-Leaded Chip Carrier (PLCC) . . . . . . . . . . . . 187
14.6
44-Pin Quad Flat Pack (QFP). . . . . . . . . . . . . . . . . . . . . . . . . 188
14.2 Introduction
Package dimensions available at the time of this publication for the
MC68HC705C4A are provided in this section. The packages are:
•
40-pin plastic dual in-line package (PDIP)
•
42-pin shrink dual in-line package (SDIP)
•
44-lead plastic-leaded chip carrier (PLCC)
•
44-pin quad flat pack (QFP)
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Mechanical Specifications
Technical Data
185
Mechanical Specifications
14.3 40-Pin Plastic Dual In-Line Package (PDIP)
40
NOTES:
1.POSITION TOLERANCE OF LEADS (D), SHA
BEWITHIN 0.25 (0.010) AT MAXIMUM MATE
CONDITIONS, IN RELATION TO SEATING P
AND EACH OTHER.
2.DIMENSION L TO CENTER OF LEADS WHE
FORMED PARALLEL.
3.DIMENSION B DOES NOT INCLUDE MOLD
21
B
1
20
DIM
A
B
C
D
F
G
H
J
K
L
M
N
L
A
C
N
J
H
G
F
K
D
M
SEATING
PLANE
MILLIMETERS
MIN
MAX
51.69
52.45
13.72
14.22
3.94
5.08
0.36
0.56
1.02
1.52
2.54 BSC
1.65
2.16
0.20
0.38
2.92
3.43
15.24 BSC
1°
0°
0.51
1.02
INCHES
MIN
MAX
2.035
2.065
0.540
0.560
0.155
0.200
0.014
0.022
0.040
0.060
0.100 BSC
0.065
0.085
0.008
0.015
0.115
0.135
0.600 BSC
0°
1°
0.020
0.040
Figure 14-1. MC68HC705C4AP Package Dimensions (Case #711)
14.4 42-Pin Shrink Dual In-Line Package (SDIP)
-A42
NOTES:
1. DIMENSIONS AND TOLERANCING PER ANSI
Y14.5M, 1982.
2. CONTROLLING DIMENSION: INCH.
3. DIMENSION L TO CENTER OF LEAD WHEN
FORMED PARALLEL.
4. DIMENSIONS A AND B DO NOT INCLUDE MOLD
FLASH. MAXIMUM MOLD FLASH 0.25 (0.010).
22
-B1
21
L
DIM
A
B
C
D
F
G
H
J
K
L
M
N
H
C
-TSEATING
PLANE
0.25 (0.010)
N
G
F
D 42 PL
K
M
T A
S
M
J 42 PL
0.25 (0.010)
M
T B
INCHES
MIN
MAX
1.435 1.465
0.540 0.560
0.155 0.200
0.014 0.022
0.032 0.046
0.070 BSC
0.300 BSC
0.008 0.015
0.115 0.135
0.600 BSC
0°
15°
0.020 0.040
MILLIMETERS
MIN
MAX
36.45 37.21
13.72 14.22
5.08
3.94
0.56
0.36
1.17
0.81
1.778 BSC
7.62 BSC
0.38
0.20
3.43
2.92
15.24 BSC
15°
0°
1.02
0.51
S
Figure 14-2. MC68HC705C4AB Package Dimensions (Case #858)
Technical Data
186
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Mechanical Specifications
MOTOROLA
Mechanical Specifications
44-Lead Plastic-Leaded Chip Carrier (PLCC)
14.5 44-Lead Plastic-Leaded Chip Carrier (PLCC)
-N-
Y BRK
0.007(0.180) M T
B
D
L-M S
0.007(0.180) M T
U
N S
L-M
S
N S
Z
-M-
-L-
V
44
X
D
W
1
G1
0.010 (0.25) S T
L-M S
N S
VIEW D-D
A
0.007(0.180) M T
L-M
S
N S
R
0.007(0.180) M T
L-M
S
N S
0.007(0.180) M T
H
L-M S
N S
Z
J
K1
E
0.004 (0.10)
G
C
-TG1
0.010 (0.25) S T
L-M S
N S
K
SEATING
PLANE
F
VIEW S
0.007(0.180) M T
L-M S
N S
VIEW S
NOTES:
1. DATUMS -L-, -M-, AND -N- ARE DETERMINED
WHERE TOP OF LEAD SHOLDERS EXITS
PLASTIC BODY AT MOLD PARTING LINE.
2. DIMENSION G1, TRUE POSITION TO BE
MEASURED AT DATUM -T-, SEATING PLANE.
3. DIMENSION R AND U DO NOT INCLUDE MOLD
FLASH. ALLOWABLE MOLD FLASH IS 0.010
(0.25) PER SIDE.
4. DIMENSIONING AND TOLERANCING PER ANSI
Y14.5M, 1982.
5. CONTROLLING DIMENSION: INCH.
6. THE PACKAGE TOP MAY BE SMALLER THAN
THE PACKAGE BOTTOM BY UP TO 0.012
(0.300). DIMENSIONS R AND U ARE DETERMINED
AT THE OUTERMOST EXTREMES OF THE
PLASTIC BODY EXCLUSIVE OF THE MOLD
FLASH, TIE BAR BURRS, GATE BURRS AND
INTERLEAD FLASH, BUT INCLUDING ANY
MISMATCH BETWEEN THE TOP AND BOTTOM
OF THE PLASTIC BODY.
7. DIMINSION H DOES NOT INCLUDE DAMBAR
PROTRUSION OR INTRUSION. THE DAMBAR
PROTUSION(S) SHALL NOT CAUSE THE H
DIMINSION TO BE GREATER THAN 0.037
(0.940188). THE DAMBAR INTRUSION(S) SHALL
NOT CAUSE THE H DIMINISION TO SMALLER
THAN 0.025 (0.635).
INCHES
DIM
A
B
C
E
F
G
H
J
K
R
U
V
W
X
Y
Z
G1
K1
MIN
MAX
0.685
0.695
0.685
0.695
0.165
0.180
0.090
0.110
0.013
0.019
0.050 BSC
0.026
0.032
0.020
0.025
0.650
0.656
0.650
0.656
0.042
0.048
0.042
0.048
0.042
0.056
0.020
2°
10°
0.610
0.630
0.040
MILLIMETERS
MIN
MAX
17.40
17.65
17.40
17.65
4.20
4.57
2.29
2.79
0.33
0.48
1.27 BSC
0.66
0.81
0.51
0.64
16.51
16.66
16.51
16.66
1.07
1.21
1.07
1.21
1.07
1.42
0.50
2°
10°
15.50
16.00
1.02
Figure 14-3. MC68HC705C4AFN Package Dimensions (Case #777)
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Mechanical Specifications
Technical Data
187
Mechanical Specifications
14.6 44-Pin Quad Flat Pack (QFP)
L
33
23
DETAIL A
S
S
D
D
S
V
H A-B
B
-A,B,DB
M
-B-
B
0.20 (0.008)
-AL
S
22
0.20 (0.008) M C A-B
0.05 (0.002) A-B
34
DETAIL A
44
12
1
11
F
-DA
0.20 (0.008) M C A-B
0.05 (0.002) A-B
S
0.20 (0.008) M H A-B
BASE METAL
S
D
S
S
D
S
N
J
D
M
DETAIL C
0.20 (0.008)
M
C A-B
S
D
S
SECTION B–B
C E
-H-
0.01 (0.004)
-CSEATING
PLANE
H
M
G
M
T
DATUM
PLANE
DATUM
PLANE
-H-
R
K
W
X
DETAIL C
Q
NOTES:
1. DIMENSIONING AND TOLERANCING PER ANSI
Y14.5M, 1982.
2. CONTROLLING DIMENSION: MILLIMETER.
3. DATUM PLANE ĆHĆ IS LOCATED AT BOTTOM OF
LEAD AND IS COINCIDENT WITH THE LEAD WHERE
THE LEAD EXITS THE PLASTIC BODY AT THE
BOTTOM OF THE PARTING LINE.
4. DATUMS ĆAĆ, ĆBĆ AND ĆDĆ TO BE DETERMINED AT
DATUM PLANE ĆHĆ.
5. DIMENSIONS S AND V TO BE DETERMINED AT
SEATING PLANE ĆCĆ.
6. DIMENSIONS A AND B DO NOT INCLUDE MOLD
PROTRUSION. ALLOWABLE PROTRUSION IS 0.25
(0.010) PER SIDE. DIMENSIONS A AND B DO
INCLUDE MOLD MISMATCH AND ARE DETERMINED
AT DATUM PLANE ĆHĆ.
7. DIMENSION D DOES NOT INCLUDE DAMBAR
PROTRUSION. ALLOWABLE DAMBAR PROTRUSION
SHALL BE 0.08 (0.003) TOTAL IN EXCESS OF THE D
DIMENSION AT MAXIMUM MATERIAL CONDITION.
DAMBAR CANNOT BE LOCATED ON THE LOWER
RADIUS OR THE FOOT.
DIM
A
B
C
D
E
F
G
H
J
K
L
M
N
Q
R
S
T
U
V
W
X
MILLIMETERS
MIN
MAX
9.90 10.10
9.90 10.10
2.45
2.10
0.45
0.30
2.10
2.00
0.40
0.30
0.80 BSC
0.25
Ċ
0.23
0.13
0.95
0.65
8.00 REF
10°
5°
0.17
0.13
7°
0°
0.30
0.13
12.95 13.45
Ċ
0.13
Ċ
0°
12.95 13.45
Ċ
0.40
1.6 REF
INCHES
MIN
MAX
0.390 0.398
0.390 0.398
0.083 0.096
0.012 0.018
0.079 0.083
0.012 0.016
0.031 BSC
0.010
Ċ
0.005 0.009
0.026 0.037
0.315 REF
10°
5°
0.005 0.007
7°
0°
0.005 0.012
0.510 0.530
Ċ
0.005
Ċ
0°
0.510 0.530
Ċ
0.016
0.063 REF
Figure 14-4. MC68HC705C4AFB Package Dimensions (Case #824E)
Technical Data
188
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Mechanical Specifications
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Section 15. Ordering Information
15.1 Contents
15.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
15.3
MCU Order Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
15.2 Introduction
This section contains ordering information for the available package
types.
15.3 MCU Order Numbers
Table 15-1 lists the MC order numbers.
Table 15-1. MC68HC705C4A Order Numbers
Temperature
Range
Order Number
40-pin plastic dual in-line
package (PDIP)
–40°C to +85°C
MC68HC705C4AC (1)P(2)
42-pin shrink dual in-line
package (SDIP)
–40°C to +85°C
MC68HC705C4ACB(3)
44-lead plastic-leaded
chip carrier (PLCC)
–40°C to +85°C
MC68HC705C4ACFN (4)
44-pin quad flat
pack (QFP)
–40°C to +85°C
MC68HC705C4ACFB(5)
Package Type
1. C = Extended temperature range (–40°C to +85°C)
2. P = Plastic dual in-line package (PDIP)
3. B = Shrink dual in-line package (SDIP)
4. FN = Plastic-leaded chip carrier (PLCC)
5. FB = Quad flat pack (QFP)
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Ordering Information
Technical Data
189
Ordering Information
Technical Data
190
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Ordering Information
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Appendix A. MC68HSC705C4A
A.1 Contents
A.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
A.3
5.0-Volt High-Speed DC Electrical Characteristics. . . . . . . . .192
A.4
3.3-Volt High-Speed DC Electrical Characteristics . . . . . . . . 193
A.5
5.0-Volt High-Speed Control Timing . . . . . . . . . . . . . . . . . . . . 194
A.6
3.3-Volt High-Speed Control Timing . . . . . . . . . . . . . . . . . . . . 194
A.7
5.0-Volt High-Speed SPI Timing . . . . . . . . . . . . . . . . . . . . . . 195
A.8
3.3-Volt High-Speed SPI Timing. . . . . . . . . . . . . . . . . . . . . . .197
A.9
Ordering Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
A.2 Introduction
The MC68HSC705C4A is an enhanced, high-speed version of the
MC68HC705C4A, featuring a 4-MHz bus speed.
The data in this document applies to the MC68HSC705C4A with the
exceptions given in this appendix.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
MC68HSC705C4A
Technical Data
191
MC68HSC705C4A
A.3 5.0-Volt High-Speed DC Electrical Characteristics
Characteristic(1)
Typ(2)
Max
—
—
—
—
—
—
—
—
0.4
—
—
0.4
—
—
5.92
2.27
14
7.0
mA
mA
—
—
5
2.0
50
50
µA
µA
Symbol
Min
Output high voltage
ILoad = –0.8 mA
PA7–PA0, PB7–PB0, PC6–PC0, TCMP
ILoad = –1.6 mA
PD4–PD1
ILoad –5.0 mA
PC7
VOH
VDD – 0.8
Output low voltage
ILoad = 1.6 mA
PA7–PA0, PB7–PB0, PC6–PC0, PD4–PD1
ILoad = 20 mA
PC7
VOL
Supply current(3)
Run(4)
(5)
Wait
Stop(6)
25°C
–40°C to +85°C
IDD
Unit
V
V
1. VDD = 5 V ± 10%; VSS = 0 Vdc, TA = TL to TH unless otherwise noted.
2. Typical values reflect average measurements at midpoint of voltage range at 25°C.
3. IDD measured with port B pullup devices disabled.
4. Run (operating) IDD measured using external square wave clock source (fOSC = 8.0 MHz). All inputs 0.2 V from rail. No dc
loads. Less than 50 pF on all outputs. CL = 20 pF on OSC2. OSC2 capacitance linearly affects run IDD.
5. Wait IDD measured using external square wave clock source (fOSC = 8.0 MHz). All inputs 0.2 V from rail. No dc loads. Less
than 50 pF on all outputs. CL = 20 pF on OSC2. VIL = 0.2 V, VIH = VDD – 0.2 V. All ports configured as inputs. SPI and SCI
disabled. If SPI and SCI enabled, add 10% current draw. OSC2 capacitance linearly affects wait IDD.
6. Stop IDD measured with OSC1 = V DD. All ports configured as inputs. VIL = 0.2 V, VIH = VDD – 0.2 V.
Technical Data
192
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MC68HSC705C4A
MOTOROLA
MC68HSC705C4A
3.3-Volt High-Speed DC Electrical Characteristics
A.4 3.3-Volt High-Speed DC Electrical Characteristics
Characteristic(1)
Typ(2)
Max
—
—
—
—
—
—
—
—
0.3
—
—
0.3
—
—
—
1.91
0.915
2.0
6.0
2.0
20
Symbol
Min
Output high voltage
ILoad = –0.2 mA
PA7–PA0, PB7–PB0, PC6–PC0, TCMP
ILoad = –0.4 mA
PD4–PD1
ILoad = –1.5 mA
PC7
VOH
VDD – 0.3
Output low voltage
ILoad = 0.4 mA
PA7–PA0, PB7–PB0, PC6–PC0, PD4–PD1
ILoad = 6.0 mA
PC7
VOL
Supply current(3)
Run(4)
Wait(5)
Stop(6)
IDD
Unit
V
V
mA
mA
µA
1. VDD = 3.3 V ± 10%; VSS = 0 Vdc, TA = TL to TH unless otherwise noted.
2. Typical values reflect average measurements at midpoint of voltage range at 25°C.
3. IDD measured with port B pullup devices disabled.
4. Run (operating) IDD measured using external square wave clock source (fOSC = 4.2 MHz). All inputs 0.2 V from rail. No dc
loads. Less than 50 pF on all outputs. CL = 20 pF on OSC2. OSC2 capacitance linearly affects run IDD.
5. Wait IDD measured using external square wave clock source (fOSC = 4.2 MHz). All inputs 0.2 V from rail. No dc loads. Less
than 50 pF on all outputs. C L = 20 pF on OSC2. V IL = 0.2 V, VIH = VDD – 0.2 V. All ports configured as inputs. SPI and SCI
disabled. If SPI and SCI enabled, add 10% current draw. OSC2 capacitance linearly affects wait IDD.
6. Stop IDD measured with OSC1 = V DD. All ports configured as inputs. VIL = 0.2 V; VIH = VDD – 0.2 V.
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
MC68HSC705C4A
Technical Data
193
MC68HSC705C4A
A.5 5.0-Volt High-Speed Control Timing
Characteristic(1)
Symbol
Min
Max
Unit
Oscillator frequency
Crystal oscillator
External clock
fOSC
—
dc
8.0
8.0
MHz
Internal operating frequency (fOSC ÷ 2)
Crystal oscillator
External clock
fOP
—
dc
4.0
4.0
MHz
Cycle time
tCYC
250
—
ns
tTH, tTL
65
—
ns
tILIH
65
—
ns
tOH, tOL
45
—
ns
Symbol
Min
Max
Unit
Oscillator frequency
Crystal oscillator
External clock
fOSC
—
dc
4.0
4.0
MHz
Internal operating frequency (fOSC ÷ 2)
Crystal oscillator
External clock
fOP
—
dc
2.0
2.0
MHz
Cycle time
tCYC
476
—
ns
tTH, tTL
125
—
ns
tILIH
125
—
ns
tOH, tOL
90
—
ns
Input capture pulse width
Interrupt pulse width low (edge-triggered)
OSC1 pulse width
1. VDD = 5 V ± 10%; VSS = 0 Vdc, TA = TL to TH unless otherwise noted.
A.6 3.3-Volt High-Speed Control Timing
Characteristic(1)
Input capture pulse width
Interrupt pulse width low (edge-triggered)
OSC1 pulse width
1. VDD = 3.3 V ± 10%; VSS = 0 Vdc, TA = TL to TH unless otherwise noted.
Technical Data
194
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MC68HSC705C4A
MOTOROLA
MC68HSC705C4A
5.0-Volt High-Speed SPI Timing
A.7 5.0-Volt High-Speed SPI Timing
Diagram
Number(1)
Characteristic(2)
Operating frequency
Master
Slave
Symbol
Min
Max
Unit
fOP(S)
fOP(S)
dc
dc
0.5
4.0
fOP
MHz
1
Cycle time
Master
Slave
tCYC(M)
tCYC(S)
2.0
250
—
—
tCYC
ns
2
Enable lead time
Master
Slave
tLead(M)
tLead(S)
Note (3)
125
—
—
ns
3
Enable lag time
Master
Slave
tLag(M)
tLag(S)
Note(2)
375
—
—
ns
4
Clock (SCK) high time
Master
Slave
tW(SCKH)M
tW(SCKH)S
170
95
—
—
ns
5
Clock (SCK) low time
Master
Slave
tW(SCKL)M
tW(SCKL)S
170
95
—
—
ns
6
Data setup time (inputs)
Master
Slave
tSU(M)
tSU(S)
50
50
—
—
ns
7
Data hold time (inputs)
Master
Slave
tH(M)
tH(S)
50
50
—
—
ns
8
Access time(4)
Slave
tA
0
60
ns
9
Disable time(5)
Slave
tDIS
—
120
ns
tV(M)
tV(S)
0.25
—
—
120
tCYC(M)
ns
10
Data valid time
Master (before capture edge)
(6)
Slave (after enable edge)
Continued
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
MC68HSC705C4A
Technical Data
195
MC68HSC705C4A
Diagram
Number(1)
Characteristic(2)
Symbol
Min
Max
Unit
tHO(M)
tHO(S)
0.25
0
—
—
tCYC(M)
ns
11
Data hold time (outputs)
Master (after capture edge)
Slave (after enable edge)
12
Rise time(7)
SPI outputs (SCK, MOSI, MISO)
SPI inputs (SCK, MOSI, MISO, SS)
tRM
tRS
—
—
50
2.0
ns
µs
13
Fall time(8)
SPI outputs (SCK, MOSI, MISO)
SPI inputs (SCK, MOSI, MISO, SS)
tFM
tFS
—
—
50
2.0
ns
µs
1. Diagram numbers refer to dimensions in Figure 13-8. SPI Master Timing and Figure 13-9. SPI Slave Timing.
2. VDD = 5 V ± 10%; VSS = 0 Vdc, TA = TL to TH unless otherwise noted.
3. Signal production depends on software.
4. Time to data active from high-impedance state
5. Hold time to high-impedance state
6. With 200 pF on all SPI pins.
7. 20% of VDD to 70% of VDD; CL = 200 pF
8. 70% of VDD to 20% of VDD; CL = 200 pF
Technical Data
196
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MC68HSC705C4A
MOTOROLA
MC68HSC705C4A
3.3-Volt High-Speed SPI Timing
A.8 3.3-Volt High-Speed SPI Timing
Diagram
Number(1)
Characteristic(2)
Operating frequency
Master
Slave
Symbol
Min
Max
Unit
fOP(S)
fOP(S)
dc
dc
0.5
2.1
fOP
MHz
1
Cycle time
Master
Slave
tCYC(M)
tCYC(S)
2.0
480
—
—
tCYC
ns
2
Enable lead time
Master
Slave
tLead(M)
tLead(S)
Note (3)
240
—
—
ns
3
Enable lag time
Master
Slave
tLag(M)
tLag(S)
Note(2)
720
—
—
ns
4
Clock (SCK) high time
Master
Slave
tW(SCKH)M
tW(SCKH)S
340
190
—
—
ns
5
Clock (SCK) low time
Master
Slave
tW(SCKL)M
tW(SCKL)S
340
190
—
—
ns
6
Data setup time (inputs)
Master
Slave
tSU(M)
tSU(S)
100
100
—
—
ns
7
Data hold time (inputs)
Master
Slave
tH(M)
tH(S)
100
100
—
—
ns
8
Access time(4)
Slave
tA
0
120
9
Disable time(5)
Slave
tDIS
—
240
10
Data valid time
Master (before capture edge)
Slave (after enable edge)(6)
tV(M)
tV(S)
0.25
—
—
240
ns
ns
tCYC(M)
ns
Continued
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
MC68HSC705C4A
Technical Data
197
MC68HSC705C4A
Diagram
Number(1)
Characteristic(2)
Symbol
Min
Max
Unit
tHO(M)
tHO(S)
0.25
0
—
—
tCYC(M)
ns
11
Data hold time (outputs)
Master (after capture edge)
Slave (after enable edge)
12
Rise time(7)
SPI outputs (SCK, MOSI, MISO)
SPI inputs (SCK, MOSI, MISO, SS)
tRM
tRS
—
—
100
2.0
ns
µs
13
Fall time(8)
SPI outputs (SCK, MOSI, MISO)
SPI inputs (SCK, MOSI, MISO, SS)
tFM
tFS
—
—
100
2.0
ns
µs
1. Diagram numbers refer to dimensions in Figure 13-8. SPI Master Timing and Figure 13-9. SPI Slave Timing.
2. VDD = 3.3 V ± 10%; VSS = 0 Vdc, TA = TL to TH unless otherwise noted.
3. Signal production depends on software.
4. Time to data active from high-impedance state
5. Hold time to high-impedance state
6. With 200 pF on all SPI pins
7. 20% of VDD to 70% of VDD; CL = 200 pF
8. 70% of VDD to 20% of VDD; CL = 200 pF
Technical Data
198
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MC68HSC705C4A
MOTOROLA
MC68HSC705C4A
Ordering Information
A.9 Ordering Information
Table A-1 provides ordering information for the MC68HSC705C4A.
Table A-1. MC68HSC705C4A Order Numbers
Temperature
Range
Order Number
40-pin plastic dual in-line
package (PDIP)
–40°C to +85°C
MC68HSC705C4AC(1)P(2)
44-lead plastic-leaded chip
carrier (PLCC)
–40°C to +85°C
MC68HSC705C4ACFN (3)
44-pin quad flat pack (QFP)
–40°C to +85°C
MC68HSC705C4ACFB (4)
42-pin shrink dual in-line
package (SDIP)
–40°C to +85°C
MC68HSC705C4ACB(5)
Package Type
1. C = Extended temperature range (–40°C to +85°C)
2. P = Plastic dual in-line package (PDIP)
3. FN = Plastic-leaded chip carrier (PLCC)
4. FB = Quad flat pack (QFP)
5. B = Shrink dual in-line package (SDIP)
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
MC68HSC705C4A
Technical Data
199
MC68HSC705C4A
Technical Data
200
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MC68HSC705C4A
MOTOROLA
Technical Data — MC68HC705C4A • MC68HSC705C4A
Index
A
accumulator (A) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45, 148, 149, 152
addressing modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
arithmetic/logic unit (ALU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
B
block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
bootloader ROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
C
C bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
central processor unit (CPU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
condition code register (CCR) . . . . . . . . . . . . . . . . . . . . . . . . . . 48, 154
COP watchdog
in stop mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
in wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
timeout formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
CPU
instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
instruction types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
programming model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
CPU registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149, 152, 157
accumulator (A) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148, 149, 152
condition code register (CCR) . . . . . . . . . . . . . . . . . . . . . . . . . . 154
index register (X) . . . . . . . . . . . . . . . . 148, 149, 150, 150, 150, 152
program counter (PC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151, 154
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Index
201
Index
D
data-retention mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
E
electrical specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
control timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
DC electrical characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
power considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
electrical specifications (high-speed part)
control timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194, 194
DC electrical characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
SPI timing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
EPROM/OTPROM (PROM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37, 99
control registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
EPROM erasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
mask option register 1 (MOR1) . . . . . . . . . . . . . . . . . . . . . 113, 114
option register (Option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
preprogramming steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
program register (PROG). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
MC68HC05PGMR programmer board . . . . . . . . . . . . . . . . . 100
programming circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
programming flowchart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
programming routines . . . . . . . . . . . . . . . . . . . . . . . . 104, 104, 107
F
features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
I
I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36, 73
data direction register A (DDRA) . . . . . . . . . . . . . . . . . . . . . . . . . 75
data direction register B (DDRB) . . . . . . . . . . . . . . . . . . . . . . . . . 78
data direction register C (DDRC) . . . . . . . . . . . . . . . . . . . . . . . . . 82
port A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
port A data register (PORTA). . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Technical Data
202
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Index
MOTOROLA
Index
port A I/O logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
port A pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
port B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
port B data register (PORTB). . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
port B I/O logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
port B pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
port C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
port C data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
port C I/O logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
port C pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
port D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
I/O bits
C bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
I/O register summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
index register (X) . . . . . . . . . . . . . . . . 45, 148, 149, 150, 150, 150, 152
instruction set
addressing modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
instruction types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
interrupt processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
flowchart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
reset/interrupt vector addresses. . . . . . . . . . . . . . . . . . . . . . . . . . 60
stacking order. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
external interrupt (IRQ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
edge- and level-triggering . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
internal function diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
timing diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
interrupt sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
masking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
port B interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
enabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55, 55
port B I/O logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
SCI interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
software interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
SPI interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
timer interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
IRQ pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Index
203
Index
J
junction temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
L
low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
data-retention mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
stop mode
SCI during stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SPI during stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
stop/wait mode function flowchart. . . . . . . . . . . . . . . . . . . . . .
wait mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
COP watchdog in wait mode . . . . . . . . . . . . . . . . . . . . . . . . .
67
72
69
69
68
70
70
M
mask option registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
MC68HSC705C8A (high-speed part)
control timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
DC electrical characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
SPI timing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
mechanical specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
memory
bootloader ROM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
I/O register summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35, 38
PROM (EPROM/OTPROM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35, 38
O
opcode map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
ordering information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
order numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
OSC1 pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
OSC2 pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Technical Data
204
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Index
MOTOROLA
Index
oscillator
ceramic resonator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
crystal resonator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
external clock signal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
P
pin assignments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
port A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33, 74
data direction register A (DDRA) . . . . . . . . . . . . . . . . . . . . . . . . . 75
port A data register (PORT A) . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
port A I/O logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
port A pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
port B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33, 77
data direction register B (DDRB) . . . . . . . . . . . . . . . . . . . . . . . . . 78
port B data register (PORTB). . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
port B I/O logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
port B pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
port C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33, 81
data direction register C (DDRC) . . . . . . . . . . . . . . . . . . . . . . . . . 82
port C data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
port C I/O logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
port C pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
port D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33, 84
power dissipation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168, 168
program counter (PC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47, 151, 154
programmable options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
programming model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
PROM (EPROM/OTPROM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
R
RAM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
registers
I/O register summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
registers (control)
mask option register 1 (MOR1) . . . . . . . . . . . . . . . . . . . . . 113, 114
option register (Option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
reset and interrupt processing flowchart . . . . . . . . . . . . . . . . . . . . . . 62
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Index
205
Index
RESET pin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
resets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
COP watchdog reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
external reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
power-on reset (POR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
reset sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ROM (bootloader) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
32
63
64
64
64
63
37
S
serial communications interface (SCI). . . . . . . . . . . . . . . . . . . . . . . 115
baud rate generator clock prescaling . . . . . . . . . . . . . . . . . . . . . 130
baud rate register (baud) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
baud rate selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
baud rate selection examples . . . . . . . . . . . . . . . . . . . . . . . . . . 132
during stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
SCI control register 1 (SCCR1) . . . . . . . . . . . . . . . . . . . . . . . . . 124
SCI control register 2 (SCCR2) . . . . . . . . . . . . . . . . . . . . . . . . . 125
SCI data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
SCI data register (SCDR). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
SCI I/O registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
SCI interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
SCI operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
SCI receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
SCI status register (SCSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
SCI transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
serial peripheral interface (SPI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
during stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
master/slave connections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
multiple-SPI systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
pin functions in master mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
pin functions in slave mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
serial clock polarity and phase . . . . . . . . . . . . . . . . . . . . . . . . . . 140
SPI block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
SPI clock/data timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
SPI control register (SPCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
SPI data register (SPDR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Technical Data
206
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Index
MOTOROLA
Index
SPI error conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
SPI I/O register summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
SPI I/O registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
SPI interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
SPI operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
SPI status register (SPSR). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
stack pointer (SP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
stop mode
effect on COP watchdog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
SCI during stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
SPI during stop mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
stop/wait mode function flowchart . . . . . . . . . . . . . . . . . . . . . . . . 68
T
TCAP pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
TCMP pin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
thermal resistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
timer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
alternate timer registers (ATRH and ATRL) . . . . . . . . . . . . . . . . . 94
I/O registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
input capture registers (ICRH and ICRL) . . . . . . . . . . . . . . . . . . . 96
output compare registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
timer block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
timer control register (TCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
timer I/O register summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
timer interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
timer operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
timer registers (TRH and TRL). . . . . . . . . . . . . . . . . . . . . . . . . . . 93
timer status register (TSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
V
VDD pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
VSS pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
MOTOROLA
Technical Data
Index
207
Index
W
wait mode
stop/wait mode function flowchart . . . . . . . . . . . . . . . . . . . . . . . . 68
Technical Data
208
MC68HC705C4A • MC68HSC705C4A — Rev. 3.0
Index
MOTOROLA
HOW TO REACH US:
USA/EUROPE/LOCATIONS NOT LISTED:
Motorola Literature Distribution;
P.O. Box 5405, Denver, Colorado 80217
1-303-675-2140 or 1-800-441-2447
JAPAN:
Motorola Japan Ltd.; SPS, Technical Information Center,
3-20-1, Minami-Azabu Minato-ku, Tokyo 106-8573 Japan
81-3-3440-3569
ASIA/PACIFIC:
Motorola Semiconductors H.K. Ltd.;
Silicon Harbour Centre, 2 Dai King Street,
Tai Po Industrial Estate, Tai Po, N.T., Hong Kong
852-26668334
TECHNICAL INFORMATION CENTER:
1-800-521-6274
Information in this document is provided solely to enable system and software
implementers to use Motorola products. There are no express or implied copyright
licenses granted hereunder to design or fabricate any integrated circuits or
integrated circuits based on the information in this document.
Motorola reserves the right to make changes without further notice to any products
herein. Motorola makes no warranty, representation or guarantee regarding the
suitability of its products for any particular purpose, nor does Motorola assume any
HOME PAGE:
http://www.motorola.com/semiconductors
liability arising out of the application or use of any product or circuit, and specifically
disclaims any and all liability, including without limitation consequential or incidental
damages. “Typical” parameters which may be provided in Motorola data sheets
and/or specifications can and do vary in different applications and actual
performance may vary over time. All operating parameters, including “Typicals”
must be validated for each customer application by customer’s technical experts.
Motorola does not convey any license under its patent rights nor the rights of
others. Motorola products are not designed, intended, or authorized for use as
components in systems intended for surgical implant into the body, or other
applications intended to support or sustain life, or for any other application in which
the failure of the Motorola product could create a situation where personal injury or
death may occur. Should Buyer purchase or use Motorola products for any such
unintended or unauthorized application, Buyer shall indemnify and hold Motorola
and its officers, employees, subsidiaries, affiliates, and distributors harmless
against all claims, costs, damages, and expenses, and reasonable attorney fees
arising out of, directly or indirectly, any claim of personal injury or death associated
with such unintended or unauthorized use, even if such claim alleges that Motorola
was negligent regarding the design or manufacture of the part.
Motorola and the Stylized M Logo are registered in the U.S. Patent and Trademark
Office. digital dna is a trademark of Motorola, Inc. All other product or service
names are the property of their respective owners. Motorola, Inc. is an Equal
Opportunity/Affirmative Action Employer.
© Motorola, Inc. 2002
MC68HC705C4A/D