Motorola reserves the right to make changes without further notice to
any products herein to improve reliability, function or design. Motorola
does not assume any liability arising out of the application or use of any
product or circuit described herein; neither does it convey any license
under its patent rights nor the rights of others. Motorola products are not
designed, intended, or authorized for use as components in systems
intended for surgical implant into the body, or other applications intended
to support or sustain life, or for any other application in which the failure
of the Motorola product could create a situation where personal injury or
death may occur. Should Buyer purchase or use Motorola products for
any such unintended or unauthorized application, Buyer shall indemnify
and hold Motorola and its officers, employees, subsidiaries, affiliates,
and distributors harmless against all claims, costs, damages, and
expenses, and reasonable attorney fees arising out of, directly or
indirectly, any claim of personal injury or death associated with such
unintended or unauthorized use, even if such claim alleges that Motorola
was negligent regarding the design or manufacture of the part.
The MC68HC05RC16 is a low-cost addition to the M68HC05 Family of
microcontrollers (MCUs) and is suitable for remote control applications.
This device contains the HC05 central processing unit (CPU) core,
including the 14-stage core timer with real-time interrupt (RTI) and
computer operating properly (COP) watchdog systems. On-chip
peripherals include a carrier modulator transmitter. The 16-kbyte
memory map has 15,936 bytes of user ROM and 352 bytes of RAM.
There are 20 input/output (I/O) lines (eight having keyscan
pullups/interrupts) and a low-power reset pin. This device is available in
28-pin small outline integrated circuit (SOIC), 28-pin dual in-line (DIP),
and 44-pin plastic leaded chip carrier (PLCC) packages. Four additional
I/O lines are available for bond out on the higher pin count package.
1.3 Features
Features for the MC68HC05RC16 include:
•Low Cost
•HC05 Core
•28-Pin Plastic Dual In-Line (PDIP), Small Outline Integrated
Circuit (SOIC), or Plastic Leaded Chip Carrier (PLCC) Packages
•On-Chip Oscillator with Crystal/Ceramic Resonator
•4-MHz Maximum Oscillator Frequency at 5 V and 2.2 V Supply
•Fully Static Operation
•15,936 Bytes of User ROM
•64 Bytes of Burn-In ROM
•352 Bytes of On-Chip RAM
•14-Stage Core Timer with Real-Time Interrupt (RTI) and
Computer Operating Properly (COP) Watchdog Circuits
•Carrier Modulator Transmitter Supporting Baseband, Pulse
Length Modulator (PLM), and Frequency Shift Keying (FSK)
Protocols
General Release SpecificationMC68HC05RC16 — Rev. 3.0
16General DescriptionMOTOROLA
General Description
Features
•Low-Power Reset Pin
•20 Bidirectional I/O Lines (Four Additional I/O Lines Available for
Bond Out in 44-Lead PLCC Package)
•Mask Programmable Pullups and Interrupts on Eight Port Pins
(PB0–PB7)
•High-Current Infrared (IR) Drive Pin
•High-Current Port Pin (PC0)
•Power-Saving Stop and Wait Modes
•Mask Selectable Options:
–COP Watchdog Timer
–STOP Instruction Disable
–Edge-Sensitive or Edge- and Level-Sensitive Interrupt Trigger
NOTE:
–Port B Pullups for Keyscan
•Illegal Address Reset
•ROM Security Feature
A line over a signal name indicates an active low signal. For example,
RESET is active low.
When the COP option is selected (COPEN = 1), the COP watchdog
timer is enabled.
When the COP option is deselected (COPEN = 0), the COP watchdog
timer is disabled.
STOPEN — STOP Instruction Enable
When the STOP option is selected (STOPEN = 1), the STOP
instruction is enabled.
When the STOP option is deselected (STOPEN = 0), the STOP
instruction is equivalent to a WAIT instruction.
IRQ — IRQ sensitivity
When the IRQ option is selected (IRQ = 1), edge- and level-sensitive
IRQ is enabled.
When the IRQ option is deselected (IRQ = 0), edge-only sensitive IRQ
is enabled.
The port B keyscan interrupt sensitivity will match that of the IRQ
sensitivity. (See 4.7 External Interrupt (IRQ/Port B Keyscan) for more
information.)
General Release SpecificationMC68HC05RC16 — Rev. 3.0
20General DescriptionMOTOROLA
1.5 Signal Description
The MC68HC05RC16 is available in
1.28-pin dual-in-line package (DIP) see Figure 1-2
2.28-pin small outline integrated circuit (SOIC) package
All no connects should be tied to an appropriate logic
level (either VDD or VSS).
PA5NCPA6
PA7
PC0
PC1
NC
Figure 1-4. 44-Pin PLCC Pinout
General Release SpecificationMC68HC05RC16 — Rev. 3.0
22General DescriptionMOTOROLA
General Description
Signal Description
1.5.1 VDDand V
1.5.2
IRQ (Maskable Interrupt Request)
SS
Power is supplied to the microcontroller’s digital circuits using these two
pins. V
is the positive supply and VSS is ground.
DD
In addition to suppling the EPROM with the required programming
voltage, this pin has a mask option as specified by the user that provides
one of two different choices of interrupt triggering sensitivity. The options
are:
1.Negative edge-sensitive triggering only
2.Both negative edge-sensitive and level-sensitive triggering.
The MCU completes the current instruction before it responds to the
interrupt request. When
IRQ goes low for at least one t
(see 11.8
ILIH
Control Timing (5.0 Vdc and 2.2 Vdc)), a logic 1 is latched internally to
signify that an interrupt has been requested. When the MCU completes
its current instruction, the interrupt latch is tested. If the interrupt latch
contains a logic 1 and the interrupt mask bit (I bit) in the condition code
register is clear, the MCU then begins the interrupt sequence.
If the option is selected to include level-sensitive triggering, the
requires an external resistor to V
IRQ pin contains an internal Schmitt trigger as part of its input to
The
for wired-OR operation.
DD
IRQ input
improve noise immunity.
Refer to Section 4. Interrupts for more detail.
These pins provide control input for an on-chip clock oscillator circuit. A
crystal, a ceramic resonator, or an external signal connects to these pins
to provide a system clock. The oscillator frequency is two times the
internal bus rate.
Figure 1-5 shows the recommended circuit when using a crystal. The
crystal and components should be mounted as close as possible to the
input pins to minimize output distortion and startup stabilization time.
A ceramic resonator may be used in place of the crystal in cost-sensitive
applications. Figure 1-5 (a) shows the recommended circuit for using a
ceramic resonator. The manufacturer of the particular ceramic resonator
being considered should be consulted for specific information.
An external clock should be applied to the OSC1 input with the OSC2 pin
not connected (see Figure 1-5 (b)). This setup can be used if the user
does not want to run the CPU with a crystal.
General Release SpecificationMC68HC05RC16 — Rev. 3.0
24General DescriptionMOTOROLA
1.5.4 RESET
1.5.5 LPRST
1.5.6 IRO
General Description
Signal Description
This active-low pin is used to reset the MCU to a known startup state by
pulling RESET low. The RESET pin contains an internal Schmitt trigger
as part of its input to improve noise immunity. See Section 5. Resets.
LPRST pin is an active-low pin and is used to put the MCU into
The
low-power reset mode. In low-power reset mode the MCU is held in reset
with all processor clocks halted. See Section 5. Resets.
The IRO pin is the high-current source and sink output of the carrier
modulator transmitter subsystem which is suitable for driving infrared
(IR) LED biasing logic. See Section 9. Carrier Modulator Transmitter
(CMT).
1.5.7 PA0–PA7
1.5.8 PB0–PB7
These eight I/O lines comprise port A. The state of any pin is software
programmable and all port A lines are configured as inputs during
power-on or reset. For detailed information on I/O programming, see2.4
Input/Output Programming.
These eight I/O lines comprise port B. The state of any pin is software
programmable and all port B lines are configured as inputs during
power-on or reset. Each port B I/O line has a mask optionable
pullup/interrupt for keyscan. For detailed information on I/O
programming, see 2.4 Input/Output Programming.
These eight I/O lines comprise port C. PC0 is a high-current pin.
PC4–PC7 are available only in the 44-lead PLCC package. The state of
any pin is software programmable and all port C lines are configured as
input during power-on or reset. For detailed information on I/O
programming, see 2.4 Input/Output Programming.
NOTE:
NOTE:
Only four bits of port C are bonded out in 28-pin packages for the
MC68HC05RC16, although port C is truly an 8-bit port. Since pins
PC4–PC7 are unbonded, software should include the code to set their
respective data direction register locations to outputs to avoid floating
inputs.
Any unused inputs, I/O ports, and no connects should be tied to an
appropriate logic level (either V
or VSS). Although the I/O ports of the
DD
do not require termination, termination is recommended to reduce the
possibility of static damage.
General Release SpecificationMC68HC05RC16 — Rev. 3.0
26General DescriptionMOTOROLA
RESERVED
PORT A DATA DIRECTION REGISTER
PORT B DATA DIRECTION REGISTER
PORT C DATA DIRECTION REGISTER
RESERVED
CORE TIMER CONTROL & STATUS REG.
CORE TIMER COUNTER REGISTER
RESERVED
. . . . . . .
RESERVED
IR TIMER CHR1
IR TIMER CLR1
IR TIMER CHR2
IR TIMER CLR2
IR TIMER MCSR
IR TIMER MDR1
IR TIMER MDR2
IR TIMER MDR3
RESERVED
RESERVED
RESERVED
$00
$01
$02
$03
$04
$05
$06
$07
$08
$09
$0A
. . . . . . .
$0F
$10
$11
$12
$13
$14
$15
$16
$17
$18
$1E
$1F
UNUSED
$3FF0
.....
UNUSED
CORE TIMER VECTOR (HIGH BYTE)
CORE TIMER VECTOR (LOW BYTE)
IR TIMER VECTOR (HIGH BYTE)
IR TIMER VECTOR (LOW BYTE)
IRQ/PTB KEYSCAN PULLUPS
VECTOR (HIGH BYTE)
IRQ/PTB KEYSCAN PULLUPS
VECTOR (LOW BYTE)
SWI VECTOR (HIGH BYTE)
SWI VECTOR (LOW BYTE)
RESET VECTOR (HIGH BYTE)
RESET VECTOR (LOW BYTE)
$3FF5
$3FF6
$3FF7
$3FF8
$3FF9
$3FFA
$3FFB
$3FFC
$3FFD
$3FFE
$3FFF
Figure 2-1. MC68HC05RC16 Memory Map
General Release SpecificationMC68HC05RC16 — Rev. 3.0
28MemoryMOTOROLA
Memory
Memory Map
Addr.RegisterBit 7654321Bit 0
$0000Port A Data Register
$0001Port B Data Register
$0002Port C Data Register
$0003ReservedRRRRRRRR
$0004Port A Data Direction Register
$0005Port B Data Direction Register
$0006Port C Data Direction Register
$0007ReservedRRRRRRRR
$0008Timer Control and Status Reg.CTOFRTIFTOFERTIETOFCRTFCRT1RT0
$0009Timer Counter Register
$000AReservedRRRRRRRR
The user ROM consists of 15,920 bytes of ROM located from $0180 to
$3FAF and 16 bytes of user vectors located from $3FF0 to $3FFF.
The burn-in ROM is located from $3FB0 to $3FEF.
Ten of the user vectors, $3FF6–$3FFF, are dedicated to reset and
interrupt vectors. The six remaining locations — $3FF0, $3FF1, $3FF2,
$3FF3, $3FF4, and $3FF5 — are general-purpose user ROM locations.
Security has been incorporated into the MC68HC05RC16 to prevent
external viewing of the ROM contents. This feature ensures that
customer-developed software remains proprietary.
1
1. No security feature is absolutely secure. However, Motorola’s strategy is to make reading or
copying the ROM difficult for unauthorized users.
General Release SpecificationMC68HC05RC16 — Rev. 3.0
30MemoryMOTOROLA
2.3.3 RAM
Memory
Input/Output Programming
The user RAM consists of 352 bytes of a shared stack area. The RAM
starts at address $0020 and ends at address $017F. The stack begins
at address $00FF. The stack pointer can access 64 bytes of RAM in the
range $00FF to $00C0.
NOTE:
Using the stack area for data storage or temporary work locations
requires care to prevent it from being overwritten due to stacking from an
interrupt or subroutine call.
2.4 Input/Output Programming
In user mode, 20 lines (28-pin PDIP or 28-pin SOIC) or 24 lines (44-lead
PLCC) are arranged as three 8-bit I/O ports. These ports are
programmable as either inputs or outputs under software control of the
data direction registers. For detailed information, refer to Section 7.
NOTE:Since the stack pointer decrements during pushes, the PCL is stacked first,
followed by PCH, etc. Pulling from the stack is in the reverse order.
E
T
U
R
N
UNSTACK
CONDITION CODE REGISTER
ACCUMULATOR
INDEX REGISTER
PCH
PCL
STACK
I
N
T
E
R
R
U
P
T
DECREASING
MEMORY
ADDRESSES
Figure 3-2. Stacking Order
The accumulator (A) is a general-purpose 8-bit register used to hold
operands and results of arithmetic calculations or data manipulations.
70
A
3.4 Index Register
The index register (X) is an 8-bit register used for the indexed
addressing value to create an effective address. The index register also
may be used as a temporary storage area.
70
X
General Release SpecificationMC68HC05RC16 — Rev. 3.0
34Central Processor UnitMOTOROLA
3.5 Condition Code Register
The condition code register (CCR) is a 5-bit register in which four bits are
used to indicate the results of the instruction just executed, and the fifth
bit indicates whether interrupts are masked. These bits can be tested
individually by a program, and specific actions can be taken as a result
of their state. Each bit is explained in the following paragraphs.
H — Half Carry
This bit is set during ADD and ADC operations to indicate that a carry
occurred between bits 3 and 4.
I — Interrupt
Central Processor Unit
Condition Code Register
CCR
HINZC
When this bit is set, timer and external interrupts are masked
(disabled). If an interrupt occurs while this bit is set, the interrupt is
latched and processed as soon as the interrupt bit is cleared.
N — Negative
When set, this bit indicates that the result of the last arithmetic, logical,
or data manipulation was negative.
Z — Zero
When set, this bit indicates that the result of the last arithmetic, logical,
or data manipulation was zero.
C — Carry/Borrow
When set, this bit indicates that a carry or borrow out of the arithmetic
logical unit (ALU) occurred during the last arithmetic operation. This
bit is also affected during bit test and branch instructions and during
shifts and rotates.
The stack pointer (SP) contains the address of the next free location on
the stack. During an MCU reset or the reset stack pointer (RSP)
instruction, the stack pointer is set to location $00FF. The stack pointer
is then decremented as data is pushed onto the stack and incremented
as data is pulled from the stack.
When accessing memory, the seven most significant bits are
permanently set to 0000011. These seven bits are appended to the six
least significant register bits to produce an address within the range of
$00FF to $00C0. Subroutines and interrupts may use up to 64 (decimal)
locations. If 64 locations are exceeded, the stack pointer wraps around
and loses the previously stored information. A subroutine call occupies
two locations on the stack; an interrupt uses five locations.
3.7 Program Counter
The program counter (PC) is a 13-bit register that contains the address
of the next byte to be fetched.
NOTE:
The HC05 CPU core is capable of addressing a 64-Kbyte memory map.
For this implementation, however, the addressing registers are limited to
an 16-Kbyte memory map.
1370
0000011SP
130
PC
General Release SpecificationMC68HC05RC16 — Rev. 3.0
36Central Processor UnitMOTOROLA
Interrupts cause the processor to save register contents on the stack
and to set the interrupt mask (I bit) to prevent additional interrupts. Unlike
reset, hardware interrupts do not cause the current instruction execution
to be halted, but are considered pending until the current instruction is
complete.
If interrupts are not masked (I bit in the CCR is clear) and the
corresponding interrupt enable bit is set, the processor will proceed with
interrupt processing. Otherwise, the next instruction is fetched and
executed. If an interrupt occurs, the processor completes the current
instruction, stacks the current CPU register state, sets the I bit to inhibit
further interrupts, and finally checks the pending hardware interrupts. If
more than one interrupt is pending after the stacking operation, the
interrupt with the highest vector location shown in Table 4-1 will be
serviced first. The SWI is executed the same as any other instruction,
regardless of the I-bit state.
When an interrupt is to be processed, the CPU fetches the address of
the appropriate interrupt software service routine from the vector table at
locations $3FF6–$3FFF as defined in Table 4-1.
Table 4-1. Vector Address for Interrupts and Reset
*External interrupts include IRQ and port B keyscan sources.
CTOF,
RTIF
End of Cycle
Interrupt
Real-Time Interrupt
Core Timer
Overflow
CPU
Interrupt
CMT$3FF8–$3FF9
CORE
TIMER
Vector Address
$3FF6–$3FF7
General Release SpecificationMC68HC05RC16 — Rev. 3.0
38InterruptsMOTOROLA
Interrupts
Reset Interrupt Sequence
The M68HC05 CPU does not support interruptible instructions. The
maximum latency to the first instruction of the interrupt service routine
must include the longest instruction execution time plus stacking
overhead.
Latency = (Longest instruction execution time + 10) x t
An RTI instruction is used to signify when the interrupt software service
routine is completed. The RTI instruction causes the register contents to
be recovered from the stack and normal processing to resume at the
next instruction that was to be executed when the interrupt took place.
Figure 4-1 shows the sequence of events that occurs during interrupt
processing.
4.4 Reset Interrupt Sequence
The reset function is not in the strictest sense an interrupt; however, it is
acted upon in a similar manner as shown inFigure 4-1. A low-level input
on the
program to vector to its starting address, which is specified by the
contents of memory locations $3FFE and $3FFF. The I bit in the
condition code register is also set. The MCU is configured to a known
state during this type of reset.
RESET pin or an internally generated RST signal causes the
seconds
cyc
4.5 Software Interrupt (SWI)
The SWI is an executable instruction and a nonmaskable interrupt since
it is executed regardless of the state of the I bit in the CCR. If the I bit is
zero (interrupts enabled), the SWI instruction executes after interrupts
that were pending before the SWI was fetched or before interrupts
generated after the SWI was fetched. The interrupt service routine
address is specified by the contents of memory locations $3FFC and
$3FFD.
General Release SpecificationMC68HC05RC16 — Rev. 3.0
40InterruptsMOTOROLA
4.6 Hardware Interrupts
All hardware interrupts except RESET are maskable by the I bit in the
CCR. If the I bit is set, all hardware interrupts (internal and external) are
disabled. Clearing the I bit enables the hardware interrupts. The three
types of hardware interrupts are explained in the following sections.
4.7 External Interrupt (IRQ/Port B Keyscan)
The IRQ pin provides an asynchronous interrupt to the CPU. A block
diagram of the IRQ function is shown in Figure 4-2.
Interrupts
Hardware Interrupts
NOTE:
EIMSK
IRQ PIN
PORT B KEYSCAN
INTERRUPT
IRQ VECTOR FETCH
RST
LEVEL
(MASK OPTION)
The BIH and BIL instructions will apply to the level on the IRQ pin itself
and to the output of the logic OR function with the port B IRQ interrupts.
The states of the individual port B pins can be checked by reading the
appropriate port B pins as inputs.
The IRQ pin is one source of an external interrupt. All port B pins
(PB0–PB7) act as other external interrupt sources if the pullup feature is
enabled as specified by the user.
When edge sensitivity is selected for the IRQ interrupt, it is sensitive to
these cases:
1.Falling edge on the IRQ pin
2.Falling edge on any port B pin with pullup enabled
When edge and level sensitivity is selected for the IRQ interrupt, it is
sensitive to these cases:
1.Low level on the IRQ pin
2.Falling edge on the
3.Falling edge or low level on any port B pin with pullup enabled
External interrupts also can be masked by setting the EIMSK bit in the
MSCR register of the IR remote timer. See 9.5.4 Modulator Period
Data Registers (MDR1, MDR2, and MDR3) for details.
4.8 External Interrupt Timing
If the interrupt mask bit (I bit) of the CCR is set, all maskable interrupts
(internal and external) are disabled. Clearing the I bit enables interrupts.
The interrupt request is latched immediately following the falling edge of
the
IRQ source. It is then synchronized internally and serviced as
specified by the contents of $3FFA and $3FFB.
Either a level-sensitive and edge-sensitive trigger or an
edge-sensitive-only trigger is available via the mask programmable
option for the
IRQ pin
IRQ pin.
4.9 Carrier Modulator Transmitter Interrupt (CMT)
A CMT interrupt occurs when the end of cycle flag (EOC) and the end of
cycle interrupt enable (EOCIE) bits are set in the modulator control and
status register (MCSR). This interrupt will vector to the interrupt service
routine located at the address specified by the contents of memory
locations $3FF8 and $3FF9.
General Release SpecificationMC68HC05RC16 — Rev. 3.0
42InterruptsMOTOROLA
4.10 Core Timer Interrupt
This timer can create two types of interrupts. A timer overflow interrupt
occurs whenever the 8-bit timer rolls over from $FF to $00 and the
enable bit TOFE is set. A real-time interrupt occurs whenever the
programmed time elapses and the enable bit RTIE is set. Either of these
interrupts vectors to the same interrupt service routine, located at the
address specified by the contents of memory locations $3FF6 and
$3FF7.
The MCU can be reset from five sources: two external inputs and three
internal restart conditions. The
shown in Figure 5-1. All the internal peripheral modules will be reset by
the internal reset signal (RST). Refer toFigure 5-2 for reset timing detail.
The RESET pin is one of the two external sources of a reset. This pin is
connected to a Schmitt trigger input gate to provide an upper and lower
threshold voltage separated by a minimum amount of hysteresis. This
external reset occurs whenever the
threshold and remains in reset until the
upper threshold. This active-low input will generate the RST signal and
reset the CPU and peripherals. Termination of the external RESET input
or the internal COP watchdog reset are the only reset sources that can
alter the operating mode of the MCU.
RESET pin is pulled below the lower
RESET pin rises above the
IRQ
RESET
DATA
ADDRESS
LPRST
ADDRESS
OSC
V
DD
NOTE:
COP WATCHDOG
Activation of the RST signal is generally referred to as reset of the
device, unless otherwise specified.
D
LATCH
R
CLOCKED
(COPR)
CPU
S
POWER-ON RESET
(POR)
ILLEGAL ADDRESS
(ILLADDR)
PH2
D
LATCH
RST
TO
IRQ
LOGIC
MODE
SELECT
TO OTHER
PERIPHERALS
Figure 5-1. Reset Block Diagram
General Release SpecificationMC68HC05RC16 — Rev. 3.0
46ResetsMOTOROLA
1. Internal timing signal and bus information are not available externally.
2. OSC1 line is not meant to represent frequency. It is only used to represent time.
3. The next rising edge of the internal processor clock following the rising edge of RESET initiates the reset sequence.
4. VDD must fall to a level lower than V
5. The
NEWNEWOP
LPRST pin resets the CPU like RESET. However, 4064 POR cycles are executed first, before the reset vector address appears on the
internal address bus. (See 5.4 Low-Power External Reset (LPRST).)
CODEPCLPCH
t
RL
3
to be recognized as a power-on reset.
POR
PCHPCL
Figure 5-2. Reset and POR Timing Diagram
OP
CODE
External Reset (RESET)
Resets
Resets
5.4 Low-Power External Reset (LPRST)
The LPRST pin is one of the two external sources of a reset. This
external reset occurs whenever the
threshold and remains in reset until the
input will, in addition to generating the RST signal and resetting the CPU
and peripherals, halt all internal processor clocks. The MCU will remain
in this low-power reset condition as long as a logic 0 remains on LPRST.
When a logic 1 is applied to LPRST , processor cloc ks will be re-enabled
with the MCU remaining in reset until the 4064 internal processor clock
cycle (t
) oscillator stabilization delay is completed. If any other reset
cyc
function is active at the end of this 4064-cycle delay, the RST signal
remains in the reset condition until the other reset condition(s) end.
5.5 Internal Resets
LPRST pin is pulled below the lower
LPRST pin rises. This active low
The three internally generated resets are the initial power-on reset
function, the COP watchdog timer reset, and the illegal address detector.
Termination of the external reset input, external
internal COP watchdog timer are the only reset sources that can alter the
operating mode of the MCU. The other internal resets do not have any
effect on the mode of operation when their reset state ends.
5.5.1 Power-On Reset (POR)
The internal POR is generated on power-up to allow the clock oscillator
to stabilize. The POR is strictly for power turn-on conditions and is not
able to detect a drop in the power supply voltage (brown-out). There is
an oscillator stabilization delay of 4064 internal processor bus clock
cycles (PH2) after the oscillator becomes active.
The POR generates the RST signal that resets the CPU. If any other
reset function is active at the end of this 4064-cycle delay, the RST
signal remains in the reset condition until the other reset condition(s)
ends.
LPRST input, or the
General Release SpecificationMC68HC05RC16 — Rev. 3.0
48ResetsMOTOROLA
5.5.2 Computer Operating Properly Reset (COPR)
The MCU contains a watchdog timer that automatically times out if not
reset (cleared) within a specific time by a program reset sequence. If the
COP watchdog timer is allowed to time out, an internal reset is
generated to reset the MCU.
The COP reset function is enabled or disabled by a mask option and is
verified during production testing.
5.5.2.1 Resetting the COP
Writing a zero to the COPF bit prevents a COP reset. This action resets
the counter and begins the time-out period again. The COPF bit is bit 0
of address $3FF0. A read of address $3FF0 returns user data
programmed at that location.
Resets
Internal Resets
5.5.2.2 COP During Wait Mode
The COP continues to operate normally during wait mode. The software
should pull the device out of wait mode periodically and reset the COP
by writing to the COPF bit to prevent a COP reset.
5.5.2.3 COP During Stop Mode
When the stop enable mask option is selected, stop mode disables the
oscillator circuit and thereby turns the clock off for the entire device.
When stop is executed, the COP counter will hold its current state. If a
reset is used to exit stop mode, the COP counter is reset and held until
4064 POR cycles are completed at this time, counting will begin. If an
external IRQ is used to exit stop mode, the COP counter does not wait
for the completion of the 4064 POR cycles but does count these cycles.
It is, therefore, recommended that the COP is fed before executing the
STOP instruction.
The COP watchdog timer is active in all modes of operation if enabled
by a mask option. If the COP watchdog timer is selected by a mask
option, any execution of the STOP instruction (either intentionally or
inadvertently due to the CPU being disturbed) causes the oscillator to
halt and prevents the COP watchdog timer from timing out. If the COP
watchdog timer is selected by a mask option, the COP resets the MCU
when it times out. Therefore, it is recommended that the COP watchdog
be disabled for a system that must have intentional uses of the wait
mode for periods longer than the COP time out period.
The recommended interactions and considerations for the COP
watchdog timer, STOP instruction, and WAIT instruction are
summarized in Table 5-1.
Table 5-1. COP Watchdog Timer Recommendations
IF the Following Conditions Exist:
Wait Time
Wait Time Less than COP Time-OutEnable or Disable COP by Mask Option
Wait Time More than COP Time-OutDisable COP by Mask Option
Any Length Wait TimeDisable COP by Mask Option
THEN the COP Watchdog Timer
Should Be as Follows:
General Release SpecificationMC68HC05RC16 — Rev. 3.0
50ResetsMOTOROLA
5.5.2.5 COP Register
Resets
Internal Resets
The COP register is shared with the LSB of an unimplemented user
interrupt vector as shown in Figure 5-3. Reading this location returns
whatever user data has been programmed at this location. Writing a zero
to the COPR bit in this location clears the COP watchdog timer.
Address:$3FF0
BIt 7654321Bit 0
Read:XXXXXXXX
Write:COPR
Reset:———————0
= Unimplemented
Figure 5-3. COP Watchdog Timer Location
5.5.3 Illegal Address
An illegal address reset is generated when the CPU attempts to fetch an
instruction from I/O address space ($0000 to $001F).
The STOP instruction places the MCU in its lowest power-consumption
mode. In stop mode, the internal oscillator is turned off, halting all
internal processing, including timer operation.
During stop mode, the CTCSR ($08) bits are altered to remove any
pending timer interrupt request and to disable any further timer
interrupts. The timer prescaler is cleared. The I bit in the CCR is cleared
to enable external interrupts. All other registers and memory remain
unaltered. All input/output lines remain unchanged.
The EIMSK bit is not cleared automatically by the execution of a STOP
instruction. Care should be taken to clear this bit before entering stop
mode.
The processor can be brought out of stop mode only by an external
interrupt,
LPRST, or RESET. Refer to Figure 6-1.
NOTE:
If an external interrupt is pending when stop mode is entered, then stop
mode will be exited immediately.
6.5 Wait Mode
The WAIT instruction places the MCU in a low power-consumption
mode, but wait mode consumes more power than stop mode. All CPU
action is suspended, but the core timer, the oscillator, and any enabled
module remain active. Any interrupt or reset will cause the MCU to exit
wait mode. The user must shut off subsystems to reduce power
General Release SpecificationMC68HC05RC16 — Rev. 3.0
54Low-Power ModesMOTOROLA
consumption. Wait current specifications assume CPU operation only
and do not include current consumption by any other subsystems.
During wait mode, the I bit in the CCR is cleared to enable interrupts. All
other registers, memory, and input/output lines remain in their previous
states. The timer may be enabled to allow a periodic exit from wait mode.
6.6 Low-Power Reset
Low-power reset mode is entered when a logic 0 is detected on the
LPRST pin. When in this mode (as long asLPRST is held low), the MCU
is held in reset and all internal clocks are halted. Applying a logic 1 to
LPRST will cause the part to exit low-power reset mode and begin
counting out the 4064-cycle oscillator stabilization period. Once this time
has elapsed, the MCU will begin operation from the reset vectors
($3FFE–$3FFF).
In user mode, 20 lines (in 28-pin PDIP or SOIC) or 24 lines (in 44-lead
PLCC) are arranged as three 8-bit I/O ports. These ports are
programmable as either inputs or outputs under software control of the
data direction registers.
To avoid a glitch on the output pins, write data to the I/O port data
register before writing a one to the corresponding data direction register.
Port A is an 8-bit bidirectional port which does not share any of its pins
with other subsystems. The port A data register is at $0000 and the data
direction register (DDR) is at $0004. Reset does not affect the data
register, but clears the data direction register, thereby returning the ports
to inputs. Writing a one to a DDR bit sets the corresponding port bit to
output mode.
Port B is an 8-bit bidirectional port which does not share any of its pins
with other subsystems. The address of the port B data register is $0001
and the data direction register (DDR) is at address $0005. Reset does
not affect the data register, but clears the data direction register, thereby
returning the ports to inputs. Writing a one to a DDR bit sets the
corresponding port bit to output mode. Each of the port B pins has a
mask programmable pullup device that can be enabled. When the pullup
device is enabled, this pin will become an interrupt pin also. The edge or
edge and level sensitivity of the
port B pins. Care needs to be taken when using port B pins that have the
pullup enabled. Before switching from an output to an input, the data
should be preconditioned to a logic one or the I bit should be set in the
condition code register to prevent an interrupt from occurring. The
EIMSK bit in the CMT MCSR register can be used to mask port B
keyscan and external interrupts (IRQ).
IRQ pin also will pertain to the enabled
7.5 Port C
NOTE:
When a port B pin is configured as an output, it’s corresponding keyscan
interrupt is disabled, regardless of it’s mask option.
PB7
V
DD
DISABLED
V
DD
MASK OPTION (PB7PU)
ENABLED
NORMAL PORT CIRCUITRY
AS SHOWN IN FIGURE 7-2
FROM ALL OTHER PORT B PINS
DDR BIT
IRQ
IRQEN
TO INTERRUPT
LOGIC
Figure 7-1. Port B Pullup Option
Port C is an 8-bit bidirectional port (PC0–PC7) which does not share any
of its pins with other subsystems. The port C data register is at $0003
and the data direction register (DDR) is at $0006. Reset does not affect
the data register, but clears the data direction register, thereby returning
General Release SpecificationMC68HC05RC16 — Rev. 3.0
58Parallel Input/Output (I/O)MOTOROLA
Parallel Input/Output (I/O)
Input/Output Programming
the ports to inputs. Writing a one to a DDR bit sets the corresponding
port bit to output mode. Port C pins PC4–PC7 are available only with the
44-lead PLCC package.
NOTE:
Only four bits of port C are bonded out in 28-pin packages for the
MC68HC05RC16, although port C is truly an 8-bit port. Since pins
PC4–PC7 are unbonded, software should include the code to set their
respective data direction register locations to outputs to avoid floating
inputs.
7.6 Input/Output Programming
Port pins may be programmed as inputs or outputs under software
control. The direction of the pins is determined by the state of the
corresponding bit in the port data direction register (DDR). Each I/O port
has an associated DDR. Any I/O port pin is configured as an output if its
corresponding DDR bit is set to a logic 1. A pin is configured as an input
if its corresponding DDR bit is cleared to a logic 0.
At power-on or reset, all DDRs are cleared, which configures all pins as
inputs. The data direction registers are capable of being written to or
read by the processor. During the programmed output state, a read of
the data register actually reads the value of the output data latch and not
the I/O pin.
Table 7-1. I/O Pin Functions
AccessDDRI/O Pin Functions
Write0
Write1
Read0The state of the I/O pin is read.
Read1The I/O pin is in an output mode. The output data latch is read.
The core timer for this device is a 14-stage multifunctional ripple counter.
Features include timer overflow, power-on reset (POR), real-time
interrupt (RTI), and COP watchdog timer.
As seen in Figure 8-1, the internal peripheral clock is divided by four,
and then drives an 8-bit ripple counter. The value of this 8-bit ripple
counter can be read by the CPU at any time by accessing the core timer
counter register (CTCR) at address $09. A timer overflow function is
implemented on the last stage of this counter, giving a possible interrupt
rate of the internal peripheral clock (E)/1024. This point is then followed
by three more stages, with the resulting clock (E/4096) driving the
real-time interrupt circuit (RTI). The RTI circuit consists of three divider
stages with a one-of-four selector. The output of the RTI circuit is further
divided by eight to drive the mask optional COP watchdog timer circuit.
The RTI rate selector bits and the RTI and CTOF enable bits and flags
are located in the timer control and status register at location $08.
General Release SpecificationMC68HC05RC16 — Rev. 3.0
62Core TimerMOTOROLA
8.3 Core Timer Control and Status Register
The CTCSR contains the timer interrupt flag, the timer interrupt enable
bits, and the real-time interrupt rate select bits. Figure 8-2 shows the
value of each bit in the CTCSR when coming out of reset.
Address:$08
Core Timer
Core Timer Control and Status Register
Read:CTOFRTIF
TOFERTIE
Write:TOFCRTFC
Reset:00000011
= Unimplemented
00
RT1RT0
Figure 8-2. Core Timer Control and Status Register (CTCSR)
CTOF — Core Timer Overflow
CTOF is a read-only status bit set when the 8-bit ripple counter rolls
over from $FF to $00. Clearing the CTOF is done by writing a one to
TOFC. Writing to this bit has no effect. Reset clears CTOF.
RTIF — Real-Time Interrupt Flag
The real-time interrupt circuit consists of a 3-stage divider and a
one-of-four selector. The clock frequency that drives the RTI circuit is
12
E/2
(or E ÷ 4096 with three additional divider stages giving a
maximum interrupt period of 16 milliseconds at a bus rate of 2.024
MHz. RTIF is a clearable, read-only status bit and is set when the
output of the chosen (one-of-four selection) stage goes active.
Clearing the RTIF is done by writing a one to RTFC. Writing has no
effect on this bit. Reset clears RTIF.
TOFE — Timer Overflow Enable
When this bit is set, a CPU interrupt request is generated when the
CTOF bit is set. Reset clears this bit.
RTIE — Real-Time Interrupt Enable
When this bit is set, a CPU interrupt request is generated when the
RTIF bit is set. Reset clears this bit.
When a one is written to this bit, CTOF is cleared. Writing a zero has
no effect on the CTOF bit. This bit always reads as zero.
RTFC — Real-Time Interrupt Flag Clear
When a one is written to this bit, RTIF is cleared. Writing a zero has
no effect on the RTIF bit. This bit always reads as zero.
RT1–RT0 — Real-Time Interrupt Rate Select
These two bits select one of four taps from the real-time interrupt
circuit. Refer toTable 8-1. Reset sets these two bits which selects the
lowest periodic rate and gives the maximum time in which to alter
these bits if necessary. Care should be taken when altering RT0 and
RT1 if the timeout period is imminent or uncertain. If the selected tap
is modified during a cycle in which the counter is switching, an RTIF
could be missed or an additional one could be generated. To avoid
problems, the COP should be cleared before changing RTI taps.
Table 8-1. RTI and COP Rates at 4.096 MHz Oscillator
RTI RATE
2.048-MHz Bus
2 ms
4 ms
8 ms
16 ms
212 ÷ E
213 ÷ E
214 ÷ E
215 ÷ E
RT1:RT0
00
01
10
11
MINIMUM COP RATES
2.048-MHz Bus
(215–212)/E
(216–213)/E
(217–214)/E
(218–215)/E
112 ms
14 ms
28 ms
56 ms
General Release SpecificationMC68HC05RC16 — Rev. 3.0
64Core TimerMOTOROLA
8.4 Core Timer Counter Register
The timer counter register is a read-only register that contains the
current value of the 8-bit ripple counter at the beginning of the timer
chain. This counter is clocked by the CPU clock (E/4) and can be used
for various functions, including a software input capture. Extended time
periods can be attained using the TOF function to increment a temporary
RAM storage location, thereby simulating a 16-bit (or more) counter.
Address:$09
Read:D7D6D5D4D3D2D1D0
Write:
Reset:00000011
= Unimplemented
Core Timer
Core Timer Counter Register
Figure 8-3. Core Timer Counter Register (CTCR)
The power-on cycle clears the entire counter chain and begins clocking
the counter. After 4064 cycles, the power-on reset circuit is released,
which again clears the counter chain and allows the device to come out
of reset. At this point, if
up from zero and normal device operation begins. When
RESET is not asserted, the timer starts counting
RESET is
asserted any time during operation (other than POR and low-power
reset), the counter chain is cleared.
The COP watchdog timer function is implemented on this device by
using the output of the RTI circuit and further dividing it by eight. The
minimum COP reset rates are listed inTable 8-1. If the COP circuit times
out, an internal reset is generated and the normal reset vector is fetched.
Preventing a COP timeout, or clearing the COP is accomplished by
writing a zero to bit 0 of address $3FF0. When the COP is cleared, only
the final divide-by-eight stage (output of the RTI) is cleared.
If the COP watchdog timer is allowed to time out, an internal reset is
generated to reset the MCU.
The COP remains enabled after execution of the WAIT instruction and
all associated operations apply. If the STOP instruction is disabled,
execution of STOP instruction causes the CPU to execute a WAIT
instruction. In addition, the COP is prohibited from being held in reset.
This prevents a device lock-up condition.
This COP’s objective is to make it impossible for this device to become
stuck or locked-up and to be sure the COP is able to rescue the part from
any situation where it might entrap itself in abnormal or unintended
behavior. This function is a mask option.
8.6 Timer During Wait Mode
The CPU clock halts during wait mode, but the timer remains active. If
interrupts are enabled, a timer interrupt will cause the processor to exit
wait mode. The COP is always enabled while in user mode.
General Release SpecificationMC68HC05RC16 — Rev. 3.0
66Core TimerMOTOROLA
The carrier modulator transmitter (CMT) module provides a means to
generate the protocol timing and carrier signals for a wide variety of
encoding schemes. It incorporates hardware to off-load the critical
and/or lengthy timing requirements associated with code generation
from the CPU, releasing much of its bandwidth to handle other tasks
such as code data generation, data decompression, or keyboard
scanning. The CMT does not include dedicated hardware configurations
for specific protocols, but is intended to be sufficiently programmable in
its function to handle the timing requirements of most protocols with
minimal CPU intervention. When disabled, certain CMT registers can be
used to change the state of the infrared out pin (IRO) directly. This
feature allows for the generation of future protocols not readily
producible by the current architecture.
9.3 Overview
The module consists of carrier generator, modulator, and transmitter
output blocks. The block diagram is shown in Figure 9-1.
The carrier generator has a resolution of 500 ns with a 2-MHz oscillator.
The user may independently define the high and low times of the carrier
signal to determine both period and duty cycle. The carrier generator can
generate signals with periods between 1 µs (1 MHz) and 64 µs (15.6
kHz) in steps of 500 ns. The possible duty cycle options will depend
upon the number of counts required to complete the carrier period. For
example, a 400-kHz signal has a period of 2.5 µs and will therefore
require 5 x 500 ns counts to generate. These counts may be split
between high and low times so the duty cycles available will be 20% (one
high, four low), 40% (two high, three low), 60% (three high, two low) and
80% (four high, one low). For lower frequency signals with larger
periods, higher resolution (as a percentage of the total period) duty
cycles are possible. The carrier generator may select between two sets
of high and low times. When operating in normal mode (subsequently
referred to as time mode), just one set will be used. When operating in
FSK (frequency shift key) mode, the generator will toggle between the
two sets when instructed to do so by the modulator, allowing the user to
dynamically switch between two carrier frequencies without CPU
intervention. When the BASE bit in the modulator control and status
register (MCSR) is set, the carrier output to the modulator is held high
continuously to allow for the generation of baseband protocols. See 9.4
Carrier Generator.
General Release SpecificationMC68HC05RC16 — Rev. 3.0
68Carrier Modulator Transmitter (CMT)MOTOROLA
The modulator provides a simple method to control protocol timing. The
modulator has a resolution of 4 µs with a 2-MHz oscillator. It can count
system clocks to provide real-time control or it can count carrier clocks
for self-clocked protocols. It can either gate the carrier onto the
modulator output (TIME), control the logic level of the modulator output
(baseband) or directly route the carrier to the modulator output while
providing a signal to switch the carrier generator between high/low time
register buffers (FSK). See 9.5 Modulator.
IRO
PIN
The transmitter output block controls the state of the infrared out pin
(IRO). The modulator output is gated on to the IRO pin when the
modulator/carrier generator is enabled. Otherwise, the IRO pin is
controlled by the state of the IRO latch, which is directly accessible to the
CPU by means of bit 7 of the carrier generator data registers CHR1 and
CLR1. The IRO latch can be written to on either edge of the internal bus
clock (f
the bus clock frequency (f
/2), allowing for IR waveforms which have a resolution of twice
The carrier signal is generated by counting a predetermined number of
input clocks (500 ns for a 2-MHz oscillator) for both the carrier high time
and the carrier low time. The period is determined by the total number of
clocks counted. The duty cycle is determined by the ratio of high time
clocks to total clocks counted. The high and low time values are user
programmable and are held in two registers. An alternate set of high/low
count values is held in another set of registers to allow the generation of
dual frequency FSK (frequency shift keying) protocols without CPU
intervention. The MCGEN bit in the MCSR must be set and the BASE bit
in the MCSR must be cleared to enable carrier generator clocks. The
block diagram is shown in Figure 9-2.
f
OSC
BASE
MODULATOR/
CARRIER GENERATOR
ENABLE
CARRIER OUT
SECONDARY HIGH COUNT REGISTER
PRIMARY HIGH COUNT REGISTER
=?
CLK
6-BIT UP COUNTER
CLR
CLOCK AND OUTPUT CONTROL
=?
SECONDARY LOW COUNT REGISTER
PRIMARY LOW COUNT REGISTER
Figure 9-2. Carrier Generator Block Diagram
MODE
PRIMARY/
SECONDARY
SELECT
COUNT REGISTER SELECT CONTROL
General Release SpecificationMC68HC05RC16 — Rev. 3.0
70Carrier Modulator Transmitter (CMT)MOTOROLA
9.4.1 Time Counter
Carrier Modulator Transmitter (CMT)
Carrier Generator
The high/low time counter is a 6-bit up counter. After each increment, the
contents of the counter are compared with the appropriate high or low
count value register. When this value is reached, the counter is reset and
the compare is redirected to the other count value register. Assuming
that the high time count compare register is currently active, a valid
compare will cause the carrier output to be driven low. The counter will
continue to increment and when reaching the value stored in the
selected low count value register, it will be cleared and will cause the
carrier output to be driven high. The cycle repeats, automatically
generating a periodic signal which is directed to the modulator. The
lowest frequency (maximum period) and highest frequency (minimum
period) which can be generated are defined below.
f
min
= f
÷ (2 x (26 – 1)) Hz
osc
NOTE:
f
max
= f
÷ (2 x 1) Hz
osc
In the general case, the carrier generator output frequency is:
f
out
= f
÷ (Highcount + Lowcount) Hz
osc
Where:
0 <
Highcount
0 <
Lowcount
< 64 and
< 64
These equations assume the DIV2 bit (bit 6) of the MCSR is clear. When
the DIV2 bit is set, the carrier generator frequency will be half of what is
shown in these equations.
The duty cycle of the carrier signal is controlled by varying the ratio of
high time to low + high time. As the input clock period is fixed, the duty
cycle resolution will be proportional to the number of counts required to
generate the desired carrier period.
9.4.2 Carrier Generator Data Registers (CHR1, CLR1, CHR2, and CLR2)
The carrier generator contains two, 7-bit data registers: primary high
time (CHR1), primary low time (CLR1); and two, 6-bit data registers:
secondary high time (CHR2) and secondary low time (CLR2). Bit 7 of
CHR1 and CHR2 is used to read and write the IRO latch.
Address:$0010
Bit 7654321Bit 0
Read:
IROLN0PH5PH4PH3PH2PH1PH0
Write:
Reset:00UUUUUU
U = Unaffected
Figure 9-3. Carrier Generator Data Register CHR1
Address:$0011
Bit 7654321Bit 0
Read:
IROLP0PL5PL4PL3PL2PL1PL0
Write:
Reset:00UUUUUU
U = Unaffected
Figure 9-4. Carrier Generator Data Register CLR1
Address:$0012
Bit 7654321Bit 0
Read:
00SH5SH4SH3SH2SH1SH0
Write:
Reset:00UUUUUU
U = Unaffected
Figure 9-5. Carrier Generator Data Register CHR2
General Release SpecificationMC68HC05RC16 — Rev. 3.0
72Carrier Modulator Transmitter (CMT)MOTOROLA
Carrier Modulator Transmitter (CMT)
Carrier Generator
Address:$0013
Bit 7654321Bit 0
Read:
00SL5SL4SL3SL2SL1SL0
Write:
Reset:00UUUUUU
U = Unaffected
Figure 9-6. Carrier Generator Data Register CLR2
PH0–PH5 and PL0–PL5 — Primary Carrier High and Low Time Data
Values
When selected, these bits contain the number of input clocks required
to generate the carrier high and low time periods. When operating in
time mode (see 9.5.1 Time Mode), this register pair is always
selected. When operating in FSK mode (see 9.5.2 FSK Mode), this
register pair and the secondary register pair are alternately selected
under control of the modulator. The primary carrier high and low time
values are undefined out of reset. These bits must be written to
nonzero values before the carrier generator is enabled to avoid
spurious results.
NOTE:
Writing to CHR1 to update PH0–PH5 or to CLR1 to update PL0–PL5 will
also update the IRO latch. When MCGEN (bit 0 in the MCSR) is clear,
the IRO latch value appears on the IRO output pin. Care should be taken
that bit 7 of the data to be written to CHR1 or CHL1 should contain the
desired state of the IRO latch.
SH0–SH5 and SL0–SL5 — Secondary Carrier High and Low Time Data
Values
When selected, these bits contain the number of input clocks required
to generate the carrier high and low time periods. When operating in
time mode (see9.5.1 Time Mode), this register pair is never selected.
When operating in FSK mode (see9.5.2 FSK Mode), this register pair
and the secondary register pair are alternately selected under control
of the modulator. The secondary carrier high and low time values are
undefined out of reset. These bits must be written to nonzero values
before the carrier generator is enabled when operating in FSK mode.
IROLN and IROLP — IRO Latch Control
Reading IROLN or IROLP reads the state of the IRO latch. Writing
IROLN updates the IRO latch with the data being written on the
negative edge of the internal processor clock (f
updates the IRO latch on the positive edge of the internal processor
clock; for example, one f
reset.
/2). Writing IROLP
osc
period later. The IRO latch is clear out of
osc
NOTE:
9.5 Modulator
Writing to CHR1 to update IROLN or to CLR1 to update IROLP will also
update the primary carrier high and low data values. Care should be
taken that bits 5–0 of the data to be written to CHR1 or CHL1 should
contain the desired values for the primary carrier high or low data.
The modulator consists of a 12-bit down counter with underflow
detection which is loaded from the modulation mark period from the
mark buffer register, MBUFF. When this counter underflows, the
modulator gate is closed and a 12-bit comparator is enabled which
continually compares the logical complement of the contents of the (still)
decrementing counter with the contents of the modulation space period
register, SREG. When a match is obtained, the modulator control gate
is opened again. Should SREG = 0, the match will be immediate and no
space period will be generated (for instance, for FSK protocols which
require successive bursts of different frequencies). When the match
occurs, the counter is reloaded with the contents of MBUFF, SREG is
reloaded with the contents of its buffer, SBUFF, and the cycle repeats.
The MCGEN bit in the MCSR must be set to enable the modulator timer.
The 12-bit MBUFF and SBUFF registers are accessed through three
8-bit modulator period registers, MDR1, MDR2, and MDR3.
General Release SpecificationMC68HC05RC16 — Rev. 3.0
74Carrier Modulator Transmitter (CMT)MOTOROLA
Carrier Modulator Transmitter (CMT)
Modulator
The modulator can operate in two modes, time or FSK. In time mode the
modulator counts clocks derived from the system oscillator and
modulates a single-carrier frequency or no carrier (baseband). In FSK
mode, the modulator counts carrier periods and instructs the carrier
generator to alternate between two carrier frequencies whenever a
modulation period (mark + space counts) expires.
When the modulator operates in time mode, the modulation mark and
space periods consist of zero or an integer number of f
(= 250 kHz @ 2 MHz osc). This provides a modulator resolution of 4 µs
and a maximum mark and space periods of about 16 ms (each).
However, to prevent carrier glitches which could affect carrier spectral
purity, the modulator control gate and carrier clock are synchronized.
The carrier signal is activated when the modulator gate opens. The
modulator gate can only close when the carrier signal is low (the output
logic level during space periods is low). If the carrier generator is in
baseband mode (BASE bit in MCSR is high), the modulator output will
be at a logic one for the duration of the mark period and at a logic zero
for the duration of a space period. See Figure 9-8.
The mark and space time equations are:
÷ 8 clocks
osc
t
mark
t
space
MBUFF1+()8×
--------------------------------------------- -ssec=
f
osc
SBUFF8×
------------------------------ssec=
f
osc
Setting the DIV2 bit in the MCSR will double mark and space times.
General Release SpecificationMC68HC05RC16 — Rev. 3.0
76Carrier Modulator Transmitter (CMT)MOTOROLA
f
÷ 8
OSC
CARRIER FREQUENCY
Carrier Modulator Transmitter (CMT)
Modulator
MODULATOR GATE
TIME MODE OUTPUT
BASEBAND OUTPUT
9.5.2 FSK Mode
MARKSPACEMARKMARKSPACE
Figure 9-8. CMT Operation in Time Mode
When the modulator operates in FSK mode, the modulation mark and
space periods consist of an integer number of carrier clocks (space
period can be zero). When the mark period expires, the space period is
transparently started (as in time mode); however, in FSK mode the
carrier switches between data registers in preparation for the next mark
period. The carrier generator toggles between primary and secondary
data register values whenever the modulator mark period expires. The
space period provides an interpulse gap (no carrier), but if SBUFF = 0,
then the modulator and carrier generator will switch between carrier
frequencies without a gap or any carrier glitches (zero space).
Using timing data for carrier burst and interpulse gap length calculated
by the CPU, FSK mode can automatically generate a phase-coherent,
dual-frequency FSK signal with programmable burst and interburst
gaps.
The mark and space time equations for FSK mode are:
Where f
is the frequency output from the carrier generator, setting the
cg
DIV2 bit in the MCSR will double mark and space times.
9.5.3 Extended Space Operation
In either time or FSK mode, the space period can be made longer than
the maximum possible value of SBUFF. Setting the EXSPC bit in the
MCSR will force the modulator to treat the next modulation period
(beginning with the next load of MBUFF/SBUFF) as a space period
equal in length to the mark and space counts combined. Subsequent
modulation periods will consist entirely of these extended space periods
with no mark periods. Clearing EXSPC will return the modulator to
standard operation at the beginning of the next modulation period. To
calculate the length of an extended space in time mode, use the
equation:
t
mark
t
space
MBUFF1+
-------------------------------ssec=
f
g
c
SBUFF
-------------------- -ssec=
f
cg
t
exspace
((SBUFF1)+(MBUFF2+1+SBUFF2) +... (MBUFFn+1+SBUFFn)) x 8
=
f
osc
secs
Where:
the subscripts 1, 2, ... n refer to the modulation periods that elapsed
while the EXSPC bit was set.
Similarly, to calculate the length of an extended space in FSK mode, use
the equation:
t
exspace
General Release SpecificationMC68HC05RC16 — Rev. 3.0
78Carrier Modulator Transmitter (CMT)MOTOROLA
Where fcg is the frequency output from the carrier generator. For an
example of extended space operation, see Figure 9-9.
NOTE:
The EXSPC feature can be used to emulate a zero mark event.
SET EXSPC
9.5.3.1 End Of Cycle (EOC) Interrupt
At the end of each cycle (when the counter is reloaded from MBUFF),
the end of cycle (EOC) flag is set. If the interrupt enable bit was
previously set, an interrupt also will be issued to the CPU. The EOC
interrupt provides a means for the user to reload new mark/space values
into the MBUFF and SBUFF registers. As the EOC interrupt is coincident
with reloading the counter, MBUFF does not require additional buffering
and may be updated with a new value for the next period from within the
EOC interrupt service routine (ISR). To allow both mark and space
period values to be updated from within the same ISR, SREG is buffered
by SBUFF. The contents written to SBUFF are transferred to the active
register SREG at the end of every cycle regardless of the state of the
EOC flag. The EOC flag is cleared by a read of the modulator control and
status register (MCSR) followed by an access of MDR2 or MDR3. The
EOC flag must be cleared within the ISR to prevent another interrupt
being generated after exiting the ISR. If the EOC interrupt is not being
used (IE = 0), the EOC flag need not be cleared.
The modulator control and status register (MCSR) contains the
modulator and carrier generator enable (MCGEN), interrupt enable (IE),
mode select (MODE), baseband enable (BASE), extended space
(EXSPC), and external interrupt mask (EIMSK) control bits,
divide-by-two prescaler (DIV2) bit, and the end of cycle (EOC) status
bit.
Address:$0014
Bit 7654321Bit 0
Read:EOC
DIV2EIMSKEXSPCBASEMODEIEMCGEN
Write:
Reset:00000000
Unimplemented
Figure 9-10. Modulator Control and Status Register (MCSR)
EOC — End Of Cycle Status Flag
EOC is set when a match occurs between the contents of the space
period register, SREG, and the down counter. This is recognized as
the end of the modulation cycle. At this time, the counter is initialized
with the (possibly new) contents of the mark period buffer, MBUFF,
and the space period register, SREG, is loaded with the (possibly
new) contents of the space period buffer, SBUFF. This flag is cleared
by a read of the MCSR followed by an access of MDR2 or MDR3. The
EOC flag is cleared by reset.
1 = End of modulator cycle (counter = SBUFF) has occurred
0 = Current modulation cycle in progress
DIV2 — Divide-by-two prescaler
The divide-by-two prescaler causes the CMT to be clocked at the bus
rate when enabled; 2 x the bus rate when disabled (f
). This bit is
osc
not double buffered and so should not be set during a transmission.
General Release SpecificationMC68HC05RC16 — Rev. 3.0
80Carrier Modulator Transmitter (CMT)MOTOROLA
Carrier Modulator Transmitter (CMT)
Modulator
EIMSK — External Interrupt Mask
The external interrupt mask bit is used to mask IRQ and keyscan
interrupts. This bit is cleared by reset.
1 = IRQ and keyscan interrupts masked
0 = IRQ and keyscan interrupts enabled
EXSPC — Extended Space Enable
For a description of the extended space enable bit, see 9.5.3
Extended Space Operation. This bit is cleared by reset.
1 = Extended space enabled
0 = Extended space disabled
BASE — Baseband Enable
When set, the BASE bit disables the carrier generator and forces the
carrier output high for generation of baseband protocols. When BASE
is clear, the carrier generator is enabled and the carrier output toggles
at the frequency determined by values stored in the carrier data
registers. See 9.5.1 Time Mode. This bit is cleared by reset. This bit
is not double buffered and should not be written to during a
transmission.
1 = Baseband enabled
0 = Baseband disabled
MODE — Mode Select
For a description of CMT operation in time mode, see 9.5.1 Time
Mode. For a description of CMT operation in FSK mode, see 9.5.2
FSK Mode. This bit is cleared by reset. This bit is not double buffered
and should not be written to during a transmission.
1 = CMT operates in FSK mode.
0 = CMT operates in time mode.
IE — Interrupt Enable
A CPU interrupt will be requested when EOC is set if IE was
previously set. If IE is clear, EOC will not request a CPU interrupt.
1 = CPU interrupt enabled
0 = CPU interrupt disabled
Setting MCGEN will initialize the carrier generator and modulator and
will enable all clocks. Once enabled, the carrier generator and
modulator will function continuously. When MCGEN is cleared, the
current modulator cycle will be allowed to expire before all carrier and
modulator clocks are disabled (to save power) and the modulator
output is forced low. The user should initialize all data and control
registers before enabling the system to prevent spurious operation.
This bit is cleared by reset.
1 = Modulator and carrier generator enabled
0 = Modulator and carrier generator disabled
General Release SpecificationMC68HC05RC16 — Rev. 3.0
82Carrier Modulator Transmitter (CMT)MOTOROLA
Carrier Modulator Transmitter (CMT)
9.5.4 Modulator Period Data Registers (MDR1, MDR2, and MDR3)
The 12-bit MBUFF and SBUFF registers are accessed through three
8-bit registers: MDR1, MDR2, and MDR3. MDR2 and MDR3 contain the
least significant eight bits of MBUFF and SBUFF respectively. MDR1
contains the two most significant nibbles of MBUFF and SBUFF. In
many applications, periods greater than those obtained by eight bits will
not be required. Dividing the registers in this manner allows the user to
clear MDR1 and generate 8-bit periods with just two data writes.
The MCU instruction set has 62 instructions and uses eight addressing
modes. The instructions include all those of the M146805 CMOS Family
plus one more: the unsigned multiply (MUL) instruction. The MUL
instruction allows unsigned multiplication of the contents of the
accumulator (A) and the index register (X). The high-order product is
stored in the index register, and the low-order product is stored in the
accumulator.
10.3 Addressing Modes
The CPU uses eight addressing modes for flexibility in accessing data.
The addressing modes provide eight different ways for the CPU to find
the data required to execute an instruction. The eight addressing modes
are:
•Inherent
•Immediate
•Direct
•Extended
•Indexed, no offset
•Indexed, 8-bit offset
•Indexed, 16-bit offset
•Relative
General Release SpecificationMC68HC05RC16 — Rev. 3.0
86Instruction SetMOTOROLA
10.3.1 Inherent
10.3.2 Immediate
Instruction Set
Addressing Modes
Inherent instructions are those that have no operand, such as return
from interrupt (RTI) and stop (STOP). Some of the inherent instructions
act on data in the CPU registers, such as set carry flag (SEC) and
increment accumulator (INCA). Inherent instructions require no operand
address and are one byte long.
Immediate instructions are those that contain a value to be used in an
operation with the value in the accumulator or index register. Immediate
instructions require no operand address and are two bytes long. The
opcode is the first byte, and the immediate data value is the second byte.
10.3.3 Direct
10.3.4 Extended
Direct instructions can access any of the first 256 memory locations with
two bytes. The first byte is the opcode, and the second is the low byte of
the operand address. In direct addressing, the CPU automatically uses
$00 as the high byte of the operand address.
Extended instructions use three bytes and can access any address in
memory. The first byte is the opcode; the second and third bytes are the
high and low bytes of the operand address.
When using the Motorola assembler, the programmer does not need to
specify whether an instruction is direct or extended. The assembler
automatically selects the shortest form of the instruction.
Indexed instructions with no offset are 1-byte instructions that can
access data with variable addresses within the first 256 memory
locations. The index register contains the low byte of the effective
address of the operand. The CPU automatically uses $00 as the high
byte, so these instructions can address locations $0000–$00FF.
Indexed, no offset instructions are often used to move a pointer through
a table or to hold the address of a frequently used RAM or I/O location.
10.3.6 Indexed, 8-Bit Offset
Indexed, 8-bit offset instructions are 2-byte instructions that can access
data with variable addresses within the first 511 memory locations. The
CPU adds the unsigned byte in the index register to the unsigned byte
following the opcode. The sum is the effective address of the operand.
These instructions can access locations $0000–$01FE.
Indexed 8-bit offset instructions are useful for selecting the kth element
in an n-element table. The table can begin anywhere within the first 256
memory locations and could extend as far as location 510 ($01FE). The
k value is typically in the index register, and the address of the beginning
of the table is in the byte following the opcode.
10.3.7 Indexed,16-Bit Offset
Indexed, 16-bit offset instructions are 3-byte instructions that can access
data with variable addresses at any location in memory. The CPU adds
the unsigned byte in the index register to the two unsigned bytes
following the opcode. The sum is the effective address of the operand.
The first byte after the opcode is the high byte of the 16-bit offset; the
second byte is the low byte of the offset.
Indexed, 16-bit offset instructions are useful for selecting the kth element
in an n-element table anywhere in memory.
As with direct and extended addressing, the Motorola assembler
determines the shortest form of indexed addressing.
General Release SpecificationMC68HC05RC16 — Rev. 3.0
88Instruction SetMOTOROLA
10.3.8 Relative
Relative addressing is only for branch instructions. If the branch
condition is true, the CPU finds the effective branch destination by
adding the signed byte following the opcode to the contents of the
program counter. If the branch condition is not true, the CPU goes to the
next instruction. The offset is a signed, two’s complement byte that gives
a branching range of –128 to +127 bytes from the address of the next
location after the branch instruction.
When using the Motorola assembler, the programmer does not need to
calculate the offset, because the assembler determines the proper offset
and verifies that it is within the span of the branch.
10.4 Instruction Types
Instruction Set
Instruction Types
The MCU instructions fall into the following five categories:
These instructions operate on CPU registers and memory locations.
Most of them use two operands. One operand is in either the
accumulator or the index register. The CPU finds the other operand in
memory.
Table 10-1. Register/Memory Instructions
Add Memory Byte and Carry Bit to AccumulatorADC
Add Memory Byte to AccumulatorADD
AND Memory Byte with AccumulatorAND
Bit Test AccumulatorBIT
Compare AccumulatorCMP
Compare Index Register with Memory ByteCPX
InstructionMnemonic
EXCLUSIVE OR Accumulator with Memory ByteEOR
Load Accumulator with Memory ByteLDA
Load Index Register with Memory ByteLDX
MultiplyMUL
OR Accumulator with Memory ByteORA
Subtract Memory Byte and Carry Bit from AccumulatorSBC
Store Accumulator in MemorySTA
Store Index Register in MemorySTX
Subtract Memory Byte from AccumulatorSUB
General Release SpecificationMC68HC05RC16 — Rev. 3.0
90Instruction SetMOTOROLA
10.4.2 Read-Modify-Write Instructions
These instructions read a memory location or a register, modify its
contents, and write the modified value back to the memory location or to
the register.
Instruction Set
Instruction Types
NOTE:
Do not use read-modify-write operations on write-only registers.
Table 10-2. Read-Modify-Write Instructions
InstructionMnemonic
Arithmetic Shift Left (Same as LSL)ASL
Arithmetic Shift RightASR
Bit ClearBCLR
Bit SetBSET
Clear RegisterCLR
Complement (One’s Complement)COM
DecrementDEC
IncrementINC
Logical Shift Left (Same as ASL)LSL
Logical Shift RightLSR
Negate (Two’s Complement)NEG
(1)
(1)
Rotate Left through Carry BitROL
Rotate Right through Carry BitROR
Test for Negative or ZeroTST
1. Unlike other read-modify-write instructions, BCLR and
BSET use only direct addressing.
2. TST is an exception to the read-modify-write sequence
because it does not write a replacement value.
Jump instructions allow the CPU to interrupt the normal sequence of the
program counter. The unconditional jump instruction (JMP) and the
jump-to-subroutine instruction (JSR) have no register operand. Branch
instructions allow the CPU to interrupt the normal sequence of the
program counter when a test condition is met. If the test condition is not
met, the branch is not performed.
The BRCLR and BRSET instructions cause a branch based on the state
of any readable bit in the first 256 memory locations. These 3-byte
instructions use a combination of direct addressing and relative
addressing. The direct address of the byte to be tested is in the byte
following the opcode. The third byte is the signed offset byte. The CPU
finds the effective branch destination by adding the third byte to the
program counter if the specified bit tests true. The bit to be tested and its
condition (set or clear) is part of the opcode. The span of branching is
from –128 to +127 from the address of the next location after the branch
instruction. The CPU also transfers the tested bit to the carry/borrow bit
of the condition code register.
General Release SpecificationMC68HC05RC16 — Rev. 3.0
92Instruction SetMOTOROLA
Table 10-3. Jump and Branch Instructions
InstructionMnemonic
Branch if Carry Bit ClearBCC
Branch if Carry Bit SetBCS
Branch if EqualBEQ
Branch if Half-Carry Bit ClearBHCC
Branch if Half-Carry Bit SetBHCS
Branch if HigherBHI
Branch if Higher or SameBHS
Branch if IRQ Pin HighBIH
Branch if IRQ Pin LowBIL
Branch if LowerBLO
Branch if Lower or SameBLS
Instruction Set
Instruction Types
Branch if Interrupt Mask ClearBMC
Branch if MinusBMI
Branch if Interrupt Mask SetBMS
Branch if Not EqualBNE
Branch if PlusBPL
Branch AlwaysBRA
Branch if Bit ClearBRCLR
Branch NeverBRN
Branch if Bit SetBRSET
Branch to SubroutineBSR
Unconditional JumpJMP
Jump to SubroutineJSR
The CPU can set or clear any writable bit in the first 256 bytes of
memory, which includes I/O registers and on-chip RAM locations. The
CPU can also test and branch based on the state of any bit in any of the
first 256 memory locations.
Table 10-4. Bit Manipulation Instructions
InstructionMnemonic
Bit ClearBCLR
Branch if Bit ClearBRCLR
Branch if Bit SetBRSET
Bit SetBSET
General Release SpecificationMC68HC05RC16 — Rev. 3.0
94Instruction SetMOTOROLA
10.4.5 Control Instructions
These instructions act on CPU registers and control CPU operation
during program execution.
Instruction Set
Instruction Types
Table 10-5. Control Instructions
InstructionMnemonic
Clear Carry BitCLC
Clear Interrupt MaskCLI
No OperationNOP
Reset Stack PointerRSP
Return from InterruptRTI
Return from SubroutineRTS
Set Carry BitSEC
Set Interrupt MaskSEI
Stop Oscillator and Enable IRQ PinSTOP
Software InterruptSWI
Transfer Accumulator to Index RegisterTAX
Transfer Index Register to AccumulatorTXA
Stop CPU Clock and Enable Interrupts
Branch if Carry Bit Set (Same as BLO)PC ← (PC) + 2 +
Branch if EqualPC ← (PC) + 2 +
Branch if Half-Carry Bit ClearPC ← (PC) + 2 +
Branch if Half-Carry Bit SetPC ← (PC) + 2 +
Branch if HigherPC ← (PC) + 2 +
Branch if Higher or SamePC ← (PC) + 2 +
OperationDescription
C
Effect on
CCR
HINZC
0
b7
b7
b0
C
b0
rel
? C = 0————— REL24 rr 3
rel
? C = 1————— REL25 rr 3
rel
? Z = 1————— REL27 rr 3
rel
? H = 0————— REL28 rr 3
rel
? H = 1————— REL29 rr 3
rel
? C ∨ Z = 0 ————— REL22 rr 3
rel
? C = 0————— REL24 rr 3
Address
IMM
DIR
EXT
IX2
IX1
IX
IMM
DIR
EXT
IX2
IX1
IX
IMM
DIR
EXT
IX2
IX1
IX
DIR
INH
INH
IX1
IX
DIR
INH
INH
IX1
IX
DIR (b0)
DIR (b1)
DIR (b2)
DIR (b3)
DIR (b4)
DIR (b5)
DIR (b6)
DIR (b7)
Mode
A9
B9
C9
D9
E9
F9
AB
BB
CB
DB
EB
FB
A4
B4
C4
D4
E4
F4
38
48
58
68
78
37
47
57
67
77
11
13
15
17
19
1B
1D
1F
Opcode
Operand
ii
dd
hh ll
ee ff
ff
ii
dd
hh ll
ee ff
ff
ii
dd
hh ll
ee ff
ff
dd
ff
dd
ff
dd
dd
dd
dd
dd
dd
dd
dd
Cycles
2
3
4
5
4
3
2
3
4
5
4
3
2
3
4
5
4
3
5
3
3
6
5
5
3
3
6
5
5
5
5
5
5
5
5
5
General Release SpecificationMC68HC05RC16 — Rev. 3.0
96Instruction SetMOTOROLA