Motorola reserves the righ t to make changes without further notice to any products
herein. Motorola makes no warranty, representation or guarantee regarding the
suitability of i ts products for any partic ular purpose, nor does Moto rola assume any
liability arising out of the application or use of any prod uct or circuit, and s pecifically
disclaims any an d all liability, including withou t limitation consequential or inc idental
damages. "Typical" parameters which may be provided in Motorola data sheets and/or
specifications can an d do vary in different applications and actua l performance may
vary over time. A ll operating parameters, i ncluding "Typicals" must be validated for
each customer application by customer’s technical experts. Motorola does not convey
any license under i ts patent rights nor the rig hts of others. Motorola prod ucts are not
designed, intended, or authorized for use as components in systems intended for
surgical implant into the body, or other applications intended to support or sustain life,
or for any other applicat ion in wh ich the failure of the Mo torola pr oduct could cr eate a
situation where personal injury or death may oc cur. Should Buyer purchase o r use
Motorola products for any such unintended or una uthorized application, Buye r shall
indemnify and hold Motorola and its officers, employees, subsid iaries, affiliates, and
distributors harmless against all claims, costs, damages, and expenses, and
reasonable attorney fees arising out of, directly or indirectly, any claim of personal
injury or death associated with such unintended or unauthorized use, even if such claim
alleges that Motorola was negligent reg arding the design o r manufacture of the p art.
Motorola, Inc. is an Equal Opportunity/Affirmative Action Employer.
The MC68HC908GR8 is a member of the low-cost, high-performance
M68HC08 Family of 8- bit micro cont rol ler uni t s (MCU s). All M CUs in th e
family use the enhanced M68HC08 central processor unit (CPU08) and
are available with a variety of modules, memory sizes and types, and
package types.
This document also describes the MC68HC908GR4. The
MC68HC908GR4 is a device identical to the MC68HC908GR8 except
that it has less Flash memory. Only wh en there are differ ences from the
MC68HC908GR8 is the MC68HC908GR4 specifically mentioned in the
text.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAGeneral Description25
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
General Description
1.3 Features
For convenie nce, features have been organized to reflect:
•Standard features of the MC68HC908GR8
•Features of the CPU08
1.3.1 Standard Features of the MC68HC908GR8
•High-performance M68HC08 architecture optimized for Ccompilers
nc...
I
cale Semiconductor,
Frees
•Fully upward-com pa tibl e obj ect cod e wi th M 680 5, M 14 68 05, and
M68HC05 Families
•8-MHz internal bus frequency
•FLASH program memory security
•On-chip programming firmware for use with host personal
computer which does not require high voltage for entry
•In-system programming
•System protection features:
–Optional computer operating properly (COP) reset
–Low-voltage detection with optional reset and selectable trip
points for 3.0 V an d 5.0 V operation
–Illegal opcode detection with reset
–Illegal address detection with reset
•Low-power design; fully static with stop and wait modes
•Standard low-power modes of operation:
(1)
–Wait mode
–Stop mode
•Master reset pin and power-o n reset (POR)
1. No security feature is absolute ly se cure . Howe ve r, Motorola’s strategy is to make reading or
copying the FLASH difficult for unauthorized users.
Technical DataMC68HC908GR8 — Rev 4.0
26General DescriptionMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
•7680 bytes of on-chip FLASH memory on the MC68HC908GR8
•384 bytes of on-chip random-access memory (RAM)
•Serial peripheral interface module (SPI)
•Serial communications inte rface module (SCI)
•One 16-bit, 2-channel timer (TIM1) and one 16-bit, 1-channel
General Description
Features
and 4096 bytes of on-chip FLASH memory on the
MC68HC908GR4 with in-circuit programming capabilities of
FLASH program memory
timer (TIM2) interface modules with sel ectab le input capture,
output compare, and PWM cap ability on each channel
•Up to 21 general-purpose input/output (I/O) pins, including:
–19 shared-function I/O pins
–Up to two dedicated I/O pins, depending on package choice
•Selectable pullups on inputs only on ports A, C, and D. Selection
is on an individual port bit basis. During output mode, pullups are
disengaged.
•High current 10-mA sink/10-mA source capab ility on all port pins
•Higher current 15-mA sink/source capability on PTC0–PTC1
•Timebase module with clock prescaler circuitry for eight user
selectable periodic re al- ti me int er rupts with optional active clock
source during stop mode for periodic wakeup from stop using an
external 32-kHz crystal
•Oscillator stop mode enable bit (OSCSTOPENB) in the CONFIG
register to allow user s electio n of havin g the oscill ator enabled or
disabled during stop mode
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAGeneral Description27
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
General Description
•4-bit keyboard wakeup port
•32-pin quad flat pack (QFP) or 2 8-p in pla stic dual- in-line package
•Specific features of the MC68HC908GR8 in 28-pin DIP and 28-p in
1.3.2 Features of the CPU08
(DIP) or 28-pin small outline integrated circuit (SOIC)
SOIC are:
–Port B is only 4 bits: PTB 0–PTB3; 4-channel ADC module
–No Port C bits
nc...
I
cale Semiconductor,
Frees
1.4 MCU Block Diagram
Features of the CPU08 include:
•Enhanced HC05 programming model
•Extensive lo op 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
Figure 1-1 shows the struc ture of the MC68HC908GR8.
Technical DataMC68HC908GR8 — Rev 4.0
28General DescriptionMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
General Description
MCU Block Diagram
nc...
I
cale Semiconductor,
Frees
–PTA0/KBD0 †
PTD6/T2CH0 †
PTD5/T1CH1 †
PTD4/T1CH0 †
PTA3/KBD3
PORTA
DDRA
INTERNAL BUS
MODULE
PROGR. TIMEBASE
UNIT (ALU)
ARITHMETIC/LOGIC
M68HC08 CPU
PTB5/AD5–PTB0/AD0
PORTB
DDRB
MODULE
SINGLE BRKPT BREAK
DUAL V. LOW-VOLTAGE INH IBI T
PTC1–PTC0 † ‡
PORTC
DDRC
MODULE
4-BIT KEYBOARD
INTERRUPT MODULE
2-CHANNEL TIMER INTERFACE
PTD3/SPSCK †
MODULE 1
MODULE 2
1-CHANNEL TIMER INTERFACE
†
PTE1/RxD
COMPUTER OPERATING
PROPERLY MODULE
PHASE-LOCKED LOOP
PTE0/TxD
PORTE
DDRE
MODULE
POWER-ON RESET
MODULE
DATA BUS SWITCH
INTERFACE MODULE
24 INTR SYSTEM INTEGRATION
MONITOR MODULE
MODULE
MODULE
SINGLE EXTERNAL IRQ
CONVERTER MODULE
8-BIT ANALOG-TO-DIG ITA L
SERIAL PERIPHERAL
MODULE
SECURITY
MODULE
MEMORY MAP
POWER
MODULE
MONITOR MODE ENTRY
MODULE
MASK OPTION REGISTER1
MODULE
MASK OPTION REGISTER2
PTD2/MOSI †
PTD1/MISO †
PTD0/SS
PORTD
DDRD
INTERFACE MODULE
SERIAL COMMUNICATIONS
32-kHz OSCILLATOR
CLOCK GENERATOR MODULE
USER RAM — 384 BYTES
CPU
REGISTERS
MC68HC908GR4 US ER FLA SH — 4096BYTES
MC68HC908GR8 USER FLASH — 7680 BYTES
CONTROL AND STATUS REGISTERS — 64 BYTES
MONITOR ROM — 310 BYTES
OSC1
USER FLASH VECTOR SPACE — 36 BYTES
FLASH PROGRAMMING (BURN-IN) ROM — 544 BYTES
OSC2
CGMXFC
* RST
* IRQ
DD
DDA
SSA
VSSV
REFL
REFH
V
/ V
SSAD
DDAD /
V
V
V
V
† Ports are software configurable with pullup device if input port.
‡ Higher current drive port pins
* Pin contains integrated pullup device
Figure 1-1. MCU Block Diagram
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAGeneral Description29
For More Information On This Product,
Go to: www.freescale.com
General Description
1.5 Pin Assignments
Freescale Semiconductor, Inc.
OSC1
OSC2
32
RST
1
PTE0/TxD
PTE1/RxD
IRQ
nc...
I
PTD0/SS
PTD1/MISO
PTD2/MOSI
PTD3/SPSCK
NOTE: Ports PTB4, PTB5, PTC0, and PTC1 are available only with the QFP.
31
2
3
4
5
6
7
8
9
10
SS
DD
V
V
SSAVDDA
CGMXFC
V
29
30
11
12
PTD4/T1CH0
PTD5/T1CH1
28
13
PTD6/T2CH0
PTC1
27
14
PTB0/AD0
Figure 1-2. QFP Pin Assignments
cale Semiconductor,
PTC0
PTB1/AD1
26
15
PTA3/KBD3
25
24
23
22
21
20
19
18
17
16
PTB2/AD2
PTA2/KBD2
PTA1/KBD1
PTA0/KBD0
V
SSAD/VREFL
V
DDAD/VREFH
PTB5/AD5
PTB4/AD4
PTB3/AD3
Frees
Technical DataMC68HC908GR8 — Rev 4.0
30General DescriptionMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
General Description
Pin Functions
nc...
I
NOTE: Ports PTB4, PTB5, PTC0, and PTC1 are available only with the QFP.
1.6 Pin Functions
Descriptions of the pin fun cti on s are pr ovide d her e .
1.6.1 Power Supply Pins (VDD and VSS)
VDD and VSS are the power supply and grou nd pins. The MCU opera tes
cale Semiconductor,
Frees
from a single power supply.
Fast signal transitions on MCU pins place high, short-duration current
demands on the power supply. To prevent noise problems, take special
care to provide power supply bypassing at the MCU as Figure 1-4
shows. Place the C1 bypass cap acitor as close to t he MCU as possib le.
Use a high-frequency-response ceramic capacitor for C1. C2 is an
optional bulk current bypass capacitor for use in applications that require
the port pins to source high current levels.
The OSC1 and OSC2 pins a re the connectio ns for the on-chi p oscillator
circuit. See Clock Generator Module (CGMC).
1.6.3 External Reset Pin (RST)
A logic 0 on the RST pin forces the MCU to a known startup state. RST
is bidirectional, allowing a reset of the entire system. It is driven low when
any internal reset sour ce is asserted. This pin contains an int ernal pullup
resistor that is always activated, even when the reset pin is pulled low.
IRQ is an asynchronous external interrupt pin. This pin contains an
internal pullup resistor tha t is always activated , even when the re set pin
is pulled low. See External Interrupt (IRQ).
1.6.5 CGM Power Supply Pins (V
V
and V
DDA
and V
DDA
are the power supply pins for the analog portion of the
SSA
SSA
)
clock generator module (CGM). Decoupling of these pins should be as
per the digital supply. See Clock Generator Module (CGMC).
Technical DataMC68HC908GR8 — Rev 4.0
32General DescriptionMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
1.6.6 External Filter Capacitor Pin (CGMXFC)
CGMXFC is an external filter capacitor connection for the CGM. See
Clock Generator Module (CGMC).
General Description
Pin Functions
1.6.7 Analog Power Supply/Reference Pins (V
V
DDAD
and V
are the power supply pins for the analog-to-digital
SSAD
DDAD/VREFH
converter. Decoupli n g o f these pins should be as per the digital supp l y.
NOTE:V
internally connected with V
nc...
I
V
V
internally connected wi th V
V
is the high reference supply for the ADC. The V
REFH
DDAD
should be tied to the same potential as VDD via separate traces.
DDAD
is the low reference supply for the ADC. The V
REFL
SSAD
should be tied to the same potential as VSS via separate traces.
SSAD
See Analog-to-Digital Converter (ADC).
1.6.8 Port A Input/Output (I/O) Pins (PTA3/KBD3–PTA0/KBD0)
PTA3–PTA0 are special-function, bidirectional I/O port pins. Any or all of
the port A pins can be progr ammed to ser ve as keybo ard interr upt pins.
See Input/Output Ports (I/O) and External Interrupt (IRQ).
These port pins also have selectable pullups when configured for input
cale Semiconductor,
mode. The pullups are disengaged when configured for output mode.
The pullups are selectable on an individual port bit basis.
When the port pins are configured for special-function mode (KBI),
Frees
pullups will be automatically engaged. As long as the port pins are in
special-function mode, the pullups will always be on.
and V
SSAD/VREFL
)
REFH
signal is
and have the same pote ntial a s V
pin is
REFL
and has the same potential as V
DDAD.
SSAD.
1.6.9 Port B I/O Pins (PTB5/AD5–PTB0/AD0)
PTB5–PTB0 are special-function, bi directional I/O port p ins that can also
be used for anal og-to-digital converter (ADC) inp uts. See Input/Output
Ports (I/O) and Analog-to-Digital Converter (ADC).
There are no pullups associated with this port.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAGeneral Description33
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
General Description
1.6.10 Port C I/O Pins (PTC1–PTC0)
PTC1–PTC0 are general-purpose, bidirectional I/O port pins. See
Input/Output Ports (I/O). PTC0 and PTC1 are only available on 32-pin
QFP packages.
These port pins also have selectable pullups when configured for input
mode. The pullups are disengaged when configured for output mode.
The pullups are selectable on an individual port bit basis.
1.6.11 Port D I/O Pins (PTD6/T2CH0–PTD0/SS)
nc...
I
1.6.12 Port E I/O Pins (PTE1/RxD–PTE0/TxD)
PTD6–PTD0 are special-function, bidirectional I/O port pins.
PTD3–PTD0 can be programm ed t o b e seri al p eriph eral i nter fac e (SP I)
pins, while PTD6–PTD4 can be individually programmed to be timer
interface module (TIM1 and TIM2) pins. See Timer Interface Module
(TIM), Serial Peripheral Interface (SPI), and Input/Output Ports (I/O).
These port pins also have selectable pullups when configured for input
mode. The pullups are disengaged when configured for output mode.
The pullups are selectable on an individual port bit basis.
When the port pins are configured for special-function mode (SPI, TIM1,
TIM2), pullups can be selectable on an individual port pin basis.
cale Semiconductor,
PTE1–PTE0 are special-function, bidir ectional I/O po rt pins. These pi ns
can also be programmed to be serial communications interface (SCI)
Frees
pins. See Serial Communications Inte rface (SCI) and Input/Output Ports
(I/O).
NOTE:Any unused inputs and I/O ports should be tied to an appropriate logic
level (either VDD or VSS). Although the I/O ports of the MC68H C908GR8
do not require termination, termination is recommended to reduce the
possibility of electro-static discharge damage.
The CPU08 can address 64K bytes of memory space. The memory
map, shown in Figure 2-1, includes:
•8K bytes of FLA SH memory, 7680 bytes of user space on the
MC68HC908GR8 or
4K bytes of FLA SH memory, 4096 bytes of user space on the
MC68HC908GR4
•384 bytes of random-access memory (RAM)
•36 bytes of user-defined vectors
•310 bytes of monitor routines in read-only memory (ROM)
•544 bytes of integrated FLAS H bu rn -i n rout ines in ROM
2.3 Unimplemented Memory Locations
Accessing an unimplemented location can cause an illegal address
reset if illegal address resets are enabled. In the memory map (Figure 2-
1) and in register figures in this document, unimplemented locations are
shaded.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAMemory Map35
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Memory Map
2.4 Reserved Memory Locations
Accessing a reserved location can have unpredictable effects on MCU
operation. In t he Figure 2-1 and in register figures in this document,
reserved locations ar e marke d with the w ord Reser ved or wi th the le tter
R.
2.5 Input/Output (I/O) Section
Most of the control, status, and data registers are in the zero page area
of $0000–$003F. Additional I/O registers have these addresses:
nc...
I
cale Semiconductor,
Frees
•$FE00; SIM break status register, SBSR
•$FE01; SIM reset status register, SRSR
•$FE03; SIM break flag control register, SBFCR
•$FE09; interrupt status register 1, INT1
•$FE0A; interrupt status register 2, INT2
•$FE0B; interrupt status register 3, INT3
•$FE07; reserved FLASH test cont rol register, FLTCR
•$FE08; FLASH control register, FLCR
•$FE09; break address register high, BRKH
•$FE0A; break ad dress register low, BRKL
•$FE0B; break status and control register, BRKSCR
•$FE0C; LVI status register, LVISR
•$FF7E; FLASH block protect reg ister , FL BPR
Data registers are shown in Figure 2-2, and Table 2-1 is a list of vector
locations.
Technical DataMC68HC908GR8 — Rev 4.0
36Memory MapMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
$0000
↓
$003F
$0040
↓
$01BF
$01C0
↓
$1BFF
I/O Registers
64 Bytes
RAM
384 Bytes
Unimplemented
6720 Bytes
Memory Map
Input/Output (I/O) Section
nc...
I
cale Semiconductor,
Frees
$1C00
↓
$1E1F
$1E20
↓
$DFFF
$E000
↓
$EDFF
$EE00
↓
$FDFF
$FE00SIM Break Status Register (SBSR)
$FE01SIM Reset Status Register (SRSR)
$FE02
Reserved for Integrated FLASH Burn-in Routines
544 Bytes
Unimplemented
49,632 Bytes
MC68HC908GR4
Unimplemented
MC68HC908GR8
FLASH Memory
7680 Bytes
Reserved
3584 Bytes
MC68HC908GR4
FLASH Memory
4096 Bytes
$FE03SIM Break Flag Control Register (SBFCR)
$FE09Interrupt Status Register 1 (INT1)
$FE0AInterrupt Status Register 2 (INT2)
$FE0BInterrupt Status Register 3 (INT3)
$FE07
Reserved for FLASH Test Control Register (FLTCR)
Figure 2-1. Memory Map
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAMemory Map37
For More Information On This Product,
Go to: www.freescale.com
Memory Map
Freescale Semiconductor, Inc.
$FE08FLASH Control Register (FLCR)
$FE09Break Address Register High (BRKH)
$FE0ABreak Address Register Low (BRKL)
$FE0BBreak Status and Control Register (BRKSCR)
$FE0CLVI Status Register (LVISR)
$FE0D
↓
$FE0F
Reserved
3 Bytes
nc...
I
cale Semiconductor,
Frees
$FE10
↓
$FE1F
$FE20
↓
$FF55
Note: $FFF6–$FFFD
contains
8 security bytes
$FF56
↓
$FF7D
$FF7EFLASH Block Protect Register (FLBPR)
$FF7F
↓
$FFDB
$FFDC
↓
$FFFE
Reserved for Compatibility with Monitor Code
Unimplemented
16 Bytes
for A-Family Parts
Monitor ROM
310 Bytes
Unimplemented
40 Bytes
Unimplemented
93 Bytes
FLASH Vectors
(36 Bytes inluding $FFFF)
$FFFF
Low byte of reset vector when read
COP Control Register (COPCTL)
Figure 2-1. Memory Map (Continued)
Technical DataMC68HC908GR8 — Rev 4.0
38Memory MapMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Memory Map
Input/Output (I/O) Section
Addr.Register NameBit 7654321Bit 0
nc...
I
cale Semiconductor,
Frees
$0000
$0001
$0002
$0003
$0004
$0005
$0006
$0007
$0008
Port A Data Register
Port B Data Register
Port C Data Register
Port D Data Register
Data Direction Register A
Data Direction Register B
Data Direction Register C
Data Direction Register D
Port E Data Register
(PTA)
(PTB)
(PTC)
(PTD)
(DDRA)
(DDRB)
(DDRC)
(DDRD)
(PTE)
Read:0000
PTA3PTA2PTA1PTA0
Write:
Reset:Unaffected by reset
Read:00
PTB5PTB4PTB3PTB2PTB1PTB0
Write:
Reset:Unaffected by reset
Read:000000
PTC1PTC0
Write:
Reset:Unaffected by reset
Read:0
PTD6PTD5PTD4PTD3PTD2PTD1PTD0
Write:
Reset:Unaffected by reset
Read:0000
DDRA3DDRA2DDRA1DDRA0
Write:
Reset:00000000
Read:00
DDRB5DDRB4DDRB3DDRB2DDRB1DDRB0
Write:
Reset:00000000
Read:000000
DDRC1DDRC0
Write:
Reset:00000000
Read:0
DDRD6DDRD5DDRD4DDRD3DDRD2DDRD1DDRD0
Write:
Reset:00000000
Read:000000
PTE1PTE0
Write:
Reset:Unaffected by reset
Read:
$0009 Unimplemented
Write:
Reset:00000000
= UnimplementedR = ReservedU = Unaffected
Figure 2-2. Control, Status, and Data Registers (Sheet 1 of 8)
The MCU may enter two low-power modes: wait mode and stop mode.
They are common to a ll HC08 MCUs and are entere d through instruction
execution. This section describes how each module acts in the lowpower modes.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLALow Power Modes49
For More Information On This Product,
Go to: www.freescale.com
Low Power Modes
3.2.1 Wait Mode
3.2.2 Stop Mode
nc...
I
Freescale Semiconductor, Inc.
The WAIT instruction puts the MCU in a low-power standby mode in
which the CPU clock is disabled but the bus clock continues to run.
Power consumption can be furt her reduced by disabling the LVI mo dule
and/or the timebase module through bits in the CONFIG register. (See
Configuration Regis ter (CONFIG).)
Stop mode is entered when a STOP instruction is executed. The CPU
clock is disabled and the bus clock is disabled if the OSCSTOPENB bit
in the CONFIG register is at a logic 0. (See Configuration Register
(CONFIG).)
3.3 Analog-to-Digital Converter (ADC)
3.3.1 Wait Mode
The ADC continues normal operation during wait mode. Any enabled
CPU interrupt request from the ADC can bring th e 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 ADCH4–ADCH0 bits in the ADC status
and control register before executing the WAIT instruction.
cale Semiconductor,
3.3.2 Stop Mode
Frees
The ADC module is inactive after the execution of a S T OP instruction.
Any pending conversion is aborted. ADC conversions resume when the
MCU exits stop mode after an external interrupt. Allow one conversion
cycle to stabilize the analog circuitry.
Technical DataMC68HC908GR8 — Rev 4.0
50Low Power ModesMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
3.4 Break Module (BRK)
3.4.1 Wait Mode
3.4.2 Stop Mode
nc...
I
Freescale Semiconductor, Inc.
If enabled, the bre ak module is active i n wait mode . In the break routi ne,
the user can subtract one from the return address on the stack if the BW
bit in the break status register is set.
The break module is ina ctive in stop mode. A break in terrupt causes exit
from stop mode and sets the BW bit in the break status register. The
STOP instruction does not affect break module register states.
Low Power Modes
Break Module (BRK)
3.5 Central Processor Unit (CPU)
3.5.1 Wait Mode
The WAIT instruction:
•Clears the interrupt mask (I bit) in the condition code register,
cale Semiconductor,
3.5.2 Stop Mode
•Disables the CPU clock
Frees
The STOP instruction:
•Clears the interrupt mask (I bit) in the condition code register,
enabling interrupts. After exit from wait mod e by interrupt, the I bit
remains clear. After exit by reset, the I bit is set.
enabling external in terrupts. 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.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLALow Power Modes51
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Low Power Modes
3.6 Clock Generator Module (CGM)
3.6.1 Wait Mode
The CGM remains active in wait mode. Before entering wait mode,
software can disengage and turn off the PLL by clearing the BCS and
PLLON bits in the PLL control register (PCTL). Less power-sensitive
applications can disengage the PLL without turning it off. Applications
that require the PLL to wake the M CU from wait mode al so can deselect
the PLL output without turning off the PLL.
nc...
I
3.6.2 Stop Mode
If the OSCSTOPEN bit in the CONFIG register is cleared (default), then
the STOP instruction disables the CGM (oscillator and phase-locked
loop) and holds low all CGM outputs (CGMXCLK, CGMOUT, and
CGMINT).
cale Semiconductor,
If the STOP instruction is executed with the VCO clock, CGMVCLK,
divided by two driv ing C GM OU T, th e P LL automatically cle ar s th e BCS
bit in the PLL control register (PCTL), thereby selecting the crystal clock,
CGMXCLK, divided by two as t he source of CGMOUT. When t he MC U
recovers from STOP, the crystal clock divided by two drives CGMOUT
and BCS remains clear.
If the OSCSTOPEN bit in the CONFIG register is set, then the phase
locked loop is shut off, but the oscillator will continue to operate in stop
mode.
Frees
3.7 Computer Operating Properly Module (COP)
3.7.1 Wait Mode
The COP remains active in wait mode. To prevent a COP reset during
wait mode, per iodically clear the COP coun ter in a CPU interrupt rou tine
or a DMA service routine.
Technical DataMC68HC908GR8 — Rev 4.0
52Low Power ModesMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
3.7.2 Stop Mode
Stop mode turns off the CGMXCLK input to the COP and clea rs the COP
prescaler. Service the COP immediately be for e en ter i ng or a fte r exi ti ng
stop mode to ensure a full COP timeout period after entering or exiting
stop mode.
The STOP bit in t he configura tion registe r (CONFIG) enables the STOP
instruction. To prevent inadvertently turning off the COP with a STOP
instruction, disable the STOP instruction by clearing the STOP bit.
3.8 External Interrupt Module (IRQ)
nc...
I
Low Power Modes
External Interrupt Module (IRQ)
3.8.1 Wait Mode
The IRQ module remains active in wait mode. Clearing the IMASK1 bit
in the IRQ status and control register enables IRQ CPU interrupt
requests to bring the MCU out of wait mode.
3.8.2 Stop Mode
The IRQ module remains active in stop mode. Clearing the IMASK1 bit
in the IRQ status and control register enables IRQ CPU interrupt
requests to bring the MCU out of stop mode.
cale Semiconductor,
3.9 Keyboard Interrupt Module (KBI)
Frees
3.9.1 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 bri ng the MCU out of wai t mod e.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLALow Power Modes53
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Low Power Modes
3.9.2 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.
3.10 Low-Voltage Inhibit Module (LVI)
3.10.1 Wait Mode
If enabled, the LVI module remains active in wait mode. If enabled to
nc...
I
generate resets, the L VI module can generate a reset and brin g the MCU
out of wait mode.
3.10.2 Stop Mode
If enabled, th e LVI module remains active in stop mode. If enabled to
generate resets, the L VI module can generate a reset and brin g the MCU
out of stop mode.
3.11 Serial Communications Interface Module (SCI)
3.11.1 Wait Mode
cale Semiconductor,
The SCI module remains active in wait mode. Any enabled CPU
interrupt request from the SCI module can bring the MCU out of wait
Frees
mode.
If SCI module fun ctions are not required du ring wait mode, redu ce power
consumption by disabling the module before executing the WAIT
instruction.
Technical DataMC68HC908GR8 — Rev 4.0
54Low Power ModesMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
3.11.2 Stop Mode
Freescale Semiconductor, Inc.
The SCI module is inacti ve in stop mode. The STOP inst ruction does not
affect SCI register states. SCI module operation resumes after the MCU
exits stop mode.
Because the internal clock is inactive during stop mode, en tering stop
mode during an SCI transmission or reception results in invalid data.
3.12 Serial Peripheral Interface Module (SPI)
nc...
3.12.1 Wait Mode
I
Low Power Modes
Serial Peripheral Interface Module (SPI)
The SPI module remains active in wait mode. Any enabled CPU interrupt
request from the SPI module can bring the MCU out of wait mode.
If SPI module functi ons are not required during wait mo de, reduce power
consumption by disabling the SPI module before executing the WAIT
instruction.
3.12.2 Stop Mode
The SPI module is inactive in stop mode. The STOP instruction does not
affect SPI register states. SPI operation resumes after an external
cale Semiconductor,
Frees
3.13 Timer Interface Module (TIM1 and TIM2)
3.13.1 Wait Mode
interrupt. If stop mode is exited by reset, any transfer in progress is
aborted, and the SPI is reset.
The TIM remains active in wait mode. Any enabled CPU interrupt
request from the TIM can bring the MCU out of wait mode.
If TIM functions are not required during wait mode, reduce power
consumption by stopping the TIM before execu ting the WAIT instruction .
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLALow Power Modes55
For More Information On This Product,
Go to: www.freescale.com
Low Power Modes
3.13.2 Stop Mode
The TIM is inactive in stop m o de. The STOP i n structi o n do es n ot a ffe ct
register states or the state of the TIM counter. TIM operation resumes
when the MCU exits stop mode after an external interrupt.
3.14 Timebase Module (TBM)
3.14.1 Wait Mode
The timebase module remains active after execution of the WAIT
nc...
I
instruction. In wait mode, the timebase register is not accessible by the
CPU.
Freescale Semiconductor, Inc.
3.14.2 Stop Mode
cale Semiconductor,
Frees
If the timebase functions are not required during wait mode, reduce the
power consumption by stop ping the timebase bef ore enabling the WAIT
instruction.
The timebase module may remain active after execution of the STOP
instruction if the oscillator has been enabled to operate during stop mode
through the OSCSTOPEN bit in the CONFIG register. The timebase
module can be used in this mode to generate a periodic wakeup from
stop mode.
If the oscillator has not been enabled to operate in stop mode, the
timebase module will not be active during stop mode. In stop mode, the
timebase register is not accessible by the CPU.
If the timebase funct ions ar e not r equir ed du ring sto p mode, r educe the
power consumptio n by stopping the timeba se before enabling the S TOP
instruction.
Technical DataMC68HC908GR8 — Rev 4.0
56Low Power ModesMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
3.15 Exiting Wait Mode
These events restart the CPU clock and load the program counter with
the reset vector or with an interrupt vector:
•External reset — A logic 0 on the RST pin resets the MCU and
•External interrupt — A high-to-low transition on an external
Low Power Modes
Exiting Wait Mode
loads the program counter with the contents of locations $FFFE
and $FFFF.
interrupt pin (IRQ pin) loads the program counter with the contents
of locations: $FFFA and $FFFB; IRQ pin.
nc...
I
cale Semiconductor,
Frees
•Break interrupt — A break interrupt loads the program counter
with the contents of $FFFC and $FFFD.
•Computer operating properly module (COP) reset — A timeout of
the COP counter resets the MCU and lo ads th e pr og ra m cou nte r
with the contents of $FFFE and $FFFF.
•Low-voltage inhibit module (LVI) reset — A power supply voltage
below the V
counter with the contents of locations $FFFE and $FFFF.
•Clock generator module (CGM) interrupt — A CPU interrupt
request from the phase-locked loop (PLL) loads the program
counter with the contents of $FFF8 and $FFF9.
•Keyboard module (KBI) interrupt — A CPU interrupt request from
the KBI module loads the program counter with the contents of
$FFDE and $FFDF.
•Timer 1 interface module (TIM1) interrupt — A CPU interrupt
request from the TIM1 loads the program counter with the
contents of:
voltage resets the MCU and loads the program
tripf
–$FFF2 and $FFF3; TIM1 overflow
–$FFF4 and $FFF5; TIM1 channel 1
–$FFF6 and $FFF7; TIM1 channel 0
•Timer 2 interface module (TIM2) interrupt — A CPU interrupt
request from the TIM2 loads the program counter with the
contents of:
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLALow Power Modes57
For More Information On This Product,
Go to: www.freescale.com
Low Power Modes
nc...
I
Freescale Semiconductor, Inc.
•Serial peripheral interface module (SPI) interrupt — A CPU
•Serial communications interface module (SCI) interrupt — A CPU
–$FFEC and $FFED; TIM2 overflow
–$FFF0 and $FFF1; TIM2 channel 0
interrupt request from the SPI loads the program counter with the
contents of:
–$FFE8 and $FFE9; SPI transmitter
–$FFEA and $FFEB; SPI receiver
interrupt request from the SCI loads the program counter with the
contents of:
–$FFE2 and $FFE3; SCI transmitter
3.16 Exiting Stop Mode
cale Semiconductor,
Frees
–$FFE4 and $FFE5; SCI receiver
–$FFE6 and $FFE7; SCI receiver error
•Analog-to-digital converter module (ADC) interrupt — A CPU
interrupt request from the ADC loads the program counter with the
contents of: $FFDE and $FFDF; ADC conversion complete.
•Timebase module (TBM) interrupt — A CPU interrupt re quest from
the TBM loads the program counter with the contents of: $FFDC
and $FFDD; TBM interrupt.
These events restart the system clocks and load the program counter
with the reset vector or with an interrupt vector:
•External reset — A logic 0 on the RST pin resets the MCU and
loads the program counter with the contents of locations $FFFE
and $FFFF.
•External interrupt — A high-to-low transition on an external
interrupt pin loads the program counter with the contents of
locations:
–$FFFA and $FFFB; IRQ pin
–$FFDE and $FFDF; keyboard interrupt pins
Technical DataMC68HC908GR8 — Rev 4.0
58Low Power ModesMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Low Power Modes
nc...
I
Freescale Semiconductor, Inc.
•Low-voltage inhi bit (LVI) reset — A power supply voltage belo w
•Break interrupt — A break interrupt loads the program counter
•Timebase module (TBM) interrupt — A TBM interrupt loads the
Upon exit from stop mode, the system clocks begin running after an
oscillator stabilization delay. A 12-bit stop recovery counter inhibits the
system clocks for 4096 CGMXCLK cycles after the reset or external
interrupt.
the LVI
with the contents of locations $FFFE and $FFFF.
with the contents of locations $FFFC and $FFFD.
program counter with the contents of locations $FFDC and $FFDD
when the timebase counter has rolled over. This allows the TBM
to generate a periodic wakeup from stop mode.
voltage resets the MCU and loads the program counter
tripf
cale Semiconductor,
Frees
The short stop recovery bit, SSREC, in the configuration register
controls the oscillator stabilization delay du ring stop recovery. Setting
SSREC reduces stop recovery time from 4096 CGMXCLK cycles to 32
CGMXCLK cycles.
NOTE:Use the full st op re cove ry time (SSREC = 0 ) in ap pl i cations that use an
Resets and interrupts are responses to exceptional events during
program execution. A rese t re-initializes the MCU to its sta rtup condition.
An interrupt vectors the program counter to a service routine.
A reset immediately returns the MCU to a known startup condition and
begins program execution from a user-defined memory location.
A reset:
•Immediately stops the operation of the instruction being executed
•Initializes certain control and status bits
•Loads the program counter with a user-defined reset vector
address from locations $FFFE and $FFFF
•Selects CGMXCLK divided by four as the bus clock
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAResets and Interrupts61
For More Information On This Product,
Go to: www.freescale.com
Resets and Interrupts
4.3.2 External Reset
Freescale Semiconductor, Inc.
4.3.3 Internal Reset
nc...
I
cale Semiconductor,
A logic 0 applied to the RST pin for a time, t
, generates an external
IRL
reset. An external reset sets the PIN bit in the SIM reset status register.
Sources:
•Power-on reset (POR)
•Computer operati ng properly (COP)
•Low-power reset circuits
•Illegal opcode
•Illegal address
All internal reset sources pull the RST pin low for 32 CGMXCLK cycles
to allow resetting of external devices. The MCU is held in reset for an
additional 32 CGMXCLK cycles after releasing the RST pin.
PULLED LOW BY MCU
RST PIN
32 CYCLES32 CYCLES
CGMXCLK
INTERNAL
RESET
Figure 4-1. Internal Reset Timing
Frees
4.3.3.1 Power-On Reset
A power-on reset is an internal reset caused by a positive transition on
the VDD pin. VDD at the POR must go comp letely to 0 V to reset the MCU.
This distinguishe s between a reset and a POR. The P OR is not a brownout detector, low-voltage detector, or glitch detector.
Technical DataMC68HC908GR8 — Rev 4.0
62Resets and InterruptsMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Resets and Interrupts
Resets
A power-on reset:
•Holds the clocks to the CPU and modules inactive for an oscillator
stabilization delay of 4096 CGMXCLK cycles
•Drives the RST pin low during the oscillator stabilization delay
•Releases the RST pin 32 CGMXCLK cycles after the oscillator
stabilization delay
•Releases the CPU to begin the reset vector sequence 64
CGMXCLK cycles after the oscillator stabilization delay
•Sets the POR bit in the SIM reset status register and clears all
other bits in the register
nc...
I
cale Semiconductor,
4.3.3.2 COP Reset
Frees
OSC1
CGMOUT
PIN
RST
RESET
(1)
4096
CYCLES32CYCLES32CYCLES
PORRST
CGMXCLK
INTERNAL
1. PORRST is an internally generated power-on reset pulse.
Figure 4-2. Power-On Reset Recovery
A COP reset is an internal reset caused by an overflow of the COP
counter. A COP reset sets the COP bit in the system integration module
(SIM) reset status register.
To clear the COP counter and prevent a COP reset, write any value to
the COP control register at location $FFFF.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAResets and Interrupts63
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Resets and Interrupts
4.3.3.3 Low-Voltage Inhibit Reset
A low-voltage inhibit (L VI) re set is an internal reset caused by a dr op in
the power supply voltage to the LVI trip voltage, V
An LVI reset:
•Holds the clocks to the CPU and modules inactive for an oscillator
stabilization delay of 4096 CGMXCLK cycles after the power
supply voltage rises to V
TRIPF
TRIPF
.
nc...
I
4.3.3.4 Illegal O pc ode Reset
cale Semiconductor,
4.3.3.5 Illegal Address Reset
•Drives the RST pin low for as long as VDD is below V
during the oscillator stabilization delay
•Releases the RST pin 32 CGMXCLK cycles after the oscillator
stabilization delay
•Releases the CPU to begin the reset vector sequence
64 CGMXCLK cycles after the oscillator stabilization delay
•Sets the LVI bit in the SIM reset status register
An illegal opcode re set is an inte rn al re set ca used by an op cod e tha t is
not in the instruction set. An illegal opcode reset sets th e ILOP bit in the
SIM reset status register.
If the stop enable bi t, STOP, in t he mas k opt ion regi ster is a logic 0, the
STOP instruction causes an illegal opcode reset.
TRIPF
and
Frees
Technical DataMC68HC908GR8 — Rev 4.0
64Resets and InterruptsMOTOROLA
An illegal address reset is an i nternal reset caused by opcode fe tch from
an unmapped address. An illegal address reset sets the ILAD bit in the
SIM reset status register.
A data fetch from an unmapped address does not generate a reset.
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
4.3.4 SIM Reset Sta t us Register
This read-only re gister contai ns flags to sho w reset sources. All flag b its
are automatically cl eare d follo wing a r ead of th e regi ster. Reset servi ce
can read the SIM reset status register to clear the register after poweron reset and to determine the source of any subsequen t reset.
The register is initi alized on p owerup as sho wn with the POR bit set and
all other bits clea red. Du ring a POR or any oth er intern al reset, th e RST
pin is pulled low. After the pin is released, it will be sampled 32 XCLK
cycles later. If the pin is not above a VIH at that time, then the PIN bit in
the SRSR may be set in addition to whatever other bits are set.
Resets and Interrupts
Resets
nc...
I
cale Semiconductor,
Frees
NOTE:Only a read of the SIM reset status register clears all reset flags. After
multiple resets from different sources without reading the register,
multiple flags remain set.
Address:$FE01
Bit 7654321Bit 0
Read:PORPINCOPILOPILAD0LVI0
Write:
POR:10000000
= Unimplemented
Figure 4-3. SIM Reset Status Register (SRSR)
POR — Power-On Reset Flag
1 = Power-on reset since last read of SRSR
0 = Read of SRSR since last power-on reset
PIN — External Reset Flag
1 = External reset via RST pin since last read of SRSR
0 = POR or read of SRSR since last external reset
COP — Computer Operating Properly Reset Bit
1 = Last reset caused by timeout of COP counter
0 = POR or read of SRSR
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAResets and Interrupts65
For More Information On This Product,
Go to: www.freescale.com
Resets and Interrupts
nc...
I
4.4 Interrupts
Freescale Semiconductor, Inc.
ILOP — Illegal Opcode Reset Bit
1 = Last reset caused by an illegal opcode
0 = POR or read of SRSR
ILAD — Illegal Address Reset Bit
1 = Last reset caused by an opcode fetch from an illegal address
0 = POR or read of SRSR
LVI — Low-Voltage Inhibit Reset Bit
1 = Last reset caused by low-power supply voltage
0 = POR or read of SRSR
4.4.1 Effects
cale Semiconductor,
Frees
An interrupt temporarily changes the sequence of program execution to
respond to a particular event. An interrupt does not stop the operation of
the instruction being executed, but begins when the current instruction
completes its operation.
An interrupt:
•Saves the CPU registers on the stack. At the end of th e interrup t,
the RTI instruction recovers the CPU registers from the stack so
that normal processing can resume.
•Sets the interrupt mask (I bit) to prevent additional interrupts.
Once an interrupt is latched, no other interrupt can take
precedence, regardless of its priority.
•Loads the program counter with a user-defined vector address
Technical DataMC68HC908GR8 — Rev 4.0
66Resets and InterruptsMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
•
•
•
Resets and Interrupts
Interrupts
CONDITION CODE REGISTER
5
4
STACKING
ORDER
nc...
I
3
PROGRAM COUNTER (HIGH BYTE)
2
PROGRAM COUNTER (LOW BYTE)
1
*High byte of index register is not stacked.
ACCUMULATOR
INDEX REGISTER (LOW BYTE)*
•
•
•
Figure 4-4. Interrupt Stacking Order
After every instruction, t he CPU chec ks all pe nd ing interrupts if the I bit
is not set. If more than one interrupt is pending when an instruction is
done, the highest priority interrupt is serviced first. In the example show n
in Figure 4-5, if an interrupt is pending upon exit from the interrupt
cale Semiconductor,
service routine, the pending interrupt is serviced before the LDA
instruction is executed.
1
2
3
UNSTACKING
ORDER
4
5
$00FF DEFAULT ADDRESS ON RESET
Frees
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAResets and Interrupts67
For More Information On This Product,
Go to: www.freescale.com
Resets and Interrupts
Freescale Semiconductor, Inc.
CLI
#$FF
LDA
INT1
INT2
nc...
I
PSHH
INT1 INTERRUPT SERVICE ROUTINE
PULH
RTI
PSHH
INT2 INTERRUPT SERVICE ROUTINE
PULH
RTI
BACKGROUND
ROUTINE
Figure 4-5. Interrupt Recognition Example
The LDA opcode is prefetched by both the INT1 and INT2 RTI
instructions. However, in the case of the INT1 RTI prefetch, this is a
redundant operation.
NOTE:To maintain compatibility with the M6805 Family, the H register is not
pushed on the stack during interrupt entry. If the interrupt service routine
modifies the H register or us es the inde xed a ddr e ssin g m ode , save the
H register and then restore it prior to exiting the routine.
cale Semiconductor,
Frees
Technical DataMC68HC908GR8 — Rev 4.0
68Resets and InterruptsMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
FROM RESET
Resets and Interrupts
Interrupts
nc...
I
cale Semiconductor,
Frees
YES
BREAK
INTERRUPT
?
NO
I BIT SET?
I BIT SET?
NO
IRQ
INTERRUPT
?
NO
CGM
INTERRUPT
?
NO
OTHER
INTERRUPTS
?
NO
FETCH NEXT
INSTRUCTION
SWI
INSTRUCTION
?
NO
RTI
INSTRUCTION
?
YES
YES
YES
YES
YES
YES
STACK CPU REGISTER S
LOAD PC WITH INTERRUPT VECTOR
UNSTACK CPU REGISTERS
SET I BIT
NO
EXECUTE INSTRUCTION
Figure 4-6. Interrupt Processing
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAResets and Interrupts69
For More Information On This Product,
Go to: www.freescale.com
Resets and Interrupts
4.4.2 Sources
The sources in Table 4-1 can generate CPU interrupt requests.
1. The I bit in the condition code register is a global mask for all interrupt sources except the SWI instruction.
2. 0 = highest priority
Technical DataMC68HC908GR8 — Rev 4.0
70Resets and InterruptsMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
4.4.2.1 SWI Instruction
4.4.2.2 Break Interrupt
nc...
I
4.4.2.3 IRQ Pin
Freescale Semiconductor, Inc.
The software interrupt instruction (SWI) causes a non-maskable
interrupt.
Resets and Interrupts
Interrupts
NOTE:A software interrupt pushes PC onto the stack. An SWI does not push
PC – 1, as a hardware interrupt does.
The break modul e causes the CPU to execute an S WI instruction at a
software-pr ogrammable break point.
4.4.2.4 CGM
4.4.2.5 TIM1
cale Semiconductor,
Frees
A logic 0 on the IRQ1 pin latches an external interrupt request.
The CGM can generate a CPU interrupt request every time the phaselocked loop circuit (PLL) enters or leaves the locked state. When the
LOCK bit changes state, the PLL flag (PLLF) is set. The PLL interrupt
enable bit (PLLIE) enables PLLF CPU interrupt requests. LOCK is in the
PLL bandwidth control register. PLLF is in the PLL control register.
TIM1 CPU interrupt sources:
•TIM1 overflow flag (TOF) — The TOF bit is set when the TIM1
counter value rolls over to $0000 after matching the value in the
TIM1 counter modulo registers. The TIM1 overflow interrupt
enable bit, TOIE, enables TIM1 overflow CPU interrupt re qu ests.
TOF and TOIE are in the TIM1 status and control register.
•TIM1 channel flags (CH1F–CH0F) — The C HxF bit is set when an
input capture or out put compare occurs on cha nnel x. The channel
x interrupt enable bit, CHxIE, enables channel x TIM1 CPU
interrupt requests. CHxF and CHxIE are in the TIM1 channel x
status and control register.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAResets and Interrupts71
For More Information On This Product,
Go to: www.freescale.com
Resets and Interrupts
4.4.2.6 TIM2
nc...
I
Freescale Semiconductor, Inc.
TIM2 CPU interrupt sources:
•TIM2 overflow flag (TOF) — The TOF bit is set when the TIM2
•TIM2 channel flag (CH0F) — The CH0F bit is set when an input
counter value rolls over to $0000 after matching the value in the
TIM2 counter modulo registers. The TIM2 overflow interrupt
enable bit, TOIE, enables TIM2 overflow CPU interrupt re qu ests.
TOF and TOIE are in the TIM2 status and control register.
capture or output compare occurs on channel 0. The channel 0
interrupt enable bit, CH0IE, enables channel 0 TIM2 CPU interrupt
requests. CH0F and CH0IE ar e in the TIM 2 channe l 0 status and
control register.
cale Semiconductor,
Frees
4.4.2.7 SPI
SPI CPU interrupt sources:
•SPI receiver full bit (SPRF) — The SPRF bit is set every time a
byte transfers from the shift register to the receive data register.
The SPI receiver interrupt enable bit, SPRIE, enables SPRF CPU
interrupt requests. SPRF is in the SPI status and control register
and SPRIE is in the SPI control register.
•SPI transmitter empty (SPTE) — The SPTE bi t is set every time a
byte transfers from the transmit data register to the shift register.
The SPI transmit inte rrupt en able bit, SP TIE, enab les SPTE CPU
interrupt req uests. SPTE is in the SPI status and c ontrol register
and SPTIE is in the SPI control register.
•Mode fault bit (MODF) — The MODF bit is set in a slave SPI if the
SS pin goes high during a transmissi on with the mode fault enable
bit (MODFEN) set. In a master SPI, the MODF bit is set if the SS
pin goes low at any time with the MODFEN bit set. The error
interrupt enable bit, ERRIE, enables MODF CPU interrupt
requests. MODF, MODFEN, and ERRIE are in the SPI status and
control register.
Technical DataMC68HC908GR8 — Rev 4.0
72Resets and InterruptsMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
nc...
I
4.4.2.8 SCI
Freescale Semiconductor, Inc.
•Overflow bit (OVRF) — The OVRF bit is set if software does not
SCI CPU interrupt sources:
•SCI transmitter empty bit (SCTE) — SCTE is set when the SCI
Resets and Interrupts
Interrupts
read the byte in the receive data register before the next full byte
enters the shift register. The error interrupt enable bit, ERRIE,
enables OVRF CPU interrupt requests. OVRF and ERRIE are in
the SPI status and control register.
data register transfers a character to the transmit shift register.
The SCI transmit in terr up t enable bit, SCTIE, en ab les transmitter
CPU interrupt reque sts. SCTE is in SCI status register 1. SCTIE is
in SCI control register 2.
cale Semiconductor,
Frees
•Transmission complete bit (TC) — TC is set when the transmit
shift register an d the S CI data re gister are emp ty and no break o r
idle character has been generated. The transmission complete
interrupt enable bit, TCIE, enables transmitter CPU interrupt
requests. TC is in SCI status register 1. TCIE is in SCI control
register 2.
•SCI receiver full bit (SCRF) — SCRF is set when the receive shift
register transfers a character to the SCI data register. The SCI
receive interrupt enable bit, SCRIE, enables receiver CPU
interrupts. SCRF is in SCI status register 1. SCRIE is in SCI
control register 2.
•Idle input bit (IDLE) — IDLE is set when 10 or 11 consecutive logic
1s shift in from the RxD pin. The idle line interrupt enable bit, ILIE,
enables IDLE CPU interrupt requests. IDLE is in SCI status
register 1. ILIE is in SCI control register 2.
•Receiver overrun bit (OR) — OR is set when the receive shift
register shifts in a new character before the previous character
was read from the SCI data regi ster. The over run interr upt enable
bit, ORIE, enables OR to generate SCI error CPU interrupt
requests. OR is in SCI status register 1. ORIE is in SCI control
register 3.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAResets and Interrupts73
For More Information On This Product,
Go to: www.freescale.com
Resets and Interrupts
nc...
I
Freescale Semiconductor, Inc.
•Noise flag (NF) — NF is set when the SCI detects noise on
•Framing error bit (FE) — FE is set when a logic 0 occurs where the
•Parity error bit (PE) — PE is set when the SCI detects a parity error
incoming data or break characters, including start, data, and stop
bits. The noise error interrupt enable bit, NEIE, enables NF to
generate SCI error CPU interrupt requests. NF is in SCI status
register 1. NEIE is in SCI control register 3.
receiver expects a stop bit. The framing error interrupt enable bit,
FEIE, enables FE to generate SCI error CPU interrupt requests.
FE is in SCI status register 1. FEIE is in SCI control register 3.
in incoming data. The parity error interrupt enable bit, PEIE,
enables PE to generate SCI error CPU interrupt requests. PE is in
SCI status register 1. PEIE is in SCI control register 3.
4.4.2.9 KBD0–KBD4 Pins
A logic 0 on a keyboard interrupt pin latches an external interrupt
4.4.2.10 ADC (Analog-to-Digital Converter)
request.
When the AIEN bit is set, the ADC module is capable of generating a
CPU interrupt after each ADC conversion. The COCO/IDMAS bit is not
used as a conversion complete flag when interrupts are enabled.
cale Semiconductor,
4.4.2.11 TBM (Timebase Module)
The timebase module can interrupt the CPU on a regular basis with a
Frees
rate defined by TBR2–TBR0. When the timebase counter chain rolls
over, the TBIF flag is set. If the TBIE bit is set, enabling the timebase
interrupt, the counter chain overflow will generate a CPU interrupt
request.
Interrupts must b e acknowledged by writing a logic 1 to the TACK bit.
Technical DataMC68HC908GR8 — Rev 4.0
74Resets and InterruptsMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
4.4.3 Interrupt Status Registers
nc...
I
Freescale Semiconductor, Inc.
Resets and Interrupts
Interrupts
The flags in the interrupt status registers identify maskable interrupt
sources. Table 4-2 summarizes the interrupt sources and the interrupt
status register flags that they set. The interrupt status registers can be
useful for debugging.
This section describes the 8-bit analog-to-digital converter (ADC).
For further information regarding analog-to-digital converters on
Motorola microcontrollers, please consult the HC08 ADC Reference
Manual, ADCRM/AD.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAAnalog-to-Digital Converter (ADC)79
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Analog-to-Digital Converter (ADC)
5.3 Features
Features of the ADC module include:
•Six channels with multiplexed input
•Linear successive approximation wi th monotonicity
•8-bit resolutio n
•Single or continuous conversion
•Conversion complete flag or conversion complete interrupt
•Selectable ADC clock
nc...
I
5.4 Functional Description
cale Semiconductor,
Frees
The ADC provides six pins for sampling external sources at pins
PTB5/ATD5–PTB0/ATD0. An analog multiplexer allows the single ADC
converter to select one of six ADC channels as ADC volta ge in (V
V
analog-to-digital converter. When the conv ersion is completed, ADC
places the result in the ADC data register and sets a flag or generates
an interrupt. See Figure 5-1.
is converted b y the successive approximation register-based
ADIN
NOTE:References to DMA (direct-memory access) and associated functions
are only valid if the MCU has a DMA module. If the MCU has no DMA,
any DMA-related register bits should be left in their reset state for
expected MCU operation.
ADIN
).
Technical DataMC68HC908GR8 — Rev 4.0
80Analog-to-Digital Converter (ADC)MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
INTERNAL
DATA BUS
READ DDRBx
Analog-to-Digital Conver ter (ADC)
Functio nal Description
nc...
I
5.4.1 ADC Port I/O Pins
cale Semiconductor,
Frees
WRITE DDRBx
WRITE PTBx
READ PTBx
INTERRUPT
LOGIC
AIENCOCO
RESET
CONVERSION
COMPLETE
CGMXCLK
BUS CLOCK
DDRBx
PTBx
ADC DATA REGISTER
ADC
ADC CLOCK
CLOCK
GENERATOR
ADIV2–ADIV0ADICLK
ADC
VOLTAGE IN
(V
ADIN
DISABLE
DISABLE
)
CHANNEL
SELECT
PTBx
ADC CHANNEL x
ADCH4–ADCH0
Figure 5-1. ADC Block Diagram
PTB5/ATD5–PTB0/ATD0 are general-purpose I/O (input/output) pins
that share with th e ADC ch annels. Th e chann el se lect b its de fine wh ich
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
DDR will not have any affect on the port pin that is selected by the ADC.
Read of a port pin in use by the ADC w ill return a logic 0.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAAnalog-to-Digital Converter (ADC)81
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Analog-to-Digital Converter (ADC)
5.4.2 Voltage Conversion
nc...
I
5.4.3 Conversion Time
cale Semiconductor,
5.4.4 Conversion
Frees
When the input voltag e to the A DC equals V
REFH
signal to $FF (full scale). If the input voltage equals V
converts it to $00. Input voltages between V
REFH
straight-line linear conversion. All other input voltages will result in $FF,
if greater than V
REFH
.
NOTE:Inside the ADC module, th e reference voltage, V
ADC analog power V
ground V
. Therefore, the ADC input volt age sh ould not exce ed the
DDAD
analog supply voltages
For operation, V
DDAD
separate traces
Conversion starts after a write to the ADSCR. One conversion will take
between 16 and 17 ADC clock cycles. The ADIVx and ADICLK bits
should be set to provide a 1 MHz ADC clock frequency.
Conversion time =
Number of bus cycles = conversion time x bus frequency
In continuous conversion mode, the ADC data register will be filled with
new data after each conversion. Data from the previous conversion will
be overwritten whether that data has been read or not. Conversions will
continue until the ADC O bit is cleared. Th e COCO/IDMAS bit is set after
the first conversion and will stay set until the next write of the ADC status
and control register or the next read of the ADC data register.
DDAD
; and V
is connected to the ADC analog
REFL
should be tied to the same potential as V
16 to17 ADC cycles
ADC frequency
, the ADC converts the
, the ADC
REFL
and V
is connected to the
REFH
REFL
are a
DD
via
In single conversion mode, conversion begins with a write to the
ADSCR. Only one conversion occurs between writes to the ADSCR.
Technical DataMC68HC908GR8 — Rev 4.0
82Analog-to-Digital Converter (ADC)MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
5.4.5 Accuracy and Precision
5.5 Interrupts
nc...
I
Freescale Semiconductor, Inc.
The conversion process is monotonic and has no missing codes.
When the AIEN bit is set, the ADC module is capable of generating CPU
interrupts after each ADC conversion. A CPU interrupt is generated if the
COCO/IDMAS bit is at logic 0. If COCO/IDMAS bit is set, a DMA interrupt
is generated. The COCO/IDMAS bit is not used as a conversion
complete flag when interrupts are enabled.
Analog-to-Digital Conver ter (ADC)
Interrupts
5.6 Low-Power Modes
5.6.1 Wait Mode
cale Semiconductor,
5.6.2 Stop Mode
Frees
The WAIT and STOP instruction can put the MCU in low powerconsumption st andby modes.
The ADC continues normal operation during wait mode. Any enabled
CPU interrupt request from the ADC can bring th e 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 ADCH4–ADCH0 bits in the ADC status
and control register before executing the WAIT instruction.
The ADC module is inactive after the execution of a S T OP instruction.
Any pending conversion is aborted. ADC conversions resume when the
MCU exits stop mode after an external interrupt. Allow one conversion
cycle to stabilize the analog circuitry.
5.7 I/O Signals
The ADC module has six pins shared with port B,
PTB5/AD5–PTB0/ATD0.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAAnalog-to-Digital Converter (ADC)83
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Analog-to-Digital Converter (ADC)
5.7.1 ADC Analog Power Pin (V
NOTE: For maximum noise immunity, route V
5.7.2 ADC Analog Ground Pin (V
nc...
I
NOTE:Route V
5.7.3 ADC Voltage In (V
cale Semiconductor,
)/ADC Voltage Reference High Pin (V
DDAD
The ADC analog portion uses V
V
necessary to ensure clean V
pin to the same voltage potential as VDD. External filtering may be
DDAD
DDAD
as its power pin. Connect the
DDAD
for good results.
DDAD
carefully and p lace bypass
capacitors as close as possible to the package.
)/ADC Voltage Reference Low Pin (V
SSAD
The ADC analog portion uses V
V
V
pin to the same voltage potential as VSS.
SSAD
cleanly to avoid any offset errors.
SSAD
)
ADIN
is the input voltage signal fro m one of the six ADC channels to the
ADIN
as its ground pi n. Connect the
SSAD
ADC module.
REFH
REFL
)
)
Frees
Technical DataMC68HC908GR8 — Rev 4.0
84Analog-to-Digital Converter (ADC)MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
5.8 I/O Registers
These I/O registers control and monitor ADC operation:
•ADC status and control register (ADSCR)
•ADC data register (ADR)
•ADC clock register (ADCLK)
5.8.1 ADC Status and Control Register
Function of the ADC status and control register (ADSCR) is described
nc...
I
here.
Address:$0003C
Analog-to-Digital Conver ter (ADC)
I/O Registers
cale Semiconductor,
Frees
Bit 7654321Bit 0
Read:
Write:
Reset:00011111
COCO/IDMAS — Conversions Complete/Interrupt DMA Select Bit
COCO/
IDMAS
Figure 5-2. ADC Status and Control Register (ADSCR)
When the AIEN bit is a logic 0, the COCO/IDMAS is a read-only bit
which is set each time a conversion is completed except in the
continuous conversion mode wh ere it is se t after th e first conver sion.
This bit is cleared whenever the ADSCR is written or whenever the
ADR is read.
If the AIEN bit is a logic 1 , the COCO/IDMAS is a read /write bit which
selects either CPU or DMA to service the ADC interrupt request.
Reset clears this bit.
CAUTION:Because the MC68HC908GR8 does NOT have a DMA module, the
IDMAS bit should NEVER be set when AIEN is set. Doing so will mask
ADC interrupts and cause unwanted results.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAAnalog-to-Digital Converter (ADC)85
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Analog-to-Digital Converter (ADC)
AIEN — ADC Interrupt Enable Bit
When this bit is set, an interrupt is generated at the end of an ADC
conversion. The interrupt signal is cleared when the data register is
read or the sta tus/control r egister is w ritten. Reset clears the AI EN bit.
When this bit is set, the ADC will convert samples continuously and
update the ADR re gister at the end of each conversion. Only one
conversion is completed between writes to the ADSCR when this bit
nc...
I
is cleared. Reset clears the ADCO bit.
1 = Continuous ADC conversion
0 = One ADC conversion
cale Semiconductor,
Frees
ADCH4–ADCH0 — ADC Channel Select Bits
ADCH4–ADCH0 form a 5-bit field which is used to select one of 16
ADC channels. Only six channels, AD5–AD0, are avail able on this
MCU. The channels are detailed in Table 5-1. Care should be take n
when using a port pin as both an analog and digital input
simultaneously to prevent switching noise from corrupting the analog
signal. See Table 5-1.
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 being used.
NOTE:Recovery from the disabled state requires one conversion cycle to
stabilize.
The voltage levels supplied from internal reference nodes, as specified
in Table 5-1, are used to verify the operation of the ADC converter both
in production test and for user applications.
ADICLK selects either the bus clock o r CGMXCLK as the inp ut clock
source to generate the internal ADC clock. Reset selects CGMXCLK
as the ADC clock source.
Technical DataMC68HC908GR8 — Rev 4.0
88Analog-to-Digital Converter (ADC)MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
If the external clock (CGMXCLK) is equal to or greater than 1 MHz,
CGMXCLK can be used as the clock source for the ADC. If
CGMXCLK is less than 1 MHz, use the PLL-generated bus clock as
the clock source. As long as the internal ADC clock is at
approximately 1 MHz, correct operation can be guaranteed.
1 = Internal bus clock
0 = External clock (CGMXCLK)
nc...
I
ADC input clock frequency
-----------------------------------------------------------------------1 M H z=
ADIV2 ADIV0–
This section des cribes the break module. The break module can
generate a break interrupt that stops normal program flow at a defined
address to enter a background program.
Features of the break module include:
•Accessible input/output (I/O) registers during the break interrupt
•CPU-generated break interrupts
•Software-generated break interrupts
•COP disabling during break interrupts
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLABreak Module (BRK)91
For More Information On This Product,
Go to: www.freescale.com
Break Module (BRK)
6.4 Functional Description
nc...
I
Freescale Semiconductor, Inc.
When the internal address bus matches the value written in the break
address registers, the break module issues a breakpoint signal to the
CPU. The CPU then loads the instruction register with a software
interrupt instructio n (SWI) after completion of the curr ent CPU
instruction. The program counter vectors to $FFFC and $FFFD ($FEFC
and $FEFD in monitor mode).
The following events can cause a break interrupt to occur:
•A CPU-generated address (the address in the program counter)
matches the contents of the break address registers.
•Software writes a logic 1 to the BRKA bit in the break status and
control register.
cale Semiconductor,
Frees
When a CPU-generated address matches the contents of the break
address registers, th e break interrupt b egins after the CPU com pletes its
current instruction. A return-from-interrupt instruction (RTI) in the break
routine ends the break interrupt and returns the MCU to normal
operation. Figure 6-1 shows the structure of the break module.
IAB15–IAB8
BREAK ADDRESS REGISTER HIGH
8-BIT COMPARATOR
IAB15–IAB0
8-BIT COMPARATOR
BREAK ADDRESS REGIS T ER LO W
IAB7–IAB0
CONTROL
BREAK
Figure 6-1. Break Module Block Diagram
Technical DataMC68HC908GR8 — Rev 4.0
92Break Module (BRK)MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Addr.Register NameBit 7654321Bit 0
Read:000100BW0
SIM Break Status Register
$FE00
(SBSR)
Write:RRRRRRNOTER
Reset:00010000
Break Module (BRK)
Functio nal Description
Read:
$FE03
$FE09
nc...
I
$FE0A
$FE0B
Note: Writing a logic 0 clears BW.
SIM Break Flag Control
Register (SBFCR)
Break Address Register
High (BRKH)
Break Address Register
Low (BRKL)
Break Status and Control
Register (BRKSCR)
Write:
Reset:0
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
BCFERRRRRRR
Bit 1514131211109Bit 8
Bit 7654321Bit 0
BRKEBRKA
Figure 6-2. I/O Register Summary
6.4.1 Flag Protection During Break Interrupts
cale Semiconductor,
The BCFE bit in the SIM break flag control register (SBFCR) enables
software to clear status bits during the break state.
000000
= UnimplementedR= Reserved
6.4.2 CPU During Break Interrupts
Frees
The CPU starts a break interrupt by:
•Loading the instruction register with the SWI instruction
•Loading the program counter with $FFFC and $FFFD ($FEFC and
$FEFD in monitor mode)
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLABreak Module (BRK)93
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Break Module (BRK)
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.
6.4.3 TIMI and TIM2 During Break Interrupts
A break interrupt stops the timer counters.
6.4.4 COP During Break Interrupts
nc...
I
6.5 Low-Power Modes
6.5.1 Wait Mode
cale Semiconductor,
6.5.2 Stop Mode
Frees
The COP is disabled during a break interrupt when V
the RST pin.
The WAIT and STOP instructions put the MCU in low powerconsumption st andby modes.
If enabled, the bre ak module is active i n wait mode . In the break routi ne,
the user can subtract one from the return address on the stack if SBSW
is set. See Low Power Mo des. Clear the BW bit by writing logic 0 to it.
A break interrupt causes exit from stop mode and sets the SBSW bit in
the break status register.
is present on
TST
6.6 Break Module Registers
These registers control and monitor operatio n of the break module:
•Break status and control register (BRKSCR)
•Break address register high (BRKH)
Technical DataMC68HC908GR8 — Rev 4.0
94Break Module (BRK)MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
•Break address register low (BRKL)
•SIM break status register (SBSR)
•SIM break flag control register (SBFCR)
6.6.1 Break Status and Control Register
The break status an d control registe r (BRKSCR) cont ains break modu le
enable and status bits.
Address:$FE0E
Break Module (BRK)
Break Module Registers
nc...
I
cale Semiconductor,
Frees
Bit 7654321Bit 0
Read:
BRKEBRKA
Write:
Reset:00000000
= Unimplemented
000000
Figure 6-3. Break Status and Control Register (BRKSCR)
BRKE — Break Enable Bit
This read/write bit enabl es breaks on break address register match es.
Clear BRKE by writing a logic 0 to bit 7. Reset clears the BRKE bit.
1 = Breaks enabled on 16-bit address match
0 = Breaks disabled on 16-bit address match
BRKA — Break Active Bit
This read/write status and control bit is set when a break address
match occurs. Writing a logic 1 to BRKA generates a break interrupt.
Clear BRKA by writing a logic 0 to it before exiti n g the br ea k ro uti n e.
Reset clears the BRKA bit.
1 = (When read) Break add r ess mat c h
0 = (When read) No break address match
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLABreak Module (BRK)95
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Break Module (BRK)
6.6.2 Break Address Registers
The break address registers (BRKH and BRKL) contain the high and low
bytes of the desire d breakpoint address. Reset clears the bre ak address
registers.
Address:$FE09
Bit 7654321Bit 0
nc...
I
6.6.3 Break Status Register
cale Semiconductor,
Read:
Bit 1514131211109Bit 8
Write:
Reset:00000000
Figure 6-4. Break Address Register High (BRKH)
Address:$FE0A
Bit 7654321Bit 0
Read:
Bit 7654321Bit 0
Write:
Reset:00000000
Figure 6-5. Break Address Register Low (BRKL)
The break status register (SBSR) contains a flag to indicate that a break
caused an exit from wait mode. The flag is useful in applications
requiring a return to wait mode after exiting from a break interrupt.
Frees
Address:$FE00
Bit 7654321Bit 0
Read:000100BW0
Write:RRRRRRNOTER
Reset:00010000
Note: Writing a logic 0 clears BW.R= Reserved
Figure 6-6. SIM Break Status Register (SBSR )
Technical DataMC68HC908GR8 — Rev 4.0
96Break Module (BRK)MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Break Module (BRK)
Break Module Registers
BW — Break Wait Bit
This read/write bit is set when a break interrupt causes an exit from
wait mode. Clear BW by writing a logic 0 to it. Reset clears BW.
1 = Break interrupt during wait mode
0 = No break interrupt during wait mode
BW can be read within the break interrupt routine. The user can modify
the return address on the stack by subtracting 1 from it. The following
code is an example.
This code works if the H register was stacked in the break interrupt
routine. Execu te this code at the end of the break interrupt routine.
nc...
I
HIBYTEEQU5
cale Semiconductor,
Frees
LOBYTEEQU6
;If not BW, do RTI
BRCLRBW,BSR, RETURN;;See if wait mode or stop mode
was exited by break.
TSTLOBYTE,SP; If RETURNLO is not 0,
BNEDOLO; then just decrement low byte.
DECHIBYTE,SP; Else deal with high byte also.
DOLODECLOBYTE,SP; Point to WAIT/STOP opcode.
RETURNPULH
RTI
; Restore H register.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLABreak Module (BRK)97
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Break Module (BRK)
6.6.4 Break Flag Control Register
The break flag control register (SBFCR) contains a bit that enables
software to clear status bits while the MCU is in a brea k state.
Address:$FE03
Bit 7654321Bit 0
Read:
Write:
Reset:0
nc...
I
BCFE — Break Clear Flag Enable Bit
cale Semiconductor,
BCFERRRRRRR
R= Reserved
Figure 6-7. SIM Break Flag Control Register (SBFCR)
This read/write bi t en ab les software to clear status bi ts by a ccessin g
status registers whil e the MCU i s in a brea k state. To clear status bit s
during the break state, the BCFE bit must be set.
1 = Status bits clearable during break
0 = Status bits not clearable during br ea k
This section describes the clock generat or modul e. The CG MC
generates the crystal clock signal, CGMXCLK, which operates at the
frequency of the crystal. The CGMC also generates the base clock
signal, CGMOUT, which is base d on ei th er the crystal clo ck divid ed by
two or the phase- locked loop ( PLL) clock, CGMV CLK, divided b y two. In
user mode, CGMOUT is the clock from which the SIM derives the
system clocks, including the bus clock, which is at a frequency of
CGMOUT/2. In monitor mo de, PTC3 determines the bu s clock. The PLL
is a fully functiona l frequency gener ator designed for use with crystals or
ceramic resonators. The PLL can generate an 8-MHz bus frequency
using a 32-kHz crystal.
MC68HC908GR8 — Rev 4.0Technical Data
MOTOROLAClock Generator Module (CGMC)99
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Clock Generator Module (CGMC)
7.3 Features
Features of the CGMC include:
•Phase-locked loop with output frequency in integer multiples of an
integer dividend of the crystal reference
•Low-frequency crystal operation with low-po wer operation and
high-output frequency resolution
•Programmable p r escaler for power-of-two increases in frequency
•Programmable hardware voltage-controlled oscillator (VCO) for
low-jitter operation
nc...
I
7.4 Functional Description
cale Semiconductor,
Frees
•Automatic bandwidth control mode for low-jitter operation
•Automatic frequency lock detector
•CPU interrupt on entry or exit from locked condition
•Configuration register bit to allow oscillator operation during stop
mode
The CGMC consists of three major submodules:
•Crystal oscillator circuit — The crystal oscillator circuit generates
the constant crystal frequency clock, CGMXCLK.
•Phase-locked loop (PLL) — The PLL generates the
programmable VCO frequency clock, CGMVCLK.
•Base clock selector circuit — This software-controlled circuit
selects either CGMXCLK divided by two or the VCO clock,
CGMVCLK, divided by two as the base clock, CGMOUT. The SIM
derives the system clocks from either CGMOUT or CGMXCLK.
Figure 7-1 shows the structure of the CGMC.
Technical DataMC68HC908GR8 — Rev 4.0
100Clock Generator Module (CGMC)MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
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.