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://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.
memory.
Figure 2-2. Control, Status, and Data Registers — Corrected bit def in iti o ns
for Port A Data Register (PTA) and Data Direction Register A (DDRA).
Table 13-3. Interrupt Sources — Corrected vector addresses for keyboard
interrupt and ADC conversion complete interrupt.
Section 13. System Integration Module (SIM) — Removed reference to break
status register as it is duplicated in break module.
11.3.1 Internal Oscillator and 11.3.1.1 Internal Oscillator Trimming —
Clarified oscillator trim option ordering information and what to expect with
untrimmed device.
Figure 11-5. Oscillator Trim Register (OSCTRIM) — Bit 1 designation
corrected.
Figure 15-13. Monitor Mode Circuit (Internal Clock, No High Voltage) —
0.1
Diagram updated for clarity.
Figure 12-1. I/O Port Register Summary — Corrected bit definitions for PTA7,
DDRA7, and DDRA6.
Description
Page
Number(s)
21
28
28
124
113
97
104
160
105
Figure 12-2. Port A Data Register (PTA) — Corrected bit definition for PTA7.106
Figure 12-3. Data Direction Register A (DDRA) — Corrected bit definitions for
DDRA7 and DDRA6.
Figure 12-6. Port B Data Register (PTB) — Corrected bit definition for PTB1109
Section 9. Keyboard Interrupt Module (KBI) — Section reworked after
deletion of auto wakeup for clarity.
Section 4. Auto Wakeup Module (AWU) — New section added for clarity.49
Figure 10-1. LVI Module Block Diagram — Corrected LVI stop representation.91
Section 16. Electrical Specification s — Extensive changes made to electrical
specifications.
17.5 8-Pin Dual Flat No Lead (DFN) Package (Case #1452) — Added case
outline drawing for DFN package.
Section 17. Ordering Information and Mechanical Specifications — Added
ordering information for DFN package.
January,
2003
Data SheetMC68HC908QY/QT Family — Rev. 3
0.24.2 Features — Corrected third bulleted item.49
107
83
169
187
185
4Revision HistoryMOTOROLA
Revision History (Continued)
Revision History
Date
August,
2003
Revision
Level
1.0
Description
Reformatted to meet latest M68HC08 documentation standardsN/A
Figure 1-1. Block Diagram — Diagram redrawn to include keyboard interrupt
module and TCLK pin designator.
Figure 1-2. MCU Pin Assignments — Added TCLK pin designator.21
Table 1-2. Pin Functions — Added TCLK pin description.22
Table 1-3. Function Priority in Shared Pins — Revised table for clarity and to
add TCLK.
Figure 2-1. Memory Map — Corrected names for the IRQ status and control
register (INTSCR) bits 3–0.
3.7.3 ADC Input Clock Register — Clarified bit description for the ADC clock
prescaler bits.
4.3 Functional Description — Updated periodic wakeup request values.51
Figure 6-1. COP Block Diagram — Reworked for clarity59
Section 8. External Interrupt (IRQ) — Corrected bit names for MODE, IRQF,
The MC68HC908QY4 is a member of the low-cost, high-performance M68HC08
Family of 8-bit microcontroller units (MCUs). The M68HC08 Family is a Complex
Instruction Set Computer (CISC) with a Von Neumann architecture. All MCUs in
the family use the enhanced M68HC08 central processor unit (CPU08) and are
available with a variety of modules, memory sizes and types, and package types.
•Fully upward-compatible object code with M68HC05 Family
•5-V and 3-V operating voltages (V
DD
)
•8-MHz internal bus operation at 5 V, 4-MHz at 3 V
•Trimmable internal oscillator
–3.2 MHz internal bus operation
–8-bit trim capability allows 0.4% accuracy
(1)
–± 25% untrimmed
Pin
Count
•Auto wakeup from STOP capability
•Configuration (CONFIG) register for MCU configuration options, including:
–Low-voltage inhibit (LVI) trip point
1. The oscillator frequency is guaranteed to ±5% over temperature and voltage range after trimming.
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAGeneral Description17
General Description
•In-system FLASH programming
•FLASH security
(1)
•On-chip in-application programmable FLASH memory (with internal
program/erase voltage generation)
–MC68HC908QY4 and MC68HC908QT4 — 4096 bytes
–MC68HC908QY2, MC68HC908QY1, MC68HC908QT2, and
MC68HC908QT1 — 1536 bytes
•128 bytes of on-chip random-access memory (RAM)
•2-channel, 16-bit timer interface module (TIM)
•4-channel, 8-bit analog-to-digital converter (ADC) on MC68HC908QY2,
MC68HC908QY4, MC68HC908QT2, and MC68HC908QT4
•5 or 13 bidirectional input/output (I/O) lines and one input only:
–Six shared with keyboard interrupt function and ADC
–Two shared with timer channels
–One shared with external interrupt (IRQ)
–Eight extra I/O lines on 16-pin package only
–High current sink/source capability on all port pins
–Selectable pullups on all ports, selectable on an individual bit basis
–Three-state ability on all port pins
•6-bit keyboard interrupt with wakeup feature (KBI)
•Low-voltage inhibit (LVI) module features:
–Software selectable trip point in CONFIG register
•System protection features:
–Computer operating properly (COP) watchdog
–Low-voltage detection with reset
–Illegal opcode detection with reset
–Illegal address detection with reset
1. No security feature is absolutely secure. However, Motorola’s strategy is to make reading or
copying the FLASH difficult for unauthorized users.
Data SheetMC68HC908QY/QT Family — Rev. 3
18General DescriptionMOTOROLA
General Description
MCU Block Diagram
•MC68HC908QY4, MC68HC908QY2, and MC68HC908QY1 are available in
these packages:
–16-pin plastic dual in-line package (PDIP)
–16-pin small outline integrated circuit (SOIC) package
–16-pin thin shrink small outline package (TSSOP)
•MC68HC908QT 4, MC68HC908QT2, and MC68HC908QT1 are available in
these packages:
–8-pin PDIP
–8-pin SOIC
–8-pin dual flat no lead (DFN) package
Features of the CPU08 include the following:
•Enhanced HC05 programming model
•Extensive loop control functions
•16 addressing modes (eight more than the HC05)
•16-bit index register and stack pointer
•Memory-to-memory data transfers
•Fast 8 × 8 multiply instruction
•Fast 16/8 divide instruction
•Binary-coded decimal (BCD) instructions
•Optimization for controller applications
•Efficient C language support
1.3 MCU Block Diagram
Figure 1-1 shows the structure of the MC68HC908QY4.
1.4 Pin Assignments
The MC68HC908QT4, MC68HC908QT2, and MC68HC908QT1 are available in
8-pin packages and the MC68HC908QY4, MC68HC908QY2, and
MC68HC908QY1 in 16-pin packages. Figure 1-2 shows the pin assignment for
these packages.
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAGeneral Description19
General Description
PTA0/AD0/TCH0/KBI0
PTA1/AD1/TCH1/KBI1
PTA2/IRQ
/KBI2/TCLK
PTA3/RST
PTA4/OSC2/AD2/KBI4
PTA5/OSC1/AD3/KBI5
/KBI3
PTB0
PTB1
PTB2
PTB3
PTB4
PTB5
PTB6
PTB7
POWER SUPPLY
PTA
PTB
8-BIT ADC
128 BYTES RAM
DDRA
DDRB
V
DD
V
SS
M68HC08 CPU
MC68HC908QY4 AND MC68HC908QT4
4096 BYTES
MC68HC908QY2, MC68HC908QY1,
MC68HC908QT2, AND MC68HC908QT1:
1536 BYTES
USER FLASH
CLOCK
GENERATOR
(OSCILLATOR)
SYSTEM INTEGRATION
MODULE
SINGLE INTERRUPT
MODULE
BREAK
MODULE
POWER-ON RESET
MODULE
KEYBOARD INTERRUPT
MODULE
16-BIT TIMER
MODULE
COP
MODULE
MONITOR ROM
RST, IRQ: Pins have internal (about 30K Ohms) pull up
PTA[0:5]: High current sink and source capability
PTA[0:5]: Pins have programmable keyboard interrupt and pull up
PTB[0:7]: Not available on 8-pin devices – MC68HC908QT1, MC68HC908QT2, and MC68HC908QT4
ADC: Not available on the MC68HC908QY1 and MC68HC908QT1
Figure 1-1. Block Diagram
Data SheetMC68HC908QY/QT Family — Rev. 3
20General DescriptionMOTOROLA
General Description
Pin Assignments
V
PTA5/OSC1/KBI5
PTA4/OSC2/KBI4
PTA3/RST
/KBI3
V
PTB7
PTB6
PTA5/OSC1/KBI5
PTA4/OSC2/KBI4
PTB5
PTB4
PTA3/RST
/KBI3
DD
1
2
3
4
8
7
6
5
8-PIN ASSIGNMENT
MC68HC908QT1 PDIP/SOIC
1
DD
2
3
4
5
6
7
8
16
15
14
13
12
11
10
9
16-PIN ASSIGNMENT
MC68HC908QY1 PDIP/SOIC
V
SS
PTA0/TCH0/KBI0
PTA1/TCH1/KBI1
PTA2/IRQ/KBI2/TCLK
V
SS
PTB0
PTB1
PTA0/TCH0/KBI0
PTA1/TCH1/KBI1
PTB2
PTB3
/KBI2/TCLK
PTA2/IRQ
V
PTA5/OSC1/AD3/KBI5
PTA4/OSC2/AD2/KBI4
PTA3/RST
/KBI3
1
DD
2
3
4
8-PIN ASSIGNMENT
MC68HC908QT2 AND MC68HC908QT4 PDIP/SOIC
V
PTB7
PTB6
PTA5/OSC1/AD3/KBI5
PTA4/OSC2/AD2/KBI4
PTB5
PTB4
PTA3/RST
/KBI3
1
DD
2
3
4
5
6
7
8
16-PIN ASSIGNMENT
MC68HC908QY2 AND MC68HC908QY4 PDIP/SOIC
V
SS
8
PTA0/AD0/TCH0/KBI0
7
6
PTA1/AD1/TCH1/KBI1
PTA2/IRQ/KBI2/TCLK
5
V
16
SS
15
PTB0
14
PTB1
PTA0/AD0/TCH0/KBI0
13
PTA1/AD1/TCH1/KBI1
12
11
PTB2
10
PTB3
PTA2/IRQ
9
/KBI2/TCLK
PTA0/TCH0/KBI0
PTB1
PTB0
V
V
PTB7
PTB6
PTA5/OSC1/KBI5
PTA0/TCH0/KBI0
PTA5/OSC1/KB15
1
2
3
4
SS
5
DD
6
7
8
16-PIN ASSIGNMENT
MC68HC908QY1 TSSOP
1
2
V
SS
V
3
DD
4
8-PIN ASSIGNMENT
MC68HC908QT1 DFN
PTA1/TCH1/KBI1
16
PTB2
15
PTB3
14
PTA2/IRQ
13
PTA3/RST
12
11
PTB4
10
PTB5
9
PTA4/OSC2/KBI4
8
PTA1/TCH1/KBI1
7
PTA2/IRQ/KBI2/TCLK
6
PTA3/RST
PTA4/OSC2/KBI4
5
/KBI2/TCLK
/KBI3
/KBI3
PTA0/AD0/TCH0/KBI0
PTA5/OSC1/AD3/KBI5
PTA0/AD0/TCH0/KBI0
PTA5//OSC1/AD3/KB15
Figure 1-2. MCU Pin Assignments
PTB1
PTB0
V
V
PTB7
PTB6
1
2
3
4
SS
5
DD
6
7
8
PTA1/AD1/TCH1/KBI1
16
PTB2
15
PTB3
14
PTA2/IRQ
13
PTA3/RST
12
11
PTB4
10
PTB5
9
PTA4/OSC2/AD2/KBI4
16-PIN ASSIGNMENT
MC68HC908QY2 AND MC68HC908QY4 TSSOP
1
V
2
SS
V
3
DD
4
8
PTA1/AD1/TCH1/KBI1
7
PTA2/IRQ/KBI2/TCLK
6
PTA3/RST
PTA4/OSC2/AD2/KBI4
5
8-PIN ASSIGNMENT
MC68HC908QT2 AND MC68HC908QT4 DFN
/KBI2/TCLK
/KBI3
/KBI3
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAGeneral Description21
General Description
1.5 Pin Functions
Table 1-2 provides a description of the pin functions.
Table 1-2. Pin Functions
Pin
Name
V
DD
V
SS
PTA0
PTA1
PTA2
PTA3
DescriptionInput/Output
Pow er supplyPower
Pow er supply groundPower
PTA0 — General purpose I/O portInput/Output
The central processor unit (CPU08) can address 64 Kbytes of memory space. The
memory map, shown in Figure 2-1, includes:
•4096 bytes of user FLASH for MC68HC908QT4 and MC68HC908QY4
•1536 bytes of user FLASH for MC68HC908QT2, MC68HC908QT1,
MC68HC908QY2, and MC68HC908QY1
•128 bytes of random access memory (RAM)
•48 bytes of user-defined vectors, located in FLASH
•416 bytes of monitor read-only memory (ROM)
•1536 bytes of FLASH program and erase routines, located in ROM
2.2 Unimplemented Memory Locations
Section 2. Memory
Accessing an unimplemented location can have unpredictable effects on MCU
operation. In Figure 2-1 and in register figures in this document, unimplemented
locations are shaded.
2.3 Reserved Memory Locations
Accessing a reserved location can have unpredictable effects on MCU operation.
In Figure 2-1 and in register figures in this document, reserved locations are
marked with the word Reserved or with the letter R.
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAMemory25
Memory
$0000
↓
$003F
$0040
↓
$007F
$0080
↓
$00FF
$0100
↓
$27FF
$2800
↓
$2DFF
$2E00
↓
$EDFF
$EE00
↓
$FDFF
$FE00BREAK STATUS REGISTER (BSR)
$FE01RESET STATUS REGISTER (SRSR)
$FE02BREAK AUXILIARY REGISTER (BRKAR)
$FE03BREAK FLAG CONTROL REGISTER (BFCR)
$FE04INTERRUPT STATUS REGISTER 1 (INT1)
$FE05INTERRUPT STATUS REGISTER 2 (INT2)
$FE06INTERRUPT STATUS REGISTER 3 (INT3)
$FE07
$FE08
$FE09BREAK ADDRESS HIGH REGISTER (BRKH)
$FE0ABREAK ADDRESS LOW REGISTER (BRKL)
$FE0BBREAK STATUS AND CONTROL REGISTER (BRKSCR)
$FE0CLVISR
$FE0D
↓
$FE0F
$FE10
↓
$FFAF
$FFB0
↓
$FFBD
$FFBEFLASH BLOCK PROTECT REGISTER (FLBPR)
$FFBF
$FFC0INTERNAL OSCILLATOR TRIM VALUE
$FFC1
$FFC2
↓
$FFCF
$FFD0
↓
$FFFF
RESERVED FOR FLASH TEST CONTROL REGISTER (FLTCR)
MC68HC908QT4 AND MC68HC908QY4
FLASH CONTROL REGISTER (FLCR)
I/O REGISTERS
64 BYTES
RESERVED
64 BYTES
128 BYTES
UNIMPLEMENTED
9984 BYTES
AUXILIARY ROM
1536 BYTES
UNIMPLEMENTED
49152 BYTES
FLASH MEMORY
4096 BYTES
RESERVED FOR FLASH TEST
MONITOR ROM 416 BYTES
14 BYTES
RESERVED FLASH
RESERVED FLASH
14 BYTES
USER VECTORS
48 BYTES
(1)
RAM
(1)
(1)
3 BYTES
FLASH
FLASH
Note 1.
Attempts to execute code from addresses in this
range will generate an illegal address reset.
UNIMPLEMENTED
51712 BYTES
FLASH MEMORY
1536 BYTES
MC68HC908QT1, MC68HC908QT2,
MC68HC908QY1, and MC68HC908QY2
Memory Map
$2E00
↓
$F7FF
$F800
↓
$FDFF
Figure 2-1. Memory Map
Data SheetMC68HC908QY/QT Family — Rev. 3
26MemoryMOTOROLA
2.4 Input/Output (I/O) Section
Addresses $0000–$003F, shown in Figure 2-2, contain most of the control, status,
and data registers. Additional I/O registers have these addresses:
•$FE00 — Break status register, BSR
•$FE01 — Reset status register, SRSR
•$FE02 — Break auxiliary register, BRKAR
•$FE03 — Break flag control register, BFCR
•$FE04 — Interrupt status register 1, INT1
•$FE05 — Interrupt status register 2, INT2
•$FE06 — Interrupt status register 3, INT3
•$FE07 — Reserved
•$FE08 — FLASH control register, FLCR
•$FE09 — Break address register high, BRKH
•$FE0A — Break address register low, BRKL
Memory
Input/Output (I/O) Section
•$FE0B — Break status and control register, BRKSCR
Addresses $0080–$00FF are RAM locations. The location of the stack RAM is
programmable. The 16-bit stack pointer allows the stack to be anywhere in the
64-Kbyte memory space.
NOTE:For correct operation, the stack pointer must point only to RAM locations.
Before processing an interrupt, the central processor unit (CPU) uses five bytes of
the stack to save the contents of the CPU registers.
NOTE:For M6805, M146805, and M68HC05 compatibility, the H register is not stacked.
During a subroutine call, the CPU uses two bytes of the stack to store the return
address. The stack pointer decrements during pushes and increments during pulls.
NOTE:Be careful when using nested subroutines. The CPU may overwrite data in the
RAM during a subroutine or during the interrupt stacking operation.
This subsection describes the operation of the embedded FLASH memory. The
FLASH memory can be read, programmed, and erased from a single external
supply. The program and erase operations are enabled through the use of an
internal charge pump.
The FLASH memory consists of an array of 4096 or 1536 bytes with an additional
48 bytes for user vectors. The minimum size of FLASH memory that can be erased
is 64 bytes; and the maximum size of FLASH memory that can be programmed in
a program cycle is 32 bytes (a row). Program and erase operations are facilitated
through control bits in the FLASH control register (FLCR). Details for these
operations appear later in this section. The address ranges for the user memory
and vectors are:
•$EE00 – $FDFF; user memory, 4096 bytes: MC68HC908QY4 and
MC68HC908QT4
•$F800 – $FDFF; user memory, 1536 bytes: MC68HC908QY2,
MC68HC908QT2, MC68HC908QY1 and MC68HC908QT1
•$FFD0 – $FFFF; user interrupt vectors, 48 bytes.
NOTE:An erased bit reads as a 1 and a programmed bit reads as a 0.
A security feature prevents viewing of the FLASH contents.
2.6.1 FLASH Control Register
The FLASH control register (FLCR) controls FLASH program and erase
operations.
Address:$FE08
Read:0000
Write:
Reset:00000000
HVEN — High Voltage Enable Bit
This read/write bit enables high voltage from the charge pump to the memory
for either program or erase operation. It can only be set if either PGM =1 or
ERASE =1 and the proper sequence for program or erase is followed.
1 = High voltage enabled to array and charge pump on
0 = High voltage disabled to array and charge pump off
(1)
Bit 7654321Bit 0
HVENMASSERASEPGM
Figure 2-3. FLASH Control Register (FLCR)
1. No security feature is absolutely secure. However, Motorola’s strategy is to make reading or
copying the FLASH difficult for unauthorized users.
Data SheetMC68HC908QY/QT Family — Rev. 3
34MemoryMOTOROLA
MASS — Mass Erase Control Bit
This read/write bit configures the memory for mass erase operation.
1 = Mass erase operation selected
0 = Mass erase operation unselected
ERASE — Erase Control Bit
This read/write bit configures the memory for erase operation. ERASE is
interlocked with the PGM bit such that both bits cannot be equal to 1 or set to 1
at the same time.
This read/write bit configures the memory for program operation. PGM is
interlocked with the ERASE bit such that both bits cannot be equal to 1 or set
to 1 at the same time.
1 = Program operation selected
0 = Program operation unselected
2.6.2 FLASH Page Erase Operation
Memory
FLASH Memory (FLASH)
Use the following procedure to erase a page of FLASH memory. A page consists
of 64 consecutive bytes starting from addresses $XX00, $XX40, $XX80, or $XXC0.
The 48-byte user interrupt vectors area also forms a page. Any FLASH memory
page can be erased alone.
1.Set the ERASE bit and clear the MASS bit in the FLASH control register.
2.Read the FLASH block protect register.
3.Write any data to any FLASH location within the address range of the block
to be erased.
4.Wait for a time, t
(minimum10 µs).
NVS
5.Set the HVEN bit.
6.Wait for a time, t
(minimum 1 ms or 4 ms).
Erase
7.Clear the ERASE bit.
8.Wait for a time, t
(minimum5 µs).
NVH
9.Clear the HVEN bit.
10.After time, t
(typical1 µs), the memory can be accessed in read mode
RCV
again.
NOTE:Programming and erasing of FLASH locations cannot be performed by code being
executed from the FLASH memory. While these operations must be performed in
the order as shown, but other unrelated operations may occur between the steps.
CAUTION:A page erase of the vector page will erase the internal oscillator trim value at
$FFC0.
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAMemory35
Memory
In applications that require more than 1000 program/erase cycles, use the 4 ms
page erase specification to get improved long-term reliability. Any application can
use this 4 ms page erase specification. However, in applications where a FLASH
location will be erased and reprogrammed less than 1000 times, and speed is
important, use the 1 ms page erase specification to get a shorter cycle time.
2.6.3 FLASH Mass Erase Operation
Use the following procedure to erase the entire FLASH memory to read as a 1:
1.Set both the ERASE bit and the MASS bit in the FLASH control register.
2.Read the FLASH block protect register.
3.Write any data to any FLASH address
range.
4.Wait for a time, t
5.Set the HVEN bit.
6.Wait for a time, t
7.Clear the ERASE and MASS bits.
(minimum10 µs).
NVS
MErase
(minimum4 ms).
(1)
within the FLASH memory address
NOTE:Mass erase is disabled whenever any block is protected (FLBPR does not equal
$FF).
8.Wait for a time, t
9.Clear the HVEN bit.
10.After time, t
again.
NOTE:Programming and erasing of FLASH locations cannot be performed by code being
executed from the FLASH memory. While these operations must be performed in
the order as shown, but other unrelated operations may occur between the steps.
CAUTION:A mass erase will erase the internal oscillator trim value at $FFC0.
2.6.4 FLASH Program Operation
Programming of the FLASH memory is done on a row basis. A row consists of 32
consecutive bytes starting from addresses $XX00, $XX20, $XX40, $XX60, $XX80,
$XXA0, $XXC0, or $XXE0. Use the following step-by-step procedure to program a
row of FLASH memory
Figure 2-4 shows a flowchart of the programming algorithm.
NOTE:Only bytes which are currently $FF may be programmed.
(minimum100 µs).
NVHL
(typical1 µs), the memory can be accessed in read mode
RCV
1. When in monitor mode, with security sequence failed (see 15.3.2 Security), write to the FLASH
block protect register instead of any FLASH address.
Data SheetMC68HC908QY/QT Family — Rev. 3
36MemoryMOTOROLA
Memory
FLASH Memory (FLASH)
1.Set the PGM bit. This configures the memory for program operation and
enables the latching of address and data for programming.
2.Read the FLASH block protect register.
3.Write any data to any FLASH location within the address range desired.
4.Wait for a time, t
(minimum10 µs).
NVS
5.Set the HVEN bit.
6.Wait for a time, t
7.Write data to the FLASH address being programmed
8.Wait for time, t
(minimum5 µs).
PGS
(minimum30 µs).
PROG
(1)
.
9.Repeat step 7 and 8 until all desired bytes within the row are programmed.
10.Clear the PGM bit
11.Wait for time, t
(1)
.
(minimum5 µs).
NVH
12.Clear the HVEN bit.
13.After time, t
(typical1 µs), the memory can be accessed in read mode
RCV
again.
NOTE:The COP register at location $FFFF should not be written between steps 5–12,
when the HVEN bit is set. Since this register is located at a valid FLASH address,
unpredictable behavior may occur if this location is written while HVEN is set.
This program sequence is repeated throughout the memory until all data is
programmed.
NOTE:Programming and erasing of FLASH locations cannot be performed by code being
executed from the FLASH memory. While these operations must be performed in
the order shown, other unrelated operations may occur between the steps. Do not
exceed t
2.6.5 FLASH Protection
Due to the ability of the on-board charge pump to erase and program the FLASH
memory in the target application, provision is made to protect blocks of memory
from unintentional erase or program operations due to system malfunction. This
protection is done by use of a FLASH block protect register (FLBPR). The FLBPR
determines the range of the FLASH memory which is to be protected. The range
of the protected area starts from a location defined by FLBPR and ends to the
bottom of the FLASH memory ($FFFF). When the memory is protected, the HVEN
bit cannot be set in either ERASE or PROGRAM operations.
NOTE:In performing a program or erase operation, the FLASH block protect register must
be read after setting the PGM or ERASE bit and before asserting the HVEN bit.
maximum, see16.16 Memory Characteristics.
PROG
1. The time between each FLASH address change, or the time between the last FLASH address
programmed to clearing PGM bit, must not exceed the maximum programming time, t
maximum.
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAMemory37
PROG
Memory
Algorithm for Programming
a Row (32 Bytes) of FLASH Memory
1
2
READ THE FLASH BLOCK PROTECT REGISTER
3
WRITE ANY DATA TO ANY FLASH ADDRESS
WITHIN THE ROW ADDRESS RANGE DESIRED
4
5
6
7
WRITE DATA TO THE FLASH ADDRESS
8
SET PGM BIT
WAIT FOR A TIME, t
SET HVEN BIT
WAIT FOR A TIME, t
TO BE PROGRAMMED
WAIT FOR A TIME, t
PROG
NVS
PGS
9
NOTES:
The time between each FLASH address change (step 7 to step 7),
or the time between the last FLASH address programmed
to clearing PGM bit (step 7 to step 10)
must not exceed the maximum programming
PROG
max.
time, t
This row program algorithm assumes the row/s
to be programmed are initially erased.
Figure 2-4. FLASH Programming Flowchart
COMPLETED
PROGRAMMING
THIS ROW?
N
Y
10
11
12
13
CLEAR PGM BIT
WAIT FOR A TIME, t
CLEAR HVEN BIT
WAIT FOR A TIME, t
END OF PROGRAMMING
NVH
RCV
Data SheetMC68HC908QY/QT Family — Rev. 3
38MemoryMOTOROLA
When the FLBPR is programmed with all 0 s, the entire memory is protected from
being programmed and erased. When all the bits are erased (all 1’s), the entire
memory is accessible for program and erase.
When bits within the FLBPR are programmed, they lock a block of memory. The
address ranges are shown in 2.6.6 FLASH Block Protect Register. Once the
FLBPR is programmed with a value other than $FF, any erase or program of the
FLBPR or the protected block of FLASH memory is prohibited. Mass erase is
disabled whenever any block is protected (FLBPR does not equal $FF). The
FLBPR itself can be erased or programmed only with an external voltage, V
present on the IRQ
mode.
2.6.6 FLASH Block Protect Register
The FLASH block protect register is implemented as a byte within the FLASH
memory, and therefore can only be written during a programming sequence of the
FLASH memory. The value in this register determines the starting address of the
protected range within the FLASH memory.
Memory
FLASH Memory (FLASH)
,
TST
pin. This voltage also allows entry from reset into the monitor
Address:$FFBE
Bit 7654321Bit 0
Read:
Write:
Reset:Unaffected by reset. Initial value from factory is 1.
Write to this register is by a programming sequence to the FLASH memory.
BPR7BPR6BPR5BPR4BPR3BPR2BPR1BPR0
Figure 2-5. FLASH Block Protect Register (FLBPR)
BPR[7:0] — FLASH Protection Register Bits [7:0]
These eight bits in FLBPR represent bits [13:6] of a 16-bit memory a ddress. Bits
[15:14] are 1s and bits [5:0] are 0s.
The resultant 16-bit address is used for specifying the start address of the
FLASH memory for block protection. The FLASH is protected from this start
address to the end of FLASH memory, at $FFFF. With this mechanism, the
protect start address can be XX00, XX40, XX80, or XXC0 within the FLASH
memory. See Figure 2-6 and Table 2-2.
and so on...
$DE (1101 1110)$F780 (1111 0111 1000 0000)
$DF (1101 1111)$F7C0 (1111 0111 1100 0000)
$FE (1111 1110)
$FFThe entire FLASH memory is not protected.
$FF80 (1111 1111 1000 0000)
FLBPR, OSCTRIM, and vectors are protected
2.6.8 Stop Mode
NOTE:Standby mode is the power-saving mode of the FLASH module in which all internal
Putting the MCU into wait mode while the FLASH is in read mode does not affect
the operation of the FLASH memory directly, but there will not be any memory
activity since the CPU is inactive.
The WAIT instruction should not be executed while performing a program or erase
operation on the FLASH, or the operation will discontinue and the FLASH will be
on standby mode.
Putting the MCU into stop mode while the FLASH is in read mode does not affect
the operation of the FLASH memory directly, but there will not be any memory
activity since the CPU is inactive.
The STOP instruction should not be executed while performing a program or erase
operation on the FLASH, or the operation will discontinue and the FLASH will be
on standby mode
control signals to the FLASH are inactive and the current consumption of the
FLASH is at a minimum.
Data SheetMC68HC908QY/QT Family — Rev. 3
40MemoryMOTOROLA
Data Sheet — MC68HC908QY/QT Family
Section 3. Analog-to-Digital Converter (ADC)
3.1 Introduction
This section describes the analog-to-digital converter (ADC). The ADC is an 8-bit,
4-channel analog-to-digital converter. The ADC module is only available on the
MC68HC908QY2, MC68HC908QT2, MC68HC908QY4, and MC68HC908QT4.
3.2 Features
Features of the ADC module include:
•4 channels with multiplexed input
•Linear successive approximation with monotonicity
•8-bit resolution
•Single or continuous conversion
•Conversion complete flag or conversion complete interrupt
•Selectable ADC clock frequency
Figure 3-1 provides a summary of the input/output (I/O) registers.
Addr.Register NameBit 7654321Bit 0
ADC Status and Control
$003C
$003DUnimplemented
$003E
$003F
Register (ADSCR)
See page 46.
ADC Data Register
(ADR)
See page 47.
ADC Input Clock Register
(ADICLK)
See page 48.
Read:COCO
Write:
Reset:00011111
Read:AD7AD6AD5AD4AD3AD2AD1AD0
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:00000000
ADIV2ADIV1ADIV0
AIENADCOCH4CH3CH2CH1CH0
00000
= Unimplemented
Figure 3-1. ADC I/O Register Summary
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAAnalog-to-Digital Converter (ADC)41
Analog-to-Digital Converter (ADC)
PTA0/AD0/TCH0/KBI0
PTA1/AD1/TCH1/KBI1
PTA2/IRQ
/KBI2/TCLK
PTA3/RST
PTA4/OSC2/AD2/KBI4
PTA5/OSC1/AD3/KBI5
/KBI3
PTB0
PTB1
PTB2
PTB3
PTB4
PTB5
PTB6
PTB7
POWER SUPPLY
PTA
PTB
8-BIT ADC
128 BYTES RAM
DDRA
DDRB
V
DD
V
SS
M68HC08 CPU
MC68HC908QY4 AND MC68HC908QT4
4096 BYTES
MC68HC908QY2, MC68HC908QY1,
MC68HC908QT2, AND MC68HC908QT1:
1536 BYTES
USER FLASH
CLOCK
GENERATOR
(OSCILLATOR)
SYSTEM INTEGRATION
MODULE
SINGLE INTERRUPT
MODULE
BREAK
MODULE
POWER-ON RESET
MODULE
KEYBOARD INTERRUPT
MODULE
16-BIT TIMER
MODULE
COP
MODULE
MONITOR ROM
RST, IRQ: Pins have internal (about 30K Ohms) pull up
PTA[0:5]: High current sink and source capability
PTA[0:5]: Pins have programmable keyboard interrupt and pull up
PTB[0:7]: Not available on 8-pin devices – MC68HC908QT1, MC68HC908QT2, and MC68HC908QT4
ADC: Not available on the MC68HC908QY1 and MC68HC908QT1
Figure 3-2. Block Diagram Highlighting ADC Block and Pins
Data SheetMC68HC908QY/QT Family — Rev. 3
42Analog-to-Digital Converter (ADC)MOTOROLA
3.3 Functional Description
Four ADC channels are available for sampling external sources at pins PTA0,
PTA1, PTA4, and PTA5. An analog multiplexer allows the single ADC converter to
select one of the four ADC channels as an ADC voltage input (ADCVIN). ADCVIN
is converted by the successive approximation register-based counters. The ADC
resolution is eight bits. When the conversion is completed, ADC puts the result in
the ADC data register and sets a flag or generates an interrupt.
Figure 3-3 shows a block diagram of the ADC.
INTERNAL
DATA BUS
READ DDRA
Analog-to-Digital Converter (ADC)
Functional Description
WRITE DDRA
WRITE PTA
READ PTA
INTERRUPT
LOGIC
AIENCOCO
CONVERSION
COMPLETE
RESET
ADC DATA REGISTER
ADC
DDRAx
PTAx
ADC CLOCK
ADC VOLTAGE IN
ADCVIN
DISABLE
DISABLE
ADC CHANNEL x
CHANNEL
SELECT
(1 OF 4 CHANNELS)
ADCx
CH[4:0]
BUS CLOCK
CLOCK
GENERATOR
ADIV[2:0]
Figure 3-3. ADC Block Diagram
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAAnalog-to-Digital Converter (ADC)43
Analog-to-Digital Converter (ADC)
3.3.1 ADC Port I/O Pins
PTA0, PTA1, PTA4, and PTA5 are general-purpose I/O pins that are shared with
the ADC channels. The channel select bits (ADC status and control register
(ADSCR), $003C), define which ADC channel/port pin will be used as the input
signal. The ADC overrides the port I/O logic by forcing that pin as input to the ADC.
The remaining ADC channels/port pins are controlled by the port I/O logic and can
be used as general-purpose I/O. Writes to the port register or data direction register
(DDR) will not have any affect on the port pin that is selected by the ADC. Read of
a port pin which is in use by the ADC will return a 0 if the corresponding DDR bit is
at 0. If the DDR bit is at 1, the value in the port data latch is read.
3.3.2 Voltage Conversion
When the input voltage to the ADC equals V
(full scale). If the input voltage equals V
voltages between V
voltages will result in $FF if greater than V
NOTE:Input voltage should not exceed the analog supply voltages.
3.3.3 Conversion Time
Sixteen ADC internal clocks are required to perform one conversion. The ADC
starts a conversion on the first rising edge of the ADC internal clock immediately
following a write to the ADSCR. If the ADC internal clock is selected to run at
1 MHz, then one conversion will take 16 µs to complete. With a 1-MHz ADC
internal clock the maximum sample rate is 62.5 kHz.
3.3.4 Continuous Conversion
In the continuous conversion mode (ADCO = 1), the ADC continuously converts
the selected channel filling the ADC data register (ADR) with new data after each
conversion. Data from the previous conversion will be overwritten whether that
data has been read or not. Conversions will continue until the ADCO bit is cleared.
The COCO bit (ADSCR, $003C) is set after each conversion and will stay set until
the next read of the ADC data register.
, the ADC converts the signal to $FF
DD
the ADC converts it to $00. Input
SS,
and V
DD
Conversion Time =
Number of Bus Cycles = Conversion Time × Bus Frequency
are a straight-line linear conversion. All other input
SS
and $00 if less than VSS.
DD
16 ADC Clock Cycles
ADC Clock Frequency
When a conversion is in process and the ADSCR is written, the current conversion
data should be discarded to prevent an incorrect reading.
3.3.5 Accuracy and Precision
The conversion process is monotonic and has no missing codes.
Data SheetMC68HC908QY/QT Family — Rev. 3
44Analog-to-Digital Converter (ADC)MOTOROLA
3.4 Interrupts
When the AIEN bit is set, the ADC module is capable of generating a central
processor unit (CPU) interrupt after each ADC conversion. A CPU interrupt is
generated if the COCO bit is at 0. The COCO bit is not used as a conversion
complete flag when interrupts are enabled.
3.5 Low-Power Modes
The following subsections describe the ADC in low-power modes.
3.5.1 Wait Mode
The ADC continues normal operation during wait mode. Any enabled CPU interrupt
request from the ADC can bring the microcontroller unit (MCU) out of wait mode. If
the ADC is not required to bring the MCU out of wait mode, power down the ADC
by setting the CH[4:0] bits in ADSCR to 1s before executing the WAIT instruction.
3.5.2 Stop Mode
Analog-to-Digital Converter (ADC)
Interrupts
The ADC module is inactive after the execution of a STOP instruction. Any pending
conversion is aborted. ADC conversions resume when the MCU exits stop mode.
Allow one conversion cycle to stabilize the analog circuitry before using ADC data
after exiting stop mode.
3.6 Input/Output Signals
The ADC module has four channels that are shared with I/O port A.
ADC voltage in (ADCVIN) is the input voltage signal from one of the four ADC
channels to the ADC module.
3.7 Input/Output Registers
These I/O registers control and monitor ADC operation:
•ADC status and control register (ADSCR)
•ADC data register (ADR)
•ADC clock register (ADICLK)
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAAnalog-to-Digital Converter (ADC)45
Analog-to-Digital Converter (ADC)
3.7.1 ADC Status and Control Register
The following paragraphs describe the function of the ADC status and control
register (ADSCR). When a conversion is in process and the ADSCR is written, the
current conversion data should be discarded to prevent an incorrect reading.
Address: $003C
Bit 7654321Bit 0
Read:COCO
Write:
Reset:00011111
Figure 3-4. ADC Status and Control Register (ADSCR)
COCO — Conversions Complete Bit
In non-interrupt mode (AIEN = 0), COCO is a read-only bit that is set at the end
of each conversion. COCO will stay set until cleared by a read of the ADC data
register. Reset clears this bit.
AIENADCOCH4CH3CH2CH1CH0
= Unimplemented
In interrupt mode (AIEN = 1), COCO is a read-only bit that is not set at the end
of a conversion. It always reads as a 0.
1 = Conversion completed (AIEN = 0)
0 = Conversion not completed (AIEN = 0) or CPU interrupt enabled
(AIEN = 1)
NOTE:The write function of the COCO bit is reserved. When writing to the ADSCR
register, always have a 0 in the COCO bit position.
AIEN — ADC Interrupt Enable Bit
When this bit is set, an interrupt is generated at the end of an ADC conversion.
The interrupt signal is cleared when ADR is read or ADSCR is written. Reset
clears the AIEN bit.
When set, the ADC will convert samples continuously and update ADR at the
end of each conversion. Only one conversion is allo wed when this bit is cleared.
Reset clears the ADCO bit.
1 = Continuous ADC conversion
0 = One ADC conversion
CH[4:0] — ADC Channel Select Bits
CH4, CH3, CH2, CH1, and CH0 form a 5-bit field which is used to select one of
the four ADC channels. The five select bits are detailed in Table 3-1. Care
should be taken when using a port pin as both an analog and a digital input
simultaneously to prevent switching noise from corrupting the analog signal.
Data SheetMC68HC908QY/QT Family — Rev. 3
46Analog-to-Digital Converter (ADC)MOTOROLA
Analog-to-Digital Converter (ADC)
Input/Output Registers
The ADC subsystem is turned off when the channel select bits are all set to 1.
This feature allows for reduced power consumption for the MCU when the ADC
is not used. Reset sets all of these bits to 1.
NOTE:Recovery from the disabled state requires one conversion cycle to stabilize.
1. If any unused channels are selected, the resulting ADC conversi on will be
unknown.
2. The voltage levels supplied from internal reference nodes, as specified in the
table, are used to verify the operation of the ADC converter both in production test and for user applications.
100—Unused
101—
110—
ADC
Channel
Input Select
V
V
DDA
SSA
(1)
(2)
(2)
Unused
One 8-bit result register is provided. This register is updated each time an ADC
conversion completes.
Address: $003E
Bit 7654321Bit 0
Read:AD7AD6AD5AD4AD3AD2AD1AD0
Write:
Reset:Indeterminate after reset
= Unimplemented
Figure 3-5. ADC Data Register (ADR)
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAAnalog-to-Digital Converter (ADC)47
Analog-to-Digital Converter (ADC)
3.7.3 ADC Input Clock Register
This register selects the clock frequency for the ADC.
Address: $003F
Bit 7654321Bit 0
Read:
Write:
Reset:00000000
ADIV2–ADIV0 — ADC Clock Prescaler Bits
ADIV2, ADIV1, and ADIV0 form a 3-bit field which selects the divide ratio used
by the ADC to generate the internal ADC clock. Table 3-2 shows the available
clock configurations. The ADC clock frequency should be set between f
and f
conversion time (maximum = 17 ADC clock cycles).
ADIV2ADIV1ADIV0
Figure 3-6. ADC Input Clock Register (ADICLK)
ADIC(MAX)
00000
= Unimplemented
ADIC(MIN)
. The analog input level should remain stable for the entire
This section describes the auto wakeup module (AWU). The AWU generates a
periodic interrupt during stop mode to wake the part up without requiring an
external signal. Figure 4-2 is a block diagram of the AWU.
4.2 Features
Features of the auto wakeup module include:
•One internal interrupt with separate interrupt enable bit, sharing the same
keyboard interrupt vector and keyboard interrupt mask bit
•Exit from low-power stop mode without external signals
•Selectable timeout periods
•Dedicated low-power internal oscillator separate from the main system clock
sources
Section 4. Auto Wakeup Module (AWU)
Figure 4-1 provides a summary of the input/output (I/O) registers used in
conjuction with the AWU.
Addr.Register NameBit 7654321Bit 0
$0000
$001A
$001B
Port A Data Register
(PTA)
See page 52.
Keyboard Status
and Control Register
(KBSCR)
See page 52.
Keyboard Interrupt Enable
Register (KBIER)
See page 53.
Read:0AWUL
Write:
Reset:Unaffected by reset
Read:0000KEYF0
Write:
Reset:00000000
Read:0
Write:
Reset:00000000
AWUIEKBIE5KBIE4KBIE3KBIE2KBIE1KBIE0
= Unimplemented
PTA5PTA4PTA3
PTA2
ACKK
PTA1PTA0
IMASKKMODEK
Figure 4-1. AWU Register Summary
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAAuto Wakeup Module (AWU)49
Auto Wakeup Module (AWU)
4.3 Functional Description
The function of the auto wakeup logic is to generate periodic wakeup requests to
bring the microcontroller unit (MCU) out of stop mode. The wakeup requests are
treated as regular keyboard interrupt requests, with the differe nce that instead of a
pin, the interrupt signal is generated by an internal logic.
Writing the AWUIE bit in the keyboard interrupt enable register enables or disables
the auto wakeup interrupt input (see Figure 4-2). A logic 1 applied to the
AWUIREQ input with auto wakeup interrupt request enabled, latches an auto
wakeup interrupt request.
Auto wakeup latch, AWUL, can be read directly from the bit 6 position of port A data
register (PTA). This is a read-only bit which is occupying an empty bit position on
PTA. No PTA associated registers, such as PTA6 data direction or PTA6 pullup
exist for this bit.
Entering stop mode will enable the auto wakeup generation logic. An internal RC
oscillator (exclusive for the auto wakeup feature) drives the wakeup request
generator. Once the overflow count is reached in the generator counter, a wakeup
request, AWUIREQ, is latched and sent to the KBI logic. See Figure 4-1.
(CGMXCLK)
BUSCLKX4
Wakeup interrupt requests will only be serviced if the associated interrupt enable
bit, AWUIE, in KBIER is set. The AWU shares the keyboard interrupt vector.
COPRS (FROM CONFIG1)
INT RC OSC
EN32 kHz
CLRLOGIC
CLEAR
CLK
RST
RESET
AUTOWUGE N
SHORT
OVERFLOW
CLK
RST
ISTOP
1 = DIV 2
0 = DIV 2
V
DD
9
14
RESET
ACKK
D
Q
E
R
TO PTA READ, BIT 6
AWUL
AWUIREQ
TO KBI INTERRUPT LOGIC (SEE
Figure 9-3. Keyboard Interrupt
Block Diagram)
RESET
AWUI E
Figure 4-2. Auto Wakeup Interrupt Request Generation Logic
Data SheetMC68HC908QY/QT Family — Rev. 3
50Auto Wakeup Module (AWU)MOTOROLA
Auto Wakeup Module (AWU)
Wait Mode
The overflow count can be selected from two options d efined by the COPRS bit in
CONFIG1. This bit was “borrowed” from the computer operating properly (COP)
using the fact that the COP feature is idle (no MCU clock available) in stop mode.
The typical values of the periodic wakeup request are (at room temperature):
•COPRS = 0: 650 ms @ 5 V, 875 ms @ 3 V
•COPRS = 1: 16 ms @ 5 V, 22 ms @ 3 V
The auto wakeup RC oscillator is highly dependent on operating voltage and
temperature. This feature is not recommended for use as a time-keeping function.
The wakeup request is latched to allow the interrupt source identification. The
latched value, AWUL, can be read directly from the bit 6 position of PTA data
register. This is a read-only bit which is occupying an empty bit position on PTA.
No PTA associated registers, such as PTA6 data, PTA6 direction, and PTA6 pullup
exist for this bit. The latch can be cleared by writing to the ACKK bit in the KBSCR
register. Reset also clears the latch. AWUIE bit in KBI interrupt enable register (see
Figure 4-2) has no effect on AWUL reading.
The AWU oscillator and counters are inactive in normal operating mode and
become active only upon entering stop mode.
4.4 Wait Mode
The AWU module remains inactive in wait mode.
4.5 Stop Mode
When the AWU module is enabled (AWUIE = 1 in the keyboard interrupt enable
register) it is activated automatically upon entering stop mode. Clearing the
IMASKK bit in the keyboard status and control register enables keyboard interrupt
requests to bring the MCU out of stop mode. The AWU counters start from ‘0’ each
time stop mode is entered.
4.6 Input/Output Registers
The AWU shares registers with the keyboard interrupt (KBI) module and the port A
I/O module. The following I/O registers control and monitor operation of the AWU:
•Port A data register (PTA)
•Keyboard interrupt status and control register (KBSCR)
•Keyboard interrupt enable register (KBIER)
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAAuto Wakeup Module (AWU)51
Auto Wakeup Module (AWU)
4.6.1 Port A I/O Register
The port A data register (PTA) contains a data latch for the state of the AWU
interrupt request, in addition to the data latches for port A.
Address: $0000
Read:0AWUL
Write:
Reset:00Unaffected by reset
AWUL — Auto Wakeup Latch
This is a read-only bit which has the value of the auto wakeup interrupt request
latch. The wakeup request signal is generated internally. There is no PTA6 port
or any of the associated bits such as PTA6 data direction or pullup bits.
1 = Auto wakeup interrupt request is pending
0 = Auto wakeup interrupt request is not pending
Bit 7654321Bit 0
PTA5PTA4PTA3
= Unimplemented
PTA2
PTA1PTA0
Figure 4-3. Port A Data Register (PTA)
NOTE:PTA5–PTA0 bits are not used in conjuction with the auto wakeup feature. To see
a description of these bits, see 12.2.1 Port A Data Register.
Writing a 1 to this write-only bit clears the keyboard/auto wakeup interrupt
request on port A and auto wakeup logic. ACKK always reads as 0.Reset clears
ACKK.
IMASKK— Keyboard Interrupt Mask Bit
Writing a 1 to this read/write bit prevents the output of the keyboard interrupt
mask from generating interrupt requests on port A or auto wakeup. Reset clears
the IMASKK bit.
This read/write bit enables the auto wakeup interrupt input to latch interrupt
requests. Reset clears AWUIE.
1 = Auto wakeup enabled as interrupt input
0 = Auto wakeup not enabled as interrupt input
NOTE:KBIE5–KBIE0 bits are not used in conjuction with the auto wakeup feature. To see
a description of these bits, see 9.7.2 Keyboard Interrupt Enable Register.
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAAuto Wakeup Module (AWU)53
Auto Wakeup Module (AWU)
Data SheetMC68HC908QY/QT Family — Rev. 3
54Auto Wakeup Module (AWU)MOTOROLA
Data Sheet — MC68HC908QY/QT Family
Section 5. Configuration Register (CONFIG)
5.1 Introduction
This section describes the configuration registers (CONFIG1 and CONFIG2). The
configuration registers enable or disable the following options:
•Stop mode recovery time (32 × BUSCLKX4 cycles or
4096 × BUSCLKX4 cycles)
•STOP instruction
•Computer operating properly module (COP)
•COP reset period (COPRS): (2
18–24
(2
•Low-voltage inhibit (LVI) enable and trip voltage selection
•OSC option selection
) × BUSCLKX4
13–24
) × BUSCLKX4 or
•IRQ
•RST
•Auto wakeup timeout period
5.2 Functional Description
The configuration registers are used in the initialization of various options. The
configuration registers can be written once after each reset. Most of the
configuration register bits are cleared during reset. Since the various options affect
the operation of the microcontroller unit (MCU) it is recommended that this register
be written immediately after reset. The configuration registers are located at $001E
and $001F, and may be read at anytime.
NOTE:The CONFIG registers are one-time writable by the user after each reset. Upon
a reset, the CONFIG registers default to predetermined settings as shown in
Figure 5-1 and Figure 5-2.
pin
pin
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAConfiguration Register (CONFIG)55
Configuration Register (CONFIG)
Address:
$001E
Bit 7654 321Bit 0
Read:
Reset:000 0 0 00U
IRQPUDIRQENROSCOPT1OSCOPT0RRRSTEN
Write:
POR:000 0 0 000
= Reserved U = Unaffected
R
Figure 5-1. Configuration Register 2 (CONFIG2)
IRQPUD — IRQ Pin Pullup Control Bit
1 = Internal pullup is disconnected
0 = Internal pullup is connected between IRQ
pin and V
DD
IRQEN — IRQ Pin Function Selection Bit
1 = Interrupt request function active in pin
0 = Interrupt request function inactive in pin
OSCOPT1 and OSCOPT0 — Selection Bits for Oscillator Option
1 = LVI module power disabled
0 = LVI module power enabled
LVI5OR3 — LVI 5-V or 3-V Operating Mode Bit
LVI5OR3 selects the voltage operating mode of the LVI module. The voltage
mode selected for the LVI should match the operating V
for the LVI’s voltage
DD
trip points for each of the modes.
1 = LVI operates in 5-V mode
0 = LVI operates in 3-V mode
NOTE:The LVI5OR3 bit is cleared by a power-on reset (POR) only. Other resets will leave
this bit unaffected.
SSREC — Short Stop Recovery Bit
SSREC enables the CPU to exit stop mode with a delay of 32 BUSCLKX4
cycles instead of a 4096 BUSCLKX4 cycle delay.
1 = Stop mode recovery after 32 BUSCLKX4 cycles
0 = Stop mode recovery after 4096 BUSCLKX4 cycles
NOTE:Exiting stop mode by an LVI reset will result in the long stop recovery.
When using the LVI during normal operation but disabling du ring stop mode, the
LVI will have an enable time of t
. The system stabilization time for power-on
EN
reset and long stop recovery (both 4096 BUSCLKX4 cycles) gives a delay
longer than the LVI enable time for these startup scenarios. There is no period
where the MCU is not protected from a low-power condition. However, when
using the short stop recovery configuration option, the 32 BUSCLKX4 delay
must be greater than the LVI’s turn on time to avoid a period in startup where
the LVI is not protecting the MCU.
The computer operating properly (COP) module contains a free-running counter
that generates a reset if allowed to overflow. The COP module helps software
recover from runaway code. Prevent a COP reset by clearing the COP counter
periodically. The COP module can be disabled through the COPD bit in the
configuration 1 (CONFIG1) register.
6.2 Functional Description
BUSCLKX4
STOP INSTRUCTION
INTERNAL RESET SOURCES
COPCTL WRITE
COPEN (FROM SIM)
COP DISABLE (COPD FROM CONFIG1)
RESET
COPCTL WRITE
COP RATE SELECT
(COPRS FROM CONFIG1)
12-BIT SIM COUNTER
CLEAR ALL STAGES
COP CLOCK
CLEAR STAGES 5–12
6-BIT COP COUNTER
CLEAR
COP COUNTER
Figure 6-1. COP Block Diagram
RESET CIRCUIT
RESET STATUS REGISTER
COP TIMEOUT
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAComputer Operating Properly (COP)59
Computer Operating Properly (COP)
The COP counter is a free-running 6-bit counter preceded by the 12-bit system
integration module (SIM) counter. If not cleared by software, the COP counter
overflows and generates an asynchronous reset after 2
BUSCLKX4 cycles; depending on the state of the COP rate select bit, COPRS, in
configuration register 1. With a 2
internal 12.8-MHz oscillator gives a COP timeout period of 20.48 ms. Writing any
value to location $FFFF before an overflow occurs prevents a COP reset by
clearing the COP counter and stages 12–5 of the SIM counter.
NOTE:Service the COP immediately after reset and before entering or after exiting stop
mode to guarantee the maximum time before the first COP counter overflow.
18–24
18–24
or 213–24
BUSCLKX4 cycle overflow option, the
A COP reset pulls the RST
for 32 × BUSCLKX4 cycles and sets the COP bit in the reset status register (RSR).
See 13.8.1 SIM Reset Status Register.
NOTE:Place COP clearing instructions in the main program and not in an interrupt
subroutine. Such an interrupt subroutine could keep the COP from generating a
reset even while the main program is not working properly.
6.3 I/O Signals
The following paragraphs describe the signals shown in Figure 6-1.
6.3.1 BUSCLKX4
BUSCLKX4 is the oscillator output signal. BUSCLKX4 frequency is equal to the
crystal frequency or the RC-oscillator frequency.
6.3.2 STOP Instruction
The STOP instruction clears the SIM counter.
6.3.3 COPCTL Write
Writing any value to the COP control register (COPCTL) (see 6.4 COP Control
Register) clears the COP counter and clears stages 12–5 of the SIM counter.
Reading the COP control register returns the low byte of the reset vector.
pin low (if the RSTEN bit is set in the CONFIG1 register)
6.3.4 Power-On Reset
The power-on reset (POR) circuit in the SIM clears the SIM counter
4096 × BUSCLKX4 cycles after power up.
6.3.5 Internal Reset
An internal reset clears the SIM counter and the COP counter.
Data SheetMC68HC908QY/QT Family — Rev. 3
60Computer Operating Properly (COP)MOTOROLA
6.3.6 COPD (COP Disable)
The COPD signal reflects the state of the COP disable bit (COPD) in the
configuration register 1 (CONFIG1). See Section 5. Configuration Register
(CONFIG).
6.3.7 COPRS (COP Rate Select)
The COPRS signal reflects the state of the COP rate select bit (COPRS) in the
configuration register 1 (CONFIG1). See Section 5. Configuration Register
(CONFIG).
6.4 COP Control Register
The COP control register (COPCTL) is located at address $FFFF and overlaps the
reset vector. Writing any value to $FFFF clears the COP counter and sta rts a new
timeout period. Reading location $FFFF returns the low byte of the reset vector.
Address: $FFFF
Read:LOW BYTE OF RESET VECTOR
Write:CLEAR COP COUNTER
Reset:Unaffected by reset
Computer Operating Properly (COP)
COP Control Register
Bit 7654321Bit 0
6.5 Interrupts
The COP does not generate CPU interrupt requests.
6.6 Monitor Mode
The COP is disabled in monitor mode when V
6.7 Low-Power Modes
The WAIT and STOP instructions put the MCU in low power-consumption standby
modes.
6.7.1 Wait Mode
The COP continues to operate during wait mode. To prevent a COP reset during
wait mode, periodically clear the COP counter.
Figure 6-2. COP Control Register (COPCTL)
is present on the IRQ pin.
TST
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAComputer Operating Properly (COP)61
Computer Operating Properly (COP)
6.7.2 Stop Mode
Stop mode turns off the BUSCLKX4 input to the COP and clears the SIM counter.
Service the COP immediately before entering or after exiting stop mode to ensure
a full COP timeout period after entering or exiting stop mode.
6.8 COP Module During Break Mode
The COP is disabled during a break interrupt with monitor mode when BDCOP bit
is set in break auxiliary register (BRKAR).
Data SheetMC68HC908QY/QT Family — Rev. 3
62Computer Operating Properly (COP)MOTOROLA
Data Sheet — MC68HC908QY/QT Family
7.1 Introduction
The M68HC08 CPU (central processor unit) is an enhanced and fully
object-code-compatible version of the M68HC05 CPU. The CPU08 Reference Manual (Motorola document order number CPU08RM/AD) contains a description
of the CPU instruction set, addressing modes, and architecture.
7.2 Features
Features of the CPU include:
•Object code fully upward-compatible with M68HC05 Family
•16-bit stack pointer with stack manipulation instructions
•16-bit index register with x-register manipulation instructions
•8-MHz CPU internal bus frequency
•64-Kbyte program/data memory space
Section 7. Central Processor Unit (CPU)
•16 addressing modes
•Memory-to-memory data moves without using accumulator
•Fast 8-bit by 8-bit multiply and 16-bit by 8-bit divide instructions
•Enhanced binary-coded decimal (BCD) data handling
•Modular architecture with expandable internal bus definition for extension
of addressing range beyond 64 Kbytes
•Low-power stop and wait modes
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLACentral Processor Unit (CPU)63
Central Processor Unit (CPU)
7.3 CPU Registers
Figure 7-1 shows the five CPU registers. CPU registers are not part of the memory
map.
7.3.1 Accumulator
7
15
HX
15
15
70
V11HINZC
0
ACCUMULATOR (A)
0
INDEX REGISTER (H:X)
0
STACK POINTER (SP)
0
PROGRAM COUNTER (PC)
CONDITION CODE REGISTER (CCR)
CARRY/BORROW FLAG
ZERO FLAG
NEGATIVE FLAG
INTERRUPT MASK
HALF-CARRY FLAG
TWO’S COMPLEMENT OVERFLOW FLAG
Figure 7-1. CPU Registers
The accumulator is a general-purpose 8-bit register. The CPU uses the
accumulator to hold operands and the results of arithmetic/logic operations.
Bit 7654321Bit 0
Read:
Write:
Reset:Unaffected by reset
Figure 7-2. Accumulator (A)
Data SheetMC68HC908QY/QT Family — Rev. 3
64Central Processor Unit (CPU)MOTOROLA
7.3.2 Index Register
Central Processor Unit (CPU)
CPU Registers
The 16-bit index register allows indexed addressing of a 64-Kbyte memory space.
H is the upper byte of the index register, and X is the lower byte. H:X is the
concatenated 16-bit index register.
In the indexed addressing modes, the CPU uses the contents of the index register
to determine the conditional address of the operand.
The index register can serve also as a temporary data storage location.
7.3.3 Stack Pointer
Bit
151413121110987654321
Read:
Write:
Reset:00000000XXXXXXXX
X = Indeterminate
Bit
0
Figure 7-3. Index Register (H:X)
The stack pointer is a 16-bit register that contains the address of the next locatio n
on the stack. During a reset, the stack pointer is preset to $00FF. The reset stack
pointer (RSP) instruction sets the least significant byte to $FF and does not affect
the most significant byte. The stack pointer decrements as data is pushed onto the
stack and increments as data is pulled from the stack.
In the stack pointer 8-bit offset and 16-bit offset addressing modes, the stack
pointer can function as an index register to access data on the stack. The CPU
uses the contents of the stack pointer to determine the conditional address of the
operand.
Bit
151413121110987654321
Bit
0
Read:
Write:
Reset:0000000011111111
Figure 7-4. Stack Pointer (SP)
NOTE:The location of the stack is arbitrary and may be relocated anywhere in
random-access memory (RAM). Moving the SP out of page 0 ($0000 to $00FF)
frees direct address (page 0) space. For correct operation, the stack pointer must
point only to RAM locations.
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLACentral Processor Unit (CPU)65
Central Processor Unit (CPU)
7.3.4 Program Counter
The program counter is a 16-bit register that contains the address of the next
instruction or operand to be fetched.
Normally, 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.
During reset, the program counter is loaded with the reset vector address located
at $FFFE and $FFFF. The vector address is the address of the first instruction to
be executed after exiting the reset state.
Bit
151413121110987654321
Read:
Write:
Reset:Loaded with vector from $FFFE and $FFFF
7.3.5 Condition Code Register
The 8-bit condition code register contains the interrupt mask and five flags that
indicate the results of the instruction just executed. Bits 6 and 5 are set
permanently to 1. The following paragraphs describe the functions o f the condition
code register.
Read:
Write:
Reset:X11X1XXX
X = Indeterminate
Bit
0
Figure 7-5. Program Counter (PC)
Bit 7654321Bit 0
V11H I NZC
Figure 7-6. Condition Code Register (CCR)
V — Overflow Flag
The CPU sets the overflow flag when a two's complement overflow occurs. The
signed branch instructions BGT, BGE, BLE, and BLT use the overflow flag.
1 = Overflow
0 = No overflow
Data SheetMC68HC908QY/QT Family — Rev. 3
66Central Processor Unit (CPU)MOTOROLA
Central Processor Unit (CPU)
CPU Registers
H — Half-Carry Flag
The CPU sets the half-carry flag when a carry occurs between accumulator bits
3 and 4 during an add-without-carry (ADD) or add-with-carry (ADC) operation.
The half-carry flag is required for binary-coded decimal (BCD) arithmetic
operations. The DAA instruction uses the states of the H and C flags to
determine the appropriate correction factor.
1 = Carry between bits 3 and 4
0 = No carry between bits 3 and 4
I — Interrupt Mask
When the interrupt mask is set, all maskable CPU interrupts are disabled. CPU
interrupts are enabled when the interrupt mask is cleared. When a CPU
interrupt occurs, the interrupt mask is set
automatically after the CPU registers are saved on the stack, but before the
interrupt vector is fetched.
1 = Interrupts disabled
0 = Interrupts enabled
NOTE:To maintain M6805 Family compatibility, the upper byte of the index register (H) is
not stacked automatically. If the interrupt service routine modifies H, then th e user
must stack and unstack H using the PSHH and PULH instructions.
After the I bit is cleared, the highest-priority interrupt request is serviced first.
A return-from-interrupt (RTI) instruction pulls the CPU registers from the stack
and restores the interrupt mask from the stack. After any reset, the interrupt
mask is set and can be cleared only by the clear interrupt mask software
instruction (CLI).
N — Negative flag
The CPU sets the negative flag when an arithmetic operation, logic operation,
or data manipulation produces a negative result, setting bit 7 of the result.
1 = Negative result
0 = Non-negative result
Z — Zero flag
The CPU sets the zero flag when an arithmetic operation, logic operation, or
data manipulation produces a result of $00.
1 = Zero result
0 = Non-zero result
C — Carry/Borrow Flag
The CPU sets the carry/borrow flag when an addition operation produces a
carry out of bit 7 of the accumulator or when a subtraction operation requires a
borrow. Some instructions — such as bit test and branch, shift, and rotate —
also clear or set the carry/borrow flag.
1 = Carry out of bit 7
0 = No carry out of bit 7
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLACentral Processor Unit (CPU)67
Central Processor Unit (CPU)
7.4 Arithmetic/Logic Unit (ALU)
The ALU performs the arithmetic and logic operations defined by the instruction
set.
Refer to the CPU08 Reference Manual (Motorola document order number
CPU08RM/AD) for a description of the instructions and addressing modes and
more detail about the architecture of the CPU.
7.5 Low-Power Modes
The WAIT and STOP instructions put the MCU in low power-consumption standby
modes.
7.5.1 Wait Mode
The WAIT instruction:
•Clears the interrupt mask (I bit) in the condition code register, enabling
interrupts. After exit from wait mode by interrupt, the I bit remains clear. After
exit by reset, the I bit is set.
•Disables the CPU clock
7.5.2 Stop Mode
The STOP instruction:
•Clears the interrupt mask (I bit) in the condition code register, enabling
external interrupts. After exit from stop mode by external interrupt, the I bit
remains clear. After exit by reset, the I bit is set.
•Disables the CPU clock
After exiting stop mode, the CPU clock begins running after the oscillator
stabilization delay.
7.6 CPU During Break Interrupts
If a break module is present on the MCU, the CPU starts a break interrupt by:
•Loading the instruction register with the SWI instruction
•Loading the program counter with $FFFC:$FFFD or with $FEFC:$FEFD in
monitor mode
The break interrupt begins after completion of the CPU instruction in progress. If
the break address register match occurs on the last cycle of a CPU instruction, the
break interrupt begins immediately.
A return-from-interrupt instruction (RTI) in the break routine ends the break
interrupt and returns the MCU to normal operation if the break interrupt has been
deasserted.
Data SheetMC68HC908QY/QT Family — Rev. 3
68Central Processor Unit (CPU)MOTOROLA
7.7 Instruction Set Summary
Table 7-1 provides a summary of the M68HC08 instruction set.
Pin; Stop Oscillator I ← 0; Stop Oscillator––0–––INH8E1
b0
C
b0
on CCR
VHI NZC
INH807
––––––INH814
Address
DIR
INH
INH
IX1
IX
SP1
DIR
INH
INH
IX1
IX
SP1
IMM
DIR
EXT
IX2
IX1
IX
SP1
SP2
DIR
EXT
IX2
IX1
IX
SP1
SP2
DIR
EXT
IX2
IX1
IX
SP1
SP2
IMM
DIR
EXT
IX2
IX1
IX
SP1
SP2
Mode
39
49
59
69
79
9E69
36
46
56
66
76
9E66
A2
B2
C2
D2
E2
F2
9EE2
9ED2
B7
C7
D7
E7
F7
9EE7
9ED7
BF
CF
DF
EF
FF
9EEF
9EDF
A0
B0
C0
D0
E0
F0
9EE0
9ED0
Opcode
dd
ff
ff
dd
ff
ff
ii
dd
hh ll
ee ff
ff
ff
ee ff
dd
hh ll
ee ff
ff
ff
ee ff
dd
hh ll
ee ff
ff
ff
ee ff
ii
dd
hh ll
ee ff
ff
ff
ee ff
Operand
4
1
1
4
3
5
4
1
1
4
3
5
2
3
4
4
3
2
4
5
3
4
4
3
2
4
5
3
4
4
3
2
4
5
2
3
4
4
3
2
4
5
Effect
Cycles
Data SheetMC68HC908QY/QT Family — Rev. 3
74Central Processor Unit (CPU)MOTOROLA
Table 7-1. Instruction Set Summary (Sheet 7 of 7)
Central Processor Unit (CPU)
Opcode Map
Source
Form
SWISoftware Interrupt
TAPTransfer A to CCRCCR ← (A)INH842
TAXTransfer A to XX ← (A)––––––INH971
TPATransfer CCR to AA ← (CCR)––––––INH851
TST opr
TSTA
TSTX
TST opr,X
TST ,X
TST opr,SP
TSXTransfer SP to H:XH:X ← (SP) + 1––––––INH952
TXATransfer X to AA ← (X)––––––INH9F1
TXSTransfer H:X to SP(SP) ← (H:X) – 1––––––INH942
AAccumulatornAny bit
CCarry/borrow bitopr Operand (one or two bytes)
CCRCondition code registerPC Program counter
ddDirect address of operandPCH Program counter high byte
dd rrDirect address of operand and relative offset of branch instructionPCL Program counter low byte
DDDirect to direct addressing modeREL Relative addressing mode
DIRDirect addressing moderelRelative program counter offset byte
DIX+Direct to indexed with post increment addressing moderrRelative program counter offset byte
ee ffHigh and low bytes of offset in indexed, 16-bit offset addressingSP1 Stack pointer, 8-bit offset addressing mode
EXTExtended addressing modeSP2 Stack pointer 16-bit offset addressing mode
ffOffset byte in indexed, 8-bit offset addressingSPStack pointer
HHalf-carry bitUUndefined
HIndex register high byteVOverflow bit
hh llHigh and low bytes of operand address in extended addressingXIndex register low byte
IInterrupt maskZZero bit
iiImmediate operand byte&Logical AND
IMDImmediate source to direct destination addressing mode|Logical OR
IMMImmediate addressing mode
INHInherent addressing mode( )Contents of
IXIndexed, no offset addressing mode–( ) Negation (two’s complement)
IX+Indexed, no offset, post increment addressing mode#Immediate value
IX+DIndexed with post increment to direct addressing mode
IX1Indexed, 8-bit offset addressing mode←Loaded with
IX1+Indexed, 8-bit offset, post increment addressing mode?If
IX2Indexed, 16-bit offset addressing mode:Concatenated with
MMemory locationSet or cleared
NNegative bit—Not affected
Test for Negative or Zero(A) – $00 or (X) – $00 or (M) – $000 – – –
INH InherentREL RelativeSP1 Stack Pointer, 8-Bit Offset
IMM ImmediateIXIndexed, No OffsetSP2 Stack Pointer, 16-Bit Off set
DIR DirectIX1 Inde xed, 8-Bit OffsetIX+ Indexed, No Offset with
EXT ExtendedIX2 Indexed, 16-Bit OffsetPost Increment
DD Direct-DirectIMD Immediate-DirectIX1+ Indexed, 1-Byte Offset with
IX+D Indexed-Direct DIX+ Direct-IndexedPost Increment
*Pre-byte for stack pointer indexed instructions
MSB
LSB
Low Byte of Opcode in Hexadecimal05BRSET0
0High Byte of Opcode in Hexadecimal
3DIR
Cycles
Opcode Mnemonic
Number of Bytes / Addressing Mode
Data Sheet — MC68HC908QY/QT Family
8.1 Introduction
The IRQ pin (external interrupt), shared with PTA2 (general purpose input) and
keyboard interrupt (KBI), provides a maskable interrupt input
8.2 Features
Features of the IRQ module include the following:
•External interrupt pin, IRQ
•IRQ interrupt control bits
•Hysteresis buffer
•Programmable edge-only or edge and level interrupt sensitivity
•Automatic interrupt acknowledge
•Selectable internal pullup resistor
Section 8. External Interrupt (IRQ)
8.3 Functional Description
IRQ pin functionality is enabled by setting configuration register 2 (CONFIG2)
IRQEN bit accordingly. A zero disables the IRQ function and IRQ
other shared functionalities. A one enables the IRQ function.
A falling edge on the external interrupt pin can latch a central processor unit (CPU)
interrupt request. Figure 8-2shows the structure of the IRQ module.
Interrupt signals on the IRQ
remains set until one of the following actions occurs:
•Vector fetch — A vector fetch automatically generates an interrupt
acknowledge signal that clears the IRQ latch.
•Software clear — Software can clear the interrupt latch by writing to the
acknowledge bit in the interrupt status and control register (INTSCR).
Writing a 1 to the ACK bit clears the IRQ latch.
•Reset — A reset automatically clears the interrupt latch.
The external interrupt pin is falling-edge-triggered out of reset and is softwareconfigurable to be either falling-edge or falling-edge and low-level triggered. The
MODE bit in the INTSCR controls the triggering sensitivity of the IRQ
When the interrupt pin is edge-triggered only (MODE = 0), the CPU interrupt
request remains set until a vector fetch, software clear, or reset occurs.
will assume the
pin are latched into the IRQ latch. An interrupt latch
pin.
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAExternal Interrupt (IRQ)77
External Interrupt (IRQ)
PTA0/AD0/TCH0/KBI0
PTA1/AD1/TCH1/KBI1
PTA2/IRQ
PTA4/OSC2/AD2/KBI4
PTA5/OSC1/AD3/KBI5
/KBI2/TCLK
PTA3/RST
/KBI3
PTB0
PTB1
PTB2
PTB3
PTB4
PTB5
PTB6
PTB7
POWER SUPPLY
PTA
PTB
8-BIT ADC
128 BYTES RAM
DDRA
DDRB
V
DD
V
SS
M68HC08 CPU
MC68HC908QY4 AND MC68HC908QT4
4096 BYTES
MC68HC908QY2, MC68HC908QY1,
MC68HC908QT2, AND MC68HC908QT1:
1536 BYTES
USER FLASH
CLOCK
GENERATOR
(OSCILLATOR)
SYSTEM INTEGRATION
MODULE
SINGLE INTERRUPT
MODULE
BREAK
MODULE
POWER-ON RESET
MODULE
KEYBOARD INTERRUPT
MODULE
16-BIT TIMER
MODULE
COP
MODULE
MONITOR ROM
RST, IRQ: Pins have internal (about 30K Ohms) pull up
PTA[0:5]: High current sink and source capability
PTA[0:5]: Pins have programmable keyboard interrupt and pull up
PTB[0:7]: Not available on 8-pin devices – MC68HC908QT1, MC68HC908QT2, and MC68HC908QT4
ADC: Not available on the MC68HC908QY1 and MC68HC908QT1
Figure 8-1. Block Diagram Highlighting IRQ Block and Pins
Data SheetMC68HC908QY/QT Family — Rev. 3
78External Interrupt (IRQ)MOTOROLA
INTERNAL ADDRESS BUS
IRQPUD
IRQ
ACK
RESET
VECTOR
FETCH
DECODER
V
DD
INTERNAL
PULLUP
DEVICE
V
DD
DQ
MODE
CK
CLR
IRQ
FF
IMASK
SYNCHRO-
NIZER
HIGH
VOLTAGE
DETECT
External Interrupt (IRQ)
Functional Description
TO CPU FOR
BIL/BIH
INSTRUCTIONS
IRQF
IRQ
INTERRUPT
REQUEST
TO MODE
SELECT
LOGIC
Figure 8-2. IRQ Module Block Diagram
When the interrupt pin is both falling-edge and low-level triggered (MODE = 1), the
CPU interrupt request remains set until both of the following occur:
•Vector fetch or software clear
•Return of the interrupt pin to logic 1
The vector fetch or software clear may occur before or after the interrupt pin returns
to logic 1. As long as the pin is low, the interrupt request remains pending. A reset
will clear the latch and the MODE control bit, thereby clearing the interrupt even if
the pin stays low.
When set, the IMASK bit in the INTSCR mask all external interrupt requests. A
latched interrupt request is not presented to the interrupt priority logic unless the
IMASK bit is clear.
NOTE:The interrupt mask (I) in the condition code register (CCR) masks all interrupt
requests, including external interrupt requests. See 13.6 Exception Control.
Figure 8-3 provides a summary of the IRQ I/O register.
Addr.Register NameBit 7654321Bit 0
Read:0000IRQF0
Write:
ACK
IMASKMODE
Reset:00000000
= Unimplemented
$001D
IRQ Status and Control
Register (INTSCR)
See page 81.
Figure 8-3. IRQ I/O Register Summary
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAExternal Interrupt (IRQ)79
External Interrupt (IRQ)
8.4 IRQ Pin
A falling edge on the IRQ pin can latch an interrupt request into the IRQ latch. A
vector fetch, software clear, or reset clears the IRQ latch.
If the MODE bit is set, the IRQ
pin is both falling-edge sensitive and low-level
sensitive. With MODE set, both of the following actions must occur to clear IRQ:
•Vector fetch or software clear — A vector fetch generates an interrupt
acknowledge signal to clear the latch. Software may generate the interrupt
acknowledge signal by writing a 1 to the ACK bit in the interrupt statu s and
control register (INTSCR). The ACK bit is useful in applications that poll the
IRQ
pin and require software to clear the IRQ latch. Writing to the ACK bit
prior to leaving an interrupt service routine can also prevent spurious
interrupts due to noise. Setting ACK does not affect subsequent transitions
on the IRQ
pin. A falling edge that occurs after writing to the ACK bit latches
another interrupt request. If the IRQ mask bit, IMASK, is clear, the CPU
loads the program counter with the vector address at locations $FFFA and
$FFFB.
•Return of the IRQ
pin to logic 1 — As long as the IRQ pin is at logic 0, IRQ
remains active.
The vector fetch or software clear and the return of the IRQ
in any order. The interrupt request remains pending as long as the IRQ
pin to logic 1 may occur
pin is at
logic 0. A reset will clear the latch and the MODE control bit, thereby clearing the
interrupt even if the pin stays low.
If the MODE bit is clear, the IRQ
pin is falling-edge sensitive only. With MODE
clear, a vector fetch or software clear immediately clears the IRQ latch.
The IRQF bit in the INTSCR register can be used to check for pending interrupts.
The IRQF bit is not affected by the IMASK bit, which makes it useful in applications
where polling is preferred.
NOTE:When the IRQ
instructions can be used to read the logic level on the IRQ
is disabled, these instructions will behave as if the IRQ
of the actual level on the pin. Conversely, when the IRQ
function is enabled in the CONFIG2 register, the BIH and BIL
pin. If the IRQ function
pin is a logic 1, regardless
function is enabled, bit 2
of the port A data register will always read a 0.
NOTE:When using the level-sensitive interrupt trigger, avoid false interrupts by masking
interrupt requests in the interrupt routine. An internal pullup resistor to V
connected to the IRQ
pin; this can be disabled by setting the IRQPUD bit in the
DD
is
CONFIG2 register ($001E).
Data SheetMC68HC908QY/QT Family — Rev. 3
80External Interrupt (IRQ)MOTOROLA
8.5 IRQ Module During Break Interrupts
The system integration module (SIM) controls whether the IRQ latch can be
cleared during the break state. The BCFE bit in the break flag control
register (BFCR) enables software to clear the latches during the break state. See
Section 13. System Integration Module (SIM).
To allow software to clear the IRQ latch during a break interrupt, write a 1 to the
BCFE bit. If a latch is cleared during the break state, it remains cleared when the
MCU exits the break state.
To protect the latches during the break state, write a 0 to the BCFE bit. With BCFE
at 0 (its default state), writing to the ACK bit in the IRQ status and control register
during the break state has no effect on the IRQ latch.
8.6 IRQ Status and Control Register
The IRQ status and control register (ISCR) controls and monitors operation of the
IRQ module, see Section 5. Configuration Register (CONFIG).
External Interrupt (IRQ)
IRQ Module During Break Interrupts
The ISCR has the following functions:
•Shows the state of the IRQ flag
•Clears the IRQ latch
•Masks IRQ and interrupt request
•Controls triggering sensitivity of the IRQ
Address: $001D
Bit 7654321Bit 0
Read:0000IRQF0
Write:ACK
Reset:00000000
= Unimplemented
interrupt pin
IMASKMODE
Figure 8-4. IRQ Status and Control Register (INTSCR)
IRQF — IRQ Flag
This read-only status bit is high when the IRQ interrupt is pending.
1 = IRQ
0 = IRQ
interrupt pending
interrupt not pending
ACK — IRQ Interrupt Request Acknowledge Bit
Writing a 1 to this write-only bit clears the IRQ latch. ACK always reads as 0.
Reset clears ACK.
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAExternal Interrupt (IRQ)81
External Interrupt (IRQ)
IMASK — IRQ Interrupt Mask Bit
Writing a 1 to this read/write bit disables IRQ interrupt requests. Reset clears
IMASK.
MODE — IRQ Edge/Level Select Bit
This read/write bit controls the triggering sensitivity of the IRQ
MODE.
interrupt requests on falling edges and low levels
interrupt requests on falling edges only
pin. Reset clears
Data SheetMC68HC908QY/QT Family — Rev. 3
82External Interrupt (IRQ)MOTOROLA
Data Sheet — MC68HC908QY/QT Family
Section 9. Keyboard Interrupt Module (KBI)
9.1 Introduction
The keyboard interrupt module (KBI) provides six independently maskable external
interrupts, which are accessible via the PTA0–PTA5 pins.
9.2 Features
Features of the keyboard interrupt module include:
•Six keyboard interrupt pins with separate keyboard interrupt enable bits and
one keyboard interrupt mask
•Software configurable pullup device if input pin is configured as input port bit
•Programmable edge-only or edge and level interrupt sensitivity
•Exit from low-power modes
Figure 9-1 provides a summary of the input/output (I/O) registers
Addr.Register NameBit 7654321Bit 0
Keyboard Status and Control
$001A
Keyboard Interrupt Enable
$001B
Register (KBSCR)
See page 88.
Register (KBIER)
See page 89.
Read:0000KEYF0
Write:
Reset:00000000
Read:0
AWUIEKBIE5KBIE4KBIE3KBIE2KBIE1KBIE0
Write:
Reset:00000000
= Unimplemented
ACKK
IMASKKMODEK
Figure 9-1. KBI I/O Register Summary
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAKeyboard Interrupt Module (KBI)83
Keyboard Interrupt Module (KBI)
PTA0/AD0/TCH0/KBI0
PTA1/AD1/TCH1/KBI1
PTA2/IRQ
PTA4/OSC2/AD2/KBI4
PTA5/OSC1/AD3/KBI5
/KBI2/TCLK
PTA3/RST
/KBI3
PTB0
PTB1
PTB2
PTB3
PTB4
PTB5
PTB6
PTB7
POWER SUPPLY
PTA
PTB
8-BIT ADC
128 BYTES RAM
DDRA
DDRB
V
DD
V
SS
M68HC08 CPU
MC68HC908QY4 AND MC68HC908QT4
4096 BYTES
MC68HC908QY2, MC68HC908QY1,
MC68HC908QT2, AND MC68HC908QT1:
1536 BYTES
USER FLASH
CLOCK
GENERATOR
(OSCILLATOR)
SYSTEM INTEGRATION
MODULE
SINGLE INTERRUPT
MODULE
BREAK
MODULE
POWER-ON RESET
MODULE
KEYBOARD INTERRUPT
MODULE
16-BIT TIMER
MODULE
COP
MODULE
MONITOR ROM
RST, IRQ: Pins have internal (about 30K Ohms) pull up
PTA[0:5]: High current sink and source capability
PTA[0:5]: Pins have programmable keyboard interrupt and pull up
PTB[0:7]: Not available on 8-pin devices – MC68HLC908QT1, MC68HLC908QT2, and MC68HLC908QT4
ADC: Not available on the MC68HC908QY1 and MC68HC908QT1
Figure 9-2. Block Diagram Highlighting KBI Block and Pins
Data SheetMC68HC908QY/QT Family — Rev. 3
84Keyboard Interrupt Module (KBI)MOTOROLA
9.3 Functional Description
The keyboard interrupt module controls the enabling/disabling of interrupt
functions on the six port A pins. These six pins can be enabled/disabled
independently of each other.
KBI0
.
KBIE0
TO PULLUP ENABLE
.
.
KBI5
V
DD
DQ
CK
CLR
KEYBOARD
INTERRUPT FF
ACKK
RESET
Keyboard Interrupt Module (KBI)
Functional Description
INTERNAL BUS
VECTOR FETCH
DECODER
KEYF
SYNCHRONIZER
IMASKK
KEYBOARD
INTERRUPT
REQUEST
KBIE5
TO PULLUP ENABLE
AWUIREQ
(1)
9.3.1 Keyboard Operation
Writing to the KBIE0–KBIE5 bits in the keyboard interrupt enable register (KBIER)
independently enables or disables each port A pin as a keyboard interrupt pin.
Enabling a keyboard interrupt pin in port A also enables its internal pullup device
irrespective of PTAPUEx bits in the port A input pullup enable register (se e 12.2.3
Port A Input Pullup Enable Register). A logic 0 applied to an enabled keyboa rd
interrupt pin latches a keyboard interrupt request.
A keyboard interrupt is latched when one or more keyboard interrupt inputs goes
low after all were high. The MODEK bit in the keyboard status and control register
controls the triggering mode of the keyboard interrupt.
•If the keyboard interrupt is edge-sensitive only, a falling edge on a keyboard
MODEK
1. For AWUGEN logic refer to Figure 4-2. Auto Wakeup Interrupt Request Generation Logic.
Figure 9-3. Keyboard Interrupt Block Diagram
interrupt input does not latch an interrupt request if another keyboard pin is
already low. To prevent losing an interrupt request on one input because
another input is still low, software can disable the latter input while it is low.
•If the keyboard interrupt is falling edge and low-level sensitive, an interrupt
request is present as long as any keyboard interrupt input is low.
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAKeyboard Interrupt Module (KBI)85
Keyboard Interrupt Module (KBI)
If the MODEK bit is set, the keyboard interrupt inputs are both falling edge and
low-level sensitive, and both of the following actions must occur to clear a keyboard
interrupt request:
•Vector fetch or software clear — A vector fetch generates an interrupt
acknowledge signal to clear the interrupt request. Software may generate
the interrupt acknowledge signal by writing a 1 to the ACKK bit in the
keyboard status and control register (KBSCR). The ACKK bit is useful in
applications that poll the keyboard interrupt inputs and require software to
clear the keyboard interrupt request. Writing to the ACKK bit prior to leaving
an interrupt service routine can also prevent spurious interrupts due to
noise. Setting ACKK does not affect subsequent transitions on the keyb oard
interrupt inputs. A falling edge that occurs after writing to the ACKK bit
latches another interrupt request. If the keyboard interrupt mask bit,
IMASKK, is clear, the central processor unit (CPU) loads the program
counter with the vector address at locations $FFE0 and $FFE1.
•Return of all enabled keyboard interrupt inputs to logic 1 — As long as any
enabled keyboard interrupt pin is at logic 0, the keyboard interrupt remains
set. The auto wakeup interrupt input, AWUIREQ, will be cleared only by
writing to ACKK bit in KBSCR or reset.
The vector fetch or software clear and the return of all enabled keyboard interrupt
pins to logic 1 may occur in any order.
If the MODEK bit is clear, the keyboard interrupt pin is falling-edge sensitive only.
With MODEK clear, a vector fetch or software clear immediately clears the
keyboard interrupt request.
Reset clears the keyboard interrupt request and the MODEK bit, clearing the
interrupt request even if a keyboard interrupt input stays at logic 0.
The keyboard flag bit (KEYF) in the keyboard status and control register can be
used to see if a pending interrupt exists. The KEYF bit is not affected by the
keyboard interrupt mask bit (IMASKK) which makes it useful in applications where
polling is preferred.
To determine the logic level on a keyboard interrupt pin, use the data direction
register to configure the pin as an input and then read the data register.
NOTE:Setting a keyboard interrupt enable bit (KBIEx) forces the corresponding keyboard
interrupt pin to be an input, overriding the data direction register. However, the data
direction register bit must be a 0 for software to read the pin.
Data SheetMC68HC908QY/QT Family — Rev. 3
86Keyboard Interrupt Module (KBI)MOTOROLA
9.3.2 Keyboard Initialization
When a keyboard interrupt pin is enabled, it takes time for the internal pullup to
reach a logic 1. Therefore a false interrupt can occur as soon as the pin is enabled.
To prevent a false interrupt on keyboard initialization:
1.Mask keyboard interrupts by setting the IMASKK bit in the keyboard status
2.Enable the KBI pins by setting the appropriate KBIEx bits in the keyboard
3.Write to the ACKK bit in the keyboard status and control registe r to clear any
4.Clear the IMASKK bit.
An interrupt signal on an edge-triggered pin can be acknowledged immediately
after enabling the pin. An interrupt signal on an edge- and level-triggered interrupt
pin must be acknowledged after a delay that depends on the external load.
Another way to avoid a false interrupt:
1.Configure the keyboard pins as outputs by setting the appropriate DDRA
2.Write 1s to the appropriate port A data register bits.
3.Enable the KBI pins by setting the appropriate KBIEx bits in the keyboard
Keyboard Interrupt Module (KBI)
Wait Mode
and control register.
interrupt enable register.
false interrupts.
bits in the data direction register A.
interrupt enable register.
9.4 Wait Mode
The keyboard module remains active in wait mode. Clearing the IMASKK bit in the
keyboard status and control register enables keyboard interrupt requests to bring
the MCU out of wait mode.
9.5 Stop Mode
The keyboard module remains active in stop mode. Clearing the IMASKK bit in the
keyboard status and control register enables keyboard interrupt requests to bring
the MCU out of stop mode.
9.6 Keyboard Module During Break Interrupts
The system integration module (SIM) controls whether the keyboard interrupt latch
can be cleared during the break state. The BCFE bit in the break flag control
register (BFCR) enables software to clear status bits during the break state.
To allow software to clear the keyboard interrupt latch during a break interrupt,
write a 1 to the BCFE bit. If a latch is cleared during the break state, it remains
cleared when the MCU exits the break state.
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAKeyboard Interrupt Module (KBI)87
Keyboard Interrupt Module (KBI)
To protect the latch during the break state, write a 0 to the BCFE bit. With BCFE
at 0 (its default state), writing to the keyboard acknowledge bit (ACKK) in the
keyboard status and control register during the break state has no effect.
9.7 Input/Output Registers
The following I/O registers control and monitor operation of the keyboard interrupt
module:
•Keyboard interrupt status and control register (KBSCR)
Writing a 1 to this write-only bit clears the keyboard interrupt request on port A
and auto wakeup logic. ACKK always reads as 0. Reset clears ACKK.
IMASKK— Keyboard Interrupt Mask Bit
Writing a 1 to this read/write bit prevents the output of the keyboard interrupt
mask from generating interrupt requests on port A or auto wakeup. Reset clears
the IMASKK bit.
KBIE5–KBIE0 — Port A Keyboard Interrupt Enable Bits
Each of these read/write bits enables the corresponding keyboard interrupt pin
on port A to latch interrupt requests. Reset clears the keyboard interrupt enable
register.
1 = KBIx pin enabled as keyboard interrupt pin
0 = KBIx pin not enabled as keyboard interrupt pin
NOTE:AWUIE bit is not used in conjunction with the keyboard interrupt feature. To see a
description of this bit, see Section 4. Auto Wakeup Module (AWU).
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAKeyboard Interrupt Module (KBI)89
Keyboard Interrupt Module (KBI)
Data SheetMC68HC908QY/QT Family — Rev. 3
90Keyboard Interrupt Module (KBI)MOTOROLA
Data Sheet — MC68HC908QY/QT Family
10.1 Introduction
This section describes the low-voltage inhibit (LVI) module, which monitors the
voltage on the V
pin and can force a reset when the V
DD
LVI trip falling voltage, V
10.2 Features
Features of the LVI module include:
•Programmable LVI reset
•Programmable power consumption
•Selectable LVI trip voltage
•Programmable stop mode operation
TRIPF
Section 10. Low-Voltage Inhibit (LVI)
voltage falls below the
DD
.
10.3 Functional Description
Figure 10-1 shows the structure of the LVI module. LVISTOP, LVIPWRD,
LVI5OR3, and LVIRSTD are user selectable options found in the configuration
register (CONFIG1). See Section 5. Configuration Register (CONFIG).
FROM CONFIG
V
DD
LOW V
DD
DETECTOR
LVI5OR3
STOP INSTRUCTION
FROM CONFIG
LVIRSTD
LVIPWRD
FROM CONFIG
> LVITRIP = 0
V
DD
≤ LVITRIP = 1
V
DD
LVIOUT
Figure 10-1. LVI Module Block Diagram
LVISTOP
FROM CONFIG
LVI RESET
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLALow-Voltage Inhibit (LVI)91
Low-Voltage Inhibit (LVI)
The LVI is enabled out of reset. The LVI module contains a bandgap reference
circuit and comparator. Clearing the LVI power disable bit, LVIPWRD, enables the
LVI to monitor V
the LVI module to generate a reset when V
the LVI enable in stop mode bit, LVISTOP, enables the LVI to operate in stop
mode. Setting the LVI 5-V or 3-V trip point bit, LVI5OR3, enables the trip point
voltage, V
enables the trip point voltage, V
actual trip thresholds are specified in 16.5 5-V DC Electrical Characteristics and
16.9 3-V DC Electrical Characteristics.
NOTE:After a power-on reset, the LVI’s default mode of operation is 3 volts. If a 5-V
system is used, the user must set the LVI5OR3 bit to raise the trip point to 5-V
operation.
If the user requires 5-V mode and sets the LVI5OR3 bit after power-on reset while
the V
(MCU) will immediately go into reset. The next time the LVI releases the reset, the
supply will be above the V
voltage. Clearing the LVI reset disable bit, LVIRSTD, enables
DD
, to be configured for 5-V operation. Clearing the LVI5OR3 bit
TRIPF
supply is not above the V
DD
TRIPR
falls below a voltage, V
DD
, to be configured for 3-V operation. The
TRIPF
for 5-V mode, the microcontroller unit
TRIPR
for 5-V mode.
TRIPF
. Setting
Once an LVI reset occurs, the MCU remains in reset until V
voltage, V
, which causes the MCU to exit reset. See Section 13. System
TRIPR
Integration Module (SIM) for the reset recovery sequence.
The output of the comparator controls the state of the LVIOUT flag in the LVI status
register (LVISR) and can be used for polling LVI operation when the LVI reset is
disabled.
10.3.1 Polled LVI Operation
In applications that can operate at V
monitor V
by polling the LVIOUT bit. In the configuration register, the LVIPWRD
DD
bit must be cleared to enable the LVI module, and the LVIRSTD bit must be at set
to disable LVI resets.
10.3.2 Forced Reset Operation
In applications that require V
resets allows the LVI module to reset the MCU when V
level. In the configuration register, the LVIPWRD and LVIRSTD bits must be
cleared to enable the LVI module and to enable LVI resets.
10.3.3 Voltage Hysteresis Protection
levels below the V
DD
to remain above the V
DD
rises above a
DD
level, software can
TRIPF
level, enabling LVI
TRIPF
falls below the V
DD
TRIPF
Once the LVI has triggered (by having V
a reset condition until V
rises above the rising trip point voltage, V
DD
fall below V
DD
), the LVI will maintain
TRIPF
TRIPR
. This
prevents a condition in which the MCU is continually entering and exiting reset if
V
is approximately equal to V
DD
hysteresis voltage, V
Data SheetMC68HC908QY/QT Family — Rev. 3
92Low-Voltage Inhibit (LVI)MOTOROLA
HYS
.
TRIPF
. V
is greater than V
TRIPR
TRIPF
by the
10.3.4 LVI Trip Selection
The LVI5OR3 bit in the configuration register selects whether the LVI is configured
for 5-V or 3-V protection.
NOTE:The microcontroller is guaranteed to operate at a minimu m supply voltage. The trip
point (V
Electrical Characteristics and 16.9 3-V DC Electrical Characteristics for the
actual trip point voltages.
10.4 LVI Status Register
The LVI status register (LVISR) indicates if the VDD voltage was detected below
the V
Address: $FE0C
Reset:00000000
Low-Voltage Inhibit (LVI)
LVI Status Register
[5 V] or V
TRIPF
level while LVI resets have been disabled.
TRIPF
[3 V]) may be lower than this. See 16.5 5-V DC
TRIPF
Bit 7654321Bit 0
Read:LVIOUT000000R
Write:
= UnimplementedR= Reserved
10.5 LVI Interrupts
Figure 10-2. LVI Status Register (LVISR)
LVIOUT — LVI Output Bit
This read-only flag becomes set when the V
trip voltage and is cleared when V
voltage rises above V
DD
voltage falls below the V
DD
. The difference
TRIPR
in these threshold levels results in a hysteresis that prevents oscillation into and
out of reset (see Table 10-1). Reset clears the LVIOUT bit.
Table 10-1. LVIOUT Bit Indication
V
TRIPF
V
V
> V
DD
VDD < V
< VDD < V
DD
TRIPR
TRIPF
TRIPR
LVIOUT
0
1
Previous value
The LVI module does not generate interrupt requests.
TRIPF
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLALow-Voltage Inhibit (LVI)93
Low-Voltage Inhibit (LVI)
10.6 Low-Power Modes
The STOP and WAIT instructions put the MCU in low power-consumption standby
modes.
10.6.1 Wait Mode
If enabled, the LVI module remains active in wait mode. If enabled to generate
resets, the LVI module can generate a reset and bring the MCU out of wait mode.
10.6.2 Stop Mode
When the LVIPWRD bit in the configuration register is cleared and the LVISTOP
bit in the configuration register is set, the LVI module remains active in stop mode.
If enabled to generate resets, the LVI module can generate a reset and bring the
MCU out of stop mode.
Data SheetMC68HC908QY/QT Family — Rev. 3
94Low-Voltage Inhibit (LVI)MOTOROLA
Data Sheet — MC68HC908QY/QT Family
11.1 Introduction
The oscillator module is used to provide a stable clock source for the
microcontroller system and bus. The oscillator module generates two output
clocks, BUSCLKX2 and BUSCLKX4. The BUSCLKX4 clock is used by the system
integration module (SIM) and the computer operating properly module (COP). The
BUSCLKX2 clock is divided by two in the SIM to be used as the bus clock for the
microcontroller. Therefore the bus frequency will be one fourth of the BUSCLKX4
frequency.
11.2 Features
The oscillator has these four clock source options available:
1.Internal oscillator: An internally generated, fixed frequency clock, trimmable
to ±5%.This is the default option out of reset.
2.External oscillator: An external clock that can be driven directly into OSC1.
3.External RC: A built-in oscillator module (RC oscillator) that requires an
external R connection only. The capacitor is internal to the chip.
4.External crystal: A built-in oscillator module (XTAL oscillator) that requires
an external crystal or ceramic-resonator.
Section 11. Oscillator Module (OSC)
11.3 Functional Description
The oscillator contains these major subsystems:
•Internal oscillator circuit
•Internal or external clock switch control
•External clock circuit
•External crystal circuit
•External RC clock circuit
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAOscillator Module (OSC)95
Oscillator Module (OSC)
PTA0/AD0/TCH0/KBI0
PTA1/AD1/TCH1/KBI1
PTA2/IRQ
/KBI2/TCLK
PTA3/RST
PTA4/OSC2/AD2/KBI4
PTA5/OSC1/AD3/KBI5
/KBI3
PTB0
PTB1
PTB2
PTB3
PTB4
PTB5
PTB6
PTB7
POWER SUPPLY
PTA
PTB
8-BIT ADC
128 BYTES RAM
DDRA
DDRB
V
DD
V
SS
M68HC08 CPU
MC68HC908QY4 AND MC68HC908QT4
4096 BYTES
MC68HC908QY2, MC68HC908QY1,
MC68HC908QT2, AND MC68HC908QT1:
1536 BYTES
USER FLASH
CLOCK
GENERATOR
(OSCILLATOR)
SYSTEM INTEGRATION
MODULE
SINGLE INTERRUPT
MODULE
BREAK
MODULE
POWER-ON RESET
MODULE
KEYBOARD INTERRUPT
MODULE
16-BIT TIMER
MODULE
COP
MODULE
MONITOR ROM
RST, IRQ: Pins have internal (about 30K Ohms) pull up
PTA[0:5]: High current sink and source capability
PTA[0:5]: Pins have programmable keyboard interrupt and pull up
PTB[0:7]: Not available on 8-pin devices – MC68HC908QT1, MC68HC908QT2, and MC68HC908QT4
ADC: Not available on the MC68HC908QY1 and MC68HC908QT1
Figure 11-1. Block Diagram Highlighting OSC Block and Pins
Data SheetMC68HC908QY/QT Family — Rev. 3
96Oscillator Module (OSC)MOTOROLA
11.3.1 Internal Oscillator
The internal oscillator circuit is designed for use with no external components to
provide a clock source with tolerance less than ±25% untrimmed.An 8-bit trimming
register allows adjustment to a tolerance of less than ±5%.
The internal oscillator will generate a clock of 12.8 MHz typical (INTCLK) resulting
in a bus speed (internal clock ÷ 4) of 3.2 MHz. 3.2 MHz came from the maximum
bus speed guaranteed at 3 V which is 4 MHz.Since the internal oscillator will have
a ±25% tolerance (pre-trim), then the +25% case should not allow a frequency
higher than 4 MHz:
3.2 MHz + 25% = 4 MHz
Figure 11-3 shows how BUSCLKX4 is derived from INTCLK and, like the RC
oscillator, OSC2 can output BUSCLKX4 by setting OSC2EN in PTAPUE
register.See Section 12. Input/Output Ports (PORTS)
11.3.1.1 Internal Oscillator Trimming
The 8-bit trimming register, OSCTRIM, allows a clock period adjust of +127 and
–128 steps. Increasing OSCTRIM value increases the clock period. Trimming
allows the internal clock frequency to be set to 12.8 MHz ± 5%.
Oscillator Module (OSC)
Functional Description
All devices are programmed with a trim value in a reserved FLASH location,
$FFC0. This value can be copied from the FLASH to the OSCTRIM register
($0038) during reset initialization.
Reset loads OSCTRIM with a default value of $80.
WARNING:Bulk FLASH erasure will set location $FFC0 to $FF and the factory
programmed value will be lost.
11.3.1.2 Internal to External Clock Switching
When external clock source (external OSC, RC, or XTAL) is desired, the user must
perform the following steps:
1.For external crystal circuits only, OSCOPT[1:0] = 1:1: To help precharge an
external crystal oscillator, set PTA4 (OSC2) as an output and drive high for
several cycles. This may help the crystal circuit start more robustly.
2.Set CONFIG2 bits OSCOPT[1:0] according to Table 11-2. The oscillator
module control logic will then set OSC1 as an external clock input and, if the
external crystal option is selected, OSC2 will also be set as the clock output.
3.Create a software delay to wait the stabilization time needed for the selected
clock source (crystal, resonator, RC) as recommended by the component
manufacturer. A good rule of thumb for crystal oscillators is to wait 4096
cycles of the crystal frequency, i.e., for a 4-MHz crystal, wait approximately
1 msec.
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAOscillator Module (OSC)97
Oscillator Module (OSC)
4.After the manufacturer’s recommended delay has ela psed , th e ECGON bit
5.After ECGON set is detected, the OSC module checks for oscillator activity
6.The OSC module then switches to the external clock. Logic pr ovides a glitch
7.The OSC module first sets the ECGST bit in the OSCSTAT register and the n
NOTE:Once transition to the external clock is done, the internal oscillator will only be
reactivated with reset. No post-switch clock monitor feature is implemented (clock
does not switch back to internal if external clock dies).
11.3.2 External Oscillator
The external clock option is designed for use when a clock signal is available in the
application to provide a clock source to the microcontroller. The OSC1 pin is
enabled as an input by the oscillator module. The clock signal is used directly to
create BUSCLKX4 and also divided by two to create BUSCLKX2.
in the OSC status register (OSCSTAT) needs to be set by the user software.
by waiting two external clock rising edges.
free transition.
stops the internal oscillator.
In this configuration, the OSC2 pin cannot output BUSCLKX4.So the OSC2EN bit
in the port A pullup enable register will be clear to enable PTA4 I/O functions on
the pin
11.3.3 XTAL Oscillator
The XTAL oscillator circuit is designed for use with an external crystal or ceramic
resonator to provide an accurate clock source. In this co nfiguration, t he OSC2 pin
is dedicated to the external crystal circuit. The OSC2EN bit in the port A pullup
enable register has no effect when this clock mode is selected.
In its typical configuration, the XTAL oscillator is connected in a Pierce oscillator
configuration, as shown in Figure 11-2. This figure shows only the logical
representation of the internal components and may not represent actual circuitry.
The oscillator configuration uses five components:
NOTE:The series resistor (R
guidelines and may not be required for all ranges of operation, especially with high
frequency crystals. Refer to the crystal manufacturer’s data for more information.
•Crystal, X
•Fixed capacitor, C
1
1
•Tuning capacitor, C2 (can also be a fixed capacitor)
•Feedback resistor, R
B
•Series resistor, RS (optional)
) is included in the diagram to follow strict Pierce oscillator
S
Data SheetMC68HC908QY/QT Family — Rev. 3
98Oscillator Module (OSC)MOTOROLA
Oscillator Module (OSC)
Functional Description
FROM SIM
BUSCLKX2BUSCLKX4
XTALCLK
SIMOSCEN
MCU
OSC2OSC1
(1)
R
R
B
X
1
C
1
Note 1.
can be zero (shorted) when used with higher-frequency crystals. Refer to manufacturer’s
R
S
data. See Section 16. Electrical Specifications for component value recommendations.
S
C
2
TO SIMTO SIM
÷ 2
Figure 11-2. XTAL Oscillator External Connections
11.3.4 RC Oscillator
The RC oscillator circuit is designed for use with external R to provide a clock
source with tolerance less than 25%.
In its typical configuration, the RC oscillator requires two external components, one
R and one C. In the MC68HC908QY4, the capacitor is internal to the chip. The R
value should have a tolerance of 1% or less, to obtain a clock source with less than
25% tolerance. The oscillator configuration uses one component, R
EXT
.
In this configuration, the OSC2 pin can be left in the reset state as PTA4. Or, the
OSC2EN bit in the port A pullup enable register can be set to enable the OSC2
output function on the pin. Enabling the OSC2 output slightly increases the external
RC oscillator frequency, f
RCCLK
.
See Figure 11-3
MC68HC908QY/QT Family — Rev. 3Data Sheet
MOTOROLAOscillator Module (OSC)99
Oscillator Module (OSC)
OSCRCOPT
INTCLK
SIMOSCEN
MCU
V
DD
See Section 16. Electrical Specifications for component value requirements.
EXTERNAL RC
EN
OSCILLATOR
OSC1
R
EXT
RCCLK
PTA4/BUSCLKX4 (OSC2)
0
1
1
0
Figure 11-3. RC Oscillator External Connections
TO SIM
PTA4
I/O
TO SIMFROM SIM
BUSCLKX2BUSCLKX4
÷ 2
PTA4
OSC2EN
11.4 Oscillator Module Signals
The following paragraphs describe the signals that are inputs to and outputs from
the oscillator module.
11.4.1 Crystal Amplifier Input Pin (OSC1)
The OSC1 pin is either an input to the crystal oscillator amplifier, an input to the RC
oscillator circuit, or an external clock source.
For the internal oscillator configuration, the OSC1 pin can assume other functions
according to Table 1-3. Function Priority in Shared Pins.
For the XTAL oscillator device, the OSC2 pin is the crystal oscillator inverting
amplifier output.
For the external clock option, the OSC2 pin is dedicated to the PTA4 I/O function.
The OSC2EN bit has no effect.
For the internal oscillator or RC oscillator options, the OSC2 pin can assume other
functions according to Table 1-3. Function Priority in Shared Pins, or the output
of the oscillator clock (BUSCLKX4).
Data SheetMC68HC908QY/QT Family — Rev. 3
100Oscillator Module (OSC)MOTOROLA
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.