All Trade Marks recognized. This document contains information on new products. Specifications and information herein are
subject to change without notice.
All products are sold on Motorola’s Terms & Conditions of Supply. In ordering a product covered by this document the
Customer agrees to be bound by those Terms & Conditions and nothing contained in this document constitutes or forms part
of a contract (with the exception of the contents of this Notice). A copy of Motorola’s Terms & Conditions of Supply is available
on request.
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 can and do vary in different applications. All
operating parameters, including “Typicals”, must be validated 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 and !are registered
trademarks of Motorola, Inc. Motorola, Inc. is an Equal Opportunity/Affirmative Action Employer.
The Customer should ensure that it has the most up to date version of the document by contacting its local Motorola office.
This document supersedes any earlier documentation relating to the products referred to herein. The information contained
in this document is current at the date of publication. It may subsequently be updated, revised or withdrawn.
MOTOROLA LTD., 1996
TPG
Page 6
Conventions
Register and bit mnemonics are defined in the paragraphs describing them.
An overbar is used to designate an active-low signal, eg: RESET
Unless otherwise stated, blank cells in a register diagram indicate that the bit is
either unused or reserved; shaded cells indicate that the bit is not described in the
following paragraphs; ‘u’ is used to indicate an undefined state (on reset).
.
TPG
Page 7
CUSTOMER FEEDBACK QUESTIONNAIRE (MC68HC05T16D/H)
Motorola wishes to continue to improve the quality of its documentation. We would welcome your feedback on the publication y ou
have just received. Having used the document, please complete this card (or a photocopy of it, if you prefer).
1. How would you rate the quality of the document? Check one box in each category.
ExcellentPoorExcellentPoor
14-4M-Bus Interface Input Signal Timing.....................................................................14-4
14-5M-Bus Interface Output Signal Timing..................................................................14-4
14-6Control Timing for 5V Operation...........................................................................14-5
NumberTITLE
Page
TPG
MC68HC05T16MOTOROLA
ix
Page 18
THIS PAGE LEFT BLANK INTENTIONALLY
MOTOROLA
x
TPG
MC68HC05T16
Page 19
1
GENERAL DESCRIPTION
The MC68HC05T16 HCMOS microcontroller is a member of the M68HC05 Family of low-cost
single-chip microcontrollers. This 8-bit microcontroller unit (MCU) contains on-chip oscillator,
CPU, RAM, ROM, OSD, M-Bus, PWM, PAC, Timer, A/D converter, I/O and Watchdog Timer.
The MC68HC705T16 is an EPROM version of the MC68HC05T16; it is av ailable in windo wed and
OTP 56-pin SDIP packages. All references to the MC68HC05T16 apply equally to the
MC68HC705T16, unless otherwise stated.
italicized in the text.
1.1Features
•8-bit architecture
References specific to the MC68HC705T16 are
1
•Power saving Stop, Wait modes
•320 bytes of on-chip RAM (64 bytes for stack)
•24064 bytes of on-chip ROM/
•PLL-based, 4-row-buffer On Screen Display (OSD)
•128-character (4K bytes) OSD ROM/
•16-character (512 bytes) dual ported OSD RAM; both readable and writable by CPU
•40 bidirectional I/O lines: 24 dedicated and 16 multiplexed I/O lines; 12 of the 24 dedicated
I/Os and 10 of the 16 multiplexed I/Os are of +12V open-drain type
•Multi-master M-Bus (I
•Timer with TCAP input pin and 2 output compare functions
•Pulse Accumulator (PAC)
•9 channel 7-bit PWM, and single channel 14-bit PWM
This section provides a description of the functional pins and I/O programming of the
MC68HC05T16/
2.1PIN DESCRIPTIONS
MC68HC705T16
microcontroller.
2
PIN NAME
VDD, VSS41, 44
IRQ/VPP38
RESET53
TCAP15
EXTAL, XTAL51, 52
PA0-PA731-24
PB0-PB716-23
56-pin SDIP
PIN No.
DESCRIPTION
Power is supplied to the MCU using these two pins. VDD is power and
VSS is ground.
In the user mode this pin is an external hardware interrupt IRQ. It is
software programmable to provide two choices of interrupt triggering
sensitivity. These options are:
1) negative edge-sensitive triggering only, or
2) both negative edge-sensitive and level sensitive triggering.
In the bootstrap mode on the MC68HC705T16, this is the EPROM
programming voltage input pin.
The active low RESET input is not required for start-up, but can be
used to reset the MCU internal state and provide an orderly software
start-up procedure.
The TCAP input controls the input capture feature for the on-chip
programmable free-running timer.
These pins provide connections to the on-chip oscillator. The
maximum crystal frequency is 4.2 MHz. EXTAL may be driven by an
external oscillator if an external crystal circuit is not used.
These eight I/O lines comprise port A. The state of any pin is software
programmable. All port A lines are configured as input during power
on or external reset.
These eight I/O lines comprise port B. The state of any pin is software
programmable. All port B lines are configured as input during power
on or external reset. These pins are +12V open-drain pins.
TPG
MC68HC05T16MOTOROLA
PIN DESCRIPTIONS AND INPUT/OUTPUT PORTS
2-1
Page 22
2
PIN NAME
PC0-PC740, 39, 37-32
PE0/PWM0 to
PE7/PWM7
PF0-PF76-13
PWM8, PWM96, 7
I, TONE8. 9
ADCIN0, ADCIN114, 10
SDA, SCL11, 12
PACIN13
R, G, B50, 49, 48These are the output pins for OSD R, G, and B videos.
FBKG47
HFBLK, VFBLK45, 46
VCO43
RP42This is an input pin for biasing the internal OSD VCO.
56-pin SDIP
PIN No.
54, 55,56, 1
2, 3, 4, 5
DESCRIPTION
These eight I/O lines comprise port C. The state of any pin is software
programmable. All port C lines are configured as input during power
on or external reset. PC0-3 are push-pull type pins, and PC4-7 are
+12V open-drain pins.
These eight I/O lines comprise port E. The state of any pin is software
programmable. All port E lines are configured as input during power
on or external reset.
These pins become PWM outputs by setting the appropriate bits in
the port E Configuration register ($0C). See Section 2.2.2.
These eight I/O lines comprise port F. The state of any pin is software
programmable. All port F lines are configured as input during power
on or external reset.
Other functions are also shared with these pins, and is selected by
setting the appropriate bits in the port F Configuration register ($0D).
See Section 2.2.2.
PWM channels.
These pins are shared with port pins PF0 and PF1, and are selected
by setting port F Configuration register ($0D) bits 0 and 1 respectively.
The I pin of the OSD module expands the color selection range by
providing an intensity bit.
The HTONE pin is mainly used for creating transparent background
effect when the background of a character window overlaps the
original TV picture display.
These pins are shared with port pins PF2 and PF3.Selection is by the
port F Configuration register ($0D) bits 2 and 3 respectively.
These are the two input channels to the analog to digital converter.
ADCIN1 pin is shared with port PF4, and is selected by setting the
port F Configuration register ($0D) bit 4.
These two pins are the M-Bus interface pins. SDA is the data line, and
SCL is the clock line. These pins are shared with port pins PF5 and
PF6 respectively. Selection is by the port F Configuration register
($0D) bits 5 and 6.
This is the clock/control input to the pulse accumulator.
This pin is shared with port pin PF7. Selection is by the port F
Configuration register ($0D) bit 7.
This is the OSD output pin for blanking out the original TV picture
display so that OSD data can be displayed on the TV screen.
These are the OSD input pins for horizontal and vertical flyback
signals from the TV set chassis. They are used for synchronizing OSD
signals with TV display.
This OSD pin is the phase detector output pin. With a low-pass filter
this pin controls the frequency of the internal OSD VCO.
MOTOROLA
2-2
TPG
MC68HC05T16PIN DESCRIPTIONS AND INPUT/OUTPUT PORTS
Page 23
2.1.1Pin Assignments
PE3/PWM3
PE4/PWM4
PE5/PWM5
PE6/PWM6
PE7/PWM7
PF0/PWM8
PF1/PWM9
PF3/HTONE
PF4/ADCIN1
PF5/SDA
PF6/SCL
PF7/PACIN
ADCIN0
Figure 2-1 Pin Assignments for 56-pin SDIP package
PF2/I
TCAP
PB0
PB1
PB2
PB3
PB4
PB5
PB6
PB7
PA 7
PA 6
PA 5
PA 4
PA 3
PE2/PWM2
PE1/PWM1
PE0/PWM0
RESET
XTAL
EXTAL
R
G
B
FBKG
VFLBK
HFLBK
VSS
VCO
RP
VDD
PC0
PC1
IRQ
/
VPP
PC2
PC3
PC4
PC5
PC6
PC7
PA 0
PA 1
PA 2
2
TPG
MC68HC05T16MOTOROLA
PIN DESCRIPTIONS AND INPUT/OUTPUT PORTS
2-3
Page 24
2
2.2INPUT/OUTPUT PORTS
2.2.1Input/Output Programming
Port A, B, C, E, and F may be programmed as an input or an output under software control. The
direction of the pins is determined by the state of corresponding bit in the port data direction
register (DDR). Each 8-bit port has an associated 8-bit data direction register. Any port A, B, C,
E, or F pin is configured as an output if its corresponding DDR bit is set to a logic one. A pin is
configured as an input if its corresponding DDR bit is cleared to a logic zero. At power-on or reset,
all DDRs are cleared, which configure all port A, B, C, E and F pins as inputs. The data direction
registers are capable of being written to or read by the processor. Refer to Figure 2-2 and
T ab le 2-1. 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 2-1 I/O Pin Functions
R/WDDRI/O Pin Function
00The I/O pin is in input mode. Data is written into the output data latch.
01Data is written into the output data latch and output to the I/O pin.
10The state of the I/O pin is read.
11The I/O pin is in an output mode. The output data latch is read.
2.2.2Port E and F Configuration Registers
Port E and F are shared with PWM, PAC, OSD, MBUS, and ADC. The configuration registers, at
$0C and $0D, are used to configure these I/O pins . The default state after a reset or POR is zero.
Setting the corresponding bits will enable the corresponding functions. For example, setting the
SDA and SCL bits will configure PF5 and PF6 as MBUS interf ace pins, regardless of the settings
in the port F Data Direction register.
Address bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
Port E Configuration Register$0CPWM7 PWM6 PWM5 PWM4 PWM3 PWM2 PWM1 PWM0 0000 0000
Address bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
Port F Configuration Register$0DPACSCLSDA ADC1 HTONEIPWM9 PWM8 0000 0000
MOTOROLA
2-4
State
on reset
State
on reset
MC68HC05T16PIN DESCRIPTIONS AND INPUT/OUTPUT PORTS
TPG
Page 25
DATA DIRECTION
REGISTER BIT
2
INTERNAL
MC68HC05
CONNECTIONS
TYPICAL PORT
DATA DIRECTION REGISTER
TYPICAL PORT REGISTER
I/ O PORT LINES
PORT DATA
PORT DDR
LATCHED OUTPUT
DATA BIT
INPUT
REGISTER
BIT
INPUT I/ O
OUTPUT
(a)
234567
DDR 7DDR 6DDR 5DDR 4DDR 3DDR 2DDR 1DDR 0
Px7Px6Px5Px4
Px3Px2
(b)
V
DD
NOTE:
(1) IP = INPUT PROTECTION
(2) LATCH-UP PROTECTION NOT SHOWN
&
P
PAD
I/ O PIN
01
Px1Px0
+
INTERNAL LOGIC
N
IP
(c)
Figure 2-2 Parallel Port I/O Circuitry
TPG
MC68HC05T16MOTOROLA
PIN DESCRIPTIONS AND INPUT/OUTPUT PORTS
2-5
Page 26
2
THIS PAGE LEFT BLANK INTENTIONALLY
MOTOROLA
2-6
TPG
MC68HC05T16PIN DESCRIPTIONS AND INPUT/OUTPUT PORTS
Page 27
3
MEMORY AND REGISTERS
This section describes the organization of the on-chip memory.
3.1Memory Map
The CPU can address 64K-bytes of memory space. The ROM portion of memory holds the
program instructions, fixed data, user-defined vectors, and interrupt service routines. The RAM
portion of memory holds variable data. I/O registers are memory-mapped so that the CPU can
access their locations in the same way that it accesses all other memory locations. Figure 3-1
shows the Memory Map for the MC68HC05T16/
3.2Input/Output Section
The first 64 addresses of memory space, $0000-$003F, are the I/O section. These are the
addresses of the I/O control registers, status registers, and data registers. Tab le 3-1 shows these
registers and their respective bits.
MC68HC705T16
.
3
3.3RAM
The 320 addresses from $0050-$018F are RAM locations. The CPU uses the 64 RAM addresses,
$00C0-$00FF, as the stack. Before processing an interrupt, the CPU uses five bytes of the stack
to save the contents of the CPU registers. During a subroutine call, the CPU uses two bytes of the
stack to store the return address. The stack pointer decrements during pushes and increments
during pulls.
Note:
MC68HC05T16MOTOROLA
Be careful when using nested subroutines or multiple interrupt levels. The CPU may
overwrite data in the RAM during a subroutine or during the interrupt stacking
operation. Once the stack pointer passes $00C0, it wraps round back to $00FF.
TPG
MEMORY AND REGISTERS
3-1
Page 28
3
$0000
$003F
$0050
$00C0
$00FF
$018F
$0200
$02FF
$0400
$05FF
$8000
$8FFF
$A000
$FDFF
$FE00
$FFDF
$FFE0
$FFEF
$FFF0
$FFFF
I/O
64 Bytes
Reserved
RAM
320 Bytes
Stack
Reserved
OSD RAM
256 Bytes
Reserved
OSD Character RAM
512 Bytes
Reserved
OSD Character
EPROM
ROM/
4096 Bytes
Reserved
User ROM/
EPROM
23.5K Bytes
Self-Check/
Bootstrap
Program
496 Bytes
Self-Check/
Bootstrap
Vectors
16 Bytes
User Vectors
16 Bytes
$FFF0
$FFF2
$FFF4
$FFF6
$FFF8
$FFFA
$FFFC
$FFFE
Por ts
14 Bytes
PAC
2 Bytes
Timer
12 Bytes
MFT
1 Byte
OSD
15 Bytes
PWM
11 Bytes
M-BUS
5 Bytes
ADC
1 Byte
EPROM PCR
1 Byte
RESERVED
2 Bytes
MFT
PAC
M-BUS
TIMER
IRQ
OSD
SWI
RESET
0
63
Port A Data Register
Port B Data Register
Port C Data Register
Reserved
Port E Data Register
Port F Data Register
Port A Direction Register
Port B Direction Register
Port C Direction Register
Reserved
Port E Direction Register
Port F Direction Register
Port E Configuration Register
Port F Configuration Register
PAC Control and Status Register
PAC Data Register
Timer Control Register
Timer Status Register
Timer Input Capture High Register
Timer Input Capture Low Register
The MC68HC05T16 can be reset in three ways: b y the initial power-on reset function, b y an active
low input to the RESET
will cause the program to go to its starting address, specified by the contents of memory locations
$FFFE and $FFFF, and cause the interrupt mask of the Condition Code register to be set.
4.1.1Power-On Reset (POR)
The power-on reset occurs when a positive transition is detected on the supply voltage, VDD. The
power-on reset is used strictly for power-up conditions , and should not be used to detect any drops
in the power supply voltage. There is no provision for a power-down reset. The power-on circuitry
provides for a 4064 tcyc delay from the time that the oscillator becomes active. If the external
RESET
pin is low at the end of the 4064 tcyc time out, the processor remains in the reset condition
until RESET
operate properly prior to the time the 4064 POR cycles have elapsed. If there is doubt, the external
RESET
specified.
goes high. The user must ensure that VDD has risen to a point where the MCU can
pin should remain low until such time that VDD has risen to the minimum operating voltage
pin, and by a COP watchdog timer reset (if enabled). Any of these resets
4
4.1.2RESET Pin
The RESET input pin is used to reset the MCU to provide an orderly software start-up procedure.
When using the external reset, the RESET
RESET
pin contains an internal Schmitt Trigger as part of its input to improve noise immunity.
MC68HC05T16MOTOROLA
RESETS AND INTERRUPTS
pin must stay low for a minimum of 1.5tcyc. The
TPG
4-1
Page 32
4.1.3Computer Operating Properly (COP) Reset
The MCU contains a watchdog timer that automatically times out if not reset (cleared) within a
specific amount of time by a program reset sequence.
4
Note:
COP time-out is prevented by periodically writing a ‘0’ to bit 0 of address $FFF0.
If the watchdog timer is allowed to time-out, an internal reset is generated to reset the MCU.
Because the internal reset signal is used, the MCU comes out of a COP reset in the same
operating mode it was in when the COP time-out was generated.
The watchdog timer is initially disabled after a reset, it is enabled by setting the WDOG bit in the
Multi-Function Timer register (writing a ‘1’ to bit 2 of address $1C); see Section 5.2 for more
details. Once enabled, it cannot be disabled by software.
Table 4-1 shows the internal circuit actions on reset, but not necessary in order of occurrence.
Table 4-1 Reset Action on Internal Circuit
DEFAULT CONDITIONS AFTER RESET
1Timer prescaler reset to zero state
2Timer counter configures to $FFFC
3All timer interrupt enable bits cleared (ICIE, OC0IE, OC1IE, and TOVFIE) to disable timer interrupt
4All data direction registers cleared to zero (default to inputs)
5Port E and port F configured as general purpose I/O ports
6Configure stack pointer to $00FF
7Force internal address bus to the address of reset vector ($FFFE)
8Set interrupt mask bit (I bit) in condition code register to logic one
Listed numbers do not represent order of occurrence.
MOTOROLA
4-2
TPG
MC68HC05T16RESETS AND INTERRUPTS
Page 33
t
VDDR
VDD
1
EXTAL PIN
INTERNAL
2
CLOCK
INTERNAL
ADDRESS
2
BUS
INTERNAL
DATA
2
BUS
RESET
NOTES:
1. EXTAL is not meant to represent frequency. It is only used to represent time.
2. Internal clock, internal address bus, and internal data bus signals are not available externally.
3. Next rising edge of internal clock after rising edge of RESET
VDD THRESHOLD (TYPICALLY 1-2V)
t
oxov
FFFEFFFFNEW PCFFFEFFFEFFFF
t
cyc
NEW
PCL
initiates reset sequence.
NEW
PCH
4064 t
CODE
tRL=1.5t
3
OP
cyc
CYC
PCH
PCL
NEW PC
OP
CODE
4
Figure 4-1 Power-On Reset and RESET Timing
TPG
MC68HC05T16MOTOROLA
RESETS AND INTERRUPTS
4-3
Page 34
4
4.2INTERRUPTS
The MC68HC05T16 is capable of handling eight types of interrupt, seven hardware and one
software. The interrupt mask bit (“I” bit in the Condition Code register), if set, masks all interrupts
except the software interrupt, SWI. Interrupts such as Timer, M-Bus, OSD, and MFT have several
flags which will cause the interrupt. Interrupt flags are found in “read only” status registers, while
their enables are in associated control registers. They are never mix ed in the same register. If the
enable bit is “0”, it masks the interrupt from occurring but does not inhibit the flag from being set.
A reset clears all enable bits. The general sequence for clearing an interrupt is a software
sequence of reading the status register while the flag is set followed by a read or write of an
associated register. When any of these interrupts occur, and if enabled, normal processing is
suspended at the end of the current instruction execution. The state of the machine is pushed onto
the stack (see Figure 4-2 for stacking order) and the appropriate vector points to the starting
address of the interrupt service routine (see T able 4-2). Also , the interrupt mask bit in the condition
code register is set. This masks fur ther interrupts. At the completion of the service routine, the
software normally contains an RTI instruction which, when executed, restores the machine state
and continues executing the interrupted program. Interrupt priority is based on interrupt vector
addresses. The higher the vector addresses, the higher the priority. For example, OSD interrupts
have a higher priority than IRQ
SWI and RESET
.
, TIMER, M-BUS, PAC, and MFT interrupts; but lower priority than
Note:
The interrupt mask bit (I bit) will be cleared if and only if the corresponding bit stored
on the stack is zero.
The following three functions are not strictly interrupts, however, they are tied very closely to the
interrupts. These functions are RESET
, STOP, WAIT.
4
1) RESETThe RESET input pin causes the program to go to its starting
address. This address is specified by the contents of memory
locations $FFFE and $FFFF. The interrupt mask of the condition
code register is also set. Most parts of the MCU is configured to
some known state as described in Table 4-1.
2) STOPThe STOP instruction causes the oscillator to be turned off and
the processor “sleeps” until an e xternal interrupt (IRQ
) or RESET
occurs. See section 12 on Low Power Modes.
3) WAITThe WAIT instruction causes all processor clocks to stop, but
leaves the Timer and PAC clocks running. This “rest” state of the
processor can be exited by RESET
, an external interrupt (IRQ),
or any of the interrupts described above. There are no special
wait vectors for these individual interrupts. See section 12 on
Low Power Modes.
TPG
MC68HC05T16MOTOROLA
RESETS AND INTERRUPTS
4-5
Page 36
4.2.2Software Interrupt (SWI)
The software interrupt is an executable instruction. The action of the SWI instruction is similar to
the hardware interrupts. The SWI is executed regardless of the state of the interr upt mask in the
condition code register. The service routine address is specified by the contents of memory
location $FFFC and $FFFD.
4
4.2.3External Interrupt (IRQ)
The external interrupt IRQ can be software configured for “negative-edge” or “negative-edge and
level” sensitive triggering by the IRQN bit in the Multi-Function Timer register.
1 (set)–Negative edge triggering for IRQ
0 (clear) –Level and negative edge triggering for IRQ.
When the signal of the external interrupt pin, IRQ, satisfies the condition selected, an external
interrupt occurs. The actual processor interrupt is generated only if the interr upt mask bit of the
condition code register is also cleared. When the interr upt is recognized, the current state of the
processor is pushed onto the stack and the interrupt mask bit in the condition code register is set.
This masks further interrupts until the present one is ser viced. The service routine address is
specified by the contents of $FFF8 & $FFF9.
The interrupt logic recognizes negative edge transitions and pulses (special case of negative
edges) on the external interrupt line. Figure 4-3 shows both a block diagram and timing for the
interrupt line (IRQ
spaced far enough apart to be serviced. The minim um time between pulses is equal to the number
of cycles required to execute the interrupt service routine plus 21 cycles. Once a pulse occurs, the
next pulse should not occur until the MCU software has exited the routine (an RTI occurs). The
second configuration shows several interrupt lines wired-OR to perform the interrupt at the
processor. Thus, if the interrupt lines remain low after servicing one interrupt, the next interrupt is
recognized.
) to the processor. The first method is used if pulses on the interrupt line are
only.
State
on reset
Note:
MOTOROLA
4-6
The internal interrupt latch is cleared in the first par t of the service routine; therefore,
one (and only one) external interrupt pulse could be latched during t
as soon as the I bit is cleared.
and serviced
ILIL
MC68HC05T16RESETS AND INTERRUPTS
TPG
Page 37
LEVEL SENSITIVE TRIGGER
IRQ
V
DD
INTERRUPT PIN
IRQ
IRQ
D
Q
C
Q
R
(a) Interrupt Function Diagram
t
ILIH
t
ILIL
t
ILIL
+
&
I BIT (CC)
POWER-ON RESET
+
EXTERNAL RESET
EXTERNAL INTERRUPT
BEING SERVICED
EDGE SENSITIVE TRIGGER
CONDITION
The minimum pulse width t
125ns (V
The period t
the number of tcyc cycles it takes to execute the interrupt service routine plus
21 tcyc cycles.
EXTERNAL
INTERRUPT
REQUEST
is either
=5V) or 250ns (VDD=3V).
DD
should not be less than
ILIL
ILIH
4
LEVEL SENSITIVE TRIGGER
Wired ORed
Interrupt signals
IRQ
CONDITION
if after servicing an interrupt the
external interrupt pins remain low, then
the next interrupt is recognized.
Normally used with wired OR
connection.
(b) Interrupt Mode Diagram
Figure 4-3 External Interrupt Circuit and Timing
TPG
MC68HC05T16MOTOROLA
RESETS AND INTERRUPTS
4-7
Page 38
4.2.4Programmable Timer Interrupt
Four timer interrupt flags are found in the top nibb le of the Timer Status register (TSR) at location
$11. All four interrupts will vector to the same address at location $FFF6-$FFF7.
Each flag bit is defined as follows:
4
Address bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
Timer Status Register$11ICFOC0F OC1FTOF TCAPS0000000 u000
TOF - Timer Overflow Flag
TOF is set during the counter transition of $FFFF to $0000. It is cleared by
reading the TSR (with TOF set) followed by reading the counter least significant
byte ($19).
OC0F, OC1F - Output Compare Flag 1 and Output Compare 2
The appropriate OCF is set when the corresponding Output Compare register
matches the Counter register. It is cleared by reading the TSR (with OCF set)
and then accessing the corresponding Output Compare register least significant
byte ($15 or $17).
ICF - Input Capture Flag
ICF is set when a proper edge has been sensed by the input capture edge
detector. It is cleared by an CPU read of the TSR (with ICF set) followed by
accessing the Input Capture register least significant byte ($13).
All four timer interrupt flags have corresponding enable bits (ICIE, OC0IE, OC1IE, and TOIE)
found in the Timer Control register (TCR) at location $10. Reset clears all enable bits preventing
an interrupt from occurring. The actual processor interrupt is generated only if the interrupt mask
bit of the condition code register is also cleared. When the interrupt is recognized, the current state
of the machine is pushed onto the stack and the interrupt mask bit in the condition code register
is set. This masks further interrupts until the present one is serviced. The service routine address
is specified by the contents of $FFF6 and $FFF7.
State
on reset
Refer to section 5.1 for detailed description of Programmable Timer.
4.2.5M-Bus Interrupts
M-Bus interrupt is enabled when the M-Bus Interrupt Enable bit, MIEN of M-Bus Control register
is set, provided the interrupt mask bit of the condition code register is cleared. There are three
causes of M-Bus interrupt:
MOTOROLA
4-8
MC68HC05T16RESETS AND INTERRUPTS
TPG
Page 39
1) An arbitration lost which is signified by the Arbitration Lost flag, ALOST of
M-Bus Status Register.
2) Addressed as slave which is indicated by the master addressed as slave
flag, SELTED of M-Bus Status Register.
3) Completed transmission or reception of one byte of data. It depends on the
original mode of the M-Bus interface which is determined by the
Transmit/Receive flag, XMT of M-Bus Control Register.
Address bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
M-Bus Status Register$3AMCF SELTED BBSY ALOSTSRWMIF
MCF - Data Transfer Complete Flag
1 (set)–A byte transfer has been completed.
0 (clear) –A byte is being transfer.
SELTED - Addressed as Slave
1 (set)–Currently addressed as a slave.
0 (clear) –Currently not addressed.
When its own specific address (M-Bus Address register) matches the calling address, this bit is
set. An interrupt is generated if the MIEN bit is set. Then CPU needs to check the SRW bit and set
its XMT bit accordingly. Writing to the M-Bus Control register clears this bit.
ALOST - Arbitration Lost
This arbitration lost bit is set by hardware when the M-bus master loses arbitr ation during a master
transmission mode. This bit must be cleared by software.
On entering the interrupt service routine, the M-Bus interrupt flag, MIF of M-Bus Status Register
must be cleared by software.
The interrupt service routine address is specified by the contents of memory location $FFF4 and
$FFF5. Reset disables the whole M-Bus block by clearing the M-Bus Control Register.
RXACKB
State
on reset
1000 0001
4
Refer to Section 6 for detailed description of M-Bus.
TPG
MC68HC05T16MOTOROLA
RESETS AND INTERRUPTS
4-9
Page 40
4.2.6PAC Interrupt
Pulse Accumulator interrupt is enabled when the enable bit, PAIE of PAC Control register is set.
The interrupt service routine address for PAC is specified by the contents of memory location
$FFF2 and $FFF3.
4
Address bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
PACTL$0EPAOF PAEN PAMOD PAIE0000 0000
PAOF - PAC Overflow Interrupt Flag Bit.
1 (set)–A PAC overflow from $FF to $00 has occurred.
0 (clear) –No PAC overflow has occurred.
It is set when the count in the pulse accumulator rolls over from $FF to $00. PAOF is cleared by
writing a “0” to the bit. An interrupt to the CPU is generated if the PAIE bit is set.
Refer to section 7 for detailed description of Pulse Accumulator.
State
on reset
4.2.7OSD Interrupts
There are five OSD interrupt sources, VFLBK bit and R0/1/2/3CF bits of OSD Status register, in
the OSD module. VFLB bit will be set whenever the leading edge of ver tical flyback pin, VFLBK,
has been detected. An interrupt will occur if the corresponding interrupt enable bit, VFINTE, is set.
Whenever each row terminates its display, RiCF bit will be set and an interrupt will be generated
provided that the corresponding interrupt enable bit, RiINTE is set. The interrupt service routine
address is specified by the contents of memory location $FFFA and $FFFB.
Address bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
Frame Control 3 and Status$2B VFINTE MUTE1 MUTE0 VFLB R3CF R2CF R1CF R0CF 0000 0000
1 (set)–Vertical flyback (leading edge) signal detected.
0 (clear) –No Vertical flyback signal detected.
RiCF - Row i display status
1 (set)–Row i display has been terminated.
0 (clear) –Row i display has been not terminated.
Whenever a row display has been terminated, the corresponding RiCF flag will be set along with
update of CDRC3-CDRC0 field.
Refer to section 9 for detailed description of On-Screen Display.
4.2.8Multi-Function Timer Interrupts
There are two different interrupting sources, TOF and RTIF bits of Multi-Function Timer Register,
in this module. The interrupt service routine address is specified by the contents of memory
location $FFF0 and $FFF1.
1 (set)–8-bit ripple timer overflow has occurred.
0 (clear) –No 8-bit ripple timer overflow has occurred.
This bit is set when the 8-bit ripple counter overflows from $FF to $00; a timer overflow interrupt
will occur, if TOFIE (bit 5) is set. TOF is cleared by writing a ‘0’ to the bit.
RTIF - Real Time Interrupt Flag
1 (set)–A real time interrupt has occurred.
0 (clear) –A real time interrupt has not occurred.
A RTIF indicates when the output of the RTI circuit goes active. The clock frequency that drives
the RTI circuit is E/16384 giving a maximum interrupt period of 3.9ms at a bus rate of 4.2MHz. A
CPU interrupt request will be generated if RTIE is set. RTIE is cleared by writing a ‘0’ to the bit.
State
on reset
TPG
MC68HC05T16MOTOROLA
RESETS AND INTERRUPTS
4-11
Page 42
4
TOFIE - Timer Overflow Interrupt Enable
1 (set)–TOF interrupt is enabled.
0 (clear) –TOF interrupt is disabled.
RTIE - Real Time Interrupt Enable
1 (set)–Real time interrupt circuit is active.
0 (clear) –Real time interrupt circuit is inactive.
Refer to section 5.2 for detailed description of Multi-Function Timer.
MOTOROLA
4-12
TPG
MC68HC05T16RESETS AND INTERRUPTS
Page 43
5
TIMERS
5.1PR OGRAMMABLE TIMER
The timer consists of a 16-bit free-running counter driven by a fixed divide-by-four prescaler. This
timer can be used for many purposes, including input waveform measurements while
simultaneously generating an output wav eform. Pulse widths can v ary from sev eral microseconds
to many seconds. Figure 5-1 shows a block diagram for the Programmable Timer.
Because the timer has a 16-bit architecture, the I/O registers for the input capture and output
compare functions are pairs of 8-bit registers (high byte and low byte). Generally, assessing the
low byte of a specific timer function allows full control of that function. However, an access of the
high byte inhibits that specific timer function until the low byte is also accessed.
Note:
Twelve 8-bit registers are associated with the programmable timer.
The I bit in the condition code register should be set while manipulating both the high
and low byte register of a specific timer function to ensure that an interrupt does not
occur.
The key element in the programmable timer is a 16-bit, free-running counter or counter register,
preceded by a prescaler that divides the internal processor clock by four. The prescaler gives the
timer a resolution of 0.95µs if the internal bus clock is 4.2MHz. The counter is incremented during
the low portion of the internal bus clock. Software can read the counter at any time without
affecting its value.
The double-byte, free-running counter can be read from either of two locations, $18 and $19
(counter register) or $1A and $1B (counter alternate register). Reading only the least significant
byte (LSB) of the free-running counter ($19 or $1B) receives the count value at the time of the
read. If the most significant byte (MSB) ($18 or $1A) is read first, the LSB ($19 or $1B) is
transferred to a buffer. This buffer v alue remains fixed after the first MSB read, even if the MSB is
read several times. This buffer is accessed when the LSB ($19 or $1B) is read, and thus,
completes a read sequence of the complete counter value.
Reading the Timer Counter register low byte after reading the timer Status Register clears the
timer overflow flag (TOF), but reading the Counter Alternate register does not affect TOF.
Therefore, the counter alternate register can be read any time without risk of missing timer
overflow interrupts due to a cleared TOF.
The free-running counter is preset to $FFFC during reset and is always a read-only register.
During a power-on reset, the counter is also preset to $FFFC and begins running after the
oscillator start-up delay. The value in the free-running counter repeats every 262144 internal bus
clock cycles. TOF is set when the counter overflows (from $FFFF to $0000); this will cause an
interrupt if TOVFIE (bit 4 of Timer Control register) is set.
5
In some timing control applications it may be desirable to reset the counter under softw are control.
When the low byte of the counter ($19 or $1B) is written to, the counter is set to its reset value of
$FFFC. The divide-by-4 prescaler is also reset and the counter resumes normal counting
operation. All of the flags and enable bits remain unaltered by this operation. If access has
previously been made to the high byte of the free-running counter ($18 or $1A), then the reset
counter operation terminates the access sequence.
Each 16-bit Output Compare register is made up of two 8-bit registers. These Output Compare
registers are used for sev eral purposes, such as indicating when a period of time has elapsed. All
TPG
MC68HC05T16MOTOROLA
TIMERS
5-3
Page 46
5
bits are readable and writable and are not affected b y the timer hardw are or reset. If the compare
function is not needed, the Output Compare registers can be used as storage locations.
The contents of the Output Compare registers are continually compared with the contents of the
free-running counter and, if a match is found, the corresponding output compare flag (OC0F or
OC1F) in the Timer Status register is set. The Output Compare registers’ v alue should be changed
after each successful comparison to establish a new elapsed time-out. An interrupt can also
accompany a successful output compare provided the corresponding interrupt enable bit (OC0IE
or OC1IE) is set. (The free-running counter is updated every four internal bus clock cycles.)
After a processor write cycle to the Output Compare registers containing the MSB ($14 or $16),
the output compare function is inhibited until the LSB ($15 or $17) is also written. The user must
write both bytes (locations) if the MSB is written first. A write made only to the LSB ($15 or $17)
will not inhibit the compare function. The processor can write to either byte of an Output Compare
register without affecting the other byte. The minimum time required to update the Output
Compare registers is a function of the program rather than the internal hardware. Because the
output compare flags and Output Compare registers are not defined at power on, and not affected
by reset, care must be taken when initializing output compare functions with software. The
following procedure is recommended:
1) write to Output Compare register 0 and/or 1 High-byte to inhibit further
compares;
2) read the Timer Status register to initialize clearing of OC0F or/and OC1F;
3) write to Output Compare register 0 or/and 1 Low-byte to enable the output
compare function.
‘Input Capture’ is a technique whereby an external signal (connected to TCAP pin) is used to
trigger a read of the free-running counter. In this way it is possib le to relate the timing of an external
signal to the internal counter value, and hence to elapsed time.
The two 8-bit registers that make up the 16-bit input capture register , are read-only, and are used
to latch the value of the free-running counter after the corresponding input capture edge detector
senses a valid transition. The level transition that triggers the counter transfer is defined by the
corresponding input edge bit (IEDG). Reset does not affect the contents of the input capture
register.
The result obtained from an input capture will be one greater than the value of the free-running
counter on the rising edge of the internal bus clock preceding the external transition. This delay is
required for internal synchronization. Resolution is one count of the free-running counter , which is
four internal bus clock cycles.
The free-running counter contents are transferred to the input capture register on each valid signal
transition whether the input capture flag (ICF) is set or clear. The input capture register always
MOTOROLA
5-4
MC68HC05T16TIMERS
TPG
Page 47
contains the free-running counter value that corresponds to the most recent input capture.After a
read of the input capture register MSB ($12), the counter transfer is inhibited until the LSB ($13)
is also read. This characteristic causes the time used in the input capture software routine and its
interaction with the main program to determine the minimum pulse period. A read of the input
capture register LSB ($13) does not inhibit the free-running counter transfer since they occur on
opposite edges of the internal bus clock.
5.1.4Timer Control Register (TCR)
Addressbit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
$10ICIEOC0IEOC1IE TOVFIEIEDG0000 0000
The TCR is a read/write register containing five control bits . F our bits control interrupts associated
with each of the four flag bits found in the Timer Status register. The other bit controls which edge
is significant to the input capture edge detector. The Timer Control register and the free-running
counter are the only sections of the timer affected by reset.
1 (set)–TCAP is positive-going edge sensitive.
0 (clear) –TCAP is negative-going edge sensitive.
TPG
MC68HC05T16MOTOROLA
TIMERS
5-5
Page 48
When IEDG is set, a positive-going edge on the TCAP pin will trigger a transfer of the free-running
counter value to the input capture registers. When clear, a negative-going edge triggers the
transfer.
5.1.5Timer Status Register (TSR)
5
Addressbit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
$11ICFOC0FOC1FTOFTCAPS0000 u000
The Timer Status register contains the status bits for the above four interrupt conditions - ICF,
OC0F, OC1F, TOF.
Accessing the timer status register satisfies the first condition required to clear the status bits. The
remaining step is to access the register corresponding to the status bit.
ICF - Input Capture Flag
1 (set)–A valid input capture has occurred.
0 (clear) –No input capture has occurred.
This bit is set when the selected polarity of edge is detected by the input capture edge detector;
an input capture interrupt will be generated, if ICIE is set, ICF is cleared by reading the TSR and
then the Input Capture Low register ($13)
OC0F - Output Compare 0 Flag
1 (set)–A valid output compare has occurred on output compare 0 register.
0 (clear) –No output compare has occurred on output compare 0 register.
OC0F will be set when its output compare 0 register contents match that of the free-running
counter; an output compare interrupt will be generated, if OC0IE is set. OC0F is cleared by
reading the TSR and then the Output Compare 0 Low register ($15).
State
on reset
OC1F - Output Compare 1 Flag
1 (set)–A valid output compare has occurred on output compare 1 register.
0 (clear) –No output compare has occurred on output compare 1 register.
OC0F will be set when its output compare 1 register contents match that of the free-running
counter; an output compare interrupt will be generated, if OC1IE is set. OC1F is cleared by
reading the TSR and then the Output Compare 1 Low register ($17).
MOTOROLA
5-6
MC68HC05T16TIMERS
TPG
Page 49
TOF - Timer Overflow Flag
1 (set)–Timer Overflow has occurred.
0 (clear) –No timer overflow has occurred.
This bit is set when the free-running counter overflows from $FFFF to $0000; a timer overflow
interrupt will occur, if TOIE (bit 5 in Timer Control register $10) is set. TOF is cleared by reading
the TSR and the counter low register ($19).
When using the timer overflow function and reading the free-running counter at random times to
measure an elapsed time, a problem may occur whereb y the timer o v erflo w flag is unintentionally
cleared if:
1) the timer status register is read or written when the TOF is set, and
2) the LSB of the free-running counter is read, but not for the purpose of
servicing the flag.
Reading the alternate counter register instead of the counter register will avoid this potential
problem.
TCAPS - Timer Capture State
1 (set)–TCAP pin is a logic high.
0 (clear) –TCAP pin is a logic low.
This bit reflects the logic level at the TCAP pin.
5
5.1.6Programmable Timer Timing Diagrams
The relationships between the internal clock signals, the counter contents and the status of the
flag bits are shown in the following diagr ams. It should be noted that the signals labelled ‘internal’
(processor clock, timer clocks and Reset) are not available to the user.
TPG
MC68HC05T16MOTOROLA
TIMERS
5-7
Page 50
INTERNAL
PROCESSOR
CLOCK
INTERNAL
RESET
T00
5
INTERNAL
CLOCKS
(external or end of POR)
INTERNAL
T01
TIMER
T10
T11
COUNTER
(16 BIT)
RESET
Notes:
RESET affects only the Counter register and Timer Control register.
INTERNAL
PROCESSOR
CLOCK
T00
T01
TIMER
CLOCKS
T10
T11
COUNTER
(16 BIT)
$FFFC$FFFD$FFFE$FFFF
Figure 5-2 Timer State Timing Diagram for Reset
$F123$F124$F125$F126$F127
INPUT
EDGE
(SEE NOTE)
INTERNAL
CAPTURE
LATCH
INPUT
CAPTURE
REGISTER
INPUT
CAPTURE
FLAG
Note:
If the input edge occurs in the shaded area from one timer state T10 to the other timer state T10
the input capture flag is set during the next state T11.
Figure 5-3 Timer State Timing Diagram for Input Capture
MOTOROLA
5-8
$F125$????
TPG
MC68HC05T16TIMERS
Page 51
INTERNAL
PROCESSOR
CLOCK
T00
INTERNAL
CLOCKS
OUTPUT COMPARE
COMPARE REGISTER
OUTPUT COMPARE
Flag and TCMP1, 2
Note:
PROCESSOR
T01
TIMER
T10
T11
COUNTER
(16 BIT)
REGISTER
LATCH
1. The CPU write to the compare registers may take place at any time, but a compare only occurs at
the timer state T01. Thus a 4-cycle difference may exist between the write to the compare register
and the actual compare.
2. The output compare flag is set at the timer state T11 that follows the comparison match ($F547 in
this example).
INTERNAL
CLOCK
T00
$F455$F456$F457$F458$F459
Note 1
CPU writes $F457
Note 1
Note 2
$F457
Figure 5-4 Timer State Timing Diagram for Output Compare
5
INTERNAL
Note:
T01
TIMER
CLOCKS
T10
T11
COUNTER
(16 BIT)
TIMER
OVERFLOW
FLAG (TOF)
The TOF bit is set at timer state T11 (transition of counter from $FFFF to $0000).
It is cleared by a read of the timer status register during the internal processor
clock high time followed by a read of the counter low register.
The MFT provides miscellaneous function to the MC68HC05T16 MCU. It includes a timer ov erflow
function, real-time interrupt, and COP watchdog. The external interrupt (IRQ
also set by this Multi-Function Timer register.
The clock base for this module is derived from the b us clock divided by f our . For a 4.2MHz E (CPU)
clock, the clock base is 1.05 MHz. This clock base is then divided by an 8-stage ripple counter to
generate the timer overflow. Timer overflow rate is thus E/1024. The output of this 8-stage ripple
counter then drives a 4-stage divider to generate real time interrupt. Hence , the clock base f or real
time interrupt is E/16384. Real time interrupt rate is selected by R T0 and RT1 bits of Multi-Function
Timer register. The interrupt rates are E/16384, (E/16384)/2, (E/16384)/4, and (E/16384)/8. The
selected real time interrupt rate is then divided by 8 to generate COP reset.
Register bit definitions:
TOF - Timer Overflow
1 (set)–8-bit ripple timer overflow has occurred.
0 (clear) –No 8-bit ripple timer overflow has occurred.
This bit is set when the 8-bit ripple counter overflows from $FF to $00; a timer overflow interrupt
will occur, if TOFIE (bit 5) is set. TOF is cleared by writing a ‘0’ to the bit.
) triggering option is
State
on reset
RTIF - Real Time Interrupt Flag
1 (set)–A real time interrupt has occurred.
0 (clear) –A real time interrupt has not occurred.
When RTIF is set, a CPU interrupt request is generated if RITE is set. The clock frequency that
drives the RTI circuit is E/16384 giving a maximum interrupt period of 3.9ms at a bus rate of
4.2MHz. RTIF is cleared by writing a “0” to the bit.
TOFIE - Timer Overflow Interrupt Enable
1 (set)–TOF interrupt is enabled.
0 (clear) –TOF interrupt is disabled.
RTIE - Real Time Interrupt Enable
1 (set)–Real time interrupt is enabled.
0 (clear) –Real time interrupt is disabled.
MOTOROLA
5-10
MC68HC05T16TIMERS
TPG
Page 53
IRQN - IRQ Pin Trigger Option
1 (set)–Negative edge triggering for IRQ only.
0 (clear) –Level and negative edge triggering for IRQ.
The COP (Computer Operating Properly) watchdog timer function is implemented by using the
output of the Multi-Function Timer counter. The minimum COP reset rates are controlled by RT0
and RT1 of Multi-Function Timer register. If the COP circuit times out, an internal reset is
generated and the reset vector is fetched (at $FFFE & $FFFF). Preventing a COP time-out is
achieved b y writing a ‘0’ to bit 0 of address $FFF0. The COP counter has to be cleared periodically
by software with a period less than COP reset rate.
5
Watchdog timer function will stop counting in Wait and Stop modes. Counting continues when it
wakes up from Wait mode, and a 4064 cycle delay after waking up from Stop mode.
The watchdog counter system is controlled by the WDOG bit in the Multi-Function Timer register
(bit 2 of address $1C). After power-on or external reset the watchdog system is disabled. Writing
a “1” to the WDOG bit will enable the watchdog system and the counter starts counting. Once
enabled, the watchdog system cannot be disabled by software. Writing a “0” to bit 0 of address
$FFF0 will reset watchdog counter to prevent a watchdog time-out.
RT0 and RT1 should only be changed immediately after COP watchdog timer has been reset.
MC68HC05T16MOTOROLA
Minimum COP reset period
E clock = 4.2MHz
TIMERS
RTI period
E clock = 4.2MHz
TPG
5-11
Page 54
5
THIS PAGE LEFT BLANK INTENTIONALLY
MOTOROLA
5-12
TPG
MC68HC05T16TIMERS
Page 55
6
M-BUS SERIAL INTERFACE
M-Bus (Motorola Bus) is a two-wire, bidirectional serial bus which provides a simple, efficient w a y
for data exchange between devices. It is fully compatible with the I
bus minimizes the interconnection between devices and eliminates the need for address
decoders; resulting in less PCB traces and economic hardware structure. This bus is suitable for
applications requiring communications in a short distance among a number of devices. The
maximum data rate is 100Kbit/s. The maximum comm unication length and number of de vices that
can be connected are limited by a maximum bus capacitance of 400pF.
The M-Bus system is a true multi-master bus, including arbitration to prevent data collision if two
or more masters intend to control the bus simultaneously. It may be used for rapid testing and
alignment of end products via external connections to an assembly-line computer.
2
C bus standard. This two-wire
6.1M-Bus Interface Features
•Compatible with I2C bus standard
•Multi-master operation
•32 software programmable serial clock frequencies
•Software selectable acknowledge bit
•Interrupt driven byte-by-byte data transfer
•Arbitration lost driven interrupt with automatic mode switching from master to slave
6
•Calling address identification interrupt
•Generate/detect the start, stop and acknowledge signals
•Repeated START signal generation
•Bus busy detection
TPG
MC68HC05T16MOTOROLA
M-BUS SERIAL INTERFACE
6-1
Page 56
Control registerStatus register
MEN MIEN MSTR XMT ACKEBMCF SELTED BBSY LOSTSRW MIF RXACKB
Interrupt
M-Bus
interrupt
Internal bus
Frequency
divider
register
Address
register
Address
comparator
8
6
M-Bus clock
START, STOP
detector and
arbitration
generator
sync logic
START, STOP
generator and
timing sync
SCL
SDA
SCL
control
SDA
control
Figure 6-1 M-Bus Interface Block Diagram
6.2M-Bus Protocol
Normally, a standard communication is composed of four parts,
1) START signal,
2) slave address transmission,
3) data transfer, and
4) STOP signal.
TX shift
register
TX
control
RX shift
register
RX
control
They are described briefly in the following sections and illustrated in Figure 6-2.
MOTOROLA
6-2
TPG
MC68HC05T16M-BUS SERIAL INTERFACE
Page 57
MSBLSBMSBLSB
SCL
SDA
SCL
SDA
1010001110100011
Acknowledge bitNo acknowledge
START signalSTOP signal
MSBLSBMSBLSB
1010001110100011
Acknowledge bitNo acknowledge
6
START signalSTOP signal
repeated START signal
Figure 6-2 M-Bus Transmission Signal Diagram
6.2.1START Signal
When the bus is free, i.e., no master device is occupying the bus (both SCL and SDA lines are at
logic high), a master may initiate communication by sending a START signal. As shown in
Figure 6-2, a START signal is defined as a high to low transition of SDA while SCL is high. This
signal denotes the beginning of a new data transfer (each data transf er ma y contain se v er al bytes
of data) and wakes up all slaves.
6.2.2Slave Address Transmission
The first byte of data transfer immediately following the START signal is the slave address
transmitted by the master . This is a seven bits long calling address followed b y a R/W
bit dictates the slave of the desired direction of data transfer.
Only the slave with matched address will respond by sending back an acknowledge bit by pulling
the SDA low at the 9th clock; see Figure 6-2.
bit. The R/W
TPG
MC68HC05T16MOTOROLA
M-BUS SERIAL INTERFACE
6-3
Page 58
6
6.2.3Data Transfer
Once a successful slave addressing is achieved, the data transfer can proceed byte by byte in a
direction specified by the R/W
Each data byte is 8 bits long. Data can be changed only when SCL is low and m ust be held stable
when SCL is high as shown in Figure 6-2. One clock pulse is for one bit of data transfer, MSB is
transferred first. Each data byte has to be followed by an acknowledge bit. Hence, one complete
data byte transfer requires 9 clock pulses.
If the slave receiver does not acknowledge the master, the SDA line should be left high by the
slave, the master can then generate a STOP signal to abor t the data transfer or a START signal
(repeated START) to commence a new calling.
If the master receiver does not acknowledge the slave transmitter after one byte transmission, it
means an “end of data” to the slave. The slave shall release the SDA line for the master to
generate STOP or START signal.
bit sent by the calling master.
6.2.4Repeated START Signal
As shown in Figure 6-2, a repeated START signal is to generate a START signal without first
generating a STOP signal to terminate the communication. This is used by the master to
communicate with another slave or with the same slave in a different mode (transmit/receive
mode) without releasing the bus.
6.2.5STOP Signal
The master can terminate the communication by generating a STOP signal to free the bus.
However, the master may generate a START signal followed by a calling command without
generating a STOP signal first. This is called repeat START. A STOP signal is defined as a low to
high transition of SDA while SCL is at a logical high; See Figure 6-2.
6.2.6Arbitration Procedure
This interface circuit is a true multi-master system which allows more than one master to be
connected. If two or more masters try to control the bus at the same time , a clock synchronization
procedure determines the bus clock. The clock low period is equal to the longest clock low period
among the masters; and the clock high period is the shortest among the masters. A data
arbitration procedure determines the priority. A master will lose arbitration if it transmits a logic “1”
while the others transmit logic “0”, the losing master will immediately switch over to slave receive
mode and stops its data and clock outputs. The transition from master to slave mode will not
generate a STOP condition. Meanwhile, a software bit will be set by hardware to indicate loss of
arbitration.
MOTOROLA
6-4
MC68HC05T16M-BUS SERIAL INTERFACE
TPG
Page 59
6.2.7Clock Synchronization
Since wire-AND logic is performed on the SCL line, a high to low transition on SCL line will aff ect
the devices connected to the bus. The devices start counting their low period and once a device's
clock has gone low, it will hold the SCL line low until the clock high state is reached. Howe v er, the
change of low to high in this device clock may not change the state of the SCL line, if another
device clock is still in its low period. Therefore synchronized clock SCL will be held low by the
device which releases SCL to a logic high in the last place. Devices with shorter low periods enter
a high wait state during this time (See Figure 6-3). When all devices concerned have counted off
their low period, the synchronized clock SCL line will be released and go high. All of them will start
counting their high periods. The first device to complete its high period will again pull the SCL line
low .
WAIT
SCL1
SCL2
SCL
Internal counter reset
Figure 6-3 Clock Synchronization
Start counting high period
6.2.8Handshaking
The clock synchronization mechanism can be used as a handshake in data transf er. Slave device
may hold the SCL low after completion of one byte transfer (9 bits). In such case, it will halt the
bus clock and force the master clock in a wait state until the slave releases the SCL line.
6
6.3M-Bus Registers
There are five registers used in the M-Bus interface, these are discussed in the following
paragraphs.
TPG
MC68HC05T16MOTOROLA
M-BUS SERIAL INTERFACE
6-5
Page 60
6.3.1M-Bus Address Register (MADR)
6
Addressbit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
$37ADR7ADR6ADR5ADR4ADR3ADR2ADR10000 0000
State
on reset
ADR1-ADR7 are the slave address bits of the M-Bus module.
6.3.2M-Bus Clock Register (MCKR)
Addressbit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
$38MBC4MBC3MBC2MBC1MBC00000 0000
MBC0-MBC4 are used for clock rate selection. The serial bit clock frequency is equal to the CPU
clock divided by the divider shown in Table 6-1.
This bit enables the MIF (in MSR) for M-Bus interrupts.
MSTR - Master/Slave Select Bit
1 (set)–M-Bus is set for master mode operation.
0 (clear) –M-Bus is set for slave mode operation.
Upon reset, this bit is cleared. When this bit is changed from 0 to 1, a START signal is generated
on the bus, and the master mode is selected. When this bit is changed from 1 to 0, a STOP signal
is generated and the operation mode changes from master to slave. In master mode, a bit clear
immediately followed b y a bit set of this bit generates a repeated START signal without generating
a STOP signal.
State
on reset
6
XMT - Transmit/Receive Mode Select Bit
1 (set)–M-Bus is set for transmit mode.
0 (clear) –M-Bus is set for receive mode.
ACKEB - Acknowledge Enable Bit
1 (set)–Do not send acknowledge signal.
0 (clear) –Send acknowledge signal at 9th clock bit.
If cleared, an acknowledge signal will be sent out to the bus at the 9th cloc k bit after receiving one
byte of data. If set, no acknowledge signal response. This is an active low control bit.
TPG
MC68HC05T16MOTOROLA
M-BUS SERIAL INTERFACE
6-7
Page 62
6.3.4M-Bus Status Register (MSR)
6
Addressbit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
$3AMCFSELTED BBSYALOSTSRWMIFRXACKB 1000 0001
The MIF and ALOST bits are software clearable; while the other bits are read only.
MCF - Data Transfer Complete Flag
1 (set)–A byte transfer has been completed.
0 (clear) –A byte is being transfer.
When MCF is set, the MIF (M-bus interrupt) bit is also set. An M-bus interrupt is generated if the
MIEN bit is set.
SELTED - Addressed as Slave Bit
1 (set)–Currently addressed as a slave.
0 (clear) –Not currently addressed.
This SELTED bit is set when its own specific address (M-Bus Address register) matches the
calling address. When SELTED is set, the MIF (M-bus interrupt) bit is also set. An interrupt is
generated if the MIEN bit is set. Then CPU needs to check the SRW bit and set its XMT bit
accordingly. Writing to the M-Bus Control register clears this bit.
BBSY - Bus Busy Bit
State
on reset
1 (set)–M-Bus busy.
0 (clear) –M-Bus idle.
This bit indicates the status of the bus. When a START signal is detected, BBSY is set. If a STOP
signal is detected, it is cleared.
This arbitration lost flag is set when the M-bus master loses arbitration during a master
transmission mode. When ALOST is set, the MIF (M-bus interrupt) bit is also set. This bit must be
cleared by software.
MOTOROLA
6-8
MC68HC05T16M-BUS SERIAL INTERFACE
TPG
Page 63
SRW - Slave R/W Select
1 (set)–Read from slave, from calling master.
0 (clear) –Write to slave from calling master.
When SELTED is set, the R/W command bit of the calling address sent from the master is latched
into this SRW bit. By checking this bit, the CPU can then select slave transmit/receive mode by
configuring XMT bit of the M-Bus Control register.
MIF - M-Bus Interrupt Flag
1 (set)–A M-Bus interrupt has occurred.
0 (clear) –A M-Bus interrupt has not occurred.
When this bit is set, an interrupt is generated to the CPU if MIEN is set. This bit is set when one
of the following events occurs:
1) Completion of one byte of data transfer . It is set at the falling edge of the 9th
clock - MCF set.
2) A match of the calling address with its own specific address in slave receive
mode - SELTED set.
3) A loss of bus arbitration - ALOST set.
This bit must be cleared by software in the interrupt routine.
RXACKB - Receive Acknowledge Bit
1 (set)–No acknowledgment signal detected.
0 (clear) –Acknowledgment signal detected after 8 bits data transmitted.
If cleared, it indicates an acknowledge signal has been received after the completion of 8 bits data
transmission on the bus. If set, no acknowledge signal has been detected at the 9th clock. This is
an active low status flag.
6.3.5M-Bus Data I/O Register (MDR)
Addressbit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
$3BMD7MD6MD5MD4MD3MD2MD1MD0uuuu uuuu
In master transmit mode, data written into this register is sent to the bus automatically, with the
most significant bit out first. In master receive mode, reading of this register initiates receiving of
the next byte data. In slave mode, the same function applies after it has been addressed.
State
on reset
6
TPG
MC68HC05T16MOTOROLA
M-BUS SERIAL INTERFACE
6-9
Page 64
6
THIS PAGE LEFT BLANK INTENTIONALLY
MOTOROLA
6-10
TPG
MC68HC05T16M-BUS SERIAL INTERFACE
Page 65
7
PULSE ACCUMULATOR
The Pulse Accumulator is an 8-bit counter that can operate in either of two modes; e vent counting
mode and the gated time accumulation mode. The operating mode is selected by a control bit in
the Pulse Accumulator Control register.
In the event counting mode, the 8-bit counter is clocked by the signal on the PACIN pin. The
maximum clocking rate for the external counting mode is E (CPU) clock divided by two.
In the gated time accumulation mode, the 8-bit counter is driven by E clock divided by 64. The
counter will increment when PACIN pin is high and halt when PACIN is low.
7.1Pulse Accumulator Registers
Two registers are associated with the Pulse Accumulator; they are described below.
7.1.1PAC Control and Status Register (PACTL)
7
Addressbit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
$0EPAOFPAENPAMODPAIE0000 0000
Register bit definitions:
PAOF - PAC Overflow Interrupt Flag Bit.
1 (set)–A PAC overflow from $FF to $00 has occurred.
0 (clear) –No PAC overflow has occurred.
It is set when the count in the pulse accumulator rolls over from $FF to $00. PAOF is cleared by
writing a “0” to the bit. An interrupt to the CPU is generated if the PAIE bit is set.
MC68HC05T16MOTOROLA
PULSE ACCUMULATOR
State
on reset
TPG
7-1
Page 66
PAEN - PAC Enable Bit
1 (set)–Pulse Accumulator enabled.
0 (clear) –Pulse Accumulator disabled. PAC counter register is also cleared.
This PAIE bit enables interrupt caused by the PAOF bit.
7.1.2PAC Counter Register
7
Addressbit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
$0FPAD7PAD6PAD5PAD4PAD3PAD2PAD1PAD00000 0000
When PAC is disabled (PAEN= 0), the counter will be cleared to zero. This ensures the Counter
starts from zero every time it is disabled and enabled.
The Pulse Accumulator Counter is read only and resets to zero a write operation.
State
on reset
MOTOROLA
7-2
TPG
MC68HC05T16PULSE ACCUMULATOR
Page 67
8
PULSE WIDTH MODULATOR
The MC68HC05T16 has 10 PWM channels, with output pins shared with port E and port F pins.
Nine 7-bit channels are driven by the Timer clock, the other single 14-bit channel is driven by the
CPU clock. All PWM outputs are +12V open-drain type; therefore a pull-up resistor is required at
each PWM pin.
8.17-Bit PWM Channels
The 7-bit PWM system works in conjunction with the 16-bit free running timer to implement nine
channels of conversion. A PWM register is allocated for each PWM channel. Channels PWM0 to
PWM8, located at $2C to $34 respectively. Each 7-bit PWM data register has the same bit
structure as shown below:
The driving clock for the 7-bit PWM channels is the 16-bit free-running timer clock divide by 2. For
a 2.1MHz CPU clock, PWM clock = 2.1MHz/4/2 = 262500Hz. The PWM pulse period is
128 x 1/262500Hz = 487.62µs, i.e. a repetition frequency of 2050.8Hz. The duty cycle is
proportional to the value in the corresponding PWM data register. A value of $00 loaded into these
registers results in a continuously low output on the corresponding PWM output pin with external
pull-up resistor connected. A v alue of $40 results in a 50% duty cycle output. The maximum value
of $7F results in a 127/128 duty cycle output.
Changes to the value in the PWM registers will only become effective after the end of the current
PWM cycle. This prevents erroneous PWM output during value update.
In Stop mode, the oscillator is stopped asynchronously with PWM operation. As a consequence,
the PWM output will remain at the state at the moment when the oscillator is stopped. The PWM
output might be at its high or low state at that moment, and it remains at that state until Stop mode
MC68HC05T16MOTOROLA
PULSE WIDTH MODULATOR
State
on reset
TPG
8-1
Page 68
PWM value
$00
$01
487.62µs
128T
T
127T
8
$40
$7F
T = PWM clock period = 2 Timer clock periods = 8 CPU clock periods =3.81µs if MCU runs at 2.1MHz
64T64T
127T
Figure 8-1 7-Bit PWM Output Waveform
is exited. After Stop mode is e xited, the PWM output resumes its unfinished portion of the stopped
cycle. In Wait mode, the oscillator is running even though the CPU clock is not present, the PWM
outputs are not affected.
Note:
Since the 7-bit PWM module uses the 16-bit free-running timer counter, PWM outputs
will be affected when the counter is being reset.
8.214-Bit PWM Channel
The output wavef orm of the 14-bit PWM channel is controlled by an 8-bit and a 6-bit register . Each
register can be viewed as configuring its own waveform; the final PWM output waveform is a
combination of the two wavefor ms (waveforms are ORed). The driving clock for the 14-bit PWM
channels is CPU clock.
The 8-bit register works in the same way as the 7-bit PWMs. That is, the value set in this 8-bit
register determines the basic duty cycle of the waveform. A value of $00 results in a continuously
MOTOROLA
MC68HC05T16PULSE WIDTH MODULATOR
8-2
TPG
Page 69
low cycle. A value of $7F results in a 50% duty cycle. The maximum value of $FF results in a
255/256 duty cycle. The 14-bit PWM period is 256x0.476µs=121.9µs for a CPU clock of 2.1MHz.
The 6-bit register acts as a binary rate multiplier (BRM). The v alue set in this register (powers of 2)
equals the number of pulses (pulse width equals to the PWM driving clock cycle) equally
distributed in a 64-PWM-cycle. A maxim um value of $2x will have 32 pulses equally distributed in
64 PWM cycles (64 cycles has a period of 64x121.9µs=7.8ms).
Combining the 8-bit PWM together with the 6-bit BRM, the total average duty cycle at the output
will be (M+N/64)/256, where M is the content of the 8-bit high-order register, and N is the content
of the 6-bit low-order register. Using this mechanism, a true 14-bit resolution PWM is achieved.
Figure 8-2 shows the waveform for the 14-bit PWM channel. Note that the resulting waveform is
periodic on every 64 PWM cycles.
256T
M= $00
T
M= $01
255T
M= $7F
M= $FF
T= 1 CPU clock period (0.476µs if CPU clock= 2.1MHz)
M = value set in 8-bit PWM register (address $36)
N = value set in 6-bit binary rate multiplier (address $35)
NPWM cycles where pulses are inserted in a 64-cycle frame
Pulse inserted at end of PWM cycle
depends on setting of N.
128T
T
Number of inserted
pulses in a 64-cycle
Figure 8-2 14-Bit PWM Output Waveform
TPG
MC68HC05T16MOTOROLA
PULSE WIDTH MODULATOR
8-3
8
Page 70
8
In order to prevent transient noise at the output during MCU write to the 8-bit PWM and 6-bit BRM
registers, double buffering is used. Programming of the 2 registers must follow the sequence as
shown below:
LDA BRM_value
STA $35;Data put in 6-bit BRM buffer
LDA PWM_value
STA $36;Load 6-bit BRM and 8-bit PWM register
The instruction STA $35 simply puts the 6-bit BRM data in a buffer. Output is not affected at this
time. The instruction STA $36, then, puts the total 14-bit data to BRM and PWM register at the
same time. Output wa vef orm will change accordingly starting from the beginning of the next PWM
cycle.
MOTOROLA
8-4
TPG
MC68HC05T16PULSE WIDTH MODULATOR
Page 71
9
ON-SCREEN DISPLAY
9.1Introduction
The PLL-based On-Screen Display module displays programmable number of rows of symbols,
be them characters or graphic symbols, either in a 16x16 dot matrix or in a 12x16 dot matrix over
a full TV screen. It supports double scan mode for TV broadcast systems which implement
non-interlaced scan broadcast. In double scan mode, each horizontal line in the character dot
matrix will be displayed twice. Users have to determine if the target TV system is an interlaced or
non-interlaced TV system. Auto TV system detection is not implemented.
The essence of this OSD module consists of four row buff ers for displa ying screen characters; with
each row buffer having its own vertical position registers. Row buffers are refreshed if more than
four rows of displa y are required. The PLL enables the OSD to adapt to any shift or change in the
incoming horizontal flyback frequency. Frame display fade-in and fade-out features are supported
for smooth display appearance and disappearance.
Besides the 128-character ROM/EPROM f or fixed character patterns, there is a 16-character RAM
for user defined patterns. This character RAM can be written and read by the CPU, but read-only
by the OSD hardware. Since the contents of this character RAM can be changed during run-time,
the user can have a large number of character sets stored in internal ROM, or in external
ROM/EPROM/EEPROMs and have them load in via the M-bus.
9
The character dot matrix can be programmed to be either 12x16 or 16x16. Mixture of character
dot matrices is not permissible on a row. There is no space between adjacent character dot
matrices. The 12 x16 dot matrix is mainly used for English-type characters; whereas the 16x16
dot matrix is mainly used for character sets requiring bigger dot matrix to create legible fonts, such
as Korean, Chinese, and Kanji. Each row buffer can display 32 characters for a 12x16
configuration, and 24 characters for a 16x16 configuration.
Character blinking, black-edge (bordering or shadowing), and background color features are
supported. Background and blinking features are on per character basis; whereas bordering
feature is on per row basis. Users have to be careful while designing their character fonts so that
bordering effect is not nullified between adjacent characters in the same row or in two consecutiv e
rows.
TPG
MC68HC05T16MOTOROLA
ON-SCREEN DISPLAY
9-1
Page 72
The video mute function, when enabled, blocks off all TV video signals; but OSD signals remain.
This feature can be used when, for example, the selected channel does not have any valid
broadcast signals. Rather than displaying snow flakes on the screen, the OSD mute function can
be activated to cover up the sno w flak es and replace them b y one of three color selections: black,
green or blue. Video mute can be synchronized with vertical flyback signal so that muting always
occurs on vertical flyback boundary to avoid inconsistent display in the same display field, be it
even or odd. To facilitate this, OSD interrupt activated by the leading edge of vertical flyback is
implemented. Whenever the video mute function is activated, fast blanking signal will be
constantly activated until video mute function is deactivated. As a result, half tone feature is
disabled while video mute is activated.
Ten pins are used for the OSD module; HFLBK, VFLBK, VCO, RP, FBKG, R, G, B, I, and HTONE.
The I and HTONE pins are shared with port PF2 and PF3 respectively. HTONE (half tone) is used
to create transparent background effect on the screen.
OSD registers are divided into four groups; with characters register group defining individual
character features, frame register group defining frame features, row register group defining
individual row features, and finally status register carrying the status of the whole OSD module.
9.2Features
Frame/Row Features
•PLL-based clock source
9
•Four display row buffers
•Programmable R/G/B, I, fast b lanking, and half tone output polarity and H/V sync input polarity
•Programmable row V and frame H start positions
•12x16 or 16x16 character dot matrix selection on per row basis
•32 (12x16 dot matrix) or 24 (16x16 dot matrix) symbols per row
•8 common color palettes for both symbol color and background color
•16 color selections per palette
•Frame fade in and fade out feature for smooth display appearance and disappearance
•Four row character size selections: 1Hx1V, 2Hx2V, 3Hx3V, and 4Hx4V
•Row character black-edge features: bordering or shadowing
•Double scan mode support for non-interlaced scan TV system
•Half tone capability for creating transparent background effect
•Video mute. Three color selections for video mute: black, green, and blue
MOTOROLA
9-2
MC68HC05T16ON-SCREEN DISPLAY
TPG
Page 73
•Interrupt on the leading edge of vertical flyback signal
Character Features
•128-character ROM/EPROM plus 16-character RAM. Character RAM is dual ported
•Character attribute is on per character basis
•Individually controllable character background
•Character blinking with four blinking rates
9.3Characters
Characters are stored in a 128-character ROM and a 16-character RAM. The 128 pairs of
character registers are equally allocated for the 4 row buffers, each have 32 pairs. Each pair of
character registers consists of the Character Code register and the Character Attribute register.
The Character Code register selects the particular character from the character
ROM/EPROM/RAM. The Character Attribute register selects the color, background, and blinking
features for that selected character.
9.3.1Character RAM
OSD character RAM is a dual ported RAM, consisting of 16 x(16 x16)/8 =512 bytes of RAM;
located from $0400 to $05FF. Upon reset, the content of character RAM is random. Every entr y
of this 16-entry character RAM occupies 32 consecutive memory bytes, always starting at even
addresses. Users can read and write any byte at any time . OSD can only read the char acter RAM.
Figure 9-1 shows the memory map of one entry of the 16-entry OSD character RAM.
If 12x16 character dot matrix is selected, bit 3 to bit 0 of all low order bytes at the right-hand side
of Figure 9-1 will not be used for display.
9.3.2Character ROM/EPROM
The memory arrangement of OSD character ROM/EPROM is the same as that of character RAM.
Character ROM/EPROM is not readable to the CPU in user mode . OSD char acter ROM is located
from $8000 to $8FFF. Three characters in the Character ROM are fixed, and cannot be changed.
They are shown in Figure 9-2.
TPG
MC68HC05T16MOTOROLA
ON-SCREEN DISPLAY
9-3
9
Page 74
even bytesodd bytes
$xxx
$xxx+ $002
$xxx+ $01E$xxx+ $01F
High order bytesLow order bytes
707430
Bits not used when 12x 16 dot
matrix is selected
indicates a character dot exist
indicates a character dot does not exist
$xxx+ $001
$xxx+ $003
Single Character Map
Select character pointer for RAM or ROM/EPROM
$0400
$05FF
Character Pointer
Character RAMCharacter ROM/EPROM
Character 0
Character 1
32-bytes per
Character
Character 16
Character 0
Character 1
32-bytes per
Character
Character 128
$8000
$8FFF
9
$201
$200
$200
$201
$240
$241
$280
$281
$2C0
$2C1
MOTOROLA
9-4
ROM/RAM
BLNKG
CH6CH5CH4CH3CH2CH1CH0
BGENBGCOL2 BGCOL1 BGCOL0CCOL2CCOL1CCOL0
$230
$231
$270
$271
$2B0
$2B1
$2F0
$2F1
Last 8 character register pairs of a row buffer
are not used when that row buffer is configured
for displaying 16x16 dot characters
Figure 9-1 OSD Character and Row Structure
Character Code Register (even bytes)
Character Attribute Register (odd bytes)
$23E
ROW BUFFER 0
$23F
$27E
ROW BUFFER 1
$27F
$2BE
ROW BUFFER 2
$2BF
$2FE
ROW BUFFER 3
$2FF
MC68HC05T16ON-SCREEN DISPLAY
TPG
Page 75
Code $00Code $20 : BlankCode $7F : Full-Filled
Figure 9-2 Reserved Character ROM Codes
9.3.3Character Registers
Address bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
Character Code reg. 1$200
Character Attribute reg. 1$201 BLNKG BGEN
Character Code reg. 128$2FE
Character Attribute reg. 128$2FF BLNKG BGEN
ROM/RAM
ROM/RAM
CH6CH5CH4CH3CH2CH1CH0 uuuu uuuu
BGCOL2 BGCOL1 BGCOL0
CH6CH5CH4CH3CH2CH1CH0 uuuu uuuu
BGCOL2 BGCOL1 BGCOL0
CCOL2 CCOL1 CCOL0 uuuu uuuu
:
:
CCOL2 CCOL1 CCOL0 uuuu uuuu
There are a total of 128 character code registers, 32 characters per row for four rows.
Character Codes:
ROM/RAM - ROM/RAM mapping select
1 (set)–CH6-CH0 is mapped to the 16 RAM codes.
0 (clear) –CH6-CH0 is mapped to the 128 ROM/EPROM codes.
CH6-CH0
0 to 127 = ROM/EPROM codes.
0 to 15 = RAM codes. Codes 16 and higher are invalid.
Ii, Ri, Gi, and Bi bits select the color for color palette i, where i=0, 1, 2,..., 7. I bit is the intensity
bit. There are 8 color palettes; each color palette is one of 16 colors. Figure 9-3 shows the color
palette organization and Table 9-1 shows the RGB color map.
0000Black
0001Blue
0010Green
0011Cyan
0100Red
0101Magenta
0110Yellow
0111White
1000Dark Grey
1001Dark Blue
1010Dark Green
1011Dark Cyan
1100Dark Red
1101Dark Magenta
1110Dark Yellow
1111Light Grey
Bit definitions may be reversed, depending on the chroma unit in the TV
The OSD module has 4 row buffers for displaying on-screen characters; row 0, 1, 2 and 3. Each
row buffer consists of 32 pairs of Char acter register pairs (See Section 9.3). There are 5 registers
which affects the position and attributes of the display rows.
1 (set)–12x16 character dot matrix selected for row i.
0 (clear) –16x16 character dot matrix selected for row i.
If 12 x16 matr ix is selected, a maximum of 32 characters may be displayed for that row. Rows
selected for 16x 16 matrix characters, the maximum is 24 characters per row; the remaining 8
MC68HC05T16MOTOROLA
ON-SCREEN DISPLAY
State
on reset
TPG
9-7
9
Page 78
Character register pairs are not used. See Figure 9-1. Unused Character register pairs may be
used as general purpose RAM.
RiBE - Black-edge for row i enable
1 (set)–Black-edge (bordering or shadowing) for row i enabled.
0 (clear) –Black-edge (bordering or shadowing) for row i disabled.
This bit is the enable bit for the shadowing and bordering option selected by the SHDW bit in the
OSD Row Horizontal Position register (bit 7 of address $28).
9
Address bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
Horizontal Position Register$28SHDW HP6HP5HP4HP3HP2HP1HP0 0000 0000
SHDW - Shadow/border select
1 (set)–Shadow feature is selected if RiBE is enabled.
0 (clear) –Border feature is selected if RiBE is enabled.
This bit does not have any effect if RiBE bit is disabled.
9.4.2Row Vertical Position Registers
Address bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
Row 0 Vertical Position Register$24
Row 1 Vertical Position Register$25
Row 2 Vertical Position Register$26
Row 3 Vertical Position Register$27
FBKGCi - FBKG (Fast Blanking) pin active select
1 (set)–FBKG pin is active during row i character dots only.
0 (clear) –FBKG pin is active during both row i character and row i background
dots.
FBKGCi bit controls the FBKG output pin of the OSD during row i display . If FBKGCi is clear , FBKG
output pin is active during both character dots and background dots of row i. If FBKGCi is set,
FBKG output pin is active only where character dots exist in the character dot matrix (including
bordering or shadowing dots). The FBKG and HTONE pins may be used to create transparent
background effects for OSD displays.
MOTOROLA
MC68HC05T16ON-SCREEN DISPLAY
9-8
TPG
Page 79
Figure 9-4 and Figure 9-5 illustrate the timing signals of R, G, B, I, FBKG, and HTONE as a
function of control bits BGEN, RiBE, and FBKGCi, using the 5th line (line 4) of a 12x16 dot matrix
as an example. All output signals assume positive polarity.
Figure 9-4 illustrates the timing of output signals for characters with and without bordering effect.
Figure 9-5 illustrates the output signal timing for characters with background enabled, yet with
opposite FBKGCi bit setting. Note that both RiBE and FBKGCi are row features. Hence, the two
adjacent dot matrices in both figures are drawn for demonstration purposes only , the y do not imply
that users can configure OSD display in such a manner that one character has FBKGCi bit set and
the next character in the same row has FBKGCi bit cleared. Note that ‘HTONE’ has exactly the
same wavef orm as ‘Bac kground R,G,B, or I’. Output signal timing diagram similar to Figure 9-5 for
the case where character bordering is enabled can be derived in very similar fashion. The only
difference is that ‘FBKG’ will be on and ‘HTONE’ will be off where a bordering dot exists. Other
output signal timings remain the same.
RiVP6 to RiVP0 - Row i Vertical Position
For single scan mode:Vertical position = RiVPx setting x 4
For double scan mode:Vertical position = RiVPx setting x 4 x 2
Each RiVP6-RiVP0 step shifts the vertical position of row i by 4 horizontal display lines. For single
scan mode, the shift is (RiVP6-RiVP0)x 4 horizontal lines. For double scan mode, the shift is
((RiVP6-RiVP0) x 4) x 2 horizontal lines. The calculation of shift is a function of scan mode, not
character size selection. Hence, care should be taken when choosing vertical position for a
particular row that locates after a row which has character size other than the basic 12x 16 or
16x16 setting. For example , assuming single scan mode, if row X has 4Hx4V character size and
vertical position of $40 while row Y has basic character size of 1Hx1V and vertical position of $48,
then row X will be displayed from the 256th (64x4) line to the 287th line, which covers only the first
32 lines of the supposed 64-line row X display, and row Y will be displayed from the 288th (72x4)
line to 303th line without any missing lines.
9
The reference point of shift is the leading edge of vertical flyback input signal, VFLBK. As a result
of this vertical start position granularity, there are a total of 262.5/4 row positions in a full
screen.
In Figure 9-6(a), row (i+1) and row i partially overlaps. Since the vertical position of row (i+1) is
lower than row i, row (i+1) will be partially covered b y row i. New symbols may be generated when
rows are partially overlapped.
In Figure 9-6(b), row (j+1) is completely covered by row j. As result, only row j is visible.
Note that in cases where the character size of the blocked row is bigger than that of the blocking
row, once the blocked row has been blocked, it will never be displayed again even after the
blocking row displa y has been terminated. For example, assume the character size of row (i+1) is
4H x4V and that of row i is 1H x1V, and the difference in vertical position between them is 4
horizontal lines only. After the first four lines of row (i+1) have been displayed, row i display will
commence and continue for the next sixteen lines, blocking off row (i+1) display for these sixteen
lines. After row i display has been terminated, there are still (64-4-16)=44 lines of row (i+1) display
Figure 9-4 Output Signal Timing Diagram - Without Background
9
that could have been displayed, the OSD is so designed that these remaining lines will not be
displayed. The same result applies to the complete overlap situation with different character sizes.
A row display is terminated if:
1) the part of the row display which is not overridden by other overlapping rows
has been completed, or
2) it completely overlaps a row or rows with higher priority, or
3) the part of the row display which does not overlap vertical retrace period has
been completed. (This applies to rows immediately before vertical retrace)
Note that the judgement of overlap is totally based on the vertical position of rows, it has nothing
to do with character size of rows. RiCF bit of Frame Control 3 and Status register will also be set
when a row display is terminated.
Figure 9-5 Output Signal Timing Diagram - With Background
9
Row (i+1)
Row (i+1)
partially overlaps
row i
Row i
Row (j+1)
Row j
(a)
Row (j+1) and
row j completely
overlaps, therefore
(b)
only row j is visible
Figure 9-6 Resolution of Overlap among Rows
TPG
MC68HC05T16MOTOROLA
ON-SCREEN DISPLAY
9-11
Page 82
9.4.3Row Horizontal Position Register
9
Addressbit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
$28SHDWHP6HP5HP4HP3HP2HP1HP00000 0000
SHDW - Shadow/border select
1 (set)–Shadow feature is selected if RiBE is enabled. See Section 9.4.1.
0 (clear) –Border feature is selected if RiBE is disabled. See Section 9.4.1.
HP6 to HP0 - Horizontal Position
Each (HP6-HP0) step shifts the horizontal position of all four rows by 4 dots . The reference point
of shift is the leading edge of horizontal flyback signal. Note that there is only one Row Horizontal
Position register for all 4 row buffers, therefore all rows will have the same horizontal start point.
If (HP6-HP0) is so programmed that part of the row display goes beyond the beginning of a
horizontal flyback signal, display wrap-around occurs . That is, all lines of the row display will ha ve
all dots before the nth horizontal flyback displa y ed on one line and all remaining dots after the nth
horizontal flyback, along with all dots of next line before the (n+1)th horizontal flyback displayed
on the next line.
Enable/disable interrupt of row i if one of the following conditions occur:
1) the part of the row i display which is not overridden by other overlapping
rows has been completed, or
2) the part of the row i display which does not overlap vertical retrace period
has been completed.
Note that for the case where row i is completely ov erlapped by other ro ws, ro w i displa y has ne v er
really happened, that is, terminated upon its commencement, row i interrupt will never occur.
MOTOROLA
9-12
MC68HC05T16ON-SCREEN DISPLAY
TPG
Page 83
RiEN - Row i display enable
1 (set)–Row i display enabled.
0 (clear) –Row i display disabled.
If RiEN bit is set while the horizontal line currently being displayed has already passed the v ertical
start position of this recently enabled row, this recently enabled row will not be displayed in this
frame. It will then be displayed in the next frame. That is, RiEN bit has to be set before current
horizontal display line reaches ((RiVP6-RiVP0)x4) for single scan mode or ((RiVP6-RiVP0)x4)x2
for double scan mode to enable display of row i in current frame.
Note that clearing RiEN bit does not clear the corresponding RiCF bit. Hence, care must be tak en
before enabling RiINTE and RiEN to avoid interrupt caused by uncleared RiCF before the setting
of RiINTE and RiEN.
There are two predefined numbers of total dots that can be displayed on a horizontal line. The
number of dots per line is a function of character size selection and the size of character dot
matrix. For the special case of 3H x3V and 12x16 dot matrix, the number of total dots per line is
396; whereas f or other combinations of char acter siz e and dot matrix, the number is 384 dots per
line. Users can avoid filling the unused bytes in a row since these bytes will not be displayed.
Table 9-2 lists the number of valid character bytes per row.
State
on reset
9.5Frame
9
The following registers affect the frame of an OSD displays.
DSCAN (double scan) bit is for the control of OSD logic so that the OSD can accommodate
non-interlaced scan TV system by adjusting dot matrix scan output. Users hav e to determine if the
target TV broadcast system is a double scan system. If DSCAN is set, all horizontal lines in the
character dot matrix will be displayed twice in the same frame. The other feature associated with
horizontal lines that will also be doubled is the RiVP6-RiVP0 field of Row Vertical Position
Registers.
FADE - Display fade enable
1 (set)–Display fade function enabled.
0 (clear) –Display fade function disabled.
The FADE bit controls the sequence of frame display appearance and disappearance. When
FADE bit is set, frame display will gradually appear (fade in) if ON/OFF is set, and gradually
disappear (fade out) if ON/OFF is clear. If FADE bit is clear, OSD display will be turned on or off
instantly.
MOTOROLA
MC68HC05T16ON-SCREEN DISPLAY
9-14
TPG
Page 85
ON/OFF - OSD display on/off
1 (set)–OSD display on.
0 (clear) –OSD display off.
For the fading f eature, the whole screen is divided into se veral 16-horizontal-line segments . Notice
that a row might not fit into the 16-horizontal-line segments. It might cross two segments,
depending on the vertical position of a row. The way that fade-in feature works is that one line in
all 16-line segments will appear in the first fading sequence; two lines, including the one line in the
first fading sequence, will appear in the second f ading sequence; four lines , including the two lines
in the second fading sequence, will appear in the third f ading sequence; eight lines, including the
four lines in the third fading sequence, will appear in the fourth fading sequence; and finally, all
sixteen lines, including the eight lines in the fourth fading sequence, will appear in the fifth fading
sequence. Fade-out feature works in the opposite manner, that is, the number of display lines to
be disappeared are 8 lines, 12 lines, 14 lines, 15 lines, and all 16 lines in each disappearance
sequence, respectively. Fade out sequence for a character in a row fitting right into the
16-horizontal-line segment is illustrated in Figure 9-7. Fading rate is fixed at 32 frames per
sequence. Therefore , it takes 160 fr ames to ex ecute the f ade function. At 60 Hz v ertical frequency ,
this will take five plus seconds. Note that when display disappears, all output pins are not
tri-stated, rather they remain in their deserted states.
CDRC3 to CDRC0 - Terminated display rows
These status bits reflect the number of row displays that have been terminated. These bits are
reset only by vertical flyback and incremented by one every time a row display has been
terminated.
Bits 7 to 5 are control bits whereas bits 4 to 0 are status bits associated with interrupt. A status bit
is cleared by writing a 0 to that bit. Care must be taken while clearing a status bit: make sure the
MC68HC05T16MOTOROLA
ON-SCREEN DISPLAY
State
on reset
TPG
9-17
9
Page 88
status bit to be cleared is indeed one before writing a zero, and do not write a 0 to a status bit
which is not 1. Otherwise, status bits which are becoming ones will be inadvertently cleared.
00No video mute
01Mute with black color
10Mute with G color
11Mute with B color
VFLB - VFLBK status
1 (set)–Vertical flyback (leading edge) signal detected.
0 (clear) –No Vertical flyback signal detected.
RiCF - Row i display status
1 (set)–Row i display has been terminated.
9
0 (clear) –Row i display has been not terminated.
Whenever a row display has been terminated, the corresponding RiCF flag will be set along with
update of CDRC3-CDRC0 field.
MOTOROLA
9-18
MC68HC05T16ON-SCREEN DISPLAY
TPG
Page 89
10
ANALOG TO DIGITAL CONVERTER
The Analog-to-Digital Converter (ADC) system consists of two analog input channels and a single
5-bit D/A Converter and Comparator, with continuous conversion. A result flag indicates if the
comparator output is above or below the analog Input. ADC is disabled by setting AD4 to AD0 bits
of ADC Control/Status register to all 1’s. This disable function is mainly for low po wer applications .
Figure 10-1 shows a block diagram of the ADC module.
RESULT
–
+
V
DD
Figure 10-1 ADC Block Diagram
2R
R
2R
R
2R
R
2R
R
2R
2R
ADCIN0 or ADCIN1
AD4
AD3
AD2
10
AD1
AD0
TPG
MC68HC05T16MOTOROLA
ANALOG TO DIGITAL CONVERTER
10-1
Page 90
10.1ADC Inputs
The ADC has two input channels: one dedicated input pin at ADCIN0 and one shared pin at
PF4/ADCIN1.
10.1.1PF4/ADCIN1
ADCIN1 multiplexes with PF4 at this pin. When the ADC1 bit of Port F Configuration register is
cleared, PF4/ADCIN1 is configured for PF4 and follows Port F DDR assignment. When ADC1 bit
is set, PF4 is configured as ADCIN1 analog input, and Port F DDR has no effect on this pin.
Reading PF4 when configured as an ADC input is zero.
10.1.2ADCIN0
ADCIN0 is a dedicated analog input channel.
10.2Program Example
The following example shows how to convert analog input channel 0 (ADCIN0). For ADCIN1
conversion, change #$00 to #$20. ADCSR is the ADC Control/Status register.
10
LDA#$00
STAADCSR;ADC Control and Status Register
DTABRSET 7, ADCSR, ATD
INCADCSR
LDAADCSR
AND#$1F
CMP #$1F
BLSDTA
;out of range
ATD...;analog value in ADC.
;ANALOG IN = ([AD4:0] +1)*0.15625V at Vdd = 5V
MOTOROLA
10-2
TPG
MC68HC05T16ANALOG TO DIGITAL CONVERTER
Page 91
10.3ADC Control and Status Register
Addressbit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
$3CRESULTCHNLAD4AD3AD2AD1AD0u000 0000
This read/write register, located at address $3C, contains six control bits and one status bit.
RESULT - Comparator Status (Read Only)
1 (set)–AD4-0 value greater than analog in.
0 (clear) –AD4-0 value is less than analog in.
CHNL - Channel Select
1 (set)–ADCIN1 is selected for conversion.
0 (clear) –ADCIN0 is selected for conversion
AD4-0 - ADC Digital Result
These bits are written by the user to perform successive approximations in softw are. When a value
causes the RESULT bit to change state from the value immediately before or after it, AD4-0 are
considered to be the digital equivalent of the analog input. Note that when AD4-0 are all 1’s, ADC
is virtually turned off to minimize power consumption.
State
on reset
TPG
MC68HC05T16MOTOROLA
ANALOG TO DIGITAL CONVERTER
10-3
10
Page 92
10
THIS PAGE LEFT BLANK INTENTIONALLY
MOTOROLA
10-4
TPG
MC68HC05T16ANALOG TO DIGITAL CONVERTER
Page 93
11
CPU CORE AND INSTRUCTION SET
This section provides a description of the CPU core registers, the instruction set and the
addressing modes of the MC68HC05L1.
11.1Registers
The MCU contains five registers, as shown in the progr amming model of Figure 11-1. The interrupt
stacking order is shown in Figure 11-2.
70
70
1570
1570
0
0
0 0 0 0 0 0 1 1
70
1
11HINZC
Figure 11-1 Programming model
Accumulator
Index register
Program counter
Stack pointer
Condition code register
Carry / borrow
Zero
Negative
Interrupt mask
Half carry
11.1.1Accumulator (A)
The accumulator is a general purpose 8-bit register used to hold operands and results of
arithmetic calculations or data manipulations.
11
TPG
MC68HC05L1MOTOROLA
CPU CORE AND INSTRUCTION SET
11-1
Page 94
Stack
Interrupt
Decreasing
memory
address
Increasing
memory
address
Unstack
70
Return
Condition code register
Accumulator
Index register
Program counter high
Program counter low
Figure 11-2 Stacking order
11.1.2Index register (X)
The index register is an 8-bit register, which can contain the indexed addressing value used to
create an effective address. The index register may also be used as a temporary storage area.
11.1.3Program counter (PC)
The program counter is a 16-bit register, which contains the address of the ne xt byte to be f etched.
11.1.4Stack pointer (SP)
The stack pointer is a 16-bit register, which 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.
11
When accessing memory, the ten most significant bits are permanently set to 0000000011. These
ten bits are appended to the six least significant register bits to produce an address within the
range of $00C0 to $00FF. Subroutines and interrupts may use up to 64 (decimal) locations. If 64
locations are exceeded, the stack pointer wraps around and overwrites the previously stored
information. A subroutine call occupies tw o locations on the stack; an interrupt uses five locations.
11.1.5Condition code register (CCR)
The 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 individually
tested by a program, and specific actions can be taken as a result of their state. Each bit is
explained in the following paragraphs.
Half carry (H)
This bit is set during ADD and ADC operations to indicate that a carry occurred between bits 3 and 4.
MOTOROLA
11-2
MC68HC05L1CPU CORE AND INSTRUCTION SET
TPG
Page 95
Interrupt (I)
When this bit is set, all maskable interrupts are masked. If an interrupt occurs while this bit is set,
the interrupt is latched and remains pending until the interrupt bit is cleared.
Negative (N)
When set, this bit indicates that the result of the last arithmetic, logical, or data manipulation was
negative.
Zero (Z)
When set, this bit indicates that the result of the last arithmetic, logical, or data manipulation was
zero.
Carry/borrow (C)
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.
11.2Instruction set
The MCU has a set of 62 basic instructions. They can be grouped into five different types as
follows:
– Register/memory
– Read/modify/write
– Branch
– Bit manipulation
– Control
The following paragraphs briefly explain each type. All the instructions within a given type are
presented in individual tables.
This MCU uses all the instructions available in the M146805 CMOS family plus one more: the
unsigned multiply (MUL) instruction. This instruction allows unsigned multiplication of the contents
of the accumulator (A) and the index register (X). The high-order product is then stored in the
index register and the low-order product is stored in the accumulator. A detailed definition of the
MUL instruction is shown in Table 11-1.
TPG
MC68HC05L1MOTOROLA
CPU CORE AND INSTRUCTION SET
11-3
11
Page 96
11.2.1Register/memory Instructions
Most of these instructions use two operands. The first operand is either the accumulator or the
index register . The second operand is obtained from memory using one of the addressing modes.
The jump unconditional (JMP) and jump to subroutine (JSR) instructions have no register
operand. Refer to Table 11-2 for a complete list of register/memory instructions.
11.2.2Branch instructions
These instructions cause the program to branch if a particular condition is met; otherwise, no
operation is performed. Branch instructions are two-byte instructions. Refer to Table 11-3.
11.2.3Bit manipulation instructions
The MCU can set or clear any writable bit that resides in the first 256 bytes of the memory space
(page 0). All port data and data direction registers, timer and serial interface registers,
control/status registers and a portion of the on-chip RAM reside in page 0. An additional feature
allows the software to test and branch on the state of any bit within these locations. The bit set, bit
clear, bit test and branch functions are all implemented with single instructions. For the test and
branch instructions, the value of the bit tested is also placed in the carry bit of the condition code
register. Refer to Table 11-4.
11
11.2.4Read/modify/write instructions
These instructions read a memory location or a register, modify or test its contents, and write the
modified value back to memory or to the register. The test for negative or z ero (TST) instruction is
an exception to this sequence of reading, modifying and writing, since it does not modify the value.
Refer to Table 11-5 for a complete list of read/modify/write instructions.
11.2.5Control instructions
These instructions are register reference instructions and are used to control processor operation
during program execution. Refer to Table 11-6 for a complete list of control instructions.
11.2.6Tables
Tables for all the instruction types listed above follow. In addition there is a complete alphabetical
listing of all the instructions (see Table 11-7), and an opcode map for the instruction set of the
M68HC05 MCU family (see Table 11-8).
MOTOROLA
11-4
MC68HC05L1CPU CORE AND INSTRUCTION SET
TPG
Page 97
Table 11-1 MUL instruction
OperationX:A ← X*A
Multiplies the eight bits in the index register by the eight
Description
bits in the accumulator and places the 16-bit result in the
concatenated accumulator and index register.
H : Cleared
Condition
codes
I : Not affected
N : Not affected
Z : Not affected
C : Cleared
SourceMUL
Form
Addressing modeCyclesBytesOpcode
Inherent111$42
Table 11-2 Register/memory instructions
Addressing modes
ImmediateDirectExtended
Function
Mnemonic
Opcode
# Bytes
# Cycles
Opcode
# Bytes
# Cycles
Opcode
Load A from memoryLDA A6 22 B6 23 C6 34 F6 13 E6 24 D6 35
Load X from memoryLDX AE 22 BE 23 CE 34 FE 13 EE 24 DE 35
Store A in memorySTA
Store X in memorySTX
Add memory to AADD AB 22 BB 23 CB 34 FB 13 EB 24 DB 35
Add memory and carry to AADC A9 22 B9 23 C9 34 F9 13 E9 24 D9 35
Subtract memorySUB A0 22 B0 23 C0 34 F0 13 E0 24 D0 35
Subtract memory from A
with borrow
AND memory with AAND A4 22 B4 23 C4 34 F4 13 E4 24 D4 35
OR memory with AORA AA 22 BA 23 CA 34 FA 13 EA 24 DA 35
Exclusive OR memory with AEOR A8 22 B8 23 C8 34 F8 13 E8 24 D8 35
Arithmetic compare A
with memory
Arithmetic compare X
with memory
Bit test memory with A
(logical compare)
Jump unconditionalJMP
Jump to subroutineJSR
BC 22 CC 33 FC 12 EC 23 DC 34
BD 25 CD 36 FD 15 ED 26 DD 37
# Bytes
Indexed
(no
offset)
# Cycles
Opcode
# Bytes
Indexed
(8-bit
offset)
# Cycles
Opcode
# Bytes
Indexed
(16-bit
offset)
# Cycles
Opcode
# Bytes
# Cycles
11
TPG
MC68HC05L1MOTOROLA
CPU CORE AND INSTRUCTION SET
11-5
Page 98
Table 11-3 Branch instructions
Relative addressing mode
FunctionMnemonicOpcode # Bytes # Cycles
Branch alwaysBRA2023
Branch neverBRN2123
Branch if higherBHI2223
Branch if lower or sameBLS2323
Branch if carry clearBCC2423
(Branch if higher or same)(BHS)2423
Branch if carry setBCS2523
(Branch if lower)(BLO)2523
Branch if not equalBNE2623
Branch if equalBEQ2723
Branch if half carry clearBHCC2823
Branch if half carry setBHCS2923
Branch if plusBPL2A23
Branch if minusBMI2B23
Branch if interrupt mask bit is clearBMC2C23
Branch if interrupt mask bit is setBMS2D23
Branch if interrupt line is lowBIL2E23
Branch if interrupt line is highBIH2F23
Branch to subroutineBSRAD26
Branch if bit n is setBRSET n (n=0–7)
Branch if bit n is clearBRCLR n (n=0–7)01+2•n35
Set bit nBSET n (n=0–7)10+2•n25
Clear bit nBCLR n (n=0–7)11+2•n25
Transfer A to XTAX9712
Transfer X to ATXA9F12
Set carry bitSEC9912
Clear carry bitCLC9812
Set interrupt mask bitSEI9B12
Clear interrupt mask bitCLI9A12
Software interruptSWI83110
Return from subroutineRTS8116
Return from interruptRTI8019
Reset stack pointerRSP9C12
No-operationNOP9D12
StopSTOP8E12
WaitWAIT8F12
TPG
MC68HC05L1MOTOROLA
CPU CORE AND INSTRUCTION SET
11-7
11
Page 100
Table 11-7 Instruction set
11
Mnemonic
INH IMM DIR EXT RELIXIX1IX2 BSC BTB HINZC
Addressing modesCondition codes
ADC◊•◊◊◊
ADD◊•◊◊◊
AND••◊◊•
ASL••◊◊◊
ASR••◊◊◊
BCC•••••
BCLR•••••
BCS•••••
BEQ•••••
BHCC•••••
BHCS•••••
BHI•••••
BHS•••••
BIH•••••
BIL•••••
BIT••◊◊•
BLO•••••
BLS•••••
BMC•••••
BMI•••••
BMS•••••
BNE
•••••
BPL•••••
BRA•••••
BRN•••••
BRCLR••••◊
BRSET••••◊
BSET•••••
BSR•••••
CLC••••0
CLI•0•••
CLR••01•
CMP••◊◊◊
Address mode abbreviations
BSC Bit set/clearIMM Immediate
BTB Bit test & branchIXIndexed (no offset)
DIR DirectIX1 Indexed, 1 byte offset
EXT ExtendedIX2 Indexed, 2 byte offset
INH InherentREL Relative
Not implemented
MOTOROLA
11-8
Condition code symbols
H Half carr y (from bit 3)◊
I Interrupt mask• Not affected
N Negate (sign bit)? Load CCR from stack
Z Zero0 Cleared
C Carr y/borrow1 Set
Tested and set if true,
cleared otherwise
MC68HC05L1CPU CORE AND INSTRUCTION SET
TPG
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.