Microcontroller Unit Guide
Microcontroller Unit Guide
HC05M68HC
MC68HC705P6A/D
REV 2
68HC05M6
MC68HC705P6A
Advance Information
HCMOS
Microcontroller Unit
blank
MC68HC705P6A
Advance Information
Motorola reserves the right to make changes without further notice to any products
herein. Motorola makes no warranty, representation or guarantee regarding the
suitability of its products for any particular purpose, nor does Motorola assume any
liability arising out of the application or use of any product or circuit, and specifically
disclaims any and all liability, including without limitation consequential or incidental
damages. "Typical" parameters which may be provided in Motorola data sheets and/or
specifications can and do vary in different applications and actual performance may
vary over time. All operating parameters, including "Typicals" must be vali1dated for
each customer application by customer’s technical experts. Motorola does not convey
any license under its patent rights nor the rights of others. Motorola products are not
designed, intended, or authorized for use as components in systems intended for
surgical implant into the body, or other applications intended to support or sustain life,
or for any other application in which the failure of the Motorola product could create a
situation where personal injury or death may occur. Should Buyer purchase or use
Motorola products for any such unintended or unauthorized application, Buyer shall
indemnify and hold Motorola and its officers, employees, subsidiaries, affiliates, and
distributors harmless against all claims, costs, damages, and expenses, and
reasonable attorney fees arising out of, directly or indirectly, any claim of personal
injury or death associated with such unintended or unauthorized use, even if such claim
alleges that Motorola was negligent regarding the design or manufacture of the part.
Motorola, Inc. is an Equal Opportunity/Affirmative Action Employer.
MOTOROLA 3
Advance Information
Revision History
Revision Page
Date Description
Level Number(s)
4 MOTOROLA
Advance Information — MC68HC705P6A
List of Sections
Section 2. Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Section 4. Resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Section 5. Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Table of Contents
1.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Section 2. Memory
2.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.6 RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Section 4. Resets
4.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Section 5. Interrupts
5.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.3 Port A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.4 Port B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.5 Port C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.6 Port D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
7.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
10.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
11.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
12.3 Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
12.3.1 Accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
12.3.2 Index Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
12.3.3 Stack Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
12.3.4 Program Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97
12.3.5 Condition Code Register . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
List of Figures
List of Tables
1.1 Contents
1.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.2 Introduction
The MC68HC705P6A is an EPROM version of the MC68HC05P6
microcontroller. It is a low-cost combination of an M68HC05 Family
microprocessor with a 4-channel, 8-bit analog-to-digital (A/D) converter,
a 16-bit timer with output compare and input capture, a serial
communications port (SIOP), and a computer operating properly (COP)
watchdog timer. The M68HC05 CPU core contains 176 bytes of RAM,
4672 bytes of user EPROM, 239 bytes of bootloader ROM, and 21
input/output (I/O) pins (20 bidirectional, 1 input-only). This device is
1.3 Features
Features of the MC68HC705P6A include:
• Low cost
• M68HC05 core
• 28-pin SOIC, PDIP, or windowed DIP package
• 4672 bytes of user EPROM (including 48 bytes of page zero
EPROM and 16 bytes of user vectors)
• 239 bytes of bootloader ROM
• 176 bytes of on-chip RAM
• 4-channel 8-bit A/D converter
• SIOP serial communications port
• 16-bit timer with output compare and input capture
• 20 bidirectional I/O lines and 1 input-only line
• PC0 and PC1 high-current outputs
• Single-chip, bootloader, and test modes
• Power-saving stop, halt, and wait modes
• Static EPROM mask option register (MOR) selectable options:
– COP watchdog timer enable or disable
– Edge-sensitive or edge- and level-sensitive external interrupt
– SIOP most significant bit (MSB) or least significant bit (LSB)
first
– SIOP clock rates: OSC divided by 8, 16, 32, or 64
– Stop instruction mode, STOP or HALT
– EPROM security external lockout
– Programmable keyscan (pullups/interrupts) on PA0–PA7
INTERNAL
COP CPU CLOCK OSC 1
÷2 OSC
OSC 2
A/ D CONVERTER
INDEX REG
MUX
0 0 0 0 0 0 0 0 1 1 STK PNTR PC5/AD1
PORT C
PC4/AD2
PROGRAM COUNTER
PC3/AD3
COND CODE REG 1 1 1H I NZC PC2
PC1
PC0
SRAM — 176 BYTES
PA7
PA6
PORT A
PA4
BOOTLOADER ROM — 239 BYTES
PA3
PA2
PB5/SDO PORT B AND PA1
SIOP
PB6/SDI PA0
REGISTERS
PB7/SCK AND LOGIC VDD
VSS
NOTE: A line over a signal name indicates an active low signal. For example,
RESET is active high and RESET is active low.
Power is supplied to the MCU through VDD and VSS. VDD is connected
to a regulated +5 volt supply and VSS is connected to ground.
Very fast signal transitions occur on the MCU pins. The short rise and fall
times place very high short-duration current demands on the power
supply. To prevent noise problems, take special care to provide good
power supply bypassing at the MCU. Use bypass capacitors with good
high-frequency characteristics and position them as close to the MCU as
possible. Bypassing requirements vary, depending on how heavily the
MCU pins are loaded.
The OSC1 and OSC2 pins are the control connections for the on-chip
oscillator. The OSC1 and OSC2 pins can accept the following:
1. A crystal as shown in Figure 1-2(a)
2. A ceramic resonator as shown in Figure 1-2(a)
3. An external clock signal as shown in Figure 1-2(b)
4.7 MΩ
UNCONNECTED
EXTERNAL CLOCK
37 pF 37 pF
1.4.2.1 Crystal
1.4.3 RESET
Driving this input low will reset the MCU to a known startup state. The
RESET pin contains an internal Schmitt trigger to improve its noise
immunity. Refer to Section 4. Resets.
1.4.4 PA0–PA7
These eight I/O pins 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. Port A has mask-option register enabled interrupt
capability with internal pullup devices selectable for any pin. Refer to
Section 6. Input/Output Ports.
These three I/O pins comprise port B and are shared with the SIOP
communications subsystem. The state of any pin is software
programmable, and all port B lines are configured as inputs during
power-on or reset. Refer to Section 6. Input/Output Ports and
Section 7. Serial Input/Output Port (SIOP).
These eight I/O pins comprise port C and are shared with the A/D
converter subsystem. The state of any pin is software programmable
and all port C lines are configured as inputs during power-on or reset.
Refer to Section 6. Input/Output Ports and Section 9. Analog
Subsystem.
These two I/O pins comprise port D and one of them is shared with the
16-bit timer subsystem. The state of PD5 is software programmable and
is configured as an input during power-on or reset. PD7 is always an
input. It may be read at any time, regardless of which mode of operation
the 16-bit timer is in. Refer to Section 6. Input/Output Ports and
Section 8. Capture/Compare Timer.
1.4.8 TCMP
This pin is the output from the 16-bit timer’s output compare function. It
is low after reset. Refer to Section 8. Capture/Compare Timer.
This input pin drives the asynchronous interrupt function of the MCU in
user mode and provides the VPP programming voltage in bootloader
mode. The MCU will complete the current instruction being executed
before it responds to the IRQ interrupt request. When the IRQ/VPP pin is
driven low, the event is latched internally to signify an interrupt has been
requested. When the MCU completes its current instruction, the interrupt
latch is tested. If the interrupt latch is set and the interrupt mask bit (I bit)
in the condition code register is clear, the MCU will begin the interrupt
sequence.
Depending on the MOR LEVEL bit, the IRQ/VPP pin will trigger an
interrupt on either a negative edge at the IRQ/VPP pin and/or while the
IRQ/VPP pin is held in the low state. In either case, the IRQ/VPP pin must
be held low for at least one tILIH time period. If the edge- and level-
sensitive mode is selected (LEVEL bit set), the IRQ/VPP input pin
requires an external resistor connected to VDD for wired-OR operation.
If the IRQ/VPP pin is not used, it must be tied to the VDD supply. The
IRQ/VPP pin input circuitry contains an internal Schmitt trigger to improve
noise immunity. Refer to Section 5. Interrupts.
NOTE: If the voltage level applied to the IRQ/VPP pin exceeds VDD, it may affect
the MCU’s mode of operation. See Section 3. Operating Modes.
Section 2. Memory
2.1 Contents
2.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.6 RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.2 Introduction
The MC68HC705P6A utilizes 13 address lines to access an internal
memory space covering 8 Kbytes. This memory space is divided into
I/O, RAM, ROM, and EPROM areas.
MOTOROLA Memory 27
Memory
USER EPROM
4608 BYTES COP CLEAR REGISTER(1) $1FF0
UNUSED $1FF1
UNUSED $1FF2
Note 1. Writing zero to bit 0 of $1FF0 clears the COP watchdog timer. Reading $1FF0 returns user EPROM data.
28 Memory MOTOROLA
Memory
Input/Output and Control Registers
MOTOROLA Memory 29
Memory
Read:
Port A Data Register PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0
$0000 (PORTA) Write:
See page 52.
Reset: Unaffected by reset
Read: 0 0 0 0 0
Port B Data Register PB7 PB6 PB5
$0001 (PORTB) Write:
See page 53.
Reset: Unaffected by reset
Read:
Port C Data Register PC7 PC6 PC5 PC4 PC3 PC2 PC1 PC0
$0002 (PORTC) Write:
See page 54.
Reset: Unaffected by reset
Read: PD7 0 1 0 0 0 0
Port D Data Register PD5
$0003 (PORTD) Write:
See page 55.
Reset: Unaffected by reset
Read:
Port A Data Direction DDRA7 DDRA6 DDRA5 DDRA4 DDRA3 DDRA2 DDRA1 DDRA0
$0004 Register (DDRA) Write:
See page 52.
Reset: 0 0 0 0 0 0 0 0
Read: 1 1 1 1 1
Port B Data Direction DDRB7 DDRB6 DDRB5
$0005 Register (DDRB) Write:
See page 53.
Reset: 0 0 0 0 0 0 0 0
Read:
Port C Data Direction DDRC7 DDRC6 DDRC5 DDRC4 DDRC3 DDRC2 DDRC1 DDRC0
$0006 Register (DDRC) Write:
See page 54.
Reset: 0 0 0 0 0 0 0 0
Read: 0 0 0 0 0 0 0
Port D Data Direction DDRD5
$0007 Register (DDRD) Write:
See page 55.
Reset: 0 0 0 0 0 0 0 0
$0008 Unimplemented
30 Memory MOTOROLA
Memory
Input/Output and Control Registers
$0009 Unimplemented
Read: 0 0 0 0 0 0
SIOP Control Register SPE MSTR
$000A (SCR) Write:
See page 62.
Reset: 0 0 0 0 0 0 0 0
Read:
SIOP Data Register SDR7 SDR6 SDR5 SDR4 SDR3 SSDR2 SDR1 SDR0
$000C (SDR) Write:
See page 64.
Reset: Unaffected by reset
$000E Unimplemented
$000F Unimplemented
$0010 Unimplemented
$0011 Unimplemented
Read: 0 0 0
Timer Control Register ICIE OCIE TOIE IEDG OLVL
$0012 (TCR) Write:
See page 68.
Reset: 0 0 0 0 0 0 U 0
MOTOROLA Memory 31
Memory
Read:
Output Compare OCRH7 OCRH6 OCRH5 OCRH4 OCRH3 OCRH2 OCRH1 OCRH0
$0016 Register MSB (OCRH) Write:
See page 74.
Reset: Unaffected by reset
Read:
Output Compare OCRL7 OCRL6 OCRL5 OCRL4 OCRL3 OCRL2 OCRL1 OCRL0
$0017 Register LSB (OCRL) Write:
See page 74.
Reset: Unaffected by reset
Read: 0 0 0 0 0 0
EPROM Programming ELAT EPGM
$001C Register (EPROG) Write:
See page 85.
Reset: 0 0 0 0 0 0 0 0
32 Memory MOTOROLA
Memory
RAM
Read: CC 0 0
A/D Status and Control ADRC ADON CH2 CH1 CH0
$001E Register (ADSC) Write:
See page 80.
Reset: 0 0 0 0 0 0 0 0
2.6 RAM
The user RAM consists of 176 bytes (including the stack) at locations
$0050 through $00FF. The stack begins at address $00FF. The stack
pointer can access 64 bytes of RAM from $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.7 EPROM/ROM
There are 4608 bytes of user EPROM at locations $0100 through
$12FF, plus 48 bytes in user page zero locations $0020 through $004F,
and 16 additional bytes for user vectors at locations $1FF0 through
$1FFF. The bootloader ROM and vectors are at locations $1F01 through
$1FEF.
MOTOROLA Memory 33
Memory
Read: 0 0 0 0 0 0 0 0
Write: COPR
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
34 Memory MOTOROLA
Advance Information — MC68HC705P6A
3.1 Contents
3.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.2 Introduction
The MC68HC705P6A has two modes of operation that affect the pinout
and architecture of the MCU: user mode and bootloader mode. The user
mode is normally used for the application and the bootloader mode is
used for programming the EPROM. The conditions required to enter
each mode are shown in Table 3-1. The mode of operation is
determined by the voltages on the IRQ/VPP and PD7/TCAP pins on the
rising edge of the external RESET pin.
RESET 1 28 VDD
IRQ/VPP 2 27 OSC1
PA7 3 26 OSC2
PA6 4 25 PD7/TCAP
PA5 5 24 TCMP
PA4 6 23 PD5
PA3 7 22 PC0
PA2 8 21 PC1
PA1 9 20 PC2
PA0 10 19 PC3/AD3
SDO/PB5 11 18 PC4/AD2
SDI/PB6 12 17 PC5/AD1
SCK/PB7 13 16 PC6/AD0
VSS 14 15 PC7/VREFH
In the user mode, there is an 8-bit I/O port, a second 8-bit I/O port shared
with the analog-to-digital (A/D) subsystem, one 3-bit I/O port shared with
the serial input/output port (SIOP), and a 3-bit port shared with the 16-bit
timer subsystem, which includes one general-purpose I/O pin.
Execution of the STOP instruction when the SWAIT bit in the MOR is
clear places the MCU in its lowest power consumption mode. In stop
mode, the internal oscillator is turned off, halting all internal processing,
including the COP watchdog timer. Execution of the STOP instruction
automatically clears the I bit in the condition code register so that the IRQ
external interrupt is enabled. All other registers and memory remain
unaltered. All input/output lines remain unchanged.
N
STOP INTERNAL EXTERNAL OSCILLATOR ACTIVE
STOP EXTERNAL OSCILLATOR, PROCESSOR CLOCK, AND
STOP INTERNAL TIMER CLOCK, CLEAR I BIT IN CCR INTERNAL TIMER CLOCK ACTIVE
RESET STARTUP DELAY
STOP INTERNAL
STOP INTERNAL Y EXTERNAL PROCESSOR CLOCK,
PROCESSOR CLOCK, RESET? CLEAR I BIT IN CCR
CLEAR I BIT IN CCR
N
IRQ Y EXTERNAL
EXTERNAL Y Y EXTERNAL RESET?
RESET? INTERRUPT?
N
N N
IRQ
IRQ TIMER Y
Y Y EXTERNAL
EXTERNAL INTERNAL INTERRUPT?
INTERRUPT? INTERRUPT?
N
N RESTART EXTERNAL OSCILLATOR, N
START STABILIZATION DELAY
TIMER
COP Y
Y INTERNAL
INTERNAL INTERRUPT?
RESET?
N
END N
Y
OF STABILIZATION
COP
DELAY? Y
INTERNAL
N RESET?
RESTART
N
INTERNAL PROCESSOR CLOCK
The MCU can be brought out of stop mode only by an IRQ external
interrupt or an externally generated RESET. When exiting stop mode,
the internal oscillator will resume after a 4064 internal clock cycle
oscillator stabilization delay.
NOTE: Execution of the STOP instruction when the SWAIT bit in the MOR is
clear will cause the oscillator to stop, and, therefore, disable the COP
watchdog timer. To avoid turning off the COP watchdog timer, stop
mode should be changed to halt mode by setting the SWAIT bit in the
MOR. See 3.6 COP Watchdog Timer Considerations for additional
information.
NOTE: Halt mode is NOT designed for intentional use. Halt mode is only
provided to keep the COP watchdog timer active in the event a STOP
instruction is executed inadvertently. This mode of operation is usually
achieved by invoking wait mode.
Execution of the STOP instruction when the SWAIT bit in the MOR is set
places the MCU in this low-power mode. Halt mode consumes the same
amount of power as wait mode (both halt and wait modes consume more
power than stop mode).
In halt mode, the internal clock is halted, suspending all processor and
internal bus activity. Internal timer clocks remain active, permitting
interrupts to be generated from the 16-bit timer or a reset to be
generated from the COP watchdog timer. Execution of the STOP
instruction automatically clears the I bit in the condition code register,
enabling the IRQ external interrupt. All other registers, memory, and
input/output lines remain in their previous states.
If the 16-bit timer interrupt is enabled, it will cause the processor to exit
the halt mode and resume normal operation. The halt mode also can be
exited when an IRQ external interrupt or external RESET occurs.
When exiting the halt mode, the internal clock will resume after a delay
of one to 4064 internal clock cycles. This varied delay time is the result
of the halt mode exit circuitry testing the oscillator stabilization delay
If the 16-bit timer interrupt is enabled, it will cause the processor to exit
wait mode and resume normal operation. The 16-bit timer may be used
to generate a periodic exit from wait mode. Wait mode may also be
exited when an IRQ external interrupt or RESET occurs.
Section 4. Resets
4.1 Contents
4.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.2 Introduction
The MCU can be reset from three sources: one external input and two
internal reset conditions. The RESET pin is a Schmitt trigger input as
shown in Figure 4-1. The CPU and all peripheral modules will be reset
by the RST signal which is the logical OR of internal reset functions and
is clocked by PH1.
RESET
POWER-ON D
VDD RESET
RST TO CPU AND
(POR) RES
DFF PERIPHERALS
OSC
COP
DATA WATCHDOG PH1
(COPR)
ADDRESS
MOTOROLA Resets 41
Resets
The POR will generate the RST signal and reset the MCU. If any other
reset function is active at the end of this 4064 internal clock cycle delay,
the RST signal will remain active until the other reset condition(s) end.
When the COP watchdog timer is enabled (COP bit in the MOR is set),
the internal COP reset is generated automatically by a timeout of the
COP watchdog timer. This timer is implemented with an 18-stage ripple
counter that provides a timeout period of 65.5 ms when a 4-MHz
oscillator is used. The COP watchdog counter is cleared by writing a
logical 0 to bit zero at location $1FF0.
The COP watchdog timer can be disabled by clearing the COP bit in the
MOR or by applying 2 x VDD to the IRQ/VPP pin (for example, during
bootloader). When the IRQ/VPP pin is returned to its normal operating
42 Resets MOTOROLA
Resets
Internal Resets
voltage range (between VSS–VDD), the COP watchdog timer’s output will
be restored if the COP bit in the mask option register (MOR) is set.
The COP register is shared with the least significant byte (LSB) of an
unused vector address as shown in Figure 4-2. Reading this location will
return the programmed value of the unused user interrupt vector,
usually 0. Writing to this location will clear the COP watchdog timer.
Address: $1FF0
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0 0 0 0 0
Write: COPR
= Unimplemented
When the COP watchdog timer expires, it will generate the RST signal
and reset the MCU. If any other reset function is active at the end of the
COP reset signal, the RST signal will remain in the reset condition until
the other reset condition(s) end. When the reset condition ends, the
MCU’s operating mode will be selected (see Table 3-1).
MOTOROLA Resets 43
Resets
44 Resets MOTOROLA
Advance Information — MC68HC705P6A
Section 5. Interrupts
5.1 Contents
5.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.2 Introduction
The MCU can be interrupted six different ways:
1. Non-maskable software interrupt instruction (SWI)
2. External asynchronous interrupt (IRQ)
3. Input capture interrupt (TIMER)
4. Output compare interrupt (TIMER)
5. Timer overflow interrupt (TIMER)
6. Port A interrupt (if selected via mask option register)
Interrupts cause the processor to save the 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
completed.
MOTOROLA Interrupts 45
Interrupts
46 Interrupts MOTOROLA
Interrupts
Interrupt Types
FROM RESET
Y IS I BIT
SET?
N
IRQ CLEAR IRQ
Y
INTERRUPT? REQUEST
LATCH
N
TIMER Y
INTERRUPT?
N STACK
PC, X, A, CC
SET
I BIT IN CCR
LOAD PC FROM:
SWI: $1FFC, $1FFD
IRQ: $1FFA-$1FFB
TIMER: $1FF8-$1FF9
FETCH NEXT
INSTRUCTION
SWI
Y
INSTRUCTION?
N
RTI RESTORE RESISTERS
Y FROM STACK
INSTRUCTION?
CC, A, X, PC
N
EXECUTE INSTRUCTION
MOTOROLA Interrupts 47
Interrupts
All hardware interrupts 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. Four hardware interrupts are
explained in the following subsections.
48 Interrupts MOTOROLA
Interrupts
Interrupt Types
$1FFA and $1FFB. If the port A interrupts are enabled by the MOR, they
generate external interrupts identically to the IRQ/VPP pin.
NOTE: The internal interrupt latch is cleared nine internal clock cycles after the
interrupt is recognized (immediately after location $1FFA is read).
Therefore, another external interrupt pulse could be latched during the
IRQ service routine.
Another interrupt will be serviced if the IRQ pin is still in a low state when
the RTI in the service routine is executed.
MOTOROLA Interrupts 49
Interrupts
50 Interrupts MOTOROLA
Advance Information — MC68HC705P6A
6.1 Contents
6.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.3 Port A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.4 Port B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.5 Port C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.6 Port D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.2 Introduction
In the user mode, 20 bidirectional I/O lines are arranged as two 8-bit I/O
ports (ports A and C), one 3-bit I/O port (port B), and one 1-bit I/O port
(port D). These ports are programmable as either inputs or outputs
under software control of the data direction registers (DDRs). Port D also
contains one input-only pin.
6.3 Port A
Port A is an 8-bit bidirectional port, which does not share any of its pins
with other subsystems (see Figure 6-1). The port A data register is
located at address $0000 and its data direction register (DDR) is located
at address $0004. The contents of the port A data register are
indeterminate at initial power up and must be initialized by user software.
Reset does not affect the data registers, but does clear the DDRs,
thereby setting all of the port pins to input mode. Writing a 1 to a DDR bit
sets the corresponding port pin to output mode. Port A has mask option
register enabled interrupt capability with an internal pullup device
VDD
READ $0004 PULLUP MASK
OPTION REGISTER
WRITE $0004
DATA DIRECTION
RESET REGISTER BIT
(RST)
WRITE $0000 I/O
DATA OUTPUT PIN
REGISTER BIT
READ $0000
INTERNAL HC05
DATA BUS TO IRQ
INTERRUPT SYSTEM
6.4 Port B
Port B is a 3-bit bidirectional port which can share pins PB5–PB7 with
the SIOP communications subsystem. The port B data register is located
at address $0001 and its data direction register (DDR) is located at
address $0005. The contents of the port B data register are
indeterminate at initial powerup and must be initialized by user software.
Reset does not affect the data registers, but clears the DDRs, thereby
setting all of the port pins to input mode. Writing a 1 to a DDR bit sets the
corresponding port pin to output mode (see Figure 6-2).
Port B may be used for general I/O applications when the SIOP
subsystem is disabled. The SPE bit in register SPCR is used to
enable/disable the SIOP subsystem. When the SIOP subsystem is
enabled, port B registers are still accessible to software. Writing to either
of the port B registers while a data transfer is under way could corrupt
the data. See Section 7. Serial Input/Output Port (SIOP) for a
discussion of the SIOP subsystem.
READ $0005
WRITE $0005
DATA DIRECTION
RESET REGISTER BIT
(RST)
WRITE $0001 I/O
DATA OUTPUT PIN
REGISTER BIT
READ $0001
INTERNAL HC05
DATA BUS
6.5 Port C
Port C is an 8-bit bidirectional port which can share pins PC3–PC7 with
the A/D subsystem. The port C data register is located at address $0002
and its data direction register (DDR) is located at address $0006. The
contents of the port C data register are indeterminate at initial powerup
and must be initialized by user software. Reset does not affect the data
registers, but clears the DDRs, thereby setting all of the port pins to input
mode. Writing a 1 to a DDR bit sets the corresponding port pin to output
mode (see Figure 6-3).
Port C may be used for general I/O applications when the A/D
subsystem is disabled. The ADON bit in register ADSC is used to
enable/disable the A/D subsystem. Care must be exercised when using
pins PC0–PC2 while the A/D subsystem is enabled. Accidental changes
to bits that affect pins PC3–PC7 in the data or DDR registers will produce
unpredictable results in the A/D subsystem. See Section 9. Analog
Subsystem.
READ $0006
WRITE $0006
DATA DIRECTION
RESET REGISTER BIT
(RST)
WRITE $0002 I/O
DATA OUTPUT PIN
REGISTER BIT
READ $0002
INTERNAL HC05
DATA BUS
6.6 Port D
Port D is a 2-bit port with one bidirectional pin (PD5) and one input-only
pin (PD7). Pin PD7 is shared with the 16-bit timer. The port D data
register is located at address $0003 and its data direction register (DDR)
is located at address $0007. The contents of the port D data register are
indeterminate at initial powerup and must be initialized by user software.
Reset does not affect the data registers, but clears the DDRs, thereby
setting PD5 to input mode. Writing a 1 to DDR bit 5 sets PD5 to output
mode (see Figure 6-4).
Port D may be used for general I/O applications regardless of the state
of the 16-bit timer. Since PD7 is an input-only line, its state can be read
from the port D data register at any time.
READ $0007
WRITE $0007
DATA DIRECTION
RESET REGISTER BIT
(RST)
WRITE $0003 I/O
DATA OUTPUT PIN
REGISTER BIT
READ $0003
INTERNAL HC05
DATA BUS
NOTE: To avoid generating a glitch on an I/O port pin, data should be written to
the I/O port data register before writing a logic 1 to the corresponding
data direction register.
At power-on or reset, all DDRs are cleared, which configures all port pins
as inputs. The DDRs are capable of being written to or read by the
processor. During the programmed output state, a read of the data
register will actually read the value of the output data latch and not the
level on the I/O port pin.
7.1 Contents
7.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
7.2 Introduction
The simple synchronous serial I/O port (SIOP) subsystem is designed to
provide efficient serial communications between peripheral devices or
other MCUs. The SIOP is implemented as a 3-wire master/slave system
with serial clock (SCK), serial data input (SDI), and serial data output
(SDO). A block diagram of the SIOP is shown in Figure 7-1. A mask
programmable option determines whether the SIOP is MSB or LSB first.
The SIOP subsystem shares its input/output pins with port B. When the
SIOP is enabled (SPE bit set in register SCR), port B DDR and data
registers are modified by the SIOP. Although port B DDR and data
registers can be altered by application software, these actions could
affect the transmitted or received data.
SPE
SCK SCK/PB7
INTERNAL
CPU CLOCK
The state of the SCK output normally remains a logic 1 during idle
periods between data transfers. The first falling edge of SCK signals the
beginning of a data transfer. At this time, the first bit of received data may
be presented at the SDI pin and the first bit of transmitted data is
presented at the SDO pin (see Figure 7-2). Data is captured at the SDI
pin on the rising edge of SCK. The transfer is terminated upon the eighth
rising edge of SCK.
The master and slave modes of operation differ only by the sourcing of
SCK. In master mode, SCK is driven from an internal source within the
MCU. In slave mode, SCK is driven from a source external to the MCU.
The SCK frequency is dependent upon the SPR0 and SPR1 bits located
in the mask option register. Refer to 11.3 Mask Option Register for a
description of available SCK frequencies.
SDO
SCK
100 ns 100 ns
SDI
BIT 0 BIT 1 BIT 2 BIT 3 BIT 4 BIT 5 BIT 6 BIT 7
On the first falling edge of SCK, the first data bit will be shifted out to the
SDO pin. The remaining data bits will be shifted out to the SDO pin on
subsequent falling edges of SCK. The SDO pin will present valid data at
least 100 nanoseconds before the rising edge of the SCK and remain
valid for 100 nanoseconds after the rising edge of SCK. See Figure 7-2.
This register is located at address $000A and contains two bits. Figure
7-3 shows the position of each bit in the register and indicates the value
of each bit after reset.
Address: $000A
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0 0 0
SPE MSTR
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
will 1) abort the transmission, 2) reset the serial bit counter, and 3)
convert the port B/SIOP port to a general-purpose I/O port. Reset
clears the SPE bit.
This register is located at address $000B and contains two bits. Figure
7-4 shows the position of each bit in the register and indicates the value
of each bit after reset.
Address: $000B
Bit 7 6 5 4 3 2 1 Bit 0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
Address: $000C
Bit 7 6 5 4 3 2 1 Bit 0
Read:
SD7 SD6 SD5 SD4 SD3 SD2 SD1 SD0
Write:
8.1 Contents
8.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.2 Introduction
This section describes the operation of the 16-bit capture/compare timer.
Figure 8-1 shows the structure of the capture/compare subsystem.
INTERNAL BUS
INTERNAL
HIGH LOW PROCESSOR
CLOCK 8-BIT
BYTE BYTE BUFFER
³³³
÷4 HIGH LOW
$16 OUTPUT HIGH BYTE BYTE
$17 COMPARE BYTE LOW
REGISTER BYTE
16-BIT FREE INPUT $14
$18 CAPTURE $15
RUNNING $19 REGISTER
COUNTER
COUNTER $1A
ALTERNATE $1B
REGISTER
D Q
CLK
TIMER OUTPUT
STATUS ICF OCF TOF $13 LEVEL
REG. REG. C
TIMER
CONTROLRESET
ICIE OCIE TOIE IEDG OLVL REG.
$12
OUTPUT EDGE
INTERRUPT CIRCUIT LEVEL INPUT
(TCMP) (TCAP)
Because of the 16-bit timer architecture, the I/O registers for the input
capture and output compare functions are pairs of 8-bit registers.
The programmer can use the output compare register to measure time
periods, to generate timing delays, or to generate a pulse of specific
duration or a pulse train of specific frequency and duty cycle on the
TCMP pin.
The timer control register (TCR), shown in Figure 8-2, performs these
functions:
• Enables input capture interrupts
• Enables output compare interrupts
• Enables timer overflow interrupts
• Controls the active edge polarity of the TCAP signal
• Controls the active level of the TCMP output
Address: $0012
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0
ICIE OCIE TOIE IEDG OLVL
Write:
Reset: 0 0 0 0 0 0 U 0
= Unimplemented U = Undetermined
The timer status register (TSR), shown in Figure 8-3, contains flags to
signal the following conditions:
Address: $0013
Bit 7 6 5 4 3 2 1 Bit 0
Read: ICF OCF TOF 0 0 0 0 0
Write:
Reset: U U U 0 0 0 0 0
U = Undetermined
The timer registers (TRH and TRL), shown in Figure 8-4, contains the
current high and low bytes of the 16-bit counter. Reading TRH before
reading TRL causes TRL to be latched until TRL is read. Reading TRL
after reading the timer status register clears the timer overflow flag
(TOF). Writing to the timer registers has no effect.
Bit 7 6 5 4 3 2 1 Bit 0
Write
Reset: 1 1 1 1 1 1 1 1
Bit 7 6 5 4 3 2 1 Bit 0
Write:
Reset: 1 1 1 1 1 1 0 0
= Unimplemented
The alternate timer registers (ATRH and ATRL), shown in Figure 8-5,
contain the current high and low bytes of the 16-bit counter. Reading
ATRH before reading ATRL causes ATRL to be latched until ATRL is
read. Reading ATRL has no effect on the timer overflow flag (TOF).
Writing to the alternate timer registers has no effect.
Bit 7 6 5 4 3 2 1 Bit 0
Write:
Reset: 1 1 1 1 1 1 1 1
Bit 7 6 5 4 3 2 1 Bit 0
Write:
Reset: 1 1 1 1 1 1 0 0
= Unimplemented
When a selected edge occurs on the TCAP pin, the current high and low
bytes of the 16-bit counter are latched into the input capture registers.
Reading ICRH before reading ICRL inhibits further capture until ICRL is
read. Reading ICRL after reading the status register clears the input
capture flag (ICF). Writing to the input capture registers has no effect.
Bit 7 6 5 4 3 2 1 Bit 0
Write:
Unaffected by reset
Bit 7 6 5 4 3 2 1 Bit 0
Write:
Unaffected by reset
= Unimplemented
When the value of the 16-bit counter matches the value in the output
compare registers, the planned TCMP pin action takes place. Writing to
OCRH before writing to OCRL inhibits timer compares until OCRL is
written. Reading or writing to OCRL after the timer status register clears
the output compare flag (OCF).
Bit 7 6 5 4 3 2 1 Bit 0
Write:
OCRH7 OCRH6 OCRH5 OCRH4 OCRH3 OCRH2 OCRH1 OCRH0
Read:
Unaffected by reset
Bit 7 6 5 4 3 2 1 Bit 0
Read:
Unaffected by reset
To prevent OCF from being set between the time it is read and the time
the output compare registers are updated, use this procedure:
9.1 Contents
9.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
9.2 Introduction
The MC68HC705P6A includes a 4-channel, multiplexed input, 8-bit,
successive approximation analog-to-digital (A/D) converter. The A/D
subsystem shares its inputs with port C pins PC3–PC7.
The A/D converter is ratiometric, with pin VREFH supplying the high
reference voltage. Applying an input voltage equal to VREFH produces a
conversion result of $FF (full scale). Applying an input voltage equal to
VSS produces a conversion result of $00. An input voltage greater than
VREFH will convert to $FF with no overflow indication. For ratiometric
conversions, VREFH should be at the same potential as the supply
voltage being used by the analog signal being measured and referenced
to VSS.
The reference supply for the A/D converter shares pin PC7 with port C.
The low reference is tied to the VSS pin internally. VREFH can be any
voltage between VSS and VDD; however, the accuracy of conversions is
tested and guaranteed only for VREFH = VDD.
If the MCU internal clock frequency is less than 1 MHz (2 MHz external
oscillator), the internal RC oscillator (approximately 1.5 MHz) must be
used for the A/D converter clock. The internal RC clock is selected by
setting the ADRC bit in the ADSC register.
An input multiplexer allows the A/D converter to select from one of four
external analog signals. Port C pins PC3 through PC6 are shared with
the inputs to the multiplexer.
Address: $001E
Bit 7 6 5 4 3 2 1 Bit 0
Read: CC 0 0
ADRC ADON CH2 CH1 CH0
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
CC — Conversion Complete
This read-only status bit is set when a conversion sequence has
completed and data is ready to be read from the ADC register. CC is
cleared when the ADSC is written to or when data is read from the
ADC register. Once a conversion has been started, conversions of
the selected channel will continue every 32 internal clock cycles until
the ADSC register is written to again. During continuous conversion
operation, the ADC register will be updated with new data, and the CC
bit set every 32 internal clock cycles. Also, data from the previous
conversion will be overwritten regardless of the state of the CC bit.
5 (VREFH + VSS)/2
6 VSS
Address: $001D
Bit 7 6 5 4 3 2 1 Bit 0
Write:
= Unimplemented
10.1 Contents
10.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
10.2 Introduction
The user EPROM consists of 48 bytes of user page zero EPROM from
$0020 to $004F, 4608 bytes of user EPROM from $0100 to $12FF, the
two MOR reset values located at $1EFF and $1F00, and 16 bytes of user
vectors EPROM from $1FF0 to $1FFF. The bootloader ROM and
vectors are located from $1F01 to $1FEF.
MOTOROLA EPROM 83
EPROM
EPROM device should be positioned about one inch from the UV lamp.
An erased EPROM byte will read as $00.
NOTE: To avoid damage to the MCU, VDD must be applied to the MCU before
VPP.
84 EPROM MOTOROLA
EPROM
EPROM Programming Register (EPROG)
Address $001C
Bit 7 6 5 4 3 2 1 Bit 0
Read: 0 0 0 0 0 0
ELAT EPGM
Write:
Reset: 0 0 0 0 0 0 0 0
= Unimplemented
MOTOROLA EPROM 85
EPROM
This sequence is also shown in the sample program listing in Table 10-1.
1 1 1 Program/verify
1 1 0 Verify only
86 EPROM MOTOROLA
EPROM
Programming from an External Memory Device
MOTOROLA EPROM 87
EPROM
88 EPROM MOTOROLA
EPROM
Programming from an External Memory Device
N
PROGRAMMING?
INSTALL MC68HC705P6A INTO PROGRAMMER
N
IS VERIFY
LED LIT?
CLOSE RESET SWITCH
Y
TURN VDD ON
CLOSE RESET SWITCH
TURN VPP ON
TURN OFF VPP
REMOVE DEVICES
MOTOROLA EPROM 89
EPROM
V
DD
MC68HC705P6A
VPP IRQ/VPP 10 kΩ
2764 MC74HC4040
PD7/TCAP V
DD
OSC1 PGM
2 MHz
PB5 A12 A11 Q12
OSC2
A10 Q11
A9 Q10
10 MΩ
20 pF 20 pF PA7 D7
A8 Q9
PA6 D6
A7 Q8
PA5 D5
A6 Q7
PA4 D4
V A5 Q6
DD
PA3 D3
A4 Q5
10 kΩ PA2 D2
A3 Q4
PA1 D1
RESET A2 Q3
RESET PA0 D0
A1 Q2
1 µF
V CE A0 Q1
DD
OE
V RST CLK
DD
10 kΩ
PC6
PC1
PROG
PB7
PC2
330 Ω VDD VDD
10 kΩ 10 kΩ
VERF
PB6 PGM
PC3 VDD = 5.0 V
330 Ω
VFY
PC5 PC4 VPP = 16.5 V
90 EPROM MOTOROLA
Advance Information — MC68HC705P6A
11.1 Contents
11.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
11.2 Introduction
The mask option register (MOR) contains two bytes of EPROM used to
enable or disable each of the features controlled by mask options on the
MC68HC05P6 (a ROM version of the MC68HC705P6A).
Address: $1EFF
Bit 7 6 5 4 3 2 1 Bit 0
Read:
PA7PU PA6PU PA5PU PA4PU PA3PU PA2PU PA1PU PA0PU
Write:
Erased State: 0 0 0 0 0 0 0 0
Address: $1F00
Bit 7 6 5 4 3 2 1 Bit 0
Read:
SECURE SWAIT SPR1 SPR0 LSBF LEVEL COP
Write:
Erased State: 0 0 0 0 0 0 0 0
= Unimplemented
0 0 fosc ÷ 64
0 1 fosc ÷ 32
1 0 fosc ÷ 16
1 1 fosc ÷ 8
NOTE: The port A pullup/interrupt function is NOT available on the ROM device,
MC68HC05P6.
Once the MOR bits have been programmed, the options are not loaded
into the MOR registers until the part is reset.
12.1 Contents
12.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
12.3 Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
12.3.1 Accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
12.3.2 Index Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
12.3.3 Stack Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
12.3.4 Program Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97
12.3.5 Condition Code Register . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
12.2 Introduction
The MC68HC705P6A has an 8-K memory map. Therefore, it uses only
the lower 13 bits of the address bus. In the following discussion, the
upper three bits of the address bus can be ignored. Also, the STOP
instruction can be modified to place the MCU in either the normal stop
mode or the halt mode by means of a MOR bit. All other instructions and
registers behave as described in this section.
12.3 Registers
The MCU contains five registers which are hard-wired within the CPU
and are not part of the memory map. These five registers are shown in
Figure 12-1 and are described in the following paragraphs.
7 6 5 4 3 2 1 0
ACCUMULATOR A
INDEX REGISTER X
15 14 13 12 11 10 9 8
0 0 0 0 0 0 0 0 1 1 STACK POINTER SP
PROGRAM COUNTER PC
12.3.1 Accumulator
The index register shown in Figure 12-1 is an 8-bit register that can
perform two functions:
• Indexed addressing
• Temporary storage
In indexed addressing with no offset, the index register contains the low
byte of the operand address, and the high byte is assumed to be $00. In
indexed addressing with an 8-bit offset, the CPU finds the operand
address by adding the index register contents to an 8-bit immediate
value. In indexed addressing with a 16-bit offset, the CPU finds the
The CCR shown in Figure 12-1 is a 5-bit register in which four bits are
used to indicate the results of the instruction just executed. The fifth bit
is the interrupt mask. These bits can be individually tested by a program,
and specific actions can be taken as a result of their state. The condition
code register should be thought of as having three additional upper bits
that are always ones. Only the interrupt mask is affected by a reset of the
device. The following paragraphs explain the functions of the lower five
bits of the condition code register.
N — Negative Bit
The negative bit is set when the result of the last arithmetic operation,
logical operation, or data manipulation was negative. (Bit 7 of the
result was a logic one.)
The negative bit can also be used to check an often-tested flag by
assigning the flag to bit 7 of a register or memory location. Loading
the accumulator with the contents of that register or location then sets
or clears the negative bit according to the state of the flag.
Z — Zero Bit
The zero bit is set when the result of the last arithmetic operation,
logical operation, data manipulation, or data load operation was zero.
C — Carry/Borrow Bit
The carry/borrow bit is set when a carry out of bit 7 of the accumulator
occurred during the last arithmetic operation, logical operation, or
data manipulation. The carry/borrow bit is also set or cleared during
bit test and branch instructions and during shifts and rotates. This bit
is not set by an INC or DEC instruction.
13.1 Contents
13.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
13.2 Introduction
The MCU instruction set has 62 instructions and uses eight addressing
modes. The instructions include all those of the M146805 CMOS Family
plus one more: the unsigned multiply (MUL) instruction. The MUL
instruction allows unsigned multiplication of the contents of the
accumulator (A) and the index register (X). The high-order product is
stored in the index register, and the low-order product is stored in the
accumulator.
13.3.1 Inherent
13.3.2 Immediate
13.3.3 Direct
Direct instructions can access any of the first 256 memory locations with
two bytes. The first byte is the opcode, and the second is the low byte of
the operand address. In direct addressing, the CPU automatically uses
$00 as the high byte of the operand address.
13.3.4 Extended
Extended instructions use three bytes and can access any address in
memory. The first byte is the opcode; the second and third bytes are the
high and low bytes of the operand address.
When using the Motorola assembler, the programmer does not need to
specify whether an instruction is direct or extended. The assembler
automatically selects the shortest form of the instruction.
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.
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.
13.3.8 Relative
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.
Decrement DEC
Increment INC
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.
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.
Operand
Address
Effect on
Opcode
Cycles
Mode
Source Operation Description CCR
Form
H I N Z C
ADC #opr IMM A9 ii 2
ADC opr DIR B9 dd 3
ADC opr EXT C9 hh ll 4
ADC opr,X
Add with Carry A ← (A) + (M) + (C) — IX2 D9 ee ff 5
ADC opr,X IX1 E9 ff 4
ADC ,X IX F9 3
Operand
Address
Effect on
Opcode
Cycles
Mode
Source CCR
Operation Description
Form
H I N Z C
BIH rel Branch if IRQ Pin High PC ← (PC) + 2 + rel ? IRQ = 1 — — — — — REL 2F rr 3
BIL rel Branch if IRQ Pin Low PC ← (PC) + 2 + rel ? IRQ = 0 — — — — — REL 2E rr 3
BIT #opr IMM A5 ii 2
BIT opr DIR B5 dd 3
BIT opr EXT C5 hh ll 4
BIT opr,X
Bit Test Accumulator with Memory Byte (A) ∧ (M) — — —
IX2 D5 ee ff 5
BIT opr,X IX1 E5 ff 4
BIT ,X IX F5 3
BLO rel Branch if Lower (Same as BCS) PC ← (PC) + 2 + rel ? C = 1 — — — — — REL 25 rr 3
BLS rel Branch if Lower or Same PC ← (PC) + 2 + rel ? C ∨ Z = 1 — — — — — REL 23 rr 3
BMC rel Branch if Interrupt Mask Clear PC ← (PC) + 2 + rel ? I = 0 — — — — — REL 2C rr 3
BMI rel Branch if Minus PC ← (PC) + 2 + rel ? N = 1 — — — — — REL 2B rr 3
BMS rel Branch if Interrupt Mask Set PC ← (PC) + 2 + rel ? I = 1 — — — — — REL 2D rr 3
BNE rel Branch if Not Equal PC ← (PC) + 2 + rel ? Z = 0 — — — — — REL 26 rr 3
BPL rel Branch if Plus PC ← (PC) + 2 + rel ? N = 0 — — — — — REL 2A rr 3
BRA rel Branch Always PC ← (PC) + 2 + rel ? 1 = 1 — — — — — REL 20 rr 3
DIR (b0) 01 dd rr 5
DIR (b1) 03 dd rr 5
DIR (b2) 05 dd rr 5
DIR (b3) 07 dd rr 5
BRCLR n opr rel Branch if Bit n Clear PC ← (PC) + 2 + rel ? Mn = 0 — — — —
DIR (b4) 09 dd rr 5
DIR (b5) 0B dd rr 5
DIR (b6) 0D dd rr 5
DIR (b7) 0F dd rr 5
BRN rel Branch Never PC ← (PC) + 2 + rel ? 1 = 0 — — — — — REL 21 rr 3
DIR (b0) 00 dd rr 5
DIR (b1) 02 dd rr 5
DIR (b2) 04 dd rr 5
DIR (b3) 06 dd rr 5
BRSET n opr rel Branch if Bit n Set PC ← (PC) + 2 + rel ? Mn = 1 — — — — DIR (b4) 08 dd rr 5
DIR (b5) 0A dd rr 5
DIR (b6) 0C dd rr 5
DIR (b7) 0E dd rr 5
DIR (b0) 10 dd 5
DIR (b1) 12 dd 5
DIR (b2) 14 dd 5
DIR (b3) 16 dd 5
BSET n opr Set Bit n Mn ← 1 — — — — —
DIR (b4) 18 dd 5
DIR (b5) 1A dd 5
DIR (b6) 1C dd 5
DIR (b7) 1E dd 5
PC ← (PC) + 2; push (PCL)
SP ← (SP) – 1; push (PCH)
BSR rel Branch to Subroutine — — — — — REL AD rr 6
SP ← (SP) – 1
PC ← (PC) + rel
CLC Clear Carry Bit C←0 — — — — 0 INH 98 2
Operand
Address
Effect on
Opcode
Cycles
Mode
Source CCR
Operation Description
Form
H I N Z C
CLR opr M ← $00 DIR 3F dd 5
CLRA A ← $00 INH 4F 3
CLRX Clear Byte X ← $00 — — 0 1 — INH 5F 3
CLR opr,X M ← $00 IX1 6F ff 6
CLR ,X M ← $00 IX 7F 5
Operand
Address
Effect on
Opcode
Cycles
Mode
Source CCR
Operation Description
Form
H I N Z C
JSR opr DIR BD dd 5
PC ← (PC) + n (n = 1, 2, or 3)
JSR opr EXT CD hh ll 6
Push (PCL); SP ← (SP) – 1
JSR opr,X Jump to Subroutine — — — — — IX2 DD ee ff 7
Push (PCH); SP ← (SP) – 1
JSR opr,X IX1 ED ff 6
PC ← Effective Address
JSR ,X IX FD 5
Operand
Address
Effect on
Opcode
Cycles
Mode
Source CCR
Operation Description
Form
H I N Z C
ROR opr DIR 36 dd 5
RORA INH 46 3
RORX Rotate Byte Right through Carry Bit C — — INH 56 3
ROR opr,X b7 b0 IX1 66 ff 6
ROR ,X IX 76 5
Operand
Address
Effect on
Opcode
Cycles
Mode
Source CCR
Operation Description
Form
H I N Z C
TAX Transfer Accumulator to Index Register X ← (A) — — — — — INH 97 2
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 1 IX 2 IMM 2 DIR 3 EXT 3 IX2 2 IX1 1 IX
5 5 3 5 3 3 6 5 2 4 5 6 5 4
7 BRCLR3 BCLR3 BEQ ASR ASRA ASRX ASR ASR TAX STA STA STA STA STA 7
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 1 IX 1 INH 2 DIR 3 EXT 3 IX2 2 IX1 1 IX
5 5 3 5 3 3 6 5 2 2 3 4 5 4 3
8 BRSET4 BSET4 BHCC ASL/LSL ASLA/LSLA ASLX/LSLX ASL/LSL ASL/LSL CLC EOR EOR EOR EOR EOR EOR 8
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 1 IX 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 2 IX1 1 IX
5 5 3 5 3 3 6 5 2 2 3 4 5 4 3
9 BRCLR4 BCLR4 BHCS ROL ROLA ROLX ROL ROL SEC ADC ADC ADC ADC ADC ADC 9
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 1 IX 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 2 IX1 1 IX
5 5 3 5 3 3 6 5 2 2 3 4 5 4 3
A BRSET5 BSET5 BPL DEC DECA DECX DEC DEC CLI ORA ORA ORA ORA ORA ORA A
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 1 IX 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 2 IX1 1 IX
5 5 3 2 2 3 4 5 4 3
B BRCLR5 BCLR5 BMI SEI ADD ADD ADD ADD ADD ADD B
3 DIR 2 DIR 2 REL 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 2 IX1 1 IX
5 5 3 5 3 3 6 5 2 2 3 4 3 2
C BRSET6 BSET6 BMC INC INCA INCX INC INC RSP JMP JMP JMP JMP JMP C
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 1 IX 1 INH 2 DIR 3 EXT 3 IX2 2 IX1 1 IX
5 5 3 4 3 3 5 4 2 6 5 6 7 6 5
D BRCLR6 BCLR6 BMS TST TSTA TSTX TST TST NOP BSR JSR JSR JSR JSR JSR D
MC68HC705P6A — Rev. 2.0
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 1 IX 1 INH 2 REL 2 DIR 3 EXT 3 IX2 2 IX1 1 IX
5 5 3 2 2 3 4 5 4 3
E BRSET7 BSET7 BIL STOP LDX LDX LDX LDX LDX LDX E
3 DIR 2 DIR 2 REL 1 INH 2 IMM 2 DIR 3 EXT 3 IX2 2 IX1 1 IX
5 5 3 5 3 3 6 5 2 2 4 5 6 5 4
F BRCLR7 BCLR7 BIH CLR CLRA CLRX CLR CLR WAIT TXA STX STX STX STX STX F
3 DIR 2 DIR 2 REL 2 DIR 1 INH 1 INH 2 IX1 1 IX 1 INH 1 INH 2 DIR 3 EXT 3 IX2 2 IX1 1 IX
MSB
INH = Inherent REL = Relative 0 MSB of Opcode in Hexadecimal
MOTOROLA
14.1 Contents
14.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
14.2 Introduction
This section contains the electrical and timing specifications.
The MCU contains circuitry to protect the inputs against damage from
high static voltages; however, do not apply voltages higher than those
shown in the table below. Keep VIn and VOut within the range
VSS ≤ (VIn or VOut) ≤ VDD. Connect unused inputs to the appropriate
voltage level, either VSS or VDD.
VSS –0.3 to
Bootloader mode (IRQ/VPP pin only) VIn V
2 x VDD +0.3
Resolution 8 8 Bits
Absolute accuacy
— ± 1 1/2 LSB Including quanitization
(VDD ≥ VREFH > 4.0)
Input leakage
AD0, AD1, AD2, AD3 — ±1 µA
VREFH — ±1
Conversion time
MCU external oscillator — 32 tcyc Includes sampling time
Internal RC oscillator — 32 µs
Sample time
MCU external oscillator — 12 tcyc
Internal RC oscillator — 12 µs
Input capacitance — 12 pF
Programming current
IPP — 5.0 10 mA
IRQ/VPP
Operating frequency
Master fop(m) 0.25 0.25 fop
Slave fop(s) dc 0.25
Cycle time
1 Master tcyc(m) 4.0 4.0 tcyc
Slave tcyc(s) — 4.0
t1 t2
SCK
t5 t6
SDI
BIT 0 BIT 1 ... 6 BIT 7
t3 t4
SDO
BIT 0 BIT 1 ... 6 BIT 7
Frequency of operation
Crystal option fOSC — 4.2 MHz
External clock option DC 4.2
1. V DD = 5.0 Vdc ± 10%, VSS = 0 Vdc, TA = –40°C to +125°C, unless otherwise noted
2. The minimum period, tILIL, should not be less than the number of cycle times it takes to execute the interrupt service routine
plus 19 tCYC.
Advance Information
t
VDDR
OSC1(2)
4064 t
cyc
tcyc
INTERNAL
PROCESSOR
Electrical Specifications
(1)
CLOCK
INTERNAL
ADDRESS 1FFE 1FFF NEW PC NEW PC 1FFE 1FFE 1FFE 1FFE 1FFF NEW PC NEW PC
(1)
BUS
INTERNAL
DATA NEW NEW OP PCH PCL OP
(1) PCH PCL CODE CODE
BUS
tRL
RESET NOTE 3
Notes:
1. Internal timing signal and bus information are not available externally.
MC68HC705P6A — Rev. 2.0
2. OSC1 line is not meant to represent frequency. It is only used to represent time.
3. The next rising edge of the internal clock following the rising edge of RESET initiates the reset sequence.
15.1 Contents
15.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
15.2 Introduction
The MC68HC705P6A is available in either a 28-pin plastic dual in-line
(PDIP) or a 28-pin small outline integrated circuit (SOIC) package.
To make sure that you have the latest case outline specifications,
contact one of the following:
• Local Motorola Sales Office
• World Wide Web at
http://www.motorola.com/semiconductors
NOTES:
1. POSITIONAL TOLERANCE OF LEADS (D),
SHALL BE WITHIN 0.25mm (0.010) AT
MAXIMUM MATERIAL CONDITION, IN
RELATION TO SEATING PLANE AND
EACH OTHER.
28 15 2. DIMENSION L TO CENTER OF LEADS
WHEN FORMED PARALLEL.
3. DIMENSION B DOES NOT INCLUDE
B MOLD FLASH.
MILLIMETERS INCHES
1 14 DIM MIN MAX MIN MAX
A 36.45 37.21 1.435 1.465
A L B 13.72 14.22 0.540 0.560
C C 3.94 5.08 0.155 0.200
D 0.36 0.56 0.014 0.022
N F 1.02 1.52 0.040 0.060
G 2.54 BSC 0.100 BSC
H 1.65 2.16 0.065 0.085
J 0.20 0.38 0.008 0.015
H G J K 2.92 3.43 0.115 0.135
K M
F D L 15.24 BSC 0.600 BSC
SEATING M 0° 15° 0° 15°
PLANE
N 0.51 1.02 0.020 0.040
-A-
28 15 NOTES:
1. DIMENSIONING AND TOLERANCING PER
14X P ANSI Y14.5M, 1982.
-B- 0.010 (0.25) M B M 2. CONTROLLING DIMENSION: MILLIMETER.
3. DIMENSION A AND B DO NOT INCLUDE MOLD
PROTRUSION.
1 14 4. MAXIMUM MOLD PROTRUSION 0.15
(0.006) PER SIDE.
5. DIMENSION D DOES NOT INCLUDE
DAMBAR PROTRUSION. ALLOWABLE
28X D DAMBAR PROTRUSION SHALL BE 0.13
M (0.005) TOTAL IN EXCESS OF D
0.010 (0.25) M T A S B S
DIMENSION AT MAXIMUM MATERIAL
R X 45° CONDITION.
MILLIMETERS INCHES
-T- C DIM MIN MAX MIN MAX
A 17.80 18.05 0.701 0.711
-T- B 7.40 7.60 0.292 0.299
26X G SEATING C 2.35 2.65 0.093 0.104
PLANE
D 0.35 0.49 0.014 0.019
K
F F 0.41 0.90 0.016 0.035
G 1.27 BSC 0.050 BSC
J 0.23 0.32 0.009 0.013
J K 0.13 0.29 0.005 0.011
M 0° 8° 0° 8°
P 10.05 10.55 0.395 0.415
R 0.25 0.75 0.010 0.029
16.1 Contents
16.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
16.2 Introduction
This section contains ordering information for the available package
types.
Operating
MC Order Number Temperature Range
MC68HC705P6ACP(1) (extended) –40°C to 85°C
JAPAN:
Motorola Japan Ltd.
SPS, Technical Information Center
3-20-1, Minami-Azabu, Minato-ku
Tokyo 106-8573 Japan
81-3-3440-3569
ASIA/PACIFIC:
Motorola Semiconductors H.K. Ltd.
Silicon Harbour Centre
2 Dai King Street
Tai Po Industrial Estate
Tai Po, N.T., Hong Kong
852-26668334
HOME PAGE:
http://www.motorola.com/semiconductors/
Q4/00
MC68HC705P6A/D REV 1
REV 2