Freescale reserves the right to make changes without further notice to any products
herein. Freescale makes no warranty, representation or guarantee regarding the
suitability of its products for any particular purpose, nor does Freescale assume any
liability arising out of the application or use of any product or circuit, and specifically
disclaims any and all liability, including without limitation consequential or incidental
damages. "Typical" parameters which may be provided in Freescale data sheets
and/or specifications can and do vary in different applications and actual performance
may vary over time. All operating par ameters, including "Typicals" m ust be validated
for each customer application by customer's technical experts. Freescale does not
convey any license under its pa tent rig hts n or th e righ ts of ot hers . Fre esca le pro duc ts
are not designed, intended, or authorized for use as components in systems intended
for surgical implant into the body, or other applications intended to support or sustain
life, or for any other application in which the failure of the Freescale product could
create a situation where personal injury or death may occur. Should Buyer pur chase or
use Freescale products for any such unintended or unauthorized application, Buyer
shall indemnify and hold Freescale and its officers, employees, subsidiaries, affiliates,
and distributors harmless against all claims, costs, damages, and expenses, and
reasonable attorney fees arising out of, directly or indirectly, any claim of personal
injury or death associated with such unintend ed or unauthorized use, even if such claim
alleges that Freescale was negligent regarding the design or manufacture of the part.
Freescale, Inc. is an Equal Opportunity/Affirmative Action Employer.
The MC68HC908MR8 is a member of the low-cost, high-performance
M68HC08 Family of 8-bit microcontroller units (MCU). The M68HC08
Family is based on the customer-specified integrated circuit (CSIC)
design strategy. 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.
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorGeneral Description 29
General Description
1.3 Features
Features of the MC68HC908MR8 include:
•High-performance M68HC08 architecture
•Fully upward-compatible object code with M6805, M146805, and
M68HC05 Families
•8-MHz internal bus frequency
•8 Kbytes of on-chip FLASH
•On-chip programming firmware for use with host personal
computer
•256 bytes of on-chip random-access memory (RAM):
•12-bit, 6-channel center-aligned or edge-aligned pulse-width
modulator (PWMMC)
•Serial communications interface module (SCI)
•Two 16-bit, 2-channel timer interface modules (TIMA and TIMB)
•Eight high current sink and source pins (PTA1/ATD1, PTA0/ATD0,
PTB6/TCH1B, PTB5/TCH0B, PTB4/TCH1A, PTB3/TCH0A,
PTB2/TCLKA, and PTB1/TxD)
•Clock generator module (CGM)
•Digitally filtered low-voltage inhibit (LVI), software selectable for
±5 percent or ±10 percent tolerance
•10-bit, 4 to 7-channel analog-to-digital converter (ADC)
•System protection features:
–Optional computer operating properly (COP) reset
–Low-voltage detection with optional reset
–Illegal opcode detection with optional reset
–Illegal address detection with optional reset
–Fault detection with optional PWM disabling
•Low-power design, fully static with stop and wait modes
•Break (BRK) module allows single breakpoint setting during
in-circuit debugging
•Master reset pin and power-on reset (POR)
Features of the CPU08 include:
•Enhanced HC05 programming model
•Extensive loop control functions
•16 addressing modes (eight more than the M68HC05)
•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
•C language support
1.4 MCU Block Diagram
Figure 1-1 shows the structure of the MC68HC908MR8.
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorGeneral Description 31
Technical DataMC68HC908MR8 — Rev 4.1
32General DescriptionFreescale Semiconductor
INTERNAL BUS
M68HC08 CPU
General Description
CPU
REGISTERS
CONTROL AND STATUS REGISTERS — 112 BYTES
USER FLASH — 7680 BYTES
USER RAM — 256 BYTES
MONITOR ROM — 313 BYTES
USER VECTOR SPACE — 46 BYTES
OSC1
OSC2
CGMXFC
RST
IRQ
ARITHMETIC/LOGIC
CLOCK GENERATOR
SYSTEM INTEGRATION
UNIT (ALU)
MODULE
MODULE
IRQ
MODULE
LOW-VOLTAGE INHIBIT
MODULE
COMPUTER OPERATING PROPERLY
MODULE
BREAK
MODULE
TIMER A AND TIMER B INTERFACE
MODULES
SERIAL COMMUNICATIONS INTERFACE
MODULE
POWER-ON RESET
MODULE
DDRA
DDRB
PULSE-WIDTH
PTA6/ATD6
PTA5/ATD5
PTA4/ATD4
PTA
PTB
MODULATOR
PTA3/ATD3
PTA2/ATD2
PTA1/ATD1
PTA0/ATD0
PTB6/TCH1B
PTB5/TCH0B
PTB4/TCH1A
PTB3/TCH0A
PTB2/TCLKA
PTB1/TxD
PTB0/RxD
PWM6
PWM5
PWM4
PWM3
PWM2
PWM1
PTC1/FAULT4
PTC0/FAULT1
V
REFH
V
V
V
V
DD
DDA
SSA
SS
ANALOG-TO-DIGITAL CONVERTER
MODULE
PULSE-WIDTH MODULATOR
MODULE
POWER
Figure 1-1. MCU Block Diagram
1.5 Pin Assignments
Figure 1-2 shows 32-pin QFP and 28-pin DIP/SOIC pin assignments.
V
SSA
OSC2
OSC1
CGMXFC
IRQ
PWM1
PWM2
PWM3
General Description
Pin Assignments
******
REFH
DDA
RST
V
V
32
O
1
2
3
4
5
6
7
8
9
PTA6/ATD6
29
30
31
32-PIN QFP
1112131415
10
PTA4/ATD4
PTA5/ATD5
27
28
26
PTA3/ATD3
PTA2/ATD2
25
24
23
22
21
20
19
18
17
16
PTA1/ATD1
PTA0/ATD0
PTB6/TCH1B
PTB5/TCH0B
V
SS
V
DD
PTB4/TCH1A
PTB3/TCH0A
*
*
PWM4
PWM5
PWM6
PTB1/TxD
PTB0/RxD
21
PTB2/TCLKA
*
PTA3/ATD3
PTA2/ATD2
PTA1/ATD1
PTA0/ATD0
PTB6/TCH1B
PTB5/TCH0B
V
SS
V
DD
PTB4/TCH1A
PTB3/TCH0A
PTB2/TCLKA
PTB1/TxD
PTB0/RxD
PTC0/FAULT1
*
*
V
REFH
RST
V
DDA
V
SSA
OSC2
OSC1
CGMXFC
IRQ
PWM1
PWM2
PWM3
PWM4
PWM5
PWM6
O
1
2
3
4
5
6
7
8
9
10
11
12
13
14
PTC0/FAULT1
28-PIN
DIP/SOIC
PTC1/FAULT4
**
28
27
26
25
24
23
22
20
19
18
17
16
15
* High current pins
** These pins are not bonded on the 28-pin package.
Figure 1-2. QFP and DIP/SOIC Pin Assignments
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorGeneral Description 33
General Description
1.5.1 Power Supply Pins (VDD and VSS)
VDD and VSS are the power supply and ground pins. The MCU operates
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-3
shows. Place the C1 bypass capacitor as close to the MCU as possible.
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 are the connections for the on-chip oscillator
circuit. See Section 8. Clock Generator Module (CGM).
1.5.3 External Reset Pin (RST)
V
DD
C1
0.1 µF
+
C2
V
DD
V
SS
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 source is asserted. See Section 7. System
Integration Module (SIM).
Technical DataMC68HC908MR8 — Rev 4.1
34General DescriptionFreescale Semiconductor
1.5.4 External Interrupt Pin (IRQ)
IRQ is an asynchronous external interrupt pin. See Section 16. External
Interrupt (IRQ).
General Description
Pin Assignments
1.5.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) and the analog-to-digital converter
(ADC). Decoupling of these pins should be per the digital supply. See
is the power supply input for setting the reference voltage. See
REFH
REFH
Section 18. Analog-to-Digital Converter (ADC).
1.5.7 External Filter Capacitor Pin (CGMXFC)
CGMXFC is an external filter capacitor connection for the CGM. See
Section 8. Clock Generator Module (CGM).
)
)
1.5.8 Port A Input/Output (I/O) Pins (PTA6/ATD6–PTA0/ATD0)
Port A is a 7-bit special function port, sharing all of its pins with the
analog-to-digital converter (ADC). On the 32-pin QFP package, all seven
bits (PTA6/ATD6–PTA0/ATD0) of the port are available. On the 28-pin
package, four bits (PTA3/ATD3–PTA0/ATD0) are available.
PTA3–PTA0 have high current source and sink capability. See
Section 14. Input/Output (I/O) Ports.
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorGeneral Description 35
General Description
1.5.9 Port B I/O Pins (PTB6/TCHB1–PTB0/RxD)
Port B is a 7-bit special function port, sharing five of its pins with the timer
interface modules (TIMA and TIMB) and two of its pins with the serial
communications interface (SCI). See Section 11. Timer Interface A
(TIMA), Section 12. Timer Interface B (TIMB), Section 14.
Input/Output (I/O) Ports, and Section 13. Serial Communications
Interface (SCI).
1.5.10 Port C I/O Pins (PTC1/FAULT1–PTC0/FAULT4)
Port C is a 2-bit special function port, sharing its pins with pulse-width
modulator fault inputs. See Section 9. Pulse-Width Modulator for
Motor Control (PWMMC) and Section 14. Input/Output (I/O) Ports.
1.5.11 PWM Pins (PWM6–PWM1)
PWM6–PWM1 are dedicated pins used for the outputs of the pulsewidth modulator module (PWMMC). See Section 9. Pulse-Width
The central processor unit (CPU08) can address 64 Kbytes of memory
space.
The memory map, shown in Figure 2-1, includes these features:
•8 Kbytes of FLASH
•256 bytes of RAM
•313 bytes of monitor ROM
•46 bytes of user-defined vectors
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorMemory Map 37
Memory Map
2.3 Unimplemented Memory Locations
Some addresses are unimplemented. Accessing an unimplemented
address will cause an illegal address reset. In the memory map and in
the input/output (I/O) register summary, unimplemented addresses are
shaded.
Some I/O bits are read-only; the write function is unimplemented. Writing
to a read-only I/O bit has no effect on MCU operation. In register figures,
the write function of read-only bits is shaded. Similarly, some I/O bits are
write-only; the read function is unimplemented. Reading of write-only I/O
bits has no effect on microcontroller unit (MCU) operation. In register
figures, the read function of write-only bits is shaded.
2.4 Reserved Memory Locations
Some addresses are reserved. Writing to a reserved address can have
unpredictable effects on MCU operation. In the memory map and in the
I/O register summary, reserved addresses are marked with the word
reserved.
Some I/O bits are reserved. Writing to a reserved bit can have
unpredictable effects on MCU operation. In register figures, reserved
bits are marked with the letter R.
Technical DataMC68HC908MR8 — Rev 4.1
38Memory MapFreescale Semiconductor
2.5 I/O Section
Memory Map
I/O Section
Addresses $0000–$005F, shown in Figure 2-2, contain most of the
control, status, and data registers. Additional I/O registers have these
addresses:
•$FE00, system integration module (SIM) break status register
(SBSR)
•$FE01, SIM reset status register (SRSR)
•$FE03, SIM break flag control register (SBFCR)
•$FE08, FLASH control register (FLCR)
•$FF57, FLASH test control register (FLTCR)
•$FE0C, break address register high (BRKH)
•$FE0D, break flag control register low (BRKL)
•$FE0E, break status and control register (BRKSCR)
•$FE0F, low-voltage inhibit (LVI) status and control register
(LVISCR)
•$FF7E, FLASH block protect register (FLBPR)
•$FFFF, computer operating properly (COP) control register
(COPCTL)
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorMemory Map 39
Memory Map
MC68HC908MR8
$0000
↓↓
$005F$005F
$0060
↓
$011F
$0120$015F
↓UNIMPLEMENTED — 56,992 BYTES
$EDFF
$EE00
↓
$FDFF$FDFF
$FE00SIM BREAK STATUS REGISTER (SBSR)$FE00
$FE01SIM RESET STATUS REGISTER (SRSR)$FE01
$FE02RESERVED$FE02
$FE03SIM BREAK FLAG CONTROL REGISTER (SBFCR)$FE03
$FE04RESERVED$FE04
$FE05RESERVED$FE05
$FE06RESERVED$FE06
$FE07RESERVED$FE07
$FE07FLASH CONTROL REGISTER (FLCR)$FE08
$FE09UNIMPLEMENTED$FE09
$FE0ARESERVED$FE0A
$FE0BUNIMPLEMENTED$FE0B
$FE0CBREAK ADDRESS REGISTER HIGH (BRKH)$FE0C
$FE0DBREAK ADDRESS REGISTER LOW (BRKL)$FE0D
$FE0EBREAK STATUS AND CONTROL REGISTER (BRKSCR)$FE0E
$FE0FLVI STATUS AND CONTROL REGISTER (LVISCR)$FE0F
$FE10
I/O REGISTERS — 96 BYTES
RAM — 256 BYTES
FLASH MEMORY — 7,680 BYTES
$0000
$0060
↓
$0160
↓
$DFFF
$E000
↓
$FE10
↓
$FF48$FF48
$FF49
↓↓
$FF7D$FF7D
MONITOR ROM — 313 BYTES
UNIMPLEMENTED — 53 BYTES
↓
$FF49
Figure 2-1. Memory Map
Technical DataMC68HC908MR8 — Rev 4.1
40Memory MapFreescale Semiconductor
Memory Map
I/O Section
$FF7EFLASH BLOCK PROTECT REGISTER (FLBPR)$FF7E
$FF7F
↓↓
UNIMPLEMENTED — 83 BYTES
$FF7F
$FFD1$FFD1
$FFD2
↓↓
VECTORS — 45 BYTES (46 including $FFFF)
$FFD2
$FFFE$FFFE
$FFFF
Low byte of reset vector when read
COP Control Register
(COPCTL)
$FFFF
Figure 2-1. Memory Map
Addr.Register NameBit 7654321Bit 0
Port A Data Register
$0000
See page 281.
Port B Data Register
$0001
See page 284.
Port C Data Register
$0002
See page 287.
$0003Unimplemented
Data Direction Register
$0004
See page 282.
(PTA)
(PTB)
(PTC)
(DDRA)
Read
Write:
ResetUnaffected by reset
Read:
Write:
Reset:
Read:
Write:
Reset:
Read:
A
Write:
Reset:
UPTA6PTA5PTA4PTA3PTA2PTA1PTA0
UPTB6PTB5PTB4PTB3PTB2PTB1PTB0
Unaffected by reset
UUUUUUPTC1PTC0
Unaffected by reset
UDDRA6 DDRA5 DDRA4DDRA3DDRA2 DDRA1 DDRA0
U0 0 0 0 0 0 0
U = UnaffectedX = Indeterminate
R
= Reserved
Bold
= Buff-
ered
= Unimplemented
Figure 2-2. Control, Status, and Data Registers (Sheet 1 of 10)
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorMemory Map 41
Memory Map
Addr.Register NameBit 7654321Bit 0
Read:
Data Direction Register
$0005
See page 284.
Data Direction Register
$0006
See page 288.
$0007Unimplemented
↓
$000DUnimplemented
(DDRB)
(DDRC)
B
C
Write:
Reset:
Read:
Write:
Reset:
UDDRB6 DDRB5DDRB4DDRB3DDRB2 DDRB1 DDRB0
U0 0 0 0 0 0 0
DDRC1 DDRC0
UU U U U U 0 0
$000E
$000F
$0010
$0011
$0012
$0013
TIMA Status/Control
Register (TASC)
See page 214.
TIMA Counter Register
High
(TACNTH)
See page 216.
TIMA Counter Register
Low
(TACNTL)
See page 216.
TIMA Counter Modulo
Register High
(TAMODH)
See page 217.
TIMA Counter Modulo
Register Low (TAMODL)
See page 217.
TIMA Channel 0 Sta-
tus/Control Register
(TASC0)
See page 218.
Read:TOF
TOIETSTOP
Write:0TRSTR
Reset:00100000
Read: Bit 15Bit 14 Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Write:RRRRRRRR
Reset:00000000
Read:Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:RRRRRRRR
Reset:00000000
Read:
Bit 1514131211109Bit 8
Write:
Reset:11111111
Read:
Bit 7654321Bit 0
Write:
Reset:11111111
Read: CH0F
CH0IEMS0BMS0AELS0BELS0ATOV0
Write:0
Reset:00000000
00
PS2PS1PS0
CH0MA
X
U = UnaffectedX = Indeterminate
R
= Reserved
Bold
= Buff-
ered
= Unimplemented
Figure 2-2. Control, Status, and Data Registers (Sheet 2 of 10)
Technical DataMC68HC908MR8 — Rev 4.1
42Memory MapFreescale Semiconductor
Memory Map
I/O Section
Addr.Register NameBit 7654321Bit 0
TIMA Channel 0 Regis-
$0014
$0015
$0016
$0017
$0018
$0019Unimplemented
↓
ter High (TACH0H)
See page 222.
TIMA Channel 0 Regis-
ter Low (TACH0L)
See page 218.
TIMA Channel 1 Sta-
tus/Control
Register (TASC1)
See page 222.
TIMA Channel 1 Regis-
ter High (TACH1H)
See page 222.
TIMA Channel 1 Regis-
ter Low (TACH1L)
See page 222.
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:Indeterminate after reset
Read: CH1F
Write:0R
Reset:00000000
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:Indeterminate after reset
Bit 1514131211109Bit 8
Bit 7654321Bit 0
CH1IE
Bit 1514131211109Bit 8
Bit 7654321Bit 0
0
MS1AELS1BELS1ATOV1
CH1MA
X
$001EUnimplemented
$001F
$0020
$0021
U = UnaffectedX = Indeterminate
Configuration Register
(CONFIG)
See page 68.
PWM Control Register 1
(PCTL1)
See page 175.
PWM Control Register 2
(PCTL2)
See page 177.
Read:
EDGE
Write:
Reset:00001100
Read:
DISXDISY
Write:
Reset:00000000
Read:
LDFQ1 LDFQ0
Write:
Reset:00000000
R
BOT-
NEG
= Reserved
TOP-
NEG
PW-
MINT
0
INDEPLVIRST LVIPWR STOPE COPD
PWMF
SEL12SEL34SEL56 PRSC1 PRSC0
Bold
= Buff-
ered
Figure 2-2. Control, Status, and Data Registers (Sheet 3 of 10)
LDOK
= Unimplemented
PW-
MEN
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorMemory Map 43
Memory Map
Addr.Register NameBit 7654321Bit 0
$0022
$0023
$0024
$0025
$0026
Fault Control Register
(FCR)
See page 180.
Fault Status Register
(FSR)
See page 181.
Fault Acknowledge Reg-
ister (FTACK)
See page 182.
PWM Output Control
(PWMOUT)
See page 159.
PWM Counter Register
High (PCNTH)
See page 172.
Read:
Write:
Reset:00000000
Read:
Write:
Reset:
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
FINT4
FPIN4
FMODE
4
FFLAG
4
FINT1
00 0 0FPIN1
FMODE
FFLAG
U0 U 0 U 0 U 0
00 0 0 0 0 0 0
FTACK
FTACK
4
0
OUT-
CTL
OUT6OUT5OUT4OUT3OUT2OUT1
0000Bit 11Bit 10Bit 9Bit 8
1
1
1
PWM Counter Register
$0027
PWM Counter Modulo
$0028
$0029
$002A
U = UnaffectedX = Indeterminate
Register High (PMODH)
PWM Counter Modulo
Register Low (PMODL)
PWM 1 Value Register
Low (PCNTL)
See page 172.
See page 173.
See page 173.
High (PVAL1H)
See page 174.
Figure 2-2. Control, Status, and Data Registers (Sheet 4 of 10)
Read:Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:
Reset:00000000
Read:
Write:
Reset:0000XXXX
Read:
Write:
Reset:XXXXXXXX
Read:
Write:
Reset:00000000
00 0 0
Bit 11Bit 10Bit 9Bit 8
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
R
= Reserved
Bold
= Buff-
ered
= Unimplemented
Technical DataMC68HC908MR8 — Rev 4.1
44Memory MapFreescale Semiconductor
Memory Map
I/O Section
Addr.Register NameBit 7654321Bit 0
$002B
$002C
$002D
$002E
$002F
$0030
PWM 1 Value Register
Low (PVAL1L)
See page 174.
PWM 2 Value Register
High (PVAL2H)
See page 174.
PWM 2 Value Register
Low (PVAL2L)
See page 174.
PWM 3 Value Register
High (PVAL3H)
See page 174.
PWM 3 Value Register
Low (PVAL3L)
See page 174.
PWM 4 Value Register
High (PVAL4H)
See page 174.
Read:
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:
Reset:00000000
Read:
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Write:
Reset:00000000
Read:
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:
Reset:00000000
Read:
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Write:
Reset:00000000
Read:
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:
Reset:00000000
Read:
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Write:
Reset:00000000
PWM 4 Value Register
$0031
PWM 5 Value Register
$0032
PWM 5 Value Register
$0033
PWM 6 Value Register
$0034
U = UnaffectedX = Indeterminate
Low (PVAL4L)
See page 174.
High (PMVAL5H)
See page 174.
Low (PVAL5L)
See page 174.
High (PVAL6H)
See page 174.
Figure 2-2. Control, Status, and Data Registers (Sheet 5 of 10)
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
R
= Reserved
Bold
= Buff-
ered
= Unimplemented
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorMemory Map 45
Memory Map
Addr.Register NameBit 7654321Bit 0
$0035
$0036
$0037
$0038
$0039
$003A
PWM 6 Value Register
Low (PMVAL6L)
See page 174.
Dead-Time Write-Once
Register (DEADTM)
See page 179.
PWM Disable Mapping
Write-Once Register
(DISMAP)
See page 179.
SCI Control Register 1
(SCC1)
See page 264.
SCI Control Register 2
(SCC2)
See page 267.
SCI Control Register 3
(SCC3)
See page 270.
Read:
Write:
Reset:00000000
Read:
Write:
Reset:11111111
Read:
Write:
Reset:11111111
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Read:R8
Write:RRR
Reset:UU000000
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
LOOP
SCTIETCIESCRIEILIETERERWUSBK
ENSCITXINVMWAKEILTYPENPTY
S
T8
00
ORIENEIEFEIEPEIE
SCI Status Register 1
$003B
See page 271.
SCI Status Register 2
$003C
See page 275.
SCI Data Register
$003D
See page 276.
SCI Baud Rate Register
$003E
See page 276.
U = UnaffectedX = Indeterminate
(SCS1)
(SCS2)
(SCDR)
(SCBR)
Figure 2-2. Control, Status, and Data Registers (Sheet 6 of 10)
Read: SCTETCSCRFIDLEORNFFEPE
Write:RRRRRRRR
Reset:11000000
Read:000000BKFRPF
Write:RRRRRRRR
Reset:00000000
Read:R7R6R5R4R3R2R1R0
Write:T7T6T5T4T3T2T1T0
Reset:Unaffected by reset
Read:00
Write:RRR
Reset:00000000
= Reserved
R
SCP1SCP0
Bold
= Buff-
ered
0
SCR2SCR1SCR0
= Unimplemented
Technical DataMC68HC908MR8 — Rev 4.1
46Memory MapFreescale Semiconductor
Memory Map
I/O Section
Addr.Register NameBit 7654321Bit 0
IRQ Status/Control Reg-
$003F
See page 303.
ADC Status and Control
$0040
$0041
$0042
$0043
$0044Unimplemented
↓
Register (ADSCR)
See page 319.
ADC Data Register High
See page 322.
ADC Data Register Low
See page 323.
ADC Clock Register
See page 324.
(ISCR)
(ADRH)
(ADRL)
(ADCLK)
Read:0000
ister
Write:RRRRACK1
Reset:00000000
Read:
Write:
Reset:00011111
Read:000000AD9AD8
Write:RRRRRRRR
Reset:Unaffected by reset
Read:AD7AD6AD5AD4AD3AD2AD1AD0
Write:RRRRRRRR
Reset:Unaffected by reset
Read:
Write:R
Reset:00000100
COCOAIENADCOADCH4ADCH3ADCH2 ADCH1 ADCH0
ADIV2ADIV1ADIV0ADICLKMODE1MODE00
IRQF
0
IMASK1 MODE1
0
$0050Unimplemented
TIMB Status/Control
$0051
$0052
$0053
$0054
U = UnaffectedX = Indeterminate
Register (TBSC)
See page 238.
TIMB Counter Register
High
(TBCNTH)
See page 240.
TIMB Counter Register
Low
(TBCNTL)
See page 240.
TIMB Counter Modulo
Register High (TB-
MODH)
See page 241.
Read:TOF
Write:0TRSTR
Reset:00100000
Read: Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Write:RRRRRRRR
Reset:00000000
Read;Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Write:RRRRRRRR
Reset:00000000
Read:
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Write:
Reset:11111111
R
TOIETSTOP
= Reserved
00
Bold
= Buff-
ered
Figure 2-2. Control, Status, and Data Registers (Sheet 7 of 10)
PS2PS1PS0
= Unimplemented
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorMemory Map 47
Memory Map
Addr.Register NameBit 7654321Bit 0
$0055
$0056
$0057
$0058
$0059
$005A
TIMB Counter Modulo
Register Low (TBMODL)
See page 241.
TIMB Channel 0 Sta-
tus/Control Register
(TBSC0)
See page 242.
TIMB Channel 0 Regis-
ter High (TBCH0H)
See page 246.
TIMB Channel 0 Regis-
ter Low (TBCH0L)
See page 246.
TIMB Channel 1 Sta-
tus/Control Register
(TBSC1)
See page 242.
TIMB Channel 1 Regis-
ter High (TBCH1H)
See page 246.
Read:
Write:
Reset:11111111
Read: CH0F
Write:0
Reset:00000000
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:
Reset:Indeterminate after reset
Read: CH1F
Write:0R
Reset:00000000
Read:
Write:
Reset:Indeterminate after reset
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
CH0IEMS0BMS0AELS0BELS0ATOV0
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
CH1IE
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
0
MS1AELS1BELS1ATOV1
CH0MA
CH1MA
X
X
TIMB Channel 1 Regis-
$005B
$005C
$005D
$005E
U = UnaffectedX = Indeterminate
ter Low (TBCH1L)
See page 246.
PLL Control Register
(PCTL)
See page 126.
PLL Bandwidth Control
Register (PBWC)
See page 129.
PLL Programming Reg-
ister
(PPG)
See page 131.
Figure 2-2. Control, Status, and Data Registers (Sheet 8 of 10)
Read:
Write:
Reset:Indeterminate after reset
Read:
Write:RRRRR
Reset:00101111
Read:
Write:RRRRR
Reset:00000000
Read:
Write:
Reset:01100110
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
PLLIE
AUTO
MUL7MUL6MUL5MUL4VRS7VRS6VRS5VRS4
R
PLLF
LOCK
= Reserved
PLLONBCS
ACQ
XLD
Bold
1111
0000
= Buff-
ered
= Unimplemented
Technical DataMC68HC908MR8 — Rev 4.1
48Memory MapFreescale Semiconductor
Memory Map
I/O Section
Addr.Register NameBit 7654321Bit 0
$005FReservedRRRRRRRR
$FE00
SIM Break Status Regis-
ter
(SBSR)
See page 336.
Read:
RR R R R R
Write:
Reset:0
SBSW
Note
(1)
Note 1. Writing a logic 0 clears SBSW.
SIM Reset Status Regis-
$FE01
SIM Break Flag Control
$FE03
$FE08
$FE0AReservedRRRRRRRR
$FE0BUnimplemented
Register (SBFCR)
FLASH Control Register
(SRSR)
See page 108.
See page 109.
(FLCR)
See page 57.
Read: PORPINCOPILOPILAD0LVI0
ter
Write:RRRRRRRR
Reset:10000000
Read:
Write:
Reset:0
Read:
BCFERRRRRRR
00 0 0
HVENMASSERASEPGM
Write:
Reset:00000000
R
Break Address Register
$FE0C
Break Address Register
$FE0D
Break Status and Con-
$FE0E
U = UnaffectedX = Indeterminate
trol Register (BRKSCR)
High (BRKH)
See page 334.
Low (BRKL)
See page 334.
See page 333.
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Read:
Write:
Reset:00000000
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
BRKEBRKA
= Reserved
R
00 0 000
Bold
= Buff-
ered
= Unimplemented
Figure 2-2. Control, Status, and Data Registers (Sheet 9 of 10)
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorMemory Map 49
Memory Map
Addr.Register NameBit 7654321Bit 0
LVI Status and Control
$FE0F
$FF7E
$FFFF
U = UnaffectedX = Indeterminate
Register (LVISCR)
See page 308.
FLASH Block Protect
Register (FLBPR)
See page 63.
COP Control Register
(COPCTL)
See page 294.
Figure 2-2. Control, Status, and Data Registers (Sheet 10 of 10)
Read:
Write:RRRRRRR
Reset:00000000
Read:
Write:
Reset:Unaffected by reset
Read:Low byte of reset vector
Write:Clear COP counter
Reset:Unaffected by reset
LVI-
OUT
BPR7BPR6BPR5BPR4BPR3BPR2BPR1BPR0
R
0
= Reserved
TRPS-
EL
00000
Bold
= Buff-
ered
= Unimplemented
Technical DataMC68HC908MR8 — Rev 4.1
50Memory MapFreescale Semiconductor
Table 2-1 is a list of vector locations.
Table 2-1. Vector Addresses
AddressVector
$FFD2SCI transmit vector (high)
Low
$FFD3SCI transmit vector (low)
$FFD4SCI receive vector (high)
$FFD5SCI receive vector (low)
$FFD6SCI error vector (high)
$FFD7SCI error vector (low)
$FFD8Reserved
$FFD9Reserved
$FFDAReserved
$FFDBReserved
Memory Map
I/O Section
Priority
$FFDCA/D vector (high)
$FFDDA/D vector (low)
$FFDETIMB overflow vector (high)
$FFDFTIMB overflow vector (low)
$FFE0TIMB channel 1 vector (high)
$FFE1TIMB channel 1 vector (low)
$FFE2TIMB channel 0 vector (high)
$FFE3TIMB channel 0 vector (low)
$FFE4TIMA overflow vector (high)
$FFE5TIMA overflow vector (low)
$FFE6Reserved
$FFE7Reserved
$FFE8Reserved
$FFE9Reserved
$FFEATIMA channel 1 vector (high)
$FFEBTIMA channel 1 vector (low)
$FFECTIMA channel 0 vector (high)
$FFEDTIMA channel 0 vector (low)
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorMemory Map 51
Memory Map
Priority
Table 2-1. Vector Addresses (Continued)
AddressVector
$FFEEPWMMC vector (high)
$FFEFPWMMC vector (low)
$FFF0FAULT 4 (high)
$FFF1FAULT 4 (low)
$FFF2Reserved
$FFF3Reserved
$FFF4Reserved
$FFF5Reserved
$FFF6FAULT 1 (high)
$FFF7FAULT 1 (low)
$FFF8PLL vector (high)
$FFF9PLL vector (low)
2.6 Monitor ROM
$FFFAIRQ vector (high)
$FFFBIRQ vector (low)
$FFFCSWI vector (high)
$FFFDSWI vector (low)
$FFFEReset vector (high)
High
$FFFFReset vector (low)
313 bytes at addresses $FE10–$FF48 are reserved ROM addresses
that contain the instructions for the monitor functions.
This section describes the 256 bytes of random-access memory (RAM)
on the MC68HC908MR8.
3.3 Functional Description
Addresses $0060–$015F 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.
Within page zero are 160 bytes of RAM. Because the location of the
stack RAM is programmable, all page zero RAM locations can be used
for input/output (I/O) control and user data or code. When the stack
pointer is moved from its reset location at $00FF, direct addressing
mode instructions can access efficiently all page zero RAM locations.
Page zero RAM, therefore, provides ideal locations for frequently
accessed global variables.
Before processing an interrupt, the CPU uses five bytes of the stack to
save the contents of the central processor unit (CPU) registers.
NOTE:For M6805 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 section describes the operation of the MC68HC908MR8 embedded
FLASH memory. This 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.
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorFLASH Memory 55
FLASH Memory
4.2.1 Functional Description
The FLASH memory physically consists of an array of 7680 bytes with
an additional 46 bytes of user vectors and one byte of block protection.
An erased bit reads as a logic 1 and a programmed bit reads as a logic 0.
Program and erase operations are facilitated through control bits in a
memory mapped register. Details for these operations appear later in
this section.
Memory in the FLASH array is organized into two rows per page base.
For the 8-K word by 8-bit embedded FLASH memory, the page size is
64 bytes per page. The minimum erase page size is 64 bytes. Program
and erase operations are performed through control bits in the FLASH
control register (FLCR).
The address ranges for the user memory, control register, and vectors
are:
•$E000–$FDFF, user memory
•$FF7E, block protect register (FLBPR)
•$FE08, FLASH control register (FLCR)
•$FFD2–$FFFF, locations reserved for user-defined interrupt and
reset vectors
Programming tools are available from Freescale. Contact a local
Freescale representative for more information.
NOTE:A security feature
1
prevents viewing of the FLASH contents.
1. No security feature is absolutely secure. However, Freescale’s strategy is to make reading or
copying the FLASH difficult for unauthorized users.
Technical DataMC68HC908MR8 — Rev 4.1
56FLASH MemoryFreescale Semiconductor
4.2.2 FLASH Control Register
The FLASH control register (FLCR) controls the FLASH program, erase,
and read operations.
Ad-
$FE08
dress:
FLASH Memory
Introduction
Bit 7654321Bit 0
Read:0000
Write:
Reset:00000000
= Unimplemented
HVENMASSERASEPGM
Figure 4-1. FLASH Control Register (FLCR)
HVEN — High-Voltage Enable Bit
This read/write bit enables the charge pump to drive high voltages for
program and erase operations in the array. HVEN can be set only if
either PGM = 1 or ERASE = 1 and the proper sequence for
program/margin read or erase is followed.
1 = High voltage enabled to array and charge pump on
0 = High voltage disabled to array and charge pump off
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
set 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
set at the same time.
1 = Program operation selected
0 = Program operation unselected
4.2.3 FLASH Page Erase Operation
Use this step-by-step procedure to erase a page (64 bytes) of FLASH
memory to read as logic 1:
1.Set the ERASE bit and clear the MASS bit in the FLASH control
register.
2.Read the FLASH block protect register.
3.Write to any FLASH address with any data within the page
address range desired.
4.Wait for a time, t
(minimum of 10 µs).
NVS
5.Set the HVEN bit.
6.Wait for a time, t
(minimum of 1 ms).
Erase
7.Clear the ERASE bit.
8.Wait for a time, t
(minimum of 5 µs).
NVH
9.Clear the HVEN bit.
10.After a time, t
(typically 1 µs), the memory can be accessed in
RCV
read mode again.
NOTE:While these operations must be performed in the order shown, other
unrelated operations may occur between the steps. Do not exceed t
maximum. See 21.7 Memory Characteristics.
NVH
Technical DataMC68HC908MR8 — Rev 4.1
58FLASH MemoryFreescale Semiconductor
4.2.4 FLASH Mass Erase Operation
Use this step-by-step procedure to erase the entire FLASH memory to
read as logic 1:
1.Set the ERASE bit and the MASS bit in the FLASH control register.
2.Read the block protect register.
3.Write to any FLASH address with any data within the page
address range desired.
FLASH Memory
Introduction
4.Wait for a time, t
5.Set the HVEN bit.
6.Wait for a time, t
7.Clear the ERASE bit.
8.Wait for a time, t
9.Clear the HVEN bit.
10.After a time, t
read mode again.
NOTE:Programming and erasing of FLASH locations cannot be performed by
code being executed from the FLASH memory. While these operations
must be performed in the order shown, other unrelated operations may
occur between the steps. Do not exceed t
Memory Characteristics.
4.2.5 FLASH Program/Read Operation
(minimum of 10 µs).
NVS
(minimum of 4 ms).
Erase
(minimum of 100 µs).
NVHL
(typically 1 µs), the memory can be accessed in
RCV
maximum. See 21.7
NVH
Programming of the FLASH memory is done on a row basis. A row
consists of 32 consecutive bytes starting from address $XX00, $XX20,
$XX40, and $XX80.
Use this step-by-step procedure to program a row of FLASH memory:
1.Set the PGM bit in the FLASH control register. This configures the
memory for program operation and enables the latching of
address and data programming.
2.Read the block protect register.
3.Write to any FLASH address with any data within the page
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorFLASH Memory 59
FLASH Memory
address range desired.
4.Wait for a time, t
(minimum of 10 µs).
NVS
5.Set the HVEN bit.
6.Wait for a time, t
(minimum of 5 µs).
PGS
7.Write data to the FLASH address to be programmed.
8.Wait for a time, t
PROG
(minimum of 30 µs).
9.Repeat step 7 and step 8 until all the bytes within the row are
programmed.
10.Clear the PGM bit.
11.Wait for a time, t
(minimum of 5 µs).
NVH
12.Clear the HVEN bit.
13.After a time, t
(typically 1 µs), the memory can be accessed in
RCV
read mode again.
NOTE:The time between each FLASH address change, or the time between
the last FLASH address programmed to clear the PGM bit, must not
exceed the maximum programming time, t
PROG
.
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
Memory Characteristics.
4.3 FLASH Programming Algorithm
Refer to Figure 4-2 for an algorithm for programming a row (32 bytes) of
FLASH memory.
maximum. See 21.7
PROG
Technical DataMC68HC908MR8 — Rev 4.1
60FLASH MemoryFreescale Semiconductor
FLASH Memory
FLASH Programming Algorithm
Note:
This page program algorithm assumes the rows to be
programmed are initially erased.
PROGRAM FLASH
SET PGM BIT
READ FLASH BLOCK
PROTECT REGISTER
WRITE ANY DATA TO
SELECTED PAGE
WAIT FOR A TIME,
SET HVEN BIT
WAIT FOR A TIME, t
WRITE DATA TO THE FLASH
ADDRESS TO BE PROGRAMMED
WAIT FOR A TIME,
t
NVS
PGS
t
PROG
Note:
The time between each address change, or the time
between the last FLASH address programmed to clear
the PGM bit, must not exceed the maximum
programming time, t
PROG
.
Figure 4-2. FLASH Programming Algorithm
NO
COMPLETED
PROGRAMMING
THIS ROW?
YES
CLEAR PGM BIT
WAIT FOR A TIME,
CLEAR HVEN BIT
WAIT FOR A TIME, TPROG
PROGRAMMING OPERATION
COMPLETE
t
PROG
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorFLASH Memory 61
FLASH Memory
4.3.1 FLASH Block 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 for protecting
blocks of memory from unintentional erase or program operations due to
system malfunction. This protection is done by using a FLASH protection
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 at 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 erase operation, the FLASH block protect
register must be read after setting the PGM or ERASE bit and before
asserting the HVEN bit.
When the block protect register is erased (all 1s), the entire memory is
accessible for program and erase. When bits within the register are
programmed (set to 0), they lock blocks of memory address ranges as
shown in 4.3.2 FLASH Block Protect Register. Once the block protect
register is programmed with value other than $FF, any erase or program
of the block protect register or the protected pages will be prohibited. The
block protect register itself can be erased or programmed only with an
external voltage VHI present on the IRQ pin. The presence of VHI on the
IRQ pin also allows entry into monitor mode out of reset. Therefore, the
ability to change the block protect register is voltage dependent and can
occur in either user or monitor modes.
Technical DataMC68HC908MR8 — Rev 4.1
62FLASH MemoryFreescale Semiconductor
4.3.2 FLASH Block Protect Register
The block protect register (FLBPR) 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 location of the protected range within the FLASH
memory.
Ad-
$FF7E
dress:
Bit 7654321Bit 0
Read:
Write:
Reset:UUUUUUUU
BPR7BPR6BPR5BPR4BPR3BPR2BPR1BPR0
U= Unaffected by reset. Initial value from factory is 1.
Write to this register by a programming sequence to the FLASH memory.
FLASH Memory
FLASH Programming Algorithm
Figure 4-3. FLASH Block Protect Register (FLBPR)
BPR[7:0] — Block Protect Register Bits
These eight bits represent bits [13:6] of a 16-bit memory address.
Bits[15:14] are logical 1s and bits [5:0] are logic 0s.
The resultant 16-bit address is used for specifying the start address
of the FLASH memory for block protection. The FLASH is protected
from this start address to the end of FLASH memory at $FFFF. With
this mechanism, the protect start address can be $XX00, $XX40,
$XX80, and $XXC0 (64-byte page boundaries) within the FLASH
memory.
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorFLASH Memory 63
FLASH Memory
16-BIT MEMORY ADDRESS
START ADDRESS OF
FLASH
BLOCK PROTECT
11
FLBPR VALUE000000
Figure 4-4. FLASH Block Protect Address
$80 = The entire FLASH memory is protected.
$81 = Protected range: $E040–$FFFF
$82 = Protected range: $E080–$FFFF
↓↓↓
$FE = Protected range: $FF80–$FFFF
$FF = Entire FLASH memory is not protected.
If all bits are erased, then all of the memory is available for erase and
program. The presence of a voltage VHI on the IRQ pin will bypass the
block protection so that all of the memory, including the block protect
register, is open for program and erase operations.
4.3.3 Low-Power Modes
The WAIT and STOP instructions will place the MCU in a low powerconsumption standby mode.
4.3.3.1 Wait Mode
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 never be executed while performing a
program or erase operation on the FLASH. When the MCU is put into
wait mode, the charge pump for the FLASH is disabled so that either a
program or erase operation will not continue. If the memory is in either
program mode (PGM = 1, HVEN = 1) or erase mode (ERASE = 1,
HVEN = 1), then it will remain in that mode during wait.
NOTE:Exiting from wait must now be done with a reset rather than an interrupt
because if exiting wait with an interrupt, the memory will not be in read
mode and the interrupt vector cannot be read from the memory.
Technical DataMC68HC908MR8 — Rev 4.1
64FLASH MemoryFreescale Semiconductor
4.3.3.2 Stop Mode
NOTE:Standby mode is the power-saving mode of the FLASH module, in which
FLASH Memory
FLASH Programming Algorithm
If the FLASH is in read mode, when the MCU is put into stop mode, the
FLASH will be put into low-power standby mode.
The STOP instruction should never be executed while performing a
program or erase operation on the FLASH. Otherwise the operation will
be discontinued and the FLASH will be in standby mode.
all internal control signals to the FLASH are inactive and the current
consumption of the FLASH is minimum.
The configuration register (CONFIG) is a write-once register. Once the
register is written, further writes will have no effect until a reset occurs.
5.4 CONFIG Bits
NOTE:If the LVI module and the LVI reset signal are enabled, a reset occurs
when VDD falls to a voltage, LVI
for at least nine consecutive central processor unit (CPU) cycles. Once
an LVI reset occurs, the microcontroller unit (MCU) remains in reset until
VDD rises to a voltage, LVI
Address: $001F
Bit 7654321Bit 0
Read:
Write:
Reset
states:
CONFIG00001100
EDGE
BOT-
NEG
TRIPR
TOP-
NEG
, and remains at or below that level
TRIPF
.
INDEPLVIRST
LVIP-
WR
STOPECOPD
Figure 5-1. CONFIG Register
EDGE — Edge-Align Enable Bit
EDGE determines if the motor control PWM will operate in
edge-aligned mode or center-aligned mode. See Section 9.
This section describes the central processor unit (CPU08, version A).
The M68HC08 CPU is an enhanced and fully object-code-compatible
version of the M68HC05 CPU. The CPU08 Reference Manual,
Freescale document number CPU08RM/AD, contains a description of
the CPU instruction set, addressing modes, and architecture.
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorCentral Processor Unit (CPU) 71
Central Processor Unit (CPU)
6.3 Features
Features of the CPU include:
•Fully upward, object-code compatibility 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
•Sixteen addressing modes
•Memory-to-memory data moves without using the 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
6.4 CPU Registers
•Low-power stop and wait modes
Figure 6-1 shows the five CPU registers. CPU registers are not part of
the memory map.
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 6-1. CPU Registers
Technical DataMC68HC908MR8 — Rev 4.1
72Central Processor Unit (CPU)Freescale Semiconductor
6.4.1 Accumulator
Central Processor Unit (CPU)
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:
6.4.2 Index Register
Reset:
Unaffected by reset
Figure 6-2. Accumulator (A)
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.
Bit
151413121110987654321
Read:
Write:
Re-
00000000XXXXXXXX
set:
Bit
0
X = Indeterminate
Figure 6-3. Index Register (H:X)
The index register can serve also as a temporary data storage location.
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorCentral Processor Unit (CPU) 73
Central Processor Unit (CPU)
6.4.3 Stack Pointer
The stack pointer (SP) is a 16-bit register that contains the address of
the next location 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.
Read:
Write:
Reset:
Bit
151413121110987654321
0000000011111111
Bit
0
Figure 6-4. Stack Pointer (SP)
NOTE:The location of the stack is arbitrary and may be relocated anywhere in
RAM. Moving the SP out of page zero ($0000 to $00FF) frees direct
address (page zero) space. For correct operation, the stack pointer must
point only to RAM locations.
Technical DataMC68HC908MR8 — Rev 4.1
74Central Processor Unit (CPU)Freescale Semiconductor
6.4.4 Program Counter
The program counter (PC) 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.
Central Processor Unit (CPU)
CPU Registers
Read:
Write:
Reset:
Bit
151413121110987654321
Loaded with vector from $FFFE and $FFFF
Figure 6-5. Program Counter (PC)
Bit
0
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorCentral Processor Unit (CPU) 75
Central Processor Unit (CPU)
6.4.5 Condition Code Register
The 8-bit condition code register (CCR) contains the interrupt mask and
five flags that indicate the results of the instruction just executed. Bit 6
and bit 5 are set permanently to logic 1. The functions of the condition
code register are described here.
Bit 7654321Bit 0
Read
:
V11H I NZC
Write:
Reset:
X11X1XXX
X = Indeterminate
Figure 6-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
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.
Technical DataMC68HC908MR8 — Rev 4.1
76Central Processor Unit (CPU)Freescale Semiconductor
Central Processor Unit (CPU)
CPU Registers
1 = Interrupts disabled
0 = Interrupts enabled
NOTE:To maintain M6805 compatibility, the upper byte of the index register (H)
is not stacked automatically. If the interrupt service routine modifies H,
then the user must stack and unstack H using the PSHH and PULH
instructions.
After the I bit is cleared, the highest-priority interrupt request is
serviced first.
A return-from-interrupt (RTI) instruction pulls the CPU registers from
the stack and restores the interrupt mask from the stack. After any
reset, the interrupt mask is set and can be cleared only by the clear
interrupt mask software instruction (CLI).
N — Negative Flag
The CPU sets the negative flag when an arithmetic operation, logic
operation, or data manipulation produces a negative result, setting
bit 7 of the result.
1 = Negative result
0 = Non-negative result
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
MC68HC908MR8 — Rev 4.1Technical Data
Freescale SemiconductorCentral Processor Unit (CPU) 77
Central Processor Unit (CPU)
6.5 Arithmetic/Logic Unit (ALU)
The ALU performs the arithmetic and logic operations defined by the
instruction set.
Refer to the CPU08 Reference Manual, Freescale document number
CPU08RM/AD, for a description of the instructions and addressing
modes and more detail about CPU architecture.
6.6 Low-Power Modes
The WAIT and STOP instructions put the MCU in low power-consumption
standby modes.
6.6.1 Wait Mode
6.6.2 Stop 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
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.
Technical DataMC68HC908MR8 — Rev 4.1
78Central Processor Unit (CPU)Freescale Semiconductor
6.7 Instruction Set Summary
Table 6-1 provides a summary of the M68HC08 instruction set.
Freescale SemiconductorCentral Processor Unit (CPU) 85
Central Processor Unit (CPU)
Table 6-1. Instruction Set Summary (Sheet 8 of 8)
Source
Form
TST opr
TSTA
TSTX
TST opr,X
TST ,X
TST opr,SP
OperationDescription
Test for Negative or Zero(A) – $00 or (X) – $00 or (M) – $000 – – ↕↕ –
Effect on CCR
VH I NZC
DIR
INH
INH
IX1
IX
SP1
Address
Mode
3D
4D
5D
6D
7D
9E6D
Opcode
dd
ff
ff
Operand
3
1
1
3
2
4
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
WAITEnable Interrupts; Stop ProcessorI bit ← 0––0–––INH8F1
AAccumulatornAny bit
CCarry/borrow bitoprOperand (one or two bytes)
CCR Condition code registerPCProgram counter
ddDirect address of operandPCH Program counter high byte
dd rr Direct 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+D Indexed 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 location↕Set or cleared
NNegative bit—Not affected
⊕Logical EXCLUSIVE OR
«Sign extend
Cycles
6.8 Opcode Map
See Table 6-2.
Technical DataMC68HC908MR8 — Rev 4.1
86Central Processor Unit (CPU)Freescale Semiconductor
Freescale SemiconductorCentral Processor Unit (CPU) 87
MC68HC908MR8 — Rev 4.1Technical Data
MSB
LSB
05BRSET0
15BRCLR0
25BRSET1
35BRCLR1
45BRSET2
55BRCLR2
65BRSET3
75BRCLR3
85BRSET4
95BRCLR4
A5BRSET5
B5BRCLR5
C5BRSET6
D5BRCLR6
E5BRSET7
F5BRCLR7
Table 6-2. Opcode Map
Bit ManipulationBranchRead-Modify-WriteControlRegister/Memory
This section describes the system integration module (SIM). Together
with the central processor unit (CPU), the SIM controls all
microcontroller unit (MCU) activities. A block diagram of the SIM is
shown in Figure 7-1. Figure 7-2 is a summary of the SIM inout/output
(I/O) registers.
The SIM is a system state controller that coordinates CPU and exception
timing. The SIM is responsible for:
•Bus clock generation and control for CPU and peripherals:
–Stop, wait, reset, break entry, and recovery
–Internal clock control
•Master reset control, including power-on reset (POR) and
computer operating properly (COP) timeout
•Interrupt control:
–Acknowledge timing
–Arbitration control timing
–Vector address generation
•CPU enable/disable timing
•Modular architecture expandable to 128 interrupt sources
The bus clock generator provides system clock signals for the CPU and
peripherals on the MCU. The system clocks are generated from an
incoming clock, CGMOUT, as shown in Figure 7-3. This clock can come
from either an external oscillator or from the on-chip phase-locked loop
(PLL). See Section 8. Clock Generator Module (CGM).
System Integration Module (SIM)
SIM Bus Clock Control and Generation
OSC1
7.3.1 Bus Timing
CGMVCLK
PLL
CLOCK
SELECT
CIRCUIT
BCS
MONITOR MODE
USER MODE
÷ 2
A
B
S*
*When S = 1,
CGMXCLK
CGMOUT
CGMOUT = B
SIM COUNTER
÷ 2
SIM
BUS CLOCK
GENERATORS
CGM
Figure 7-3. CGM Clock Signals
In user mode, the internal bus frequency is either the crystal oscillator
output (CGMXCLK) divided by four or the PLL output (CGMVCLK)
divided by four. See Section 8. Clock Generator Module (CGM).
7.3.2 Clock Startup from POR or LVI Reset
When the power-on reset (POR) module or the low-voltage inhibit (LVI)
module generates a reset, the clocks to the CPU and peripherals are
inactive and held in an inactive phase until after the 4096 CGMXCLK
cycle POR timeout has completed. The RST pin is driven low by the SIM
during this entire period. The IBUS clocks start upon completion of the
timeout.
In wait mode, the CPU clocks are inactive. The SIM also produces two
sets of clocks for other modules. Refer to the wait mode subsection of
each module to see if the module is active or inactive in wait mode.
Some modules can be programmed to be active in wait mode.
7.4 Reset and System Initialization
The MCU has these reset sources:
•Power-on reset module (POR)
•External reset pin (RST)
•Computer operating properly module (COP)
•Low-voltage inhibit module (LVI)
All of these resets produce the vector $FFFE–FFFF ($FEFE–FEFF in
monitor mode) and assert the internal reset signal (IRST). IRST causes
all registers to be returned to their default values and all modules to be
returned to their reset states.
An internal reset clears the SIM counter (see 7.5 SIM Counter), but an
external reset does not. Each of the resets sets a corresponding bit in
the SIM reset status register (SRSR). See 7.7.4 SIM Reset Status
Register.
7.4.1 External Pin Reset
Pulling the asynchronous RST
of the SIM reset status register (SRSR) is set as long as RST is held low
for a minimum of 67 CGMXCLK cycles, assuming that neither the POR
nor the LVI was the source of the reset. See Table 7-2 for details.
All internal reset sources actively pull the RST pin low for 32 CGMXCLK
cycles to allow resetting of external peripherals. The internal reset signal
(IRST) continues to be asserted for an additional 32 cycles (see
Figure 7-5). An internal reset can be caused by an illegal address, illegal
opcode, COP timeout, LVI, or POR (see Figure 7-6).
NOTE:For LVI or POR resets, the SIM cycles through 4096 CGMXCLK cycles
during which the SIM forces the RST
then follows the sequence from the falling edge of RST as shown in
The active reset feature allows the part to issue a reset to peripherals
and other chips within a system built around the MCU.
7.4.2.1 Power-On Reset (POR)
When power is first applied to the MCU, the power-on reset (POR)
module generates a pulse to indicate that power-on has occurred. The
external reset pin (RST) is held low while the SIM counter counts out
4096 CGMXCLK cycles. Sixty-four CGMXCLK cycles later, the CPU and
memories are released from reset to allow the reset vector sequence to
occur.
ILLEGAL ADDRESS RST
ILLEGAL OPCODE RST
COPRST
LVI
POR
INTERNAL RESET
Figure 7-6. Sources of Internal Reset
At power-on, these events occur:
•A POR pulse is generated.
•The internal reset signal is asserted.
•The SIM enables CGMOUT.
•Internal clocks to the CPU and modules are held inactive for 4096
CGMXCLK cycles to allow stabilization of the oscillator.
•The RST pin is driven low during the oscillator stabilization time.
•The POR bit of the SIM reset status register (SRSR) is set and all
other bits in the register are cleared.
An input to the SIM is reserved for the COP reset signal. The overflow of
the COP counter causes an internal reset and sets the COP bit in the
SIM reset status register (SRSR). The SIM actively pulls down the RST
pin for all internal reset sources.
To prevent a COP module timeout, write any value to location $FFFF.
Writing to location $FFFF clears the COP counter and bits 12–4 of the
SIM counter. The SIM counter output, which occurs at least every
213–24 CGMXCLK cycles, drives the COP counter. The COP should be
serviced as soon as possible out of reset to guarantee the maximum
amount of time before the first timeout.
$FFFE$FFFF
The COP module is disabled if the RST
pin or the IRQ pin is held at
VDD+VHI while the MCU is in monitor mode. The COP module can be
disabled only through combinational logic conditioned with the high
voltage signal on the RST or the IRQ pin. This prevents the COP from
becoming disabled as a result of external noise. During a break state,
VDD+VHI on the RST pin disables the COP module.
The SIM decodes signals from the CPU to detect illegal instructions. An
illegal instruction sets the ILOP bit in the SIM reset status register
(SRSR) and causes a reset.
Because the MC68HC08MR8 has stop mode disabled by bit 1 in the
CONFIG register, execution of the STOP instruction will cause an illegal
opcode reset if stop mode has not been enabled by setting CONFIG
register bit 1.
7.4.2.4 Illegal Address Reset
An opcode fetch from addresses other than FLASH, I/O, or RAM
addresses generates an illegal address reset (unimplemented locations
within memory map). The SIM verifies that the CPU is fetching an
opcode prior to asserting the ILAD bit in the SIM reset status register
(SRSR) and resetting the MCU. A data fetch from an unmapped address
does not generate a reset.
7.4.2.5 Low-Voltage Inhibit (LVI) Reset
The low-voltage inhibit module (LVI) asserts its output to the SIM when
the VDD voltage falls to the LVI
level for at least nine consecutive CPU cycles. The LVI bit in the SIM
reset status register (SRSR) is set, and the external reset pin (RST) is
held low while the SIM counter counts out 4096 CGMXCLK cycles.
Sixty-four CGMXCLK cycles later, the CPU is released from reset to
allow the reset vector sequence to occur. The SIM actively pulls down
the RST
The SIM counter is used by the POR module to allow the oscillator time
to stabilize before enabling the internal bus (IBUS) clocks. The SIM
counter also serves as a prescaler for the COP module. The SIM counter
overflow supplies the clock for the COP module. The SIM counter is 13
bits long and is clocked by the falling edge of CGMXCLK.
7.5.1 SIM Counter During Power-On Reset
The POR detects power applied to the MCU. At power-on, the POR
circuit asserts the signal PORRST. Once the SIM is initialized, it enables
the clock generation module (CGM) to drive the bus clock state machine.
7.5.2 SIM Counter and Reset States
System Integration Module (SIM)
SIM Counter
External reset has no effect on the SIM counter. The SIM counter is
free-running after all reset states. See 7.4.2 Active Resets from
Internal Sources for counter control and internal reset recovery
sequences.
7.6 Exception Control
Normal, sequential program execution can be changed in three different
ways:
At the beginning of an interrupt, the CPU saves the CPU register
contents on the stack and sets the interrupt mask (I bit) to prevent
additional interrupts. At the end of an interrupt, the return from interrupt
(RTI) instruction recovers the CPU register contents from the stack so
that normal processing can resume. Figure 7-8 shows interrupt entry
timing. Figure 7-10 shows interrupt recovery timing.
Interrupts are latched, and arbitration is performed in the SIM at the start
of interrupt processing. The arbitration result is a constant that the CPU
uses to determine which vector to fetch. Once an interrupt is latched by
the SIM, no other interrupt can take precedence, regardless of priority,
until the latched interrupt is serviced (or the I bit is cleared). See
Figure 7-9.
MODULE
INTERRUPT
I BIT
IAB
IDB
R/W
DUMMY
SPSP – 1SP – 2SP – 3SP – 4VECT HVECT L START ADDR
DUMMYPC – 1[7:0] PC – 1[15:8]XACCRV DATA HV DATA L OPCODE