D78F9232 Nec
D78F9232 Nec
78K0S/KB1+
8-Bit Single-Chip Microcontrollers
µPD78F9232
µPD78F9234
© 2005
Printed in Japan
Caution: This product uses SuperFlash® technology licensed from Silicon Storage Technology, inc.
• The information contained in this document is being issued in advance of the production cycle for the
product. The parameters for the product may change before final production or NEC Electronics
Corporation, at its own discretion, may withdraw the product prior to its production.
• Not all products and/or types are available in every country. Please check with an NEC Electronics sales
representative for availability and additional information.
• No part of this document may be copied or reproduced in any form or by any means without the prior written consent
of NEC Electronics. NEC Electronics assumes no responsibility for any errors that may appear in this document.
• NEC Electronics does not assume any liability for infringement of patents, copyrights or other intellectual property
rights of third parties by or arising from the use of NEC Electronics products listed in this document or any other
liability arising from the use of such products. No license, express, implied or otherwise, is granted under any
patents, copyrights or other intellectual property rights of NEC Electronics or others.
• Descriptions of circuits, software and other related information in this document are provided for illustrative purposes
in semiconductor product operation and application examples. The incorporation of these circuits, software and
information in the design of a customer's equipment shall be done under the full responsibility of the customer. NEC
Electronics assumes no responsibility for any losses incurred by customers or third parties arising from the use of
these circuits, software and information.
• While NEC Electronics endeavors to enhance the quality, reliability and safety of NEC Electronics products,
customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. To minimize
risks of damage to property or injury (including death) to persons arising from defects in NEC Electronics products,
customers must incorporate sufficient safety measures in their design, such as redundancy, fire-containment and
anti-failure features.
• NEC Electronics products are classified into the following three quality grades: "Standard", "Special" and "Specific".
The "Specific" quality grade applies only to NEC Electronics products developed based on a customer-designated
"quality assurance program" for a specific application. The recommended applications of an NEC Electronics
products depend on its quality grade, as indicated below. Customers must check the quality grade of each NEC
Electronics product before using it in a particular application.
"Standard": Computers, office equipment, communications equipment, test and measurement equipment, audio and
visual equipment, home electronic appliances, machine tools, personal electronic equipment and
industrial robots.
"Special": Transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster
systems, anti-crime systems, safety equipment and medical equipment (not specifically designed for life
support).
"Specific": Aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life support
systems and medical equipment for life support, etc.
The quality grade of NEC Electronics products is "Standard" unless otherwise expressly specified in NEC
Electronics data sheets or data books, etc. If customers wish to use NEC Electronics products in applications
not intended by NEC Electronics, they must contact an NEC Electronics sales representative in advance to
determine NEC Electronics' willingness to support a given application.
(Note)
(1) "NEC Electronics" as used in this statement means NEC Electronics Corporation and also includes its
majority-owned subsidiaries.
(2) "NEC Electronics products" means any product developed or manufactured by or for NEC Electronics (as
defined above).
Some information contained in this document may vary from country to country. Before using any NEC
Electronics product in your application, pIease contact the NEC Electronics office in your country to
obtain a list of authorized representatives and distributors. They will verify:
• Device availability
• Ordering information
• Development environment specifications (for example, specifications for third-party tools and
components, host computers, power plugs, AC supply voltages, and so forth)
• Network requirements
In addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary
from country to country.
[GLOBAL SUPPORT]
http://www.necel.com/en/support/support.html
NEC Electronics America, Inc. (U.S.) NEC Electronics (Europe) GmbH NEC Electronics Hong Kong Ltd.
Santa Clara, California Duesseldorf, Germany Hong Kong
Tel: 408-588-6000 Tel: 0211-65030 Tel: 2886-9318
800-366-9782
• Sucursal en España NEC Electronics Hong Kong Ltd.
Madrid, Spain Seoul Branch
Tel: 091-504 27 87 Seoul, Korea
Tel: 02-558-3737
• Succursale Française
Vélizy-Villacoublay, France NEC Electronics Shanghai Ltd.
Tel: 01-30-67 58 00 Shanghai, P.R. China
Tel: 021-5888-5400
• Filiale Italiana
Milano, Italy
NEC Electronics Taiwan Ltd.
Tel: 02-66 75 41
Taipei, Taiwan
Tel: 02-2719-2377
• Branch The Netherlands
Eindhoven, The Netherlands
NEC Electronics Singapore Pte. Ltd.
Tel: 040-244 58 45
Novena Square, Singapore
• Tyskland Filial Tel: 6253-8311
Taeby, Sweden
Tel: 08-63 80 820
• United Kingdom Branch
Milton Keynes, UK
Tel: 01908-691-133
J04.1
Target Readers This manual is intended for user engineers who wish to understand the functions of
the 78K0S/KB1+ in order to design and develop its application systems and programs.
The target devices are the following subseries products.
• 78K0S/KB1+: µPD78F9232, 78F9234
Purpose This manual is intended to give users on understanding of the functions described in
the Organization below.
Organization Two manuals are available for the 78K0S/KB1+: this manual and the Instruction
Manual (common to the 78K/0S Series).
78K/0S Series
78K0S/KB1+
Instructions
User’s Manual
User’s Manual
How to Use This Manual It is assumed that the readers of this manual have general knowledge of electrical
engineering, logic circuits, and microcontrollers.
Related Documents The related documents indicated in this publication may include preliminary versions.
However, preliminary versions are not marked as such.
Language U14877E
Language U14872E
Caution The related documents listed above are subject to change without notice. Be sure to use the latest
version of each document for designing.
Guide to Prevent Damage for Semiconductor Devices by Electrostatic Discharge (ESD) C11892E
Caution The related documents listed above are subject to change without notice. Be sure to use the latest
version of each document for designing.
CHAPTER 1 OVERVIEW......................................................................................................................... 15
1.1 Features ...................................................................................................................................... 15
1.2 Application Fields ...................................................................................................................... 15
1.3 Ordering Information ................................................................................................................. 16
1.4 Pin Configuration (Top View) ................................................................................................... 17
1.5 78K0S/Kx1+ Product Lineup..................................................................................................... 18
1.6 Block Diagram............................................................................................................................ 19
1.7 Functional Outline ..................................................................................................................... 20
CHAPTER 12 MULTIPLIER...................................................................................................................217
12.1 Multiplier Function ...................................................................................................................217
12.2 Multiplier Configuration...........................................................................................................217
12.3 Multiplier Control Register ......................................................................................................219
12.4 Multiplier Operation .................................................................................................................220
1.1 Features
O Minimum instruction execution time selectable from high speed (0.2 µs) to low speed (3.2 µs) (with CPU clock of
10 MHz)
O General-purpose registers: 8 bits × 8 registers
O ROM and RAM capacities
Item
Program Memory (Flash Memory) Memory (Internal High-Speed RAM)
Part number
O On-chip power-on clear (POC) circuit and low voltage detector (LVI)
O On-chip watchdog timer (operable on internal low-speed Ring-OSC clock)
O I/O ports: 26
O Timer: 4 channels
• 16-bit timer/event counter: 1 channel
• 8-bit timer: 2 channels
• Watchdog timer: 1 channel
O Serial interface: UART (LIN (Local Interconnect Network) bus supported) 1 channel
O On-chip multiplier: 8 bits x 8 bits = 16 bits
O 10-bit resolution A/D converter: 4 channels
O Supply voltage: VDD = 2.0 to 5.5 VNote
O Operating temperature range: TA = −40 to +85°C
Note Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on
clear (POC) circuit is 2.1 V ±0.1 V.
O Automotive electronics
• System control of body instrumentation system (such as power windows and keyless entry reception)
• Sub-microcontroller of control system
O Household appliances
• Electric toothbrushes
• Electric shavers
O Toys
O Industrial equipment
• Sensor and switch control
• Power tools
Please refer to "Quality Grades on NEC Semiconductor Devices" (Document No. C11531E) published by
NEC Corporation to know the specification of quality grade on the devices and its recommended applications.
P03 1 30 P120
P02 2 29 AVSS
P01 3 28 AVREF
P00 4 27 P20/ANI0
P123 5 26 P21/ANI1
VSS 6 25 P22/ANI2
VDD 7 24 P23/ANI3
P121/X1 8 23 P130
P122/X2 9 22 P47
P34/RESET 10 21 P46
P33 11 20 P45
P32 12 19 P44/RxD6
P31/TI010/TO00/INTP2 13 18 P43/TxD6/INTP1
P30/TI000/INTP0 14 17 P42/TOH1
P40 15 16 P41/INTP3
Item
Clock for TMH1 and WDT Internal low-speed Ring-OSC oscillation (240 kHz (TYP.))
(oscillation frequency)
CMOS input 1 1 1
CMOS output − 1 1
8-bit (TMH) 1 ch
8-bit (TM8) − 1 ch
WDT 1 ch
Interrupts External 2 4
Internal 5 9
WDT Provided
Note Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.1 V ±0.1 V.
PORT 2 4 P20-P23
8-bit TIMER 80
4 P30-P33
PORT 3
TOH1/P42 8-bit TIMER H1 P34
78K0S
FLASH PORT 4 8 P40-P47
LOW-SPEED CPU
MEMORY
Ring-OSC CORE
PORT 12 4 P120-P123
WATCHDOG TIMER
RESET CONTROL
INTP0/P30
INTP1/P43
INTERRUPT
CONTROL RESET/P34
INTP2/P31 SYSTEM
CONTROL X1/P121
INTP3/P41
X2/P122
HIGH-SPEED
MULTIPLIER Ring-OSC
VDD VSS
Memory space 64 KB
Low speed (for TMH1 Internal Ring oscillation: 240 kHz (TYP.)
and WDT)
Minimum instruction execution time 0.2 µs/0.4 µs/0.8 µs/1.6 µs/3.2 µs (X1 input clock: fX = 10 MHz)
Vectored External 4
interrupt sources
Internal 9
Note Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.1 V ±0.1 V.
P30 I/O Port 3 Can be set to input or output mode in 1- Input TI000/INTP0
bit units.
P31 TI010/TO00/
An on-chip pull-up resistor can be
INTP2
connected by setting software.
P32 −
P33 −
Note Note
P34 Input Input only Input RESET
P43 TxD6/INTP1
P44 RxD6
P45 −
P46 −
P47 −
Caution The P121/X1 and P122/X2 pins are pulled down during reset.
INTP0 Input External interrupt input for which the valid edge (rising edge, Input P30/TI000
falling edge, or both rising and falling edges) can be specified
INTP1 P43/TxD6
INTP2 P31/TI010/TO00
INTP3 P41
RxD6 Input Serial data input for asynchronous serial interface Input P44
TxD6 Output Serial data output for asynchronous serial interface Input P43/INTP1
TI000 External count clock input to 16-bit timer/event counter 00. P30/INTP0
Capture trigger input to capture registers (CR000 and CR010) of
16-bit timer/event counter 00
TI010
(b) TI000
This pin inputs an external count clock to 16-bit timer/event counter 00, or a capture trigger signal to the
capture registers (CR000 and CR010) of 16-bit timer/event counter 00.
(c) TI010
This pin inputs a capture trigger signal to the capture register (CR000) of 16-bit timer/event counter 00.
(d) TO00
This pin outputs a signal from 16-bit timer/event counter 00.
(b) TOH1
This is the output pin of 8-bit timer H1.
(c) TxD6
This pin outputs serial data from the asynchronous serial interface.
(d) RxD6
This pin inputs serial data to the asynchronous serial interface.
Caution The P121/X1 and P122/X2 pins are pulled down during reset.
2.2.7 RESET
This pin inputs an active-low system reset signal.
2.2.8 X1 and X2
These pins connect an oscillator to oscillate the X1 input clock.
X1 and X2 also function as the P121 and P122 pins, respectively. For settings of alternate function, refer to
CHAPTER 18 OPTION BYTE.
Supply an external clock to X1.
Caution The P121/X1 and P122/X2 pins are pulled down during reset.
2.2.9 AVREF
This pin inputs a reference voltage to the internal A/D converter. When the A/D converter is not used, connect this
pin to VDD.
2.2.10 AVSS
This is the A/D converter ground potential pin. Even when the A/D converter is not used, always use this pin with
the same potential as the VSS pin.
2.2.11 VDD
This is the positive power supply pin.
2.2.12 VSS
This is the ground pin.
Table 2-1 shows I/O circuit type of each pin and the connections of unused pins.
For the configuration of the I/O circuit of each type, refer to Figure 2-1.
Table 2-1. Types of Pin I/O Circuits and Connection of Unused Pins
Pin Name I/O Circuit Type I/O Recommended Connection of Unused Pin
P00 to P03 8-A I/O Input: Independently connect to VDD or VSS via a resistor.
Output: Leave open.
P40 8-A I/O Input: Independently connect to VDD or VSS via a resistor.
Output: Leave open.
P41/INTP3
P42/TOH1
P43/TxD6/INTP1
P44/RxD6
P45 to P47
P120
Pull up
enable P-ch
AVREF
Data P-ch
IN
IN/OUT
Output N-ch
disable
Input
enable
P-ch
VDD
P-ch
Data OUT
OSC
enable
X1, X2,
IN/OUT IN/OUT
N-ch
V
VDD
Data
P-ch
Type 8-A
VDD Output N-ch
disable
Pull up
enable P-ch
VDD
Data
Data P-ch
P-ch
IN/OUT
Output N-ch
Output N-ch Disable
disable
The 78K0S/KB1+ can access up to 64 KB of memory space. Figures 3-1 and 3-2 show the memory maps.
FFFFH
FF00H
FEFFH
Internal high-speed RAM
256 × 8 bits
FE00H
FDFFH
Use prohibited
Data memory
space 0FFFH
1000H
0FFFH
Program area
0 082 H
0 081 H Protect byte area
Program memory 0 080 H Option byte area
Flash memory 0 07F H
space 4,096 × 8 bits CALLT table area
0040H
003FH
Program area
0022H
0021H
Vector table area
0000H 0000H
Remark The option byte and protect byte are 1 byte each.
FFFFH
FF00H
FEFFH
Internal high-speed RAM
256 × 8 bits
FE00H
FDFFH
Use prohibited
Data memory
space 1FFFH
2000H
1FFFH
Program area
0082H
0081H Protect byte area
Flash memory Option byte area
0080H
Program memory 8,192 × 8 bits 007FH
space
CALLT table area
0040H
003FH
Program area
0022H
0021H
Vector table area
0000H 0000H
Remark The option byte and protect byte are 1 byte each.
Structure Capacity
The following areas are allocated to the internal program memory space.
Vector Table Address Interrupt Request Vector Table Address Interrupt Request
FFFFH
FF00H
FEFFH
FE00H
FDFFH
Direct addressing
Based addressing
Use prohibted
1000H
0FFFH
Flash memory
4,096 × 8 bits
0000H
FFFFH
FF00H
FEFFH
FE00H
FDFFH
Direct addressing
Based addressing
Use prohibited
2000H
1FFFH
Flash memory
8,192 × 8 bits
0000H
PSW IE Z 0 AC 0 0 1 CY
The SP is decremented before writing (saving) to the stack memory and is incremented after reading
(restoring) from the stack memory.
Each stack operation saves/restores data as shown in Figures 3-8 and 3-9.
Caution Since generation of reset signal makes the SP contents undefined, be sure to initialize the
SP before using the stack memory.
SP SP _ 2 SP SP _ 2 SP _ 3 PC7 to PC0
Lower half
SP _ 2 SP _ 2 PC7 to PC0 SP _ 2 PC15 to PC8
register pairs
Upper half
SP _ 1 SP _ 1 PC15 to PC8 SP _ 1 PSW
register pairs
SP SP SP
Lower half
SP SP PC7 to PC0 SP PC7 to PC0
register pairs
Upper half
SP + 1 SP + 1 PC15 to PC8 SP + 1 PC15 to PC8
register pairs
SP SP + 2 SP SP + 2 SP + 2 PSW
SP SP + 3
H
HL
L
D
DE
E
B
BC
C
A
AX
X
15 0 7 0
R7
RP3
R6
R5
RP2
R4
R3
RP1
R2
R1
RP0
R0
15 0 7 0
• 1-bit manipulation
Describes a symbol reserved by the assembler for the 1-bit manipulation instruction operand (sfr.bit). This
manipulation can also be specified with an address.
• 8-bit manipulation
Describes a symbol reserved by the assembler for the 8-bit manipulation instruction operand (sfr). This
manipulation can also be specified with an address.
• 16-bit manipulation
Describes a symbol reserved by the assembler for the 16-bit manipulation instruction operand. When specifying
an address, describe an even address.
Table 3-3 lists the special function registers. The meanings of the symbols in this table are as follows:
• Symbol
Indicates the addresses of the implemented special function registers. It is defined as a reserved word in the
RA78K0S, and is defined as an sfr variable using the #pragma sfr directive in the CC78K0S. Therefore, these
symbols can be used as instruction operands if an assembler or integrated debugger is used.
• R/W
Indicates whether the special function register can be read or written.
R/W: Read/write
R: Read only
W: Write only
• After reset
Indicates the status of the special function register when a reset signal is generated.
Address Special Function Register (SFR) Name Symbol R/W Number of Bits Manipulated After Reset
Simultaneously
1 Bit 8 Bits 16 Bits
FF00H Port register 0 P0 R/W √ √ − 00H
Note 1
FF02H Port register 2 P2 √ √ −
FF03H Port register 3 P3 √ √ −
FF04H Port register 4 P4 √ √ −
FF0CH Port register 12 P12 √ √ −
FF0DH Port register 13 P13 √ √ −
FF0EH 8-bit timer H compare register 01 CMP01 R/W − √ −
FF0FH 8-bit timer H compare register 11 CMP11 − √ −
FF10H 16-bit Multiplication result storage register L MUL0L MUL0 R − √ √ Undefined
FF11H 16-bit Multiplication result storage register MUL0H − √
H
Note 2
FF12H 16-bit timer counter 00 TM00 − − √ 0000H
FF13H
Note 2
FF14H 16-bit timer capture/compare register 000 CR000 R/W − − √ 0000H
FF15H
Note 2
FF16H 16-bit timer capture/compare register 010 CR010 − − √ 0000H
FF17H
Note 2
FF18H 10-bit A/D conversion result register ADCR R − − √ Undefined
FF19H
FF1AH 8-bit A/D conversion result register ADCRH − √ −
FF20H Port mode register 0 PM0 R/W √ √ − FFH
FF22H Port mode register 2 PM2 √ √ −
FF23H Port mode register 3 PM3 √ √ −
FF24H Port mode register 4 PM4 √ √ −
FF2CH Port mode register 12 PM12 √ √ −
FF30H Pull-up resistance option register 0 PU0 √ √ − 00H
FF32H Pull-up resistance option register 2 PU2 √ √ −
FF33H Pull-up resistance option register 3 PU3 √ √ −
FF34H Pull-up resistance option register 4 PU4 √ √ −
FF3CH Pull-up resistance option register 12 PU12 √ √ −
FF48H Watchdog timer mode register WDTM − √ − 67H
FF49H Watchdog timer enable register WDTE − √ − 9AH
Note 3
FF50H Low voltage detect register LVIM √ √ − 00H
FF51H Low voltage detection level select register LVIS − √ −
Note 4
FF54H Reset control flag register RESF R − √ − 00H
FF58H Low-speed Ring-OSC mode register LSRCM R/W √ √ − 00H
Address Special Function Register (SFR) Name Symbol R/W Number of Bits Manipulated After Reset
Simultaneously
1 Bit 8 Bits 16 Bits
FF60H 16-bit timer mode control register 00 TMC00 R/W √ √ − 00H
FF61H Prescaler mode register 00 PRM00 √ √ −
FF62H Capture/compare control register 00 CRC00 √ √ −
FF63H 16-bit timer output control register 00 TOC00 √ √ −
FF70H 8-bit timer H mode register 1 TMHMD1 √ √ −
FF80H A/D converter mode register ADM √ √ −
FF81H Analog input channel specify register ADS √ √ −
FF84H Port mode control register 2 PMC2 √ √ −
FF8CH Input switching control register ISC √ √ −
FF90H Asynchronous serial interface operation mode ASIM6 √ √ − 01H
register 6
FF92H Reception buffer register 6 RXB6 R − √ − FFH
FF93H Asynchronous serial interface reception error ASIS6 − √ − 00H
status register 6
FF94H Transmission buffer register 6 TXB6 R/W − √ − FFH
FF95H Asynchronous serial interface transmission ASIF6 R − √ − 00H
status register 6
FF96H Clock selection register 6 CKSR6 R/W − √ −
FF97H Baud rate generator control register 6 BRGC6 − √ − FFH
FF98H Asynchronous serial interface control register 6 ASICL6 √ √ − 16H
FFA0H Flash protect command register PFCMD W − √ − Undefined
FFA1H Flash status register PFS R/W √ √ − 00H
FFA2H Flash programming mode control register FLPMC − √ − Undefined
FFA3H Flash programming command register FLCMD √ √ − 00H
FFA4H Flash address pointer L FLAPL √ √ − Undefined
FFA5H Flash address pointer H FLAPH √ √ −
FFA6H Flash address pointer H compare register FLAPHC √ √ − 00H
FFA7H Flash address pointer L compare register FLAPLC √ √ −
FFA8H Flash write buffer register FLW − √ −
FFCCH 8-bit timer mode control register 80 TMC80 √ √ −
FFCDH 8-bit compare register 80 CR80 W − √ − Undefined
FFCEH 8-bit timer counter 80 TM80 R − √ − 00H
FFD0H Multiplication data register A MRA0 W − √ − Undefined
FFD1H Multiplication data register B MRB0 − √ −
FFD2H Multiplier control register 0 MULC0 R/W √ √ − 00H
FFE0H Interrupt request flag register 0 IF0 √ √ −
FFE1H Interrupt request flag register 1 IF1 √ √ −
FFE4H Interrupt mask flag register 0 MK0 √ √ − FFH
FFE5H Interrupt mask flag register 1 MK1 √ √ −
FFECH External interrupt mode register 0 INTM0 − √ − 00H
Address Special Function Register (SFR) Name Symbol R/W Number of Bits Manipulated After Reset
Simultaneously
1 Bit 8 Bits 16 Bits
FFEDH External interrupt mode register 1 INTM1 − √ − 00H
FFF3H Preprocessor clock control register PPCC √ √ − 02H
Note
FFF4H Oscillation stabilization time selection register OSTS − √ − Undefined
FFFBH Processor clock control register PCC √ √ − 02H
Note The oscillation stabilization time that elapses after release of reset is selected by the option byte. For
details, refer to CHAPTER 18 OPTION BYTE.
An instruction address is determined by the program counter (PC) contents. The PC contents are normally
incremented (+1 for each byte) automatically according to the number of bytes of an instruction to be fetched each
time another instruction is executed. When a branch instruction is executed, the branch destination address
information is set to the PC to branch by the following addressing (for details of each instruction, refer to 78K/0S
Series Instructions User’s Manual (U11047E)).
[Function]
The value obtained by adding 8-bit immediate data (displacement value: jdisp8) of an instruction code to the start
address of the following instruction is transferred to the program counter (PC) to branch. The displacement
value is treated as signed two’s complement data (–128 to +127) and bit 7 becomes the sign bit. In other words,
the range of branch in relative addressing is between –128 and +127 of the start address of the following
instruction.
This function is carried out when the BR $addr16 instruction or a conditional branch instruction is executed.
[Illustration]
15 0
... PC is the start address of
PC
the next instruction of
a BR instruction.
+
15 8 7 6 0
α S
jdisp8
15 0
PC
[Function]
Immediate data in the instruction word is transferred to the program counter (PC) to branch.
This function is carried out when the CALL !addr16 and BR !addr16 instructions are executed.
CALL !addr16 and BR !addr16 instructions can be used to branch to all the memory spaces.
[Illustration]
In case of CALL !addr16 and BR !addr16 instructions
7 0
PC CALL or BR
15 8 7 0
PC
[Function]
The table contents (branch destination address) of the particular location to be addressed by the immediate data
of an instruction code from bit 1 to bit 5 are transferred to the program counter (PC) to branch.
Table indirect addressing is carried out when the CALLT [addr5] instruction is executed. This instruction can be
used to branch to all the memory spaces according to the address stored in the memory table 40H to 7FH.
[Illustration]
7 6 5 1 0
15 8 7 6 5 1 0
Effective address 0 0 0 0 0 0 0 0 0 1 0
7 Memory (Table) 0
Low addr.
15 8 7 0
PC
[Function]
The register pair (AX) contents to be specified with an instruction word are transferred to the program counter
(PC) to branch.
This function is carried out when the BR AX instruction is executed.
[Illustration]
7 0 7 0
rp A X
15 8 7 0
PC
The following methods (addressing) are available to specify the register and memory to undergo manipulation
during instruction execution.
[Function]
The memory indicated by immediate data in an instruction word is directly addressed.
[Operand format]
Identifier Description
[Description example]
MOV A, !0FE80H; When setting !addr16 to FE80H
1 0 0 0 0 0 0 0 80H
1 1 1 1 1 1 1 0 FEH
[Illustration]
7 0
OP code
addr16 (low)
addr16 (high)
Memory
[Function]
The memory to be manipulated in the fixed space is directly addressed with the 8-bit data in an instruction word.
The fixed space where this addressing is applied is the 256-byte space FE20H to FF1FH. An internal high-
speed RAM is mapped at FE20H to FEFFH and the special function registers (SFR) are mapped at FF00H to
FF1FH.
The SFR area where short direct addressing is applied (FF00H to FF1FH) is a part of the total SFR area. In this
area, ports which are frequently accessed in a program and a compare register of the timer counter are mapped,
and these SFRs can be manipulated with a small number of bytes and clocks.
When 8-bit immediate data is at 20H to FFH, bit 8 of an effective address is cleared to 0. When it is at 00H to
1FH, bit 8 is set to 1. See [Illustration] below.
[Operand format]
Identifier Description
[Description example]
EQU DATA1 0FE90H; DATA1 indicates FE90H in saddr area
MOV DATA1, #50H; When the immediate data to 50H
1 0 0 1 0 0 0 0 90H (saddr-offset)
[Illustration]
7 0
OP code
saddr-offset
[Function]
A memory-mapped special function register (SFR) is addressed with the 8-bit immediate data in an instruction
word.
This addressing is applied to the 256-byte space FF00H to FFFFH. However, SFRs mapped at FF00H to
FF1FH are accessed with short direct addressing.
[Operand format]
Identifier Description
[Description example]
MOV PM0, A; When selecting PM0 for sfr
Instruction code 1 1 1 0 0 1 1 1
0 0 1 0 0 0 0 0
[Illustration]
7 0
OP code
sfr-offset
SFR
15 8 7 0
Effective
1 1 1 1 1 1 1 1
address
[Function]
A general-purpose register is accessed as an operand.
The general-purpose register to be accessed is specified with the register specify code and functional name in
the instruction code.
Register addressing is carried out when an instruction with the following operand format is executed. When an
8-bit register is specified, one of the eight registers is specified with 3 bits in the instruction code.
[Operand format]
Identifier Description
r X, A, C, B, E, D, L, H
‘r’ and ‘rp’ can be described with absolute names (R0 to R7 and RP0 to RP3) as well as function names (X, A, C,
B, E, D, L, H, AX, BC, DE, and HL).
[Description example]
MOV A, C; When selecting the C register for r
Instruction code 0 0 0 0 1 0 1 0
0 0 1 0 0 1 0 1
Instruction code 1 0 0 0 1 0 0 0
[Function]
The memory is addressed with the contents of the register pair specified as an operand. The register pair to be
accessed is specified with the register pair specify code in the instruction code. This addressing can be carried
out for all the memory spaces.
[Operand format]
Identifier Description
− [DE], [HL]
[Description example]
MOV A, [DE]; When selecting register pair [DE]
Instruction code 0 0 1 0 1 0 1 1
[Illustration]
15 8 7 0
DE D E
[Function]
8-bit immediate data is added to the contents of the base register, that is, the HL register pair, and the sum is
used to address the memory. Addition is performed by expanding the offset data as a positive number to 16 bits.
A carry from the 16th bit is ignored. This addressing can be carried out for all the memory spaces.
[Operand format]
Identifier Description
− [HL+byte]
[Description example]
MOV A, [HL+10H]; When setting byte to 10H
Instruction code 0 0 1 0 1 1 0 1
0 0 0 1 0 0 0 0
[Illustration]
16 8 7 0
HL H L
+10
7 Memory 0
7 0
[Function]
The stack area is indirectly addressed with the stack pointer (SP) contents.
This addressing method is automatically employed when the PUSH, POP, subroutine call, and return instructions
are executed or the register is saved/restored upon interrupt request generation.
Stack addressing can be used to access the internal high-speed RAM area only.
[Description example]
In the case of PUSH DE
Instruction code 1 0 1 0 1 0 1 0
[Illustration]
7 Memory 0
SP FEE0H FEE0H
FEDFH D
SP FEDEH FEDEH E
The 78K0S/KB1+ has the ports shown in Figure 4-1, which can be used for various control operations. Table 4-1
shows the functions of each port.
In addition to digital I/O port functions, each of these ports has an alternate function. For details, refer to
CHAPTER 2 PIN FUNCTIONS.
P40 P00
Port 0
P03
Port 4
P20
Port 2
P47
P23
P120
P30
Port 12
P123 Port 3
P33
Port 13 P130 P34
P30 I/O Port 3 Can be set to input or output mode in 1- Input TI000/INTP0
bit units.
P31 TI010/TO00/
On-chip pull-up resistor can be
INTP2
connected by setting software.
P32 −
P33 −
Note Note
P34 Input Input only Input RESET
P43 TxD6/INTP1
P44 RxD6
P45 −
P46 −
P47 −
Caution The P121/X1 and P122/X2 pins are pulled down during reset.
Remarks 1. P121 and P122 can be allocated when the high-speed Ring-OSC is selected as the system clock.
2. P122 can be allocated when an external clock is selected as the system clock.
Item Configuration
Control registers Port mode registers (PM0, PM2, PM3, PM4, PM12)
Port registers (P0, P2, P3, P4, P12, P13)
Port mode control register 2 (PMC2)
Pull-up resistor option registers (PU0, PU2, PU3, PU4, PU12)
4.2.1 Port 0
Port 0 is a 4-bit I/O port with an output latch. Each bit of this port can be set to the input or output mode by using
port mode register 0 (PM0). When the P00 to P03 pins are used as an input port, an on-chip pull-up resistor can be
connected in 1-bit units by using pull-up resistor option register 0 (PU0).
This port is also used as the analog input pins of the internal A/D converter.
Generation of reset signal sets port 0 to the input mode.
Figure 4-2 shows the block diagram of port 0.
VDD
WRPU
PU0
PU00 to PU03
P-ch
RD
Internal bus
Selector
WRPORT
P0
Output latch
P00 to P03
(P00 to P03)
WRPM
PM0
PM00 to PM03
4.2.2 Port 2
Port 2 is a 4-bit I/O port with an output latch. Each bit of this port can be set to the input or output mode by using
port mode register 2 (PM2). When the P20 to P23 pins are used as an input port, an on-chip pull-up resistor can be
connected in 1-bit units by using pull-up resistor option register 2 (PU2).
This port is also used as the analog input pins of the internal A/D converter.
Generation of reset signal sets port 2 to the input mode.
Figure 4-2 shows the block diagram of port 2.
VDD
WRPU
PU2
PU20 to PU23
P-ch
WRPMC
PMC2
PMC20 to PMC23
RD
Internal bus
Selector
WRPORT
P2
Output latch
P20/ANI0 to P23/ANI3
(P20 to P23)
WRPM
PM2
PM20 to PM23
A/D converter
4.2.3 Port 3
Pins P30 to P33 constitute a 4-bit I/O port with an output latch. Each bit of this port can be set to the input or
output mode by using port mode register
VDD
WRPU
PU3
PU31
P-ch
Alternate
function
RD
Selector
Internal bus
WRPORT
P3
Output latch
(P31) P31/TI010/TO00/INTP2
WRPM
PM3
PM31
Alternate
function
VDD
WRPU
PU3
PU32, PU33
P-ch
RD
Internal bus
Selector
WRPORT
P3
Output latch
P32, P33
(P32, P33)
WRPM
PM3
PM32, PM33
RD
Internal bus
P34/RESET
Reset
Option
byte
Caution Because the P34 pin functions alternately as the RESET pin, if it is used as an input port pin, the
function to input an external reset signal to the RESET pin cannot be used. The function of the
port is selected by the option byte. For details, refer to CHAPTER 18 OPTION BYTE.
If a low level is input to the RESET pin before the option byte is referenced again after reset is
released by the POC circuit, the 78K0S/KB1+ is reset and is held in the reset state until a high
level is input to the RESET pin.
4.2.4 Port 4
Port 4 is a 8-bit I/O port with an output latch. Each bit of this port can be set to the input or output mode by using
port mode register 4 (PM4). When the P40 to P47 pins are used as an input port, an on-chip pull-up resistor can be
connected in 1-bit units by using pull-up resistor option register 4 (PU4).
The P41 to P44 pins can also be used for external interrupt request input, serial interface data I/O, and timer
output.
Generation of reset signal sets port 4 to the input mode.
Figures 4-8 to 4-11 show the block diagrams of port 4.
VDD
WRPU
PU4
PU40,
PU45 to PU47 P-ch
RD
Internal bus
Selector
WRPORT
P4
Output latch
P40, P45 to P47
(P40, P45 to P47)
WRPM
PM4
PM40,
PM45 to PM47
VDD
WRPU
PU4
PU41, PU44
P-ch
Alternate
function
RD
Internal bus
Selector
WRPORT
P4
Output latch P41/INTP3,
(P41, P44) P44/RxD6
WRPM
PM4
PM41, PM44
VDD
WRPU
PU4
PU42
P-ch
RD
Selector
Internal bus
WRPORT
P4
Output latch
(P42) P42/TOH1
WRPM
PM4
PM42
Alternate
function
VDD
WRPU
PU4
PU43
P-ch
Alternate
function
RD
Selector
Internal bus
WRPORT
P4
Output latch
(P43) P43/TxD6/INTP1
WRPM
PM4
PM43
Alternate
function
4.2.5 Port 12
Port 12 is a 4-bit I/O port with an output latch. Each bit of this port can be set to the input or output mode by using
port mode register 12 (PM12). When the P120 and P123 pins are used as an input port, an on-chip pull-up resistor
can be connected by using pull-up resistor option register 12 (PU12).
The P121 and P122 pins are also used as the X1 and X2 pins of the system clock oscillator. The functions of the
P121 and P122 pins differ, therefore, depending on the selected system clock oscillator. The following three system
clock oscillators can be used.
The system clock oscillation is selected by the option byte. For details, refer to CHAPTER 18 OPTION BYTE.
Generation of reset signal sets port 12 to the input mode.
Figures 4-12 and 4-13 show the block diagrams of port 12.
VDD
WRPU
PU12
PU120, PU123
P-ch
RD
Internal bus
Selector
WRPORT
P12
Output latch
P120, P123
(P120, P123)
WRPM
PM12
PM120, PM123
RD
Selector
Internal bus
WRPORT
P12
Output latch P121/X1,
(P121, P122) P122/X2
WRPM
PM12
PM121, PM122
Clock input
4.2.6 Port 13
This is a 1-bit output-only port.
Figure 4-14 shows the block diagram of port 13.
RD
Internal bus
WRPORT
P13
Output latch
P130
(P130)
Remark When a reset is input, P130 outputs a low level. If P130 outputs a high level immediately after
reset is released, the output signal of P130 can be used as a dummy CPU reset signal.
Caution Because P30, P31, and P43 are also used as external interrupt pins, the corresponding
interrupt request flag is set if each of these pins is set to the output mode and its output level
is changed. To use the port pin in the output mode, therefore, set the corresponding
interrupt mask flag to 1 in advance.
Symbol 7 6 5 4 3 2 1 0
Symbol 7 6 5 4 3 2 1 0
Symbol 7 6 5 4 3 2 1 0
Symbol 7 6 5 4 3 2 1 0
Symbol 7 6 5 4 3 2 1 0
Symbol 7 6 5 4 3 2 1 0
Note Note
Address: FF03H After reset: 00H (Output latch) R/W
Symbol 7 6 5 4 3 2 1 0
Symbol 7 6 5 4 3 2 1 0
Symbol 7 6 5 4 3 2 1 0
Symbol 7 6 5 4 3 2 1 0
P13 0 0 0 0 0 0 0 P130
Controls of output data (in output mode) Input data read (in input mode)
Table 4-3. Setting of Port Mode Register, Port Register (Output Latch), and Port Mode Control Register
When Alternate Function Is Used
INTP0 Input 1 × −
TI010 Input 1 × −
INTP2 Input 1 × −
INTP1 Input 1 × −
(4) Pull-up resistor option registers (PU0, PU2, PU3, PU4, and PU12)
These registers are used to specify whether an on-chip pull-up resistor is connected to P00 to P03, P20 to
P23, P30 to P33, P40 to P47, P120, and P123. By setting PU0, PU2, PU3, PU4, or PU12, an on-chip pull-up
resistor can be connected to the port pin corresponding to the bit of PU0, PU2, PU3, PU4, or PU12.
PU0, PU2, PU3, PU4, and PU12 are set by using a 1-bit or 8-bit memory manipulation instruction.
Generation of reset signal set these registers to 00H.
Symbol 7 6 5 4 3 2 1 0
Symbol 7 6 5 4 3 2 1 0
Symbol 7 6 5 4 3 2 1 0
PU3 0 0 0 0 PU33 P32 PU31 PU30
Symbol 7 6 5 4 3 2 1 0
Symbol 7 6 5 4 3 2 1 0
The operation of a port differs, as follows, depending on the setting of the I/O mode.
Caution Although a 1-bit memory manipulation instruction manipulates 1 bit, it accesses a port in 8-bit
units. Therefore, the contents of the output latch of a pin in the input mode, even if it is not
subject to manipulation by the instruction, are undefined in a port with a mixture of inputs and
outputs.
The clock generators include a circuit that generates a clock (system clock) to be supplied to the CPU and
peripheral hardware, and a circuit that generates a clock (interval time generation clock) to be supplied to the
watchdog timer and 8-bit timer H1 (TMH1).
• Crystal/ceramic oscillator
This circuit oscillates a clock with a crystal/ceramic oscillator connected across the X1 and X2 pins. It can
oscillate a clock of 1 to 10 MHz. Oscillation of this circuit can be stopped by execution of the STOP instruction.
The system clock source is selected by using the option byte. For details, refer to CHAPTER 18 OPTION BYTE.
When using the X1 and X2 pins as I/O port pins, refer to CHAPTER 4 PORT FUNCTIONS for details.
Item Configuration
Internal bus
Watchdog timer
System clock
X1/P121 oscillatorNote
Crystal/ceramic
oscillation Prescaler
fX
X2/P122 fX fX
External clock
2 22
Selector
input
High-speed
Ring-OSC
oscillation
fXP
22
Selector
fXP
Prescaler
Clock to peripheral
hardware (fXP)
Option byte
1: Cannot be stopped.
0: Can be stopped.
LSRSTOP
Low-speed Ring-OSC
mode register (LSRCM)
Internal bus
Note Select the high-speed Ring-OSC oscillator, crystal/ceramic oscillator, or external clock input as the system
clock source by using the option byte.
(1) Processor clock control register (PCC) and preprocessor clock control register (PPCC)
These registers are used to specify the division ratio of the system clock.
PCC and PPCC are set by using a 1-bit or 8-bit memory manipulation instruction.
Generation of reset signal sets PCC and PPCC to 02H.
Symbol 7 6 5 4 3 2 1 0
PCC 0 0 0 0 0 0 PCC1 0
Symbol 7 6 5 4 3 2 1 0
0 0 0 fX
Note 1
0 1 0 fX/2
2
0 0 1 fX/2
2 Note 2
1 0 0 fX/2
3 Note 1
0 1 1 fX/2
4 Note 2
1 0 1 fX/2
Notes 1. If PPCC = 01H, the clock (fXP) supplied to the peripheral hardware is fX/2.
2. If PPCC = 02H, the clock (fXP) supplied to the peripheral hardware is fX/22.
The fastest instruction of the 78K0S/KB1+ is executed in two CPU clocks. Therefore, the relationship between the
CPU clock (fCPU) and the minimum instruction execution time is as shown in Table 5-2.
Table 5-2. Relationship Between CPU Clock and Minimum Instruction Execution Time
Note
CPU Clock (fCPU) Minimum Instruction Execution Time: 2/fCPU
fX 0.25 µs 0.2 µs
Note The CPU clock (high-speed Ring-OSC clock, crystal/ceramic oscillation clock, or external clock input) is
selected by the option byte.
Symbol 7 6 5 4 3 2 1 <0>
LSRCM 0 0 0 0 0 0 0 LSRSTOP
Symbol 7 6 5 4 3 2 1 0
Cautions 1. To set and then release the STOP mode, set the oscillation stabilization time as follows.
Expected oscillation stabilization time of resonator ≤ Oscillation stabilization time set by
OSTS
2. The wait time after the STOP mode is released does not include the time from the release of
the STOP mode to the start of clock oscillation (“a” in the figure below), regardless of
whether STOP mode was released by reset signal generation or interrupt generation.
Voltage
waveform
of X1 pin
a
Caution 3. The oscillation stabilization time that elapses on power application or after release of reset is
selected by the option byte. For details, refer to CHAPTER 18 OPTION BYTE.
Remarks 1. ( ): fX = 10 MHz
2. Determine the oscillation stabilization time of the resonator by checking the characteristics of the
resonator to be used.
VSS
X1
X2
Crystal resonator
or ceramic resonator
Caution When using the crystal/ceramic oscillator, wire as follows in the area enclosed by the broken
lines in Figure 5-6 to avoid an adverse effect from wiring capacitance.
(a) Too long wiring of connected circuit (b) Crossed signal lines
PORT
VSS X1 X2 VSS X1 X2
(c) Wiring near high fluctuating current (d) Current flowing through ground line of oscillator
(Potential at points A, B, and C fluctuates.)
VDD
PORT
VSS X1 X2
VSS X1 X2
High current
A B C
High current
VSS X1 X2
5.4.4 Prescaler
The prescaler divides the clock (fX) output by the system clock oscillator to generate a clock (fXP) to be supplied to
the peripheral hardware. It also divides the clock to peripheral hardware (fXP) to generate a clock to be supplied to the
CPU.
Remark The clock output by the oscillator selected by the option byte (high-speed Ring-OSC oscillator,
crystal/ceramic oscillator, or external clock input circuit) is divided. For details of the option byte, refer to
CHAPTER 18 OPTION BYTE.
A clock (fCPU) is supplied to the CPU from the system clock (fX) oscillated by one of the following three types of
oscillators.
The system clock oscillator is selected by the option byte. For details of the option byte, refer to CHAPTER 18
OPTION BYTE.
Figures 5-8 and 5-9 show the timing chart and status transition diagram of the default start by the high-speed
Ring-OSC oscillator.
Remark When the high-speed Ring-OSC oscillator is used, the clock accuracy is ±5%.
(a)
VDD
RESET H
Internal reset
(b)
System clock
Note Operation stop time is 277 µs (MIN.), 544 µs (TYP.), and 1.075 ms (MAX.).
(a) The internal reset signal is generated by the power-on clear function on power application, the option byte is
referenced after reset, and the system clock is selected.
(b) The option byte is referenced and the system clock is selected. Then the high-speed Ring-OSC clock
operates as the system clock.
Power
application
Reset by
power-on clear
Reset signal
High-speed Ring-OSC
selected by option byte
(a)
VDD
RESET H
Internal reset
(b)
System clock
(c)
Crystal/ceramic
CPU clock oscillator clock
PCC = 02H, PPCC = 02H
Notes 1. Operation stop time is 276 µs (MIN.), 544 µs (TYP.), and 1.074 ms (MAX.).
2. The clock oscillation stabilization time for default start is selected by the option byte. For details, refer
to CHAPTER 18 OPTION BYTE. The oscillation stabilization time that elapses after the STOP mode
is released is selected by the oscillation stabilization time select register (OSTS).
(a) The internal reset signal is generated by the power-on clear function on power application, the option byte is
referenced after reset, and the system clock is selected.
(b) After high-speed Ring-OSC clock is generated, the option byte is referenced and the system clock is
selected. In this case, the crystal/ceramic oscillator clock is selected as the system clock.
(c) If the system clock is the crystal/ceramic oscillator clock, it starts operating as the CPU clock after clock
oscillation is stabilized. The wait time is selected by the option byte. For details, refer to CHAPTER 18
OPTION BYTE.
Power
application
Reset by
power-on clear
Reset signal
Crystal/ceramic
oscillation selected
by option byte
Interrupt Interrupt
HALT
instruction STOP
instruction
HALT STOP
• High-speed operation
The accuracy of processing is improved as compared with high-speed Ring-OSC oscillation (8 MHz (TYP.))
because an oscillation frequency of 1 to 10 MHz can be selected and an external clock with a small frequency
deviation can be supplied.
• Improvement of expandability
If the external clock input circuit is selected as the oscillator, the X2 pin can be used as an I/O port pin. For
details, refer to CHAPTER 4 PORT FUNCTIONS.
Figures 5-12 and 5-13 show the timing chart and status transition diagram of default start by external clock input.
(a)
VDD
RESET H
Internal reset
(b)
System clock
Note Operation stop time is 277 µs (MIN.), 544 µs (TYP.), and 1.075 ms (MAX.).
(a) The internal reset signal is generated by the power-on clear function on power application, the option byte is
referenced after reset, and the system clock is selected.
(b) The option byte is referenced and the system clock is selected. Then the external clock operates as the
system clock.
Power
application
Reset by
power-on clear
Reset signal
HALT STOP
The following two types of clocks are supplied to the peripheral hardware.
0 0 fX
0 1 fX/2
2
1 0 fX/2
1 1 Setting prohibited
Standby
Power
application
Reset by
power-on clear
Reset signal
LSRSTOP = 1
LSRSTOP = 0
Low-speed Ring-OSC
oscillator stops
Note The clock source of the watchdog timer (WDT) is selected from fX or fRL, or it may be stopped. For details,
refer to CHAPTER 9 WATCHDOG TIMER.
Item Configuration
Internal bus
Capture/compare control
register 00 (CRC00)
CRC002CRC001 CRC000
Selector
CR010 INTTM000
Selector
Match
fXP
Selector
fXP/22
fXP/28 16-bit timer counter 00
Clear
(TM00) Output TO00/TI010/
controller INTP2/P31
Noise Match
fX elimi- 2 Output latch
nator PM31
(P31)
Noise 16-bit timer capture/compare
TI000/INTP0/P30 elimi-
nator register 010 (CR010)
Selector
INTTM010
CRC002
PRM001 PRM000 TMC003 TMC002 TMC001 OVF00 OSPT00 OSPE00 TOC004 LVS00 LVR00 TOC001 TOE00
Prescaler mode 16-bit timer mode 16-bit timer output
control register 00 control register 00
register 00 (PRM00) (TMC00) (TOC00)
Internal bus
TM00
CR000
Table 6-2. CR000 Capture Trigger and Valid Edges of TI000 and TI010 Pins
(1) TI000 pin valid edge selected as capture trigger (CRC001 = 1, CRC000 = 1)
CR000 Capture Trigger TI000 Pin Valid Edge
ES010 ES000
(2) TI010 pin valid edge selected as capture trigger (CRC001 = 0, CRC000 = 1)
CR000 Capture Trigger TI010 Pin Valid Edge
ES110 ES100
Cautions 1. Set CR000 to other than 0000H in the clear & start mode entered on match between TM00
and CR000. This means a 1-pulse count operation cannot be performed when this
register is used as an external event counter. However, in the free-running mode and in
the clear & start mode using the valid edge of TI000 pin, if CR000 is set to 0000H, an
interrupt request (INTTM000) is generated when CR000 changes from 0000H to 0001H
following overflow (FFFFH).
2. If the new value of CR000 is less than the value of 16-bit timer counter 0 (TM00), TM00
continues counting, overflows, and then starts counting from 0 again. If the new value of
CR000 is less than the old value, therefore, the timer must be reset to be restarted after
the value of CR000 is changed.
3. The value of CR000 after 16-bit timer/event counter 00 has stopped is not guaranteed.
4. The capture operation may not be performed for CR000 set in compare mode even if a
capture trigger is input.
5. When P31 is used as the input pin for the valid edge of TI010, it cannot be used as a timer
output (TO00). Moreover, when P31 is used as TO00, it cannot be used as the input pin
for the valid edge of TI010.
6. If the register read period and the input of the capture trigger conflict when CR000 is
used as a capture register, the capture trigger input takes precedence and the read data
is undefined. Also, if the count stop of the timer and the input of the capture trigger
conflict, the capture trigger is undefined.
7. Changing the CR000 setting may cause a malfunction. To change the setting, refer to 6.5
Cautions Related to 16-Bit Timer/Event Counter 00 (17) Changing compare register
during timer operation.
CR010
Table 6-3. CR010 Capture Trigger and Valid Edge of TI000 Pin (CRC002 = 1)
Cautions 1. In the free-running mode and in the clear & start mode using the valid edge of the TI000
pin, if CR010 is set to 0000H, an interrupt request (INTTM010) is generated when CR010
changes from 0000H to 0001H following overflow (FFFFH).
2. If the new value of CR010 is less than the value of 16-bit timer counter 0 (TM00), TM00
continues counting, overflows, and then starts counting from 0 again. If the new value of
CR010 is less than the old value, therefore, the timer must be reset to be restarted after
the value of CR010 is changed.
3. The value of CR010 after 16-bit timer/event counter 00 has stopped is not guaranteed.
4. The capture operation may not be performed for CR010 set in compare mode even if a
capture trigger is input.
5. If the register read period and the input of the capture trigger conflict when CR010 is
used as a capture register, the capture trigger input takes precedence and the read data
is undefined. Also, if the timer count stop and the input of the capture trigger conflict,
the capture data is undefined.
6. Changing the CR010 setting during TM00 operation may cause a malfunction. To change
the setting, refer to 6.5 Cautions Related to 16-Bit Timer/Event Counter 00 (17) Changing
compare register during timer operation.
The following six types of registers are used to control 16-bit timer/event counter 00.
Caution 16-bit timer counter 00 (TM00) starts operation at the moment TMC002 and TMC003
(operation stop mode) are set to a value other than 0, 0, respectively. Set TMC002 and
TMC003 to 0, 0 to stop the operation.
Symbol 7 6 5 4 3 2 1 <0>
TMC003 TMC002 TMC001 Operating mode and clear TO00 inversion timing selection Interrupt request generation
mode selection
0 0 0 Operation stop No change Not generated
0 0 1 (TM00 cleared to 0)
Cautions 1. The timer operation must be stopped before writing to bits other than the OVF00 flag.
2. Regardless of the CPU’s operation mode, when the timer stops, the signals input to pins
TI000/TI010 are not acknowledged.
3. Except when TI000 pin valid edge is selected as the count clock, stop the timer operation
before setting STOP mode or system clock stop mode; otherwise the timer may malfunction
when the system clock starts.
4. Set the valid edge of the TI000 pin with bits 4 and 5 of prescaler mode register 00 (PRM00)
after stopping the timer operation.
5. If the clear & start mode entered on a match between TM00 and CR000, clear & start mode at
the valid edge of the TI000 pin, or free-running mode is selected, when the set value of CR000
is FFFFH and the TM00 value changes from FFFFH to 0000H, the OVF00 flag is set to 1.
6. Even if the OVF00 flag is cleared before the next count clock is counted (before TM00
becomes 0001H) after the occurrence of a TM00 overflow, the OVF00 flag is re-set newly and
clear is disabled.
7. The capture operation is performed at the fall of the count clock. An interrupt request input
(INTTM0n0), however, occurs at the rise of the next count clock.
Note If both the rising and falling edges have been selected as the valid edges of the TI000 pin, capture is
not performed.
TOC004 Timer output F/F control using match of CR010 and TM00
0 Disables inversion operation
1 Enables inversion operation
TOC001 Timer output F/F control using match of CR000 and TM00
0 Disables inversion operation
1 Enables inversion operation
Note The one-shot pulse output mode operates correctly only in the free-running mode and the mode in which
clear & start occurs at the TI000 pin valid edge. In the mode in which clear & start occurs on a match
between TM00 and CR000, one-shot pulse output is not possible because an overflow does not occur.
Cautions 1. Timer operation must be stopped before setting other than OSPT00.
2. If LVS00 and LVR00 are read, 0 is read.
3. OSPT00 is automatically cleared after data is set, so 0 is read.
4. Do not set OSPT00 to 1 other than in one-shot pulse output mode.
5. A write interval of two cycles or more of the count clock selected by prescaler mode register
00 (PRM00) is required to write to OSPT00 successively.
6. When the TOE00 is 0, set the TOE00, LVS00, and LVR00 at the same time with the 8-bit
memory manipulation instruction. When the TOE00 is 1, the LVS00 and LVR00 can be set
with the 1-bit memory manipulation instruction.
0 0 Falling edge
0 1 Rising edge
1 0 Setting prohibited
1 1 Both falling and rising edges
0 0 Falling edge
0 1 Rising edge
1 0 Setting prohibited
1 1 Both falling and rising edges
Note The external clock requires a pulse longer than two cycles of the internal count clock (fXP).
Cautions 1. Always set data to PRM00 after stopping the timer operation.
2. If the valid edge of the TI000 pin is to be set as the count clock, do not set the clear/start
mode and the capture trigger at the valid edge of the TI000 pin.
3. In the following cases, note with caution that the valid edge of the TI0n0 pin is detected.
<1> Immediately after a system reset, if a high level is input to the TI0n0 pin, the
operation of the 16-bit timer counter 00 (TM00) is enabled
→ If the rising edge or both rising and falling edges are specified as the valid edge
of the TI0n0 pin, a rising edge is detected immediately after the TM00 operation is
enabled.
<2> If the TM00 operation is stopped while the TI0n0 pin is high level, TM00 operation is
then enabled after a low level is input to the TI0n0 pin
→ If the falling edge or both rising and falling edges are specified as the valid edge
of the TI0n0 pin, a falling edge is detected immediately after the TM00 operation is
enabled.
<3> If the TM00 operation is stopped while the TI0n0 pin is low level, TM00 operation is
then enabled after a high level is input to the TI0n0 pin
→ If the rising edge or both rising and falling edges are specified as the valid edge
of the TI0n0 pin, a rising edge is detected immediately after the TM00 operation is
enabled.
4. The sampling clock used to eliminate noise differs when a TI000 valid edge is used as the
count clock and when it is used as a capture trigger. In the former case, the count clock
is fXP, and in the latter case the count clock is selected by prescaler mode register 00
(PRM00). The capture operation is not performed until the valid edge is sampled and the
valid level is detected twice, thus eliminating noise with a short pulse width.
5. When using P31 as the input pin (TI010) of the valid edge, it cannot be used as a timer
output (TO00). When using P31 as the timer output pin (TO00), it cannot be used as the
input pin (TI010) of the valid edge.
Remark n = 0, 1
Symbol 7 6 5 4 3 2 1 0
Setting
The basic operation setting procedure is as follows.
<1> Set the CRC00 register (see Figure 6-10 for the set value).
<2> Set any value to the CR000 register.
<3> Set the count clock by using the PRM00 register.
<4> Set the TMC00 register to start the operation (see Figure 6-10 for the set value).
Caution Changing the CR000 setting during TM00 operation may cause a malfunction. To change the
setting, refer to 6.5 Cautions Related to 16-Bit Timer/Event Counter 00 (17) Changing compare
register during timer operation.
Remark For how to enable the INTTM000 interrupt, see CHAPTER 13 INTERRUPT FUNCTIONS.
Interrupt requests are generated repeatedly using the count value set in 16-bit timer capture/compare register 000
(CR000) beforehand as the interval.
When the count value of 16-bit timer counter 00 (TM00) matches the value set to CR000, counting continues with
the TM00 value cleared to 0 and the interrupt request signal (INTTM000) is generated.
The count clock of the 16-bit timer/event counter can be selected using bits 0 and 1 (PRM000, PRM001) of
prescaler mode register 00 (PRM00).
TMC00 0 0 0 0 1 1 0/1 0
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with the interval timer. See the
description of the respective control registers for details.
INTTM000
fXP
Selector
fXP/22
Note
16-bit timer counter 00
fXP/28 OVF00
(TM00)
Noise
TI000/INTP0/P30 eliminator
Clear
circuit
fXP
Note OVF00 is set to 1 only when 16-bit timer capture/compare register 000 (CR000) is set to FFFFH.
Count clock
INTTM000
When the compare register is changed during timer count operation, if the value after 16-bit timer capture/compare
register 000 (CR000) is changed is smaller than that of 16-bit timer counter 00 (TM00), TM00 continues counting,
overflows and then restarts counting from 0. Thus, if the value (M) after the CR000 change is smaller than that (N)
before the change, it is necessary to restart the timer after changing CR000.
Figure 6-13. Timing After Change of Compare Register During Timer Count Operation (N → M: N > M)
Count clock
CR000 N M
Remark N>X>M
Setting
The basic operation setting procedure is as follows.
<1> Set the CRC00 register (see Figure 6-14 for the set value).
<2> Set the count clock by using the PRM00 register.
<3> Set any value to the CR000 register (0000H cannot be set).
<4> Set the TMC00 register to start the operation (see Figure 6-14 for the set value).
Remarks 1. For the setting of the TI000 pin, see 6.3 (5) Port mode register 3 (PM3).
2. For how to enable the INTTM000 interrupt, see CHAPTER 13 INTERRUPT FUNCTIONS.
The external event counter counts the number of external clock pulses to be input to the TI000 pin with using 16-bit
timer counter 00 (TM00).
TM00 is incremented each time the valid edge specified by prescaler mode register 00 (PRM00) is input.
When the TM00 count value matches the 16-bit timer capture/compare register 000 (CR000) value, TM00 is
cleared to 0 and the interrupt request signal (INTTM000) is generated.
Input a value other than 0000H to CR000. (A count operation with a pulse cannot be carried out.)
The rising edge, the falling edge, or both edges can be selected using bits 4 and 5 (ES000 and ES010) of
prescaler mode register 00 (PRM00).
Because an operation is carried out only when the valid edge of the TI000 pin is detected twice after sampling with
the internal clock (fXP), noise with a short pulse width can be removed.
Figure 6-14. Control Register Settings in External Event Counter Mode (with Rising Edge Specified)
TMC00 0 0 0 0 1 1 0/1 0
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with the external event counter.
See the description of the respective control registers for details.
Internal bus
Match
INTTM000
Clear
Note OVF00 is 1 only when 16-bit timer capture/compare register 000 (CR000) is set to FFFFH.
Figure 6-16. External Event Counter Operation Timing (with Rising Edge Specified)
Count starts
TM00 count value 0000H 0001H 0002H 0003H N-2 N-1 N 0000H 0001H 0002H
CR000 N
INTTM000
(2) INTTM000 generation timing after INTTM000 has been generated twice
TM00 count value N 0000H 0001H 0002H 0003H 0004H N-1 N 0000H 0001H 0002H 0003H
CR000 N
INTTM000
Caution When reading the external event counter count value, TM00 should be read.
Count clock
TI000
CR010 N
INTTM010
Setting
The basic operation setting procedure is as follows.
<1> Set the CRC00 register (see Figures 6-18, 6-21, 6-23, and 6-25 for the set value).
<2> Set the count clock by using the PRM00 register.
<3> Set the TMC00 register to start the operation (see Figures 6-18, 6-21, 6-23, and 6-25 for the set value).
Caution To use two capture registers, set the TI000 and TI010 pins.
Remarks 1. For the setting of the TI000 (or TI010) pin, see 6.3 (5) Port mode register 3 (PM3).
2. For how to enable the INTTM000 (or INTTM010) interrupt, see CHAPTER 13 INTERRUPT
FUNCTIONS.
(1) Pulse width measurement with free-running counter and one capture register
When 16-bit timer counter 00 (TM00) is operated in free-running mode, and the edge specified by prescaler
mode register 00 (PRM00) is input to the TI000 pin, the value of TM00 is taken into 16-bit timer
capture/compare register 010 (CR010) and an external interrupt request signal (INTTM010) is set.
Specify both the rising and falling edges by using bits 4 and 5 (ES000 and ES010) of PRM00.
Sampling is performed using the count clock selected by PRM00, and a capture operation is only performed
when a valid level of the TI000 pin is detected twice, thus eliminating noise with a short pulse width.
Figure 6-18. Control Register Settings for Pulse Width Measurement with Free-Running Counter
and One Capture Register (When TI000 and CR010 Are Used)
TMC00 0 0 0 0 0 1 0/1 0
Free-running mode
CRC00 0 0 0 0 0 1 0/1 0
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with pulse width measurement.
See the description of the respective control registers for details.
Figure 6-19. Configuration Diagram for Pulse Width Measurement by Free-Running Counter
fXP
Selector
fXP/22 16-bit timer/counter 00 OVF00
(TM00)
6
fXP/2
INTTM010
Internal bus
Count clock
INTTM010
OVF00 Note
Figure 6-21. Control Register Settings for Measurement of Two Pulse Widths with Free-Running Counter
TMC00 0 0 0 0 0 1 0/1 0
Free-running mode
CRC00 0 0 0 0 0 1 0 1
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with pulse width measurement.
See the description of the respective control registers for details.
Figure 6-22. Timing of Pulse Width Measurement Operation with Free-Running Counter
(with Both Edges Specified)
Count clock
INTTM010
INTTM000
OVF00 Note
(3) Pulse width measurement with free-running counter and two capture registers
When 16-bit timer counter 00 (TM00) is operated in free-running mode, it is possible to measure the pulse
width of the signal input to the TI000 pin.
When the rising or falling edge specified by bits 4 and 5 (ES000 and ES010) of prescaler mode register 00
(PRM00) is input to the TI000 pin, the value of TM00 is taken into 16-bit timer capture/compare register 010
(CR010) and an interrupt request signal (INTTM010) is set.
Also, when the inverse edge to that of the capture operation is input into CR010, the value of TM00 is taken
into 16-bit timer capture/compare register 000 (CR000).
Sampling is performed using the count clock cycle selected by prescaler mode register 00 (PRM00), and a
capture operation is only performed when a valid level of the TI000 pin is detected twice, thus eliminating
noise with a short pulse width.
Figure 6-23. Control Register Settings for Pulse Width Measurement with Free-Running Counter and
Two Capture Registers (with Rising Edge Specified)
TMC00 0 0 0 0 0 1 0/1 0
Free-running mode
CRC00 0 0 0 0 0 1 1 1
CR000 used as capture register
Note If the valid edge of TI000 pin is specified to be both the rising and falling edges, 16-bit timer
capture/compare register 000 (CR000) cannot perform the capture operation. When the CRC001 bit value is
1, the TM00 count value is not captured in the CR000 register when a valid edge of the TI010 pin is
detected, but the input from the TI010 pin can be used as an external interrupt source because INTTM000
is generated at that timing.
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with pulse width measurement.
See the description of the respective control registers for details.
Count clock
INTTM010
OVF00 Note
Figure 6-25. Control Register Settings for Pulse Width Measurement by Means of Restart
(with Rising Edge Specified)
TMC00 0 0 0 0 1 0 0/1 0
CRC00 0 0 0 0 0 1 1 1
CR000 used as capture register
Note If the valid edge of TI000 pin is specified to be both the rising and falling edges, 16-bit timer
Setting
The basic operation setting procedure is as follows.
Caution Changing the CR000 setting during TM00 operation may cause a malfunction. To change the
setting, refer to 6.5 Cautions Related to 16-Bit Timer/Event Counter 00 (17) Changing compare
register during timer operation.
Remarks 1. For the setting of the TO00 pin, see 6.3 (5) Port mode register 3 (PM3).
2. For how to enable the INTTM000 interrupt, see CHAPTER 13 INTERRUPT FUNCTIONS.
A square wave with any selected frequency can be output at intervals determined by the count value preset to 16-
bit timer capture/compare register 000 (CR000).
The TO00 pin output status is reversed at intervals determined by the count value preset to CR000 + 1 by setting
bit 0 (TOE00) and bit 1 (TOC001) of 16-bit timer output control register 00 (TOC00) to 1. This enables a square wave
with any selected frequency to be output.
TMC00 0 0 0 0 1 1 0 0
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with square-wave output. See the
description of the respective control registers for details.
Count clock
TM00 count value 0000H 0001H 0002H N−1 N 0000H 0001H 0002H N−1 N 0000H
CR000 N
INTTM000
Setting
The basic operation setting procedure is as follows.
<1> Set the CRC00 register (see Figure 6-29 for the set value).
<2> Set any value to the CR000 register as the cycle.
<3> Set any value to the CR010 register as the duty factor.
<4> Set the TOC00 register (see Figure 6-29 for the set value).
<5> Set the count clock by using the PRM00 register.
<6> Set the TMC00 register to start the operation (see Figure 6-29 for the set value).
Caution Changing the CRC0n0 setting during TM00 operation may cause a malfunction. To change the
setting, refer to 6.5 Cautions Related to 16-Bit Timer/Event Counter 00 (17) Changing compare
register during timer operation.
Remarks 1. For the setting of the TO00 pin, see 6.3 (5) Port mode register 3 (PM3).
2. For how to enable the INTTM000 interrupt, see CHAPTER 13 INTERRUPT FUNCTIONS.
3. n = 0 or 1
In the PPG output operation, rectangular waves are output from the TO00 pin with the pulse width and the cycle
that correspond to the count values preset in 16-bit timer capture/compare register 010 (CR010) and in 16-bit timer
capture/compare register 000 (CR000), respectively.
TMC00 0 0 0 0 1 1 0 0
CRC00 0 0 0 0 0 0 × 0
Cautions 1. Values in the following range should be set in CR000 and CR010.
0000H < CR010 < CR000 ≤ FFFFH
2. The cycle of the pulse generated through PPG output (CR000 setting value + 1) has a duty of
(CR010 setting value + 1)/(CR000 setting value + 1).
fXP
Selector
fXP/22
16-bit timer counter 00 Clear
fXP/28 (TM00) circuit
Noise
Output controller
TI000/INTP0/P30
eliminator
TO00/TI010/
fXP INTP2/P31
Count clock
Clear Clear
TO00
Pulse width: (M + 1) × t
1 cycle: (N + 1) × t
Setting
The basic operation setting procedure is as follows.
Remarks 1. For the setting of the TO00 pin, see 6.3 (5) Port mode register 3 (PM3).
2. For how to enable the INTTM000 (if necessary, INTTM010) interrupt, see CHAPTER 13
INTERRUPT FUNCTIONS.
Note The case where N < M is described here. When N > M, the output becomes active with the CR000
register and inactive with the CR010 register. Do not set N to M.
Cautions 1. Do not set the OSPT00 bit to 1 again while the one-shot pulse is being output. To output the
one-shot pulse again, wait until the current one-shot pulse output is completed.
2. When using the one-shot pulse output of 16-bit timer/event counter 00 with a software
trigger, do not change the level of the TI000 pin or its alternate-function port pin.
Because the external trigger is valid even in this case, the timer is cleared and started even
at the level of the TI000 pin or its alternate-function port pin, resulting in the output of a
pulse at an undesired timing.
Figure 6-32. Control Register Settings for One-Shot Pulse Output with Software Trigger
Free-running mode
CRC00 0 0 0 0 0 0 0/1 0
Setting invalid
(setting “10” is prohibited.)
Setting invalid
(setting “10” is prohibited.)
Figure 6-33. Timing of One-Shot Pulse Output Operation with Software Trigger
Count clock
TM00 count 0000H 0001H N N+1 0000H N−1 N M−1 M M+1 M+2
OSPT00
INTTM010
INTTM000
Caution 16-bit timer counter 00 starts operating as soon as a value other than 00 (operation stop
mode) is set to the TMC003 and TMC002 bits.
Remark N<M
Note The case where N < M is described here. When N > M, the output becomes active with the CR000
register and inactive with the CR010 register. Do not set N to M.
Caution Do not input the external trigger again while the one-shot pulse is being output. To output
the one-shot pulse again, wait until the current one-shot pulse output is completed.
Figure 6-34. Control Register Settings for One-Shot Pulse Output with External Trigger
(with Rising Edge Specified)
TMC00 0 0 0 0 1 0 0 0
CRC00 0 0 0 0 0 0 0/1 0
Figure 6-35. Timing of One-Shot Pulse Output Operation with External Trigger (with Rising Edge Specified)
Count clock
TM00 count value 0000H 0001H 0000H N N+1 N+2 M−2 M−1 M M+1 M+2
INTTM010
INTTM000
Caution 16-bit timer counter 00 starts operating as soon as a value other than 00 (operation stop mode) is
set to the TMC002 and TMC003 bits.
Remark N<M
Count clock
Timer start
<1> 16-bit timer counter 00 (TM00) starts operation at the moment TMC002 and TMC003 (operation stop
mode) are set to a value other than 0, 0, respectively. Set TMC002 and TMC003 to 0, 0 to stop the
operation.
<2> Even if TM00 is read, the value is not captured by 16-bit timer capture/compare register 010 (CR010).
<4> Regardless of the CPU’s operation mode, when the timer stops, the signals input to pins TI000/TI010
are not acknowledged.
(3) Setting of 16-bit timer capture/compare registers 000, 010 (CR000, CR010)
<1> Set 16-bit timer capture/compare register 000 (CR000) to other than 0000H in the clear & start mode
entered on match between TM00 and CR000. This means a 1-pulse count operation cannot be
performed when this register is used as an external event counter.
<2> When the clear & start mode entered on a match between TM00 and CR000 is selected, CR000 should
not be specified as a capture register.
<3> In the free-running mode and in the clear & start mode using the valid edge of the TI000 pin, if CR0n0 is
set to 0000H, an interrupt request (INTTM0n0) is generated when CR0n0 changes from 0000H to
0001H following overflow (FFFFH).
<4> If the new value of CR0n0 is less than the value of TM00, TM00 continues counting, overflows, and then
starts counting from 0 again. If the new value of CR0n0 is less than the old value, therefore, the timer
must be reset to be restarted after the value of CR0n0 is changed.
Remark n = 0, 1
<1> Timer operation must be stopped before setting other than OSPT00.
<4> Do not set OSPT00 to 1 other than in one-shot pulse output mode.
<5> A write interval of two cycles or more of the count clock selected by prescaler mode register 00 (PRM00)
is required to write to OSPT00 successively.
<2> When using the one-shot pulse output of 16-bit timer/event counter 00 with a software trigger, do not
change the level of the TI000 pin or its alternate function port pin. Because the external trigger is valid
even in this case, the timer is cleared and started even at the level of the TI000 pin or its alternate
function port pin, resulting in the output of a pulse at an undesired timing.
<3> Do not set the 16-bit timer capture/compare registers 000 and 010 (CR000 and CR010) to 0000H.
<1> Do not input the external trigger again while the one-shot pulse is being output.To output the one-shot
pulse again, wait until the current one-shot pulse output is completed.
<2> Do not set the 16-bit timer capture/compare registers 000 and 010 (CR000 and CR010) to 0000H.
Count clock
CR000 FFFFH
OVF00
INTTM000
<2> Even if the OVF00 flag is cleared before the next count clock is counted (before TM00 becomes 0001H)
after the occurrence of a TM00 overflow, the OVF00 flag is re-set newly and clear is disabled.
Count clock
Edge input
INTTM010
<1> If the TI000 pin is specified as the valid edge of the count clock, a capture operation by the capture
register specified as the trigger for the TI000 pin is not possible.
<2> If both the rising and falling edges are selected as the valid edges of the TI000 pin, capture is not
performed.
<3> When the CRC001 bit value is 1, the TM00 count value is not captured in the CR000 register when a
valid edge of the TI010 pin is detected, but the input from the TI010 pin can be used as an external
interrupt source because INTTM000 is generated at that timing.
<4> To ensure the reliability of the capture operation, the capture trigger requires a pulse longer than two
cycles of the count clock selected by prescaler mode register 00 (PRM00).
<5> The capture operation is performed at the fall of the count clock. A interrupt request input (INTTM0n0),
however, occurs at the rise of the next count clock.
<6> To use two capture registers, set the TI000 and TI010 pins.
Remark n = 0, 1
<1> With the 16-bit timer capture/compare register 0n0 (CR0n0) used as a compare register, when changing
CR0n0 around the timing of a match between 16-bit timer counter 00 (TM00) and 16-bit timer
capture/compare register 0n0 (CR0n0) during timer counting, the change timing may conflict with the
timing of the match, so the operation is not guaranteed in such cases. To change CR0n0 during timer
counting, follow the procedure below using an INTTM000 interrupt.
While interrupts and timer output inversion are disabled (1 to 4 above), timer counting is continued. If
the value to be set in CR0n0 is small, the value of TM00 may exceed CR0n0. Therefore, set the value,
considering the time lapse of the timer clock and CPU clock after an INTTM000 interrupt has been
generated.
Remark n = 0, 1
<2> If CR010 is changed during timer counting without performing processing <1> above, the value in
CR010 may be rewritten twice or more, causing an inversion of the output level of the TO00 pin at each
rewrite.
<1> In the following cases, note with caution that the valid edge of the TI0n0 pin is detected.
(a) Immediately after a system reset, if a high level is input to the TI0n0 pin, the operation of the 16-bit
timer counter 00 (TM00) is enabled
→ If the rising edge or both rising and falling edges are specified as the valid edge of the TI0n0 pin,
a rising edge is detected immediately after the TM00 operation is enabled.
(b) If the TM00 operation is stopped while the TI0n0 pin is high level, TM00 operation is then enabled
after a low level is input to the TI0n0 pin
→ If the falling edge or both rising and falling edges are specified as the valid edge of the TI0n0 pin,
a falling edge is detected immediately after the TM00 operation is enabled.
(c) When the TM00 operation is stopped while the TI0n0 pin is low level, TM00 operation is then
enabled after a high level is input to the TI0n0 pin
→ If the rising edge or both rising and falling edges are specified as the valid edge, of the TI0n0 pin,
a rising edge is detected immediately after the TM00 operation is enabled.
Remark n = 0, 1
<2> The sampling clock used to remove noise differs when a TI000 valid edge is used as the count clock and
when it is used as a capture trigger. In the former case, the count clock is fXP, and in the latter case the
count clock is selected by prescaler mode register 00 (PRM00). The capture operation is not performed
until the valid edge is sampled and the valid level is detected twice, thus eliminating, noise with a short
pulse width.
<1> Values in the following range should be set in CR000 and CR010:
0000H < CR010 < CR000 ≤ FFFFH (setting CR000 to 0000H is prohibited)
<2> The cycle of the pulse generated through PPG output (CR000 setting value + 1) has a duty of (CR010
setting value + 1)/(CR000 setting value + 1).
8-bit timer 80 has an 8-bit interval timer function and generates an interrupt at intervals specified in advance.
Item Configuration
Timer counter 8-bit timer counter 80 (TM80)
Register 8-bit compare register 80 (CR80)
Control register 8-bit timer mode control register 80 (TMC80)
Internal bus
Match
INTTM80
fXP/26
Selector
Clear
fXP/28 8-bit timer/counter 80
(TM80)
fXP/210
fXP/216
Symbol 7 6 5 4 3 2 1 0
CR80
Caution When changing the value of CR80, be sure to stop the timer operation. If the value of CR80
is changed with the timer operation enabled, a match interrupt request signal may be
generated immediately.
Symbol 7 6 5 4 3 2 1 0
TM80
<1> Disable the operation of 8-bit timer counter 80 (clear TCE80 (bit 7 of 8-bit timer mode control register 80
(TMC80)) to 0).
<2> Set the count clock of 8-bit timer 80 (refer to Tables 7-3 and 7-4).
<3> Set the count value to CR80.
<4> Enable the operation of TM80 (set TCE80 to 1).
When the count value of 8-bit timer counter 80 (TM80) matches the set value of CR80, the value of TM80 is
cleared to 00H and counting is continued. At the same time, an interrupt request signal (INTTM80) is generated.
Tables 7-3 and 7-4 show the interval time, and Figure 7-5 shows the timing of the interval timer operation.
Cautions 1. When changing the value of CR80, be sure to stop the timer operation. If the value of CR80 is
changed with the timer operation enabled, a match interrupt request signal may be generated
immediately.
2. If the count clock of TMC80 is set and the operation of TM80 is enabled at the same time by
using an 8-bit memory manipulation instruction, the error of one cycle after the timer is
started may be 1 clock or more. Therefore, be sure to follow the above sequence when using
TM80 as an interval timer.
Count clock
Clear Clear
CR80 N N N N
TCE80
Count start
INTTM80
TO80
Delay A
Count pulse
Selected clock 8-bit timer counter 80
(TM80)
Clear signal
TCE80
Delay B
Selected clock
TCE80
Clear signal
Count pulse
• Interval timer
• PWM output mode
• Square-wave output
Item Configuration
Internal bus
8-bit timer H mode register 1
(TMHMD1)
TMHE1 CKS12 CKS11 CKS10 TMMD11 TMMD10 TOLEV1 TOEN1 8-bit timer H 8-bit timer H
compare register compare register
11 (CMP11) 01 (CMP01)
3 2
Decoder TOH1/P42
Selector
Preliminary User’s Manual U17446EJ1V0UD
1
0
Timer H enable signal
INTTMH1
Free Datasheet http://www.datasheet4u.com/
CHAPTER 8 8-BIT TIMER H1
Symbol 7 6 5 4 3 2 1 0
CMP01
Symbol 7 6 5 4 3 2 1 0
CMP11
Caution In the PWM output mode, be sure to set CMP11 when starting the timer count operation (TMHE1
= 1) after the timer count operation was stopped (TMHE1 = 0) (be sure to set again even if setting
the same value to CMP11).
The following three registers are used to control 8-Bit Timer H1.
Cautions 1. When TMHE1 = 1, setting the other bits of the TMHMD1 register is prohibited.
2. In the PWM output mode, be sure to set 8-bit timer H compare register 11 (CMP11) when
starting the timer count operation (TMHE1 = 1) after the timer count operation was stopped
(TMHE1 = 0) (be sure to set again even if setting the same value to the CMP11 register).
(1) Usage
Generates the INTTMH1 signal repeatedly at the same interval.
<3> When the values of 8-bit timer counter H1 and the CMP01 register match, the INTTMH1 signal is generated
and 8-bit timer counter H1 is cleared to 00H.
<4> Subsequently, the INTTMH1 signal is generated at the same interval. To stop the count operation, clear
TMHE1 to 0.
Count clock
Count start
8-bit timer counter H1 00H 01H N 00H 01H N 00H 01H 00H
Clear Clear
CMP01 N
TMHE1
INTTMH1
Interval time
TOH1
<1> The count operation is enabled by setting the TMHE1 bit to 1. The count clock starts counting no more than
1 clock after the operation is enabled.
<2> When the values of 8-bit timer counter H1 and the CMP01 register match, the value of 8-bit timer counter H1
is cleared, the TOH1 output level is inverted, and the INTTMH1 signal is output.
<3> The INTTMH1 signal and TOH1 output become inactive by clearing the TMHE1 bit to 0 during timer H1
operation. If these are inactive from the first, the level is retained.
Count clock
Count start
8-bit timer counter H1 00H 01H FEH FFH 00H FEH FFH 00H
Clear Clear
CMP01 FFH
TMHE1
INTTMH1
TOH1
Interval time
Count clock
Count start
CMP01 00H
TMHE1
INTTMH1
TOH1
Interval time
(1) Usage
In PWM output mode, a pulse for which an arbitrary duty and arbitrary cycle can be set is output.
<4> When 8-bit timer counter H1 and the CMP11 register match, TOH1 output becomes inactive and the
compare register to be compared with 8-bit timer counter H1 is changed from the CMP11 register to the
CMP01 register. At this time, 8-bit timer counter H1 is not cleared and the INTTMH1 signal is not
generated.
<5> By performing procedures <3> and <4> repeatedly, a pulse with an arbitrary duty can be obtained.
<6> To stop the count operation, set TMHE1 = 0.
If the setting value of the CMP01 register is N, the setting value of the CMP11 register is M, and the count clock
frequency is fCNT, the PWM pulse output cycle and duty are as follows.
Cautions 1. In PWM output mode, three operation clocks (signal selected using the CKS12 to CKS10
bits of the TMHMD1 register) are required to transfer the CMP11 register value after
rewriting the register.
2. Be sure to set the CMP11 register when starting the timer count operation (TMHE1 = 1) after
the timer count operation was stopped (TMHE1 = 0) (be sure to set again even if setting the
same value to the CMP11 register).
Caution Make sure that the CMP11 register setting value (M) and CMP01 register setting value (N) are
within the following range.
00H ≤ CMP11 (M) < CMP01 (N) ≤ FFH
Count clock
8-bit timer counter H1 00H 01H A5H 00H 01H 02H A5H 00H 01H 02H A5H 00H
CMP01 A5H
CMP11 01H
TMHE1
INTTMH1
TOH1
(TOLEV1 = 0)
TOH1
(TOLEV1 = 1)
<1> The count operation is enabled by setting the TMHE1 bit to 1. Start 8-bit timer counter H1 by masking one
count clock to count up. At this time, TOH1 output remains inactive (when TOLEV1 = 0).
<2> When the values of 8-bit timer counter H1 and the CMP01 register match, the TOH1 output level is inverted,
the value of 8-bit timer counter H1 is cleared, and the INTTMH1 signal is output.
<3> When the values of 8-bit timer counter H1 and the CMP11 register match, the level of the TOH1 output is
returned. At this time, the 8-bit timer counter value is not cleared and the INTTMH1 signal is not output.
<4> Clearing the TMHE1 bit to 0 during timer H1 operation makes the INTTMH1 signal and TOH1 output inactive.
Count clock
8-bit timer counter H1 00H 01H FFH 00H 01H 02H FFH 00H 01H 02H FFH 00H
CMP01 FFH
CMP11 00H
TMHE1
INTTMH1
TOH1
(TOLEV1 = 0)
Count clock
8-bit timer counter H1 00H 01H FEH FFH 00H 01H FEH FFH 00H 01H FEH FFH 00H
CMP01 FFH
CMP11 FEH
TMHE1
INTTMH1
TOH1
(TOLEV1 = 0)
Count clock
8-bit timer counter H1 00H 01H 00H 01H 00H 00H 01H 00H 01H
CMP01 01H
CMP11 00H
TMHE1
INTTMH1
TOH1
(TOLEV1 = 0)
Count clock
8-bit timer counter H1 00H 01H 02H A5H 00H 01H 02H 03H A5H 00H 01H 02H 03H A5H 00H
CMP01 A5H
<2> <2>'
TMHE1
INTTMH1
TOH1
(TOLEV1 = 0)
<1> The count operation is enabled by setting TMHE1 = 1. Start 8-bit timer counter H1 by masking one count
clock to count up. At this time, the TOH1 output remains inactive (when TOLEV1 = 0).
<2> The CMP11 register value can be changed during timer counter operation. This operation is asynchronous
to the count clock.
<3> When the values of 8-bit timer counter H1 and the CMP01 register match, the value of 8-bit timer counter H1
is cleared, the TOH1 output becomes active, and the INTTMH1 signal is output.
<4> If the CMP11 register value is changed, the value is latched and not transferred to the register. When the
values of 8-bit timer counter H1 and the CMP11 register before the change match, the value is transferred to
the CMP11 register and the CMP11 register value is changed (<2>’).
However, three count clocks or more are required from when the CMP11 register value is changed to when
the value is transferred to the register. If a match signal is generated within three count clocks, the changed
value cannot be transferred to the register.
<5> When the values of 8-bit timer counter H1 and the CMP11 register after the change match, the TOH1 output
becomes inactive. 8-bit timer counter H1 is not cleared and the INTTMH1 signal is not generated.
<6> Clearing the TMHE1 bit to 0 during timer H1 operation makes the INTTMH1 signal and TOH1 output inactive.
The watchdog timer is used to detect an inadvertent program loop. If a program loop is detected, an internal reset
signal is generated.
When a reset occurs due to the watchdog timer, bit 4 (WDTRF) of the reset control flag register (RESF) is set to 1.
For details of RESF, see CHAPTER 15 RESET FUNCTION.
The operation mode of the watchdog timer (WDT) is switched according to the option byte setting of the on-chip
low-speed Ring-OSC oscillator as shown in Table 9-2.
Table 9-2. Option Byte Setting and Watchdog Timer Operation Mode
Notes 1. As long as power is being supplied, low-speed Ring-OSC oscillation cannot be stopped (except in the
reset period).
2. The conditions under which clock supply to the watchdog timer is stopped differ depending on the
clock source of the watchdog timer.
<1> If the clock source is fX, clock supply to the watchdog timer is stopped under the following
conditions.
• When fX is stopped
• In HALT/STOP mode
• During oscillation stabilization time
<2> If the clock source is fRL, clock supply to the watchdog timer is stopped under the following
conditions.
• If the CPU clock is fX and if fRL is stopped by software before execution of the STOP instruction
• In HALT/STOP mode
Item Configuration
Control registers Watchdog timer mode register (WDTM)
Watchdog timer enable register (WDTE)
211/fRL to
Clock 218/fRL
fRL/22 Output
16-bit Selector Internal reset signal
input controller
fX/2 4 counter or
controller
213/fX to
220/fX
2
Clear 3
Option byte
(to set “low-speed
Watchdog timer enable 0 1 1 WDCS4 WDCS3 WDCS2 WDCS1 WDCS0 Ring-OSC cannot be
register (WDTE) Watchdog timer mode stopped” or “low-speed
register (WDTM) Ring-OSC can be
stopped by software”)
Internal bus
Note 1 Note 1
WDCS4 WDCS3 Operation clock selection
Notes 1. If “low-speed Ring-OSC cannot be stopped” is specified by the option byte, this cannot be set.
The low-speed Ring-OSC clock will be selected no matter what value is written.
2. Reset is released at the maximum cycle (WDCS2, 1, 0 = 1, 1, 1).
Cautions 1. Set bits 7, 6, and 5 to 0, 1, and 1, respectively (when “low-speed Ring-OSC cannot be
stopped” is selected by the option byte, other values are ignored).
2. After reset is released, WDTM can be written only once by an 8-bit memory
manipulation instruction. If writing is attempted a second time, an internal reset
signal is generated.
3. WDTM cannot be set by a 1-bit memory manipulation instruction.
4. When using the flash memory self programming by self writing, set the overflow time
for the watchdog timer so that enough everflow time is secured (Example 1-byte
writing: 200 µs MIN., 1-block deletion: 10 ms MIN.).
Cautions 1. If a value other than ACH is written to WDTE, an internal reset signal is generated.
2. If a 1-bit memory manipulation instruction is executed for WDTE, an internal reset
signal is generated.
3. The value read from WDTE is 9AH (this differs from the written value (ACH)).
9.4.1 Watchdog timer operation when “low-speed Ring-OSC cannot be stopped” is selected by option byte
The operation clock of watchdog timer is fixed to low-speed Ring-OSC.
After reset is released, operation is started at the maximum cycle (bits 2, 1, and 0 (WDCS2, WDCS1, WDCS0) of
the watchdog timer mode register (WDTM) = 1, 1, 1). The watchdog timer operation cannot be stopped.
The following shows the watchdog timer operation after reset release.
Notes 1. The operation clock (low-speed Ring-OSC clock) cannot be changed. If any value is written to bits 3
and 4 (WDCS3, WDCS4) of WDTM, it is ignored.
2. As soon as WDTM is written, the counter of the watchdog timer is cleared.
Caution In this mode, operation of the watchdog timer cannot be stopped even during STOP instruction
execution. For 8-bit timer H1 (TMH1), a division of the low-speed Ring-OSC clock can be
selected as the count source, so clear the watchdog timer using the interrupt request of TMH1
before the watchdog timer overflows after STOP instruction execution. If this processing is not
performed, an internal reset signal is generated when the watchdog timer overflows after STOP
instruction execution.
Figure 9-4. Status Transition Diagram When “Low-Speed Ring-OSC Cannot Be Stopped”
Is Selected by Option Byte
Reset
WDTE = “ACH”
Clear WDT counter. WDT clock is fixed to fRL.
Select overflow time (settable only once).
HALT STOP
WDT count continues. WDT count continues.
9.4.2 Watchdog timer operation when “low-speed Ring-OSC can be stopped by software” is selected by
option byte
The operation clock of the watchdog timer can be selected as either the low-speed Ring-OSC clock or the system
clock.
After reset is released, operation is started at the maximum cycle of the low-speed Ring-OSC clock (bits 2, 1, and 0
(WDCS2, WDCS1, WDCS0) of the watchdog timer mode register (WDTM) = 1, 1, 1).
The following shows the watchdog timer operation after reset release.
Notes 1. As soon as WDTM is written, the counter of the watchdog timer is cleared.
2. Set bits 7, 6, and 5 to 0, 1, 1, respectively. Do not set the other values.
3. If the watchdog timer is stopped by setting WDCS4 and WDCS3 to 1 and ×, respectively, an internal
reset signal is not generated even if the following processing is performed.
• WDTM is written a second time.
• A 1-bit memory manipulation instruction is executed to WDTE.
• A value other than ACH is written to WDTE.
Caution In this mode, watchdog timer operation is stopped during HALT/STOP instruction execution.
After HALT/STOP mode is released, counting is started again using the operation clock of the
watchdog timer set before HALT/STOP instruction execution by WDTM. At this time, the counter
is not cleared to 0 but holds its value.
For the watchdog timer operation during STOP mode and HALT mode in each status, see 9.4.3 Watchdog timer
operation in STOP mode (when “low-speed Ring-OSC can be stopped by software” is selected by option
byte) and 9.4.4 Watchdog timer operation in HALT mode (when “low-speed Ring-OSC can be stopped by
software” is selected by option byte).
Figure 9-5. Status Transition Diagram When “Low-Speed Ring-OSC Can Be Stopped by Software”
Is Selected by Option Byte
Reset
WDCS4 = 1
WDT clock = fX
Select overflow time
(settable only once). WDT clock = fRL
Select overflow time
(settable only once). WDT operation stops.
HALT Interrupt
instruction STOP STOP
STOP
instruction HALT instruction
instruction
instruction
Interrupt Interrupt Interrupt
Interrupt
Interrupt
9.4.3 Watchdog timer operation in STOP mode (when “low-speed Ring-OSC can be stopped by software” is
selected by option byte)
The watchdog timer stops counting during STOP instruction execution regardless of whether the system clock or
low-speed Ring-OSC clock is being used.
(1) When the watchdog timer operation clock is the clock to peripheral hardware (fX) when the STOP
instruction is executed
When STOP instruction is executed, operation of the watchdog timer is stopped. After STOP mode is released,
operation stops for 34 µs (TYP.) (after waiting for the oscillation stabilization time set by the oscillation
stabilization time select register (OSTS) after operation stops in the case of crystal/ceramic oscillation) and then
counting is started again using the operation clock before the operation was stopped. At this time, the counter is
not cleared to 0 but holds its value.
Figure 9-6. Operation in STOP Mode (WDT Operation Clock: Clock to Peripheral Hardware)
Normal Operation
CPU operation operation STOP stoppedNote Oscillation stabilization time Normal operation
fCPU
Normal Operation
CPU operation operation STOP stoppedNote Normal operation
fCPU
Oscillation stopped
Watchdog timer
Operating Operation stopped Operating
(2) When the watchdog timer operation clock is the low-speed Ring-OSC clock (fRL) when the STOP
instruction is executed
When the STOP instruction is executed, operation of the watchdog timer is stopped. After STOP mode is
released, operation stops for 34 µs (TYP.) and then counting is started again using the operation clock before the
operation was stopped. At this time, the counter is not cleared to 0 but holds its value.
Figure 9-7. Operation in STOP Mode (WDT Operation Clock: Low-Speed Ring-OSC Clock)
Normal Operation
CPU operation operation STOP stoppedNote Oscillation stabilization time Normal operation
fCPU
Watchdog timer
Operating Operation stopped Operating
Normal Operation
CPU operation operation STOP stoppedNote Normal operation
fCPU
Oscillation stopped
fRL
Watchdog timer
Operating Operation stopped Operating
9.4.4 Watchdog timer operation in HALT mode (when “low-speed Ring-OSC can be stopped by software” is
selected by option byte)
The watchdog timer stops counting during HALT instruction execution regardless of whether the operation clock of
the watchdog timer is the system clock (fX) or low-speed Ring-OSC clock (fRL). After HALT mode is released, counting
is started again using the operation clock before the operation was stopped. At this time, the counter is not cleared to
0 but holds its value.
fCPU
fX or fRL
Watchdog timer
Operating Operation stopped Operating
The A/D converter converts an analog input signal into a digital value, and consists of up to four channels (ANI0 to
ANI3) with a resolution of 10 bits.
The A/D converter has the following function.
Figure 10-1 shows the timing of sampling and A/D conversion, and Table 10-1 shows the sampling time and A/D
conversion time.
ADCS
Sampling
timing
INTAD
Note 2 or 3 clocks are required from the ADCS rising to sampling start.
FR2 FR1 FR0 Reference Sampling Conversion fXP = 8 MHz fXP = 10 MHz
Note 2 Note 3
Voltage Time Time Sampling Conversion Sampling Conversion
Note 1
Range Time
Note 2
Time
Note 3
Time
Note 2
Time
Note 3
Notes 1. Be sure to set the FR2, FR1, and FR0 in accordance with the reference voltage range and satisfy Notes 2
and 3 below.
Example When AVREF ≥ 2.7 V
• Set FR2, FR1, and FR0 = 0, 1, 1 or 1, 1, 1.
• The sampling time is 11.0 µs or more and the A/D conversion time is 14.0 µs or more and 100 µs or
less.
2. Set the sampling time as follows.
• AVREF ≥ 4.5 V: 1.0 µs or more
• AVREF ≥ 4.0 V: 2.4 µs or more
• AVREF ≥ 2.85 V: 3.0 µs or more
• AVREF ≥ 2.7 V: 11.0 µs or more
3. Set the A/D conversion time as follows.
• AVREF ≥ 4.5 V: 3.0 µs or more and less than 100 µs
• AVREF ≥ 4.0 V: 4.8 µs or more and less than 100 µs
• AVREF ≥ 2.85 V: 6.0 µs or more and less than 100 µs
• AVREF ≥ 2.7 V: 14.0 µs or more and less than 100 µs
Caution The above sampling time and conversion time do not include the clock frequency error. Select the
conversion time taking the clock frequency error into consideration.
ANI0/P20
Sample & hold circuit
AVREF
Selector
ANI1/P21 Voltage comparator
D/A converter
ANI2/P22 AVSS
ANI3/P23 AVSS
Successive
approximation
register (SAR)
Controller INTAD
Internal bus
Item Configuration
Registers 10-bit A/D conversion result register (ADCR)
8-bit A/D conversion result register (ADCRH)
A/D converter mode register (ADM)
Analog input channel specification register (ADS)
Port mode control register 2 (PMC2)
Port mode register 2 (PM2)
(8) Controller
When A/D conversion has been completed, INTAD is generated.
FR2 FR1 FR0 Reference Sampling Conversion fXP = 8 MHz fXP = 10 MHz
Note 3 Note 4
Voltage Time Time Sampling Conversion Sampling Conversion
Note
Range Time
Note 3
Time
Note 4
Time
Note 3
Time
Note 4
2
Note 5
ADCE Comparator operation control
Note 1
0 Stops operation of comparator
1 Enables operation of comparator
Notes 1. Even when the ADCE = 0 (comparator operation stopped), the A/D conversion operation starts if
the ADCS is set to 1. However, the data of the first conversion is out of the guaranteed-value
range, so ignore it.
2. Be sure to set the FR2, FR1, and FR0 in accordance with the reference voltage range and satisfy
Notes 3 and 4 below.
Example When AVREF ≥ 2.7 V
• Set FR2, FR1, and FR0 = 0, 1, 1 or 1, 1, 1.
• The sampling time is 11.0 µs or more and the A/D conversion time is 14.0 µs or
more and 100 µs or less.
Comparator operating
ADCE
Comparator
Conversion Conversion Conversion
Conversion stopped
operation waiting operation
ADCS
Note
Note The time from the rising of the ADCE bit to the rising of the ADCS bit must be 1 µs or
longer to stabilize the internal circuit.
Cautions 1. The above sampling time and conversion time do not include the clock frequency error.
Select the conversion time taking the clock frequency error into consideration.
2. If a bit other than ADCS of ADM is manipulated while A/D conversion is stopped (ADCS
= 0) and then A/D conversion is started, execute two NOP instructions or an instruction
equivalent to two machine cycles, and set ADCS to 1.
3. A/D conversion must be stopped (ADCS = 0) before rewriting bits FR0 to FR2.
4. Be sure to clear bits 6, 2, and 1 to 0.
FF19H FF18H
Symbol
ADCR 0 0 0 0 0 0
Caution When writing to the A/D converter mode register (ADM) and analog input channel specification
register (ADS), the contents of ADCR may become undefined. Read the conversion result
following conversion completion before writing to ADM and ADS. Using timing other than the
above may cause an incorrect conversion result to be read.
Symbol 7 6 5 4 3 2 1 0
ADCRH
(5) Port mode control register 2 (PMC2) and port mode register 2 (PM2)
When using the P20/ANI0 to P23/ANI3 pins for analog input, set PMC20 to PMC23 and PM20 to PM23 to 1. At
this time, the output latches of P20 to P23 may be 0 or 1.
PMC2 and PM2 are set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation clears PMC2 to 00H and sets PM2 to FFH.
0 Port mode
1 A/D converter mode
Caution When PMC20 to PMC23 are set to 1, the P20/ANI0 to P23/ANI3 pins cannot be used as port
pins.
<1> Select one channel for A/D conversion using the analog input channel specification register (ADS).
<2> Set ADCE to 1 and wait for 1 µs or longer.
<3> Execute two NOP instructions or an instruction equivalent to two machine cycles.
<4> Set ADCS to 1 and start the conversion operation.
(<5> to <11> are operations performed by hardware.)
<5> The voltage input to the selected analog input channel is sampled by the sample & hold circuit.
<6> When sampling has been done for a certain time, the sample & hold circuit is placed in the hold state and the
input analog voltage is held until the A/D conversion operation has ended.
<7> Bit 9 of the successive approximation register (SAR) is set. The D/A converter voltage tap is set to (1/2)
AVREF by the tap selector.
<8> The voltage difference between the D/A converter voltage tap and analog input is compared by the voltage
comparator. If the analog input is greater than (1/2) AVREF, the MSB of SAR remains set to 1. If the analog
input is smaller than (1/2) AVREF, the MSB is reset to 0.
<9> Next, bit 8 of SAR is automatically set to 1, and the operation proceeds to the next comparison. The D/A
converter voltage tap is selected according to the preset value of bit 9, as described below.
• Bit 9 = 1: (3/4) AVREF
• Bit 9 = 0: (1/4) AVREF
The voltage tap and analog input voltage are compared and bit 8 of SAR is manipulated as follows.
• Analog input voltage ≥ Voltage tap: Bit 8 = 1
• Analog input voltage < Voltage tap: Bit 8 = 0
<10> Comparison is continued in this way up to bit 0 of SAR.
<11> Upon completion of the comparison of 10 bits, an effective digital result value remains in SAR, and the result
value is transferred to the A/D conversion result register (ADCR, ADCRH) and then latched.
At the same time, the A/D conversion end interrupt request (INTAD) can also be generated.
<12> Repeat steps <5> to <11>, until ADCS is cleared to 0.
To stop the A/D converter, clear ADCS to 0.
To restart A/D conversion from the status of ADCE = 1, start from <3>. To restart A/D conversion from the
status of ADCE = 0, however, start from <2>.
Remark The following two types of A/D conversion result registers can be used.
<1> ADCR (16 bits): Stores a 10-bit A/D conversion value.
<2> ADCRH (8 bits): Stores an 8-bit A/D conversion value.
Conversion time
Sampling time
Conversion
SAR Undefined result
ADCR, Conversion
ADCRH result
INTAD
A/D conversion operations are performed continuously until bit 7 (ADCS) of the A/D converter mode register (ADM)
is reset (0) by software.
If a write operation is performed to ADM or the analog input channel specification register (ADS) during an A/D
conversion operation, the conversion operation is initialized, and if the ADCS bit is set (1), conversion starts again
from the beginning.
Reset input makes the A/D conversion result register (ADCR, ADCRH) undefined.
VAIN
SAR = INT ( × 1024 + 0.5)
AVREF
or
AVREF AVREF
(ADCR − 0.5) × ≤ VAIN < (ADCR + 0.5) ×
1024 1024
Figure 10-11 shows the relationship between the analog input voltage and the A/D conversion result.
Figure 10-11. Relationship Between Analog Input Voltage and A/D Conversion Result
SAR ADCR
1023 03FFH
1022 03FEH
1021 03FDH
2 0002H
1 0001H
0 0000H
1 1 3 2 5 3 2043 1022 2045 1023 2047 1
2048 1024 2048 1024 2048 1024 2048 1024 2048 1024 2048
Input voltage/AVREF
Rewriting ADM
ADCS = 1 Rewriting ADS ADCS = 0
Conversion is stopped
Conversion result is not retained Stopped
INTAD
Remarks 1. n = 0 to 3
2. m = 0 to 3
<1> Set bit 0 (ADCE) of the A/D converter mode register (ADM) to 1.
<2> Select the channel and conversion time using bits 1 and 0 (ADS1, ADS0) of the analog input channel
specification register (ADS) and bits 5 to 3 (FR2 to FR0) of ADM.
<3> Execute two NOP instructions or an instruction equivalent to two machine cycles.
<4> Set bit 7 (ADCS) of ADM to 1 to start A/D conversion.
<5> An interrupt request signal (INTAD) is generated.
<6> Transfer the A/D conversion data to the A/D conversion result register (ADCR, ADCRH).
<Change the channel>
<7> Change the channel using bits 1 and 0 (ADS1, ADS0) of ADS.
<8> An interrupt request signal (INTAD) is generated.
<9> Transfer the A/D conversion data to the A/D conversion result register (ADCR, ADCRH).
<Complete A/D conversion>
<10> Clear ADCS to 0.
<11> Clear ADCE to 0.
(1) Resolution
This is the minimum analog input voltage that can be identified. That is, the percentage of the analog input
voltage per bit of digital output is called 1LSB (Least Significant Bit). The percentage of 1LSB with respect to the
full scale is expressed by %FSR (Full Scale Range).
111
Digital output (Lower 3 bits)
Full-scale error
110
010
000 000
0 1 2 3 AVREF 0 AVREF−3 AVREF−2 AVREF−1 AVREF
Analog input (LSB) Analog input (LSB)
Figure 10-17. Integral Linearity Error Figure 10-18. Differential Linearity Error
1……1
1……1
Ideal 1LSB width
Ideal line
Digital output
Digital output
Differential
Integral linearity linearity error
error
0……0 0……0
0 AVREF 0 AVREF
Analog input Analog input
Sampling
time
Conversion time
<1> Conflict between A/D conversion result register (ADCR, ADCRH) write and ADCR, ADCRH read by
instruction upon the end of conversion
ADCR, ADCRH read has priority. After the read operation, the new conversion result is written to ADCR,
ADCRH.
<2> Conflict between ADCR, ADCRH write and A/D converter mode register (ADM) write or analog input
channel specification register (ADS) write upon the end of conversion
ADM or ADS write has priority. ADCR, ADCRH write is not performed, nor is the conversion end interrupt
signal (INTAD) generated.
ANI0 to ANI3
C = 0.01 to 0.1 µ F
AVSS
VSS
<1> The analog input pins (ANI0 to ANI3) are also used as input port pins (P20 to P23).
When A/D conversion is performed with any of ANI0 to ANI3 selected, do not access port 2 (P20 to P23)
while conversion is in progress; otherwise the conversion resolution may be degraded.
<2> If a digital pulse is applied to the pins adjacent to the pins currently used for A/D conversion, the expected
value of the A/D conversion may not be obtained due to coupling noise. Therefore, do not apply a pulse to
the pins adjacent to the pin undergoing A/D conversion.
ADCR,
ANIn ANIn ANIm ANIm
ADCRH
ADIF
Remarks 1. n = 0 to 3
2. m = 0 to 3
ROUT RIN
ANIn
COUT CIN
LSI internal
Table 10-4. Resistance and Capacitance Values (Reference Values) of Equivalent Circuit
Remarks 1. The resistance and capacitance values shown in Table 10-4 are not guaranteed values.
2. n = 0 to 3
3. ROUT: Allowable signal source impedance
RIN: Analog input equivalent resistance
CIN: Analog input equivalent capacitance
COUT: Internal pin capacitance
Cautions 1. The TXD6 output inversion function inverts only the transmission side and not the reception
side. To use this function, the reception side must be ready for reception of inverted data.
2. If clock supply to serial interface UART6 is not stopped (e.g., in the HALT mode), normal
operation continues. If clock supply to serial interface UART6 is stopped (e.g., in the STOP
mode), each register stops operating, and holds the value immediately before clock supply
was stopped. The TXD6 pin also holds the value immediately before clock supply was
stopped and outputs it. However, the operation is not guaranteed after clock supply is
resumed. Therefore, reset the circuit so that POWER6 = 0, RXE6 = 0, and TXE6 = 0.
3. If data is continuously transmitted, the communication timing from the stop bit to the next
start bit is extended two operating clocks of the macro. However, this does not affect the
result of communication because the reception side initializes the timing when it has
detected a start bit. Do not use the continuous transmission function if the interface is
incorporated in LIN.
Remark LIN stands for Local Interconnect Network and is a low-speed (1 to 20 kbps) serial communication
protocol intended to aid the cost reduction of an automotive network.
LIN communication is single-master communication, and up to 15 slaves can be connected to one
master.
The LIN slaves are used to control the switches, actuators, and sensors, and these are connected to the
LIN master via the LIN network.
Normally, the LIN master is connected to a network such as CAN (Controller Area Network).
In addition, the LIN bus uses a single-wire method and is connected to the nodes via a transceiver that
complies with ISO9141.
In the LIN protocol, the master transmits a frame with baud rate information and the slave receives it and
corrects the baud rate error. Therefore, communication is possible when the baud rate error in the slave
is ±15% or less.
Figures 11-1 and 11-2 outline the transmission and reception operations of LIN.
LIN
bus
13-bitNote 2 SBF 55H Data Data Data Data
Note 1
8 bits transmission transmission transmission transmission transmission transmission
TX6
Note 3
INTST6
Notes 1. The wakeup signal frame is substituted by 80H transmission in the 8-bit mode.
2. The synchronous break field is output by hardware. The output width is equal to the bit length set by
bits 4 to 2 (SBL62 to SBL60) of asynchronous serial interface control register 6 (ASICL6) (see 11.4.2
(2) (h) SBF transmission).
3. INTST6 is output on completion of each transmission. It is also output when SBF is transmitted.
LIN
bus
SBF
reception
RX6 Disable Enable
Note 3
Reception interrupt
(INTSR6)
Note 4
Capture timer Disable Enable
Notes 1. The wakeup signal is detected at the edge of the pin, and enables UART6 and sets the SBF reception
mode.
2. Reception continues until the STOP bit is detected. When an SBF with low-level data of 11 bits or
more has been detected, it is assumed that SBF reception has been completed correctly, and an
interrupt request signal is output. If an SBF with low-level data of less than 11 bits has been detected,
it is assumed that an SBF reception error has occurred. The interrupt request signal is not output and
the SBF reception mode is restored.
3. If SBF reception has been completed correctly, an interrupt request signal is output. This SBF
reception completion interrupt enables the capture timer. Detection of errors OVE6, PE6, and FE6 is
suppressed, and error detection processing of UART communication and data transfer of the shift
register and RXB6 is not performed. The shift register holds the reset value FFH.
4. Calculate the baud rate error from the bit length of the synchronous field, disable UART6 after SF
reception, and then re-set baud rate generator control register 6 (BRGC6).
5. Distinguish the checksum field by software. Also perform processing by software to initialize UART6
after reception of the checksum field and to set the SBF reception mode again.
To perform a LIN receive operation, use a configuration like the one shown in Figure 11-3.
The wakeup signal transmitted from the LIN master is received by detecting the edge of the external interrupt
(INTP0). The length of the synchronous field transmitted from the LIN master can be measured using the external
event capture operation of 16-bit timer/event counter 00, and the baud rate error can be calculated.
The input signal of the reception port input (RxD6) can be input to the external interrupt (INTP0) and 16-bit
timer/event counter 00 by port input switch control (ISC0/ISC1), without connecting RxD6 and INTP0/TI000 externally.
Selector
P44/RXD6
RXD6 input
Port mode
(PM44)
Output latch
(P44)
Selector
Selector
P30/INTP0/TI000
INTP0 input
Port mode
(PM30) Port input
selection control
(ISC0)
Output latch
<ISC0>
(P30)
0: Selects INTP0 (P30).
1: Selects RxD6 (P44).
Selector
TI000 input
Port input
selection control
(ISC1)
<ISC1>
0: Selects TI000 (P30).
1: Selects RxD6 (P44).
Remark ISC0, ISC1: Bits 0 and 1 of the input switch control register (ISC) (see Figure 11-11)
The peripheral functions used in the LIN communication operation are shown below.
<Peripheral functions used>
• External interrupt (INTP0); wakeup signal detection
Use: Detects the wakeup signal edges and detects start of communication.
• 16-bit timer/event counter 00 (TI000); baud rate error detection
Use: Detects the baud rate error (measures the TI000 input edge interval in the capture mode) by detecting the
synchronous field (SF) length and divides it by the number of bits.
• Serial interface UART6
Item Configuration
Registers Receive buffer register 6 (RXB6)
Receive shift register 6 (RXS6)
Transmit buffer register 6 (TXB6)
Transmit shift register 6 (TXS6)
Control registers Asynchronous serial interface operation mode register 6 (ASIM6)
Asynchronous serial interface reception error status register 6 (ASIS6)
Asynchronous serial interface transmission status register 6 (ASIF6)
Clock selection register 6 (CKSR6)
Baud rate generator control register 6 (BRGC6)
Asynchronous serial interface control register 6 (ASICL6)
Input switch control register (ISC)
Port mode register 4 (PM4)
Port register 4 (P4)
TI000, INTP0Note
Filter RXD6/
P44
INTSR6
Reception control
INTSRE6
Receive shift register 6
fXP (RXS6)
fXP/2
fXP/22 Asynchronous serial Asynchronous serial Baud rate Asynchronous serial interface Receive buffer register 6
fXP/23 interface operation mode interface reception error
fXP/24 register 6 (ASIM6) status register 6 (ASIS6) generator control register 6 (ASICL6) (RXB6)
Selector
Internal bus
fXP/29
fXP/210
fXP/211
Baud rate generator Clock selection Asynchronous serial Baud rate Asynchronous serial interface Transmit buffer register 6
control register 6 interface transmission
(BRGC6) register 6 (CKSR6) status register 6 (ASIF6) generator control register 6 (ASICL6) (TXB6)
8 8
Cautions 1. Do not write data to TXB6 when bit 1 (TXBF6) of asynchronous serial interface transmission
status register 6 (ASIF6) is 1.
2. Do not refresh (write the same value to) TXB6 by software during a communication
operation (when bit 7 (POWER6) and bit 6 (TXE6) of asynchronous serial interface operation
mode register 6 (ASIM6) are 1 or when bit 7 (POWER6) and bit 5 (RXE6) of ASIM6 are 1).
Remark ASIM6 can be refreshed (the same value is written) by software during a communication operation
(when bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 = 1 or bit 7 (POWER6) and bit 5 (RXE6) of ASIM6
= 1).
Figure 11-5. Format of Asynchronous Serial Interface Operation Mode Register 6 (ASIM6) (1/2)
Notes 1. The output of the TXD6 pin goes high and the input from the RXD6 pin is fixed to the high level when
POWER6 is cleared to 0 during a transmission 0.
2. Asynchronous serial interface reception error status register 6 (ASIS6), asynchronous serial interface
transmission status register 6 (ASIF6), bit 7 (SBRF6) and bit 6 (SBRT6) of asynchronous serial
interface control register 6 (ASICL6), and receive buffer register 6 (RXB6) are reset.
3. Operation of the 8-bit counter output is enabled at the second base clock after 1 is written to the
POWER6 bit.
Figure 11-5. Format of Asynchronous Serial Interface Operation Mode Register 6 (ASIM6) (2/2)
0 “INTSRE6” occurs in case of error (at this time, INTSR6 does not occur).
1 “INTSR6” occurs in case of error (at this time, INTSRE6 does not occur).
Note If “reception as 0 parity” is selected, the parity is not judged. Therefore, bit 2 (PE6) of asynchronous serial
interface reception error status register 6 (ASIS6) is not set and the error interrupt does not occur.
Cautions 1. At startup, set POWER6 to 1 and then set TXE6 to 1. To stop the operation, clear TXE6 to 0,
and then clear POWER6 to 0.
2. At startup, set POWER6 to 1 and then set RXE6 to 1. To stop the operation, clear RXE6 to 0,
and then clear POWER6 to 0.
3. Set POWER6 to 1 and then set RXE6 to 1 while a high level is input to the RxD6 pin. If
POWER6 is set to 1 and RXE6 is set to 1 while a low level is input, reception is started.
4. Clear the TXE6 and RXE6 bits to 0 before rewriting the PS61, PS60, and CL6 bits.
5. Fix the PS61 and PS60 bits to 0 when mounting the device on LIN.
6. Make sure that TXE6 = 0 when rewriting the SL6 bit. Reception is always performed with “the
number of stop bits = 1”, and therefore, is not affected by the set value of the SL6 bit.
7. Make sure that RXE6 = 0 when rewriting the ISRM6 bit.
Figure 11-6. Format of Asynchronous Serial Interface Reception Error Status Register 6 (ASIS6)
Cautions 1. The operation of the PE6 bit differs depending on the set values of the PS61 and PS60 bits of
asynchronous serial interface operation mode register 6 (ASIM6).
2. The first bit of the receive data is checked as the stop bit, regardless of the number of stop
bits.
3. If an overrun error occurs, the next receive data is not written to receive buffer register 6
(RXB6) but discarded.
Figure 11-7. Format of Asynchronous Serial Interface Transmission Status Register 6 (ASIF6)
0 If POWER6 = 0 or TXE6 = 0, or if the next data is not transferred from transmit buffer register 6
(TXB6) after completion of transfer
1 If data is transferred from transmit buffer register 6 (TXB6) (if data transmission is in progress)
Cautions 1. To transmit data continuously, write the first transmit data (first byte) to the TXB6 register.
Be sure to check that the TXBF6 flag is “0”. If so, write the next transmit data (second byte)
to the TXB6 register. If data is written to the TXB6 register while the TXBF6 flag is “1”, the
transmit data cannot be guaranteed.
2. To initialize the transmission unit upon completion of continuous transmission, be sure to
check that the TXSF6 flag is “0” after generation of the transmission completion interrupt,
and then execute initialization. If initialization is executed while the TXSF6 flag is “1”, the
transmit data cannot be guaranteed.
Remark CKSR6 can be refreshed (the same value is written) by software during a communication operation
(when bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 = 1 or bit 7 (POWER6) and bit 5 (RXE6) of ASIM6
= 1).
Remark BRGC6 can be refreshed (the same value is written) by software during a communication operation
(when bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 = 1 or bit 7 (POWER6) and bit 5 (RXE6) of ASIM6
= 1).
MDL67 MDL66 MDL65 MDL64 MDL63 MDL62 MDL61 MDL60 k Output clock selection of
8-bit counter
0 0 0 0 0 × × × × Setting prohibited
0 0 0 0 1 0 0 0 8 fXCLK6/8
0 0 0 0 1 0 0 1 9 fXCLK6/9
0 0 0 0 1 0 1 0 10 fXCLK6/10
• • • • • • • • • •
• • • • • • • • • •
• • • • • • • • • •
• • • • • • • • • •
• • • • • • • • • •
1 1 1 1 1 1 0 0 252 fXCLK6/252
1 1 1 1 1 1 0 1 253 fXCLK6/253
1 1 1 1 1 1 1 0 254 fXCLK6/254
1 1 1 1 1 1 1 1 255 fXCLK6/255
Cautions 1. Make sure that bit 6 (TXE6) and bit 5 (RXE6) of the ASIM6 register = 0 when rewriting the
MDL67 to MDL60 bits.
2. The baud rate is the output clock of the 8-bit counter divided by 2.
Remarks 1. fXCLK6: Frequency of base clock selected by the TPS63 to TPS60 bits of CKSR6 register
2. k: Value set by MDL67 to MDL60 bits (k = 8, 9, 10, ..., 255)
3. ×: Don’t care
Caution ASICL6 can be refreshed (the same value is written) by software during a communication
operation (when bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 = 1 or bit 7 (POWER6) and bit 5
(RXE6) of ASIM6 = 1). However, if the SBRT6 = 1 and SBTT = 1 are set in the refresh operation
during the SBF reception (SBRF6 = 1) or SBF transmission (between the SBTT6 setting (1) and
the INTST6 occurrence), it triggers the SBF reception and SBF transmission again, so do not
set.
Figure 11-10. Format of Asynchronous Serial Interface Control Register 6 (ASICL6) (1/2)
Note
Address: FF98H After reset: 16H R/W
Symbol <7> <6> 5 4 3 2 1 0
0 −
1 SBF reception trigger
0 −
1 SBF transmission trigger
Figure 11-10. Format of Asynchronous Serial Interface Control Register 6 (ASICL6) (2/2)
0 MSB
1 LSB
Cautions 1. In the case of an SBF reception error, return the mode to the SBF reception mode again and
hold (1) the status of the SBRF6 flag.
2. Before setting the SBRT6 bit to 1, make sure that bit 7 (POWER6) and bit 5 (RXE6) of ASIM6 =
1. Moreover, after setting the SBRT6 bit to 1, do not clear the SBRT6 bit to 0 before the SBF
reception ends (an interrupt request signal is generated).
3. The read value of the SBRT6 bit is always 0. SBRT6 is automatically cleared to 0 after SBF
reception has been correctly completed.
4. Before setting the SBTT6 bit to 1, make sure that bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 =
1. Moreover, after setting the SBTT6 bit to 1, do not clear the SBTT6 bit to 0 before the SBF
transmission ends (an interrupt request signal is generated).
5. The read value of the SBTT6 bit is always 0. SBTT6 is automatically cleared to 0 at the end of
SBF transmission.
6. Before rewriting the DIR6 and TXDLV6 bits, clear the TXE6 and RXE6 bits to 0.
0 TI000 (P30)
1 RxD6 (P44)
0 INTP0 (P30)
1 RxD6 (P44)
Notes 1. The output of the TXD6 pin goes high and the input from the RXD6 pin is fixed to high level when
POWER6 = 0 during a transmission.
2. Asynchronous serial interface reception error status register 6 (ASIS6), asynchronous serial interface
transmission status register 6 (ASIF6), bit 7 (SBRF6) and bit 6 (SBRT6) of asynchronous serial
interface control register 6 (ASICL6), and receive buffer register 6 (RXB6) are reset.
Caution Clear POWER6 to 0 after clearing TXE6 and RXE6 to 0 to set the operation stop mode.
To start the operation, set POWER6 to 1, and then set TXE6 and RXE6 to 1.
Remark To use the RxD6/P44 and TxD6/INTP1/P43 pins as general-purpose port pins, see CHAPTER 4 PORT
FUNCTIONS.
Caution Take relationship with the other party of communication into consideration when setting the
port mode register and port register.
The relationship between the register settings and pins is shown below.
POWER6 TXE6 RXE6 PM43 P43 PM44 P44 UART6 Pin Function
Operation TxD6/INTP1/P43 RxD6/P44
Note Note Note Note
0 0 0 × × × × Stop P43 P44
Note Note
1 0 1 × × 1 × Reception P43 RxD6
Note Note
1 0 0 1 × × Transmission TxD6 P44
1 1 0 1 1 × Transmission/ TxD6 RxD6
reception
1. LSB-first transmission/reception
1 data frame
Start Parity
D0 D1 D2 D3 D4 D5 D6 D7 Stop bit
bit bit
Character bits
2. MSB-first transmission/reception
1 data frame
Start Parity
D7 D6 D5 D4 D3 D2 D1 D0 Stop bit
bit bit
Character bits
The character bit length, parity, and stop bit length in one data frame are specified by asynchronous serial
interface operation mode register 6 (ASIM6).
Whether data is communicated with the LSB or MSB first is specified by bit 1 (DIR6) of asynchronous serial
interface control register 6 (ASICL6).
Whether the TXD6 pin outputs normal or inverted data is specified by bit 0 (TXDLV6) of ASICL6.
1. Data length: 8 bits, LSB first, Parity: Even parity, Stop bit: 1 bit, Communication data: 55H
1 data frame
2. Data length: 8 bits, MSB first, Parity: Even parity, Stop bit: 1 bit, Communication data: 55H
1 data frame
3. Data length: 8 bits, MSB first, Parity: Even parity, Stop bit: 1 bit, Communication data: 55H, TXD6 pin
inverted output
1 data frame
4. Data length: 7 bits, LSB first, Parity: Odd parity, Stop bit: 2 bits, Communication data: 36H
1 data frame
5. Data length: 8 bits, LSB first, Parity: None, Stop bit: 1 bit, Communication data: 87H
1 data frame
Start D0 D1 D2 D3 D4 D5 D6 D7 Stop
Caution Fix the PS61 and PS60 bits to 0 when the device is incorporated in LIN.
• Reception
The number of bits that are “1” in the receive data, including the parity bit, is counted. If it is odd, a
parity error occurs.
• Reception
The number of bits that are “1” in the receive data, including the parity bit, is counted. If it is even, a
parity error occurs.
(iii) 0 parity
The parity bit is cleared to 0 when data is transmitted, regardless of the transmit data.
The parity bit is not detected when the data is received. Therefore, a parity error does not occur
regardless of whether the parity bit is “0” or “1”.
(iv) No parity
No parity bit is appended to the transmit data.
Reception is performed assuming that there is no parity bit when data is received. Because there is no
parity bit, a parity error does not occur.
INTST6
INTST6
Cautions 1. The TXBF6 and TXSF6 flags of the ASIF6 register change from “10” to “11”, and to “01”
during continuous transmission. To check the status, therefore, do not use a
combination of the TXBF6 and TXSF6 flags for judgment. Judge whether continuous
transmission is possible or not by reading only the TXBF flag.
2. When the device is incorporated in a LIN, the continuous transmission function cannot
be used. Make sure that asynchronous serial interface transmission status register 6
(ASIF6) is 00H before writing transmit data to transmit buffer register 6 (TXB6).
0 Writing enabled
1 Writing disabled
Caution To transmit data continuously, write the first transmit data (first byte) to the TXB6 register.
Be sure to check that the TXBF6 flag is “0”. If so, write the next transmit data (second byte)
to the TXB6 register. If data is written to the TXB6 register while the TXBF6 flag is “1”, the
transmit data cannot be guaranteed.
0 Transmission is completed.
1 Transmission is in progress.
Cautions 1. To initialize the transmission unit upon completion of continuous transmission, be sure
to check that the TXSF6 flag is “0” after generation of the transmission completion
interrupt, and then execute initialization. If initialization is executed while the TXSF6
flag is “1”, the transmit data cannot be guaranteed.
2. During continuous transmission, an overrun error may occur, which means that the
next transmission was completed before execution of INTST6 interrupt servicing after
transmission of one data frame. An overrun error can be detected by developing a
program that can count the number of transmit data and by referencing the TXSF6 flag.
Set registers.
Write TXB6.
Transfer
executed necessary Yes
number of times?
No
Read ASIF6 No
TXBF6 = 0?
Yes
Write TXB6.
Transmission No
completion interrupt
occurred?
Yes
Transfer Yes
executed necessary
number of times?
No
Read ASIF6 No
TXSF6 = 0?
Yes
Yes of
Completion
transmission processing
Figure 11-17 shows the timing of starting continuous transmission, and Figure 11-18 shows the timing of
ending continuous transmission.
TXD6 Start Data (1) Parity Stop Start Data (2) Parity Stop Start
INTST6
TXBF6
TXSF6 Note
Note When ASIF6 is read, there is a period in which TXBF6 and TXSF6 = 1, 1. Therefore, judge whether
writing is enabled using only the TXBF6 bit.
TXD6 Stop Start Data (n − 1) Parity Stop Start Data (n) Parity Stop
INTST6
TXBF6
TXSF6
POWER6 or TXE6
INTSR6
RXB6
Cautions 1. Be sure to read receive buffer register 6 (RXB6) even if a reception error occurs.
Otherwise, an overrun error will occur when the next data is received, and the reception
error status will persist.
2. Reception is always performed with the “number of stop bits = 1”. The second stop bit
is ignored.
3. Be sure to read asynchronous serial interface reception error status register 6 (ASIS6)
before reading RXB6.
Parity error The parity specified for transmission does not match the parity of the receive data.
Framing error Stop bit is not detected.
Overrun error Reception of the next data is completed before data is read from receive buffer
register 6 (RXB6).
The error interrupt can be separated into reception completion interrupt (INTSR6) and error interrupt
(INTSRE6) by clearing bit 0 (ISRM6) of asynchronous serial interface operation mode register 6 (ASIM6) to
0.
1. If ISRM6 is cleared to 0 (reception completion interrupt (INTSR6) and error interrupt (INTSRE6) are
separated)
INTSR6 INTSR6
INTSRE6 INTSRE6
INTSR6 INTSR6
INTSRE6 INTSRE6
Base clock
Internal signal A
RXD6/P44 In Q In Q Internal signal B
TXD6 1 2 3 4 5 6 7 8 9 10 11 12 13 Stop
INTST6
SBTT6
1. Normal SBF reception (stop bit is detected with a width of more than 10.5 bits)
RXD6 1 2 3 4 5 6 7 8 9 10 11
SBRT6
/SBRF6
INTSR6
2. SBF reception error (stop bit is detected with a width of 10.5 bits or less)
RXD6 1 2 3 4 5 6 7 8 9 10
SBRT6
/SBRF6
INTSR6
“0”
• Base clock
The clock selected by bits 3 to 0 (TPS63 to TPS60) of clock selection register 6 (CKSR6) is supplied to
each module when bit 7 (POWER6) of asynchronous serial interface operation mode register 6 (ASIM6) is
1. This clock is called the base clock and its frequency is called fXCLK6. The base clock is fixed to low level
when POWER6 = 0.
• Transmission counter
This counter stops operation, cleared to 0, when bit 7 (POWER6) or bit 6 (TXE6) of asynchronous serial
interface operation mode register 6 (ASIM6) is 0.
It starts counting when POWER6 = 1 and TXE6 = 1.
The counter is cleared to 0 when the first data transmitted is written to transmit buffer register 6 (TXB6).
If data are continuously transmitted, the counter is cleared to 0 again when one frame of data has been
completely transmitted. If there is no data to be transmitted next, the counter is not cleared to 0 and continues
counting until POWER6 or TXE6 is cleared to 0.
• Reception counter
This counter stops operation, cleared to 0, when bit 7 (POWER6) or bit 5 (RXE6) of asynchronous serial
interface operation mode register 6 (ASIM6) is 0.
It starts counting when the start bit has been detected.
The counter stops operation after one frame has been received, until the next start bit is detected.
POWER6
fXP
Baud rate generator
fXP/2
fXP/22
POWER6, TXE6 (or RXE6)
fXP/23
fXP/24
fXP/25
Selector 8-bit counter
fXP/26 fXCLK6
fXP/27
fXP/28
fXP/29
fXP/210
Match detector 1/2 Baud rate
fXP/211
Remark POWER6: Bit 7 of asynchronous serial interface operation mode register 6 (ASIM6)
TXE6: Bit 6 of ASIM6
RXE6: Bit 5 of ASIM6
CKSR6: Clock selection register 6
BRGC6: Baud rate generator control register 6
fXCLK6
• Baud rate = [bps]
2×k
fXCLK6: Frequency of base clock selected by TPS63 to TPS60 bits of CKSR6 register
k: Value set by MDL67 to MDL60 bits of BRGC6 register (k = 8, 9, 10, ..., 255)
Cautions 1. Keep the baud rate error during transmission to within the permissible error range at
the reception destination.
2. Make sure that the baud rate error during reception satisfies the range shown in (4)
Permissible baud rate range during reception.
Baud Rate fXP = 10.0 MHz fXP = 8.38 MHz fXP = 4.19 MHz
[bps] TPS63 to k Calculated ERR[%] TPS63 to k Calculated ERR[%] TPS63 to k Calculated ERR[%]
TPS60 Value TPS60 Value TPS60 Value
600 6H 130 601 0.16 6H 109 601 0.11 5H 109 601 0.11
1200 5H 130 1202 0.16 5H 109 1201 0.11 4H 109 1201 0.11
2400 4H 130 2404 0.16 4H 109 2403 0.11 3H 109 2403 0.11
4800 3H 130 4808 0.16 3H 109 4805 0.11 2H 109 4805 0.11
9600 2H 130 9615 0.16 2H 109 9610 0.11 1H 109 9610 0.11
10400 2H 120 10417 0.16 2H 101 10371 0.28 1H 101 10475 −0.28
19200 1H 130 19231 0.16 1H 109 19220 0.11 0H 109 19220 0.11
31250 1H 80 31250 0.00 0H 134 31268 0.06 0H 67 31268 0.06
38400 0H 130 38462 0.16 0H 109 38440 0.11 0H 55 38090 −0.80
76800 0H 65 76923 0.16 0H 55 76182 −0.80 0H 27 77693 1.03
115200 0H 43 116279 0.94 0H 36 116389 1.03 0H 18 116389 1.03
153600 0H 33 151515 −1.36 0H 27 155185 1.03 0H 14 149643 −2.58
230400 0H 22 227272 −1.36 0H 18 232778 1.03 0H 9 232778 1.03
Remark TPS63 to TPS60: Bits 3 to 0 of clock selection register 6 (CKSR6) (setting of base clock (fXCLK6))
k: Value set by MDL67 to MDL60 bits of baud rate generator control register 6
(BRGC6) (k = 8, 9, 10, ..., 255)
fXP: Oscillation frequency of clock to peripheral hardware
ERR: Baud rate error
Caution Make sure that the baud rate error during reception is within the permissible error range, by
using the calculation expression shown below.
Latch timing
FL
1 data frame (11 × FL)
Minimum permissible
Start bit Bit 0 Bit 1 Bit 7 Parity bit Stop bit
data frame length
FLmin
Maximum permissible Start bit Bit 0 Bit 1 Bit 7 Parity bit Stop bit
data frame length
FLmax
As shown in Figure 11-25, the latch timing of the receive data is determined by the counter set by baud rate
generator control register 6 (BRGC6) after the start bit has been detected. If the last data (stop bit) meets this
latch timing, the data can be correctly received.
Assuming that 11-bit data is received, the theoretical values can be calculated as follows.
FL = (Brate)−1
k−2 21k + 2
Minimum permissible data frame length: FLmin = 11 × FL − × FL = FL
2k 2k
Therefore, the maximum receivable baud rate at the transmission destination is as follows.
22k
BRmax = (FLmin/11)−1 = Brate
21k + 2
Similarly, the maximum permissible data frame length can be calculated as follows.
10 k+2 21k − 2
× FLmax = 11 × FL − × FL = FL
11 2×k 2×k
21k – 2
FLmax = FL × 11
20k
Therefore, the minimum receivable baud rate at the transmission destination is as follows.
20k
BRmin = (FLmax/11)−1 = Brate
21k − 2
The permissible baud rate error between UART6 and the transmission destination can be calculated from the
above minimum and maximum baud rate expressions, as follows.
Division Ratio (k) Maximum Permissible Baud Rate Error Minimum Permissible Baud Rate Error
8 +3.53% −3.61%
20 +4.26% −4.31%
50 +4.56% −4.58%
100 +4.66% −4.67%
255 +4.72% −4.73%
Remarks 1. The permissible error of reception depends on the number of bits in one frame, input clock
frequency, and division ratio (k). The higher the input clock frequency and the higher the division
ratio (k), the higher the permissible error.
2. k: Set value of BRGC6
Start bit of
1 data frame
second byte
Start bit Bit 0 Bit 1 Bit 7 Parity bit Stop bit Start bit Bit 0
FL FL FL FL FL FLstp FL FL
Where the 1-bit data length is FL, the stop bit length is FLstp, and base clock frequency is fXCLK6, the following
expression is satisfied.
FLstp = FL + 2/fXCLK6
Caution Although this register is manipulated with a 16-bit memory manipulation instruction, it can
be also manipulated with an 8-bit memory manipulation instruction. When using an 8-bit
memory manipulation instruction, however, access the register by means of direct
addressing.
Internal bus
Counter value
Selector 3-bit counter CPU clock
3
Start Clear
Counter output
16-bit
adder
MULST0 Reset
Multiplier control
register 0 (MULC0)
Internal bus
MULC0 0 0 0 0 0 0 0 MULST0
The multiplier of the 78K0S/KB1+ can execute the calculation of 8 bits × 8 bits = 16 bits. Figure 12-3 shows the
operation timing of the multiplier where MRA0 is set to AAH and MRB0 is set to D3H.
CPU clock
MRA0 AA
MRB0 D3
MULST0
Counter 000B 001B 010B 011B 100B 101B 110B 111B 000B
Selector output 00AA 0154 0000 0000 0AA0 0000 2A80 5500 00AA
(Slave) 0000 00AA 01FE 01FE 01FE 0C9E 0C9E 371E 0000
• Maskable interrupts
These interrupts undergo mask control. If two or more interrupt requests are simultaneously generated, each
interrupt has a predetermined priority as shown in Table 13-1.
A standby release signal is generated.
There are nine internal sources and four external sources of maskable interrupts.
There are a total of 13 interrupt sources, and up to four reset sources (see Table 13-1).
3 INTP1 000AH
9 INTP3 0018H
POC Power-on-clear
Note 4
LVI Low-voltage detection
Notes 1. Priority is the priority order when several maskable interrupt requests are generated at the same time. 1
is the highest and 13 is the lowest.
2. Basic configuration types (A) and (B) correspond to (A) and (B) in Figure 13-1.
3. When bit 1 (LVIMD) of low-voltage detection register (LVIM) = 0 is selected.
4. When bit 1 (LVIMD) of low-voltage detection register (LVIM) = 1 is selected.
Internal bus
MK IE
Vector table
address generator
Interrupt request IF
Internal bus
Vector table
Edge address generator
Interrupt detector IF
request
Standby
release signal
The interrupt functions are controlled by the following four types of registers.
Table 13-2 lists interrupt requests, the corresponding interrupt request flags, and interrupt mask flags.
Caution Because P30, P31, P41, and P43 have an alternate function as external interrupt inputs,
when the output level is changed by specifying the output mode of the port function, an
interrupt request flag is set. Therefore, the interrupt mask flag should be set to 1 before
using the output mode.
Symbol 7 6 5 4 3 2 1 0
0 0 Falling edge
0 1 Rising edge
1 0 Setting prohibited
0 0 Falling edge
0 1 Rising edge
1 0 Setting prohibited
0 0 Falling edge
0 1 Rising edge
1 0 Setting prohibited
Symbol 7 6 5 4 3 2 1 0
0 0 Falling edge
0 1 Rising edge
1 0 Setting prohibited
0 Disabled
1 Enabled
9 clocks 19 clocks
1
Remark 1 clock: (fCPU: CPU clock)
fCPU
When two or more maskable interrupt requests are generated at the same time, they are acknowledged starting
from the interrupt request assigned the highest priority.
A pending interrupt is acknowledged when a status in which it can be acknowledged is set.
Figure 13-7 shows the algorithm of interrupt request acknowledgment.
When a maskable interrupt request is acknowledged, the contents of the PSW and PC are saved to the stack in
that order, the IE flag is reset to 0, and the data in the vector table determined for each interrupt request is loaded to
the PC, and execution branches.
To return from interrupt servicing, use the RETI instruction.
Start
No
××IF = 1?
No
××MK = 0?
No
IE = 1?
8 clocks
Clock
Interrupt
If an interrupt request flag (××IF) is set before an instruction clock n (n = 4 to 10) under execution becomes n − 1,
the interrupt is acknowledged after the instruction under execution is complete. Figure 13-8 shows an example of the
interrupt request acknowledgment timing for an 8-bit data transfer instruction MOV A, r. Since this instruction is
executed for 4 clocks, if an interrupt occurs for 3 clocks after the execution starts, the interrupt acknowledgment
processing is performed after the MOV A, r instruction is executed.
Figure 13-9. Interrupt Request Acknowledgment Timing (When Interrupt Request Flag Is Set at Last
Clock During Instruction Execution)
8 clocks
Clock
Interrupt
If an interrupt request flag (××IF) is set at the last clock of the instruction, the interrupt acknowledgment processing
starts after the next instruction is executed.
Figure 13-9 shows an example of the interrupt request acknowledgment timing for an interrupt request flag that is
set at the second clock of NOP (2-clock instruction). In this case, the MOV A, r instruction after the NOP instruction is
executed, and then the interrupt acknowledgment processing is performed.
Caution Interrupt requests will be held pending while the interrupt request flag registers 0, 1 (IF0, IF1) or
interrupt mask flag registers 0, 1 (MK0, MK1) are being accessed.
IE = 0 IE = 0
EI EI
INTxx INTyy
RETI RETI
During interrupt INTxx servicing, interrupt request INTyy is acknowledged, and multiple interrupts are generated.
The EI instruction is issued before each interrupt request acknowledgment, and the interrupt request acknowledgment
enable state is set.
Example 2. Multiple interrupts are not generated because interrupts are not enabled
EI IE = 0
INTyy INTyy is held pending
RETI
INTxx
IE = 0
RETI
Because interrupts are not enabled in interrupt INTxx servicing (the EI instruction is not issued), interrupt request
INTyy is not acknowledged, and multiple interrupts are not generated. The INTyy request is held pending and
acknowledged after the INTxx servicing is performed.
Notes 1. When “Cannot be stopped” is selected for low-speed Ring-OSC by the option byte.
2. When it is selected that the low-speed Ring-OSC oscillator “can be stopped by software”, oscillation of
the low-speed Ring-OSC oscillator can be stopped by LSRSTOP.
3. If the operating clock of the watchdog timer is the low-speed Ring-OSC clock, the watchdog timer is
stopped.
Caution The LSRSTOP setting is valid only when “Can be stopped by software” is set for the low-speed
Ring-OSC oscillator by the option byte.
The standby function is designed to reduce the operating current of the system. The following two modes are
available.
In either of these two modes, all the contents of registers, flags and data memory just before the standby mode is
set are held. The I/O port output latches and output buffer statuses are also held.
Cautions 1. When shifting to the STOP mode, be sure to stop the peripheral hardware operation before
executing STOP instruction (except the peripheral hardware that operates on the low-speed
Ring-OSC clock).
2. The following sequence is recommended for operating current reduction of the A/D converter
when the standby function is used: First clear bit 7 (ADCS) and bit 0 (ADCE) of the A/D
converter mode register (ADM) to 0 to stop the A/D conversion operation, and then execute
the HALT or STOP instruction.
3. If the low-speed Ring-OSC oscillator is operating before the STOP mode is set, oscillation of
the low-speed Ring-OSC clock cannot be stopped in the STOP mode (refer to Table 14-1).
Caution Because an interrupt request signal is used to clear the standby mode, if there is an interrupt
source with the interrupt request flag set and the interrupt mask flag reset, the standby
mode is immediately cleared if set.
Note “Cannot be stopped” or “Stopped by software” is selected for low-speed Ring-OSC by the option byte (for the
option byte, see CHAPTER 18 OPTION BYTE).
Interrupt
HALT request
instruction Wait
Standby
release signal
Remarks 1. The broken lines indicate the case when the interrupt request which has released the
standby mode is acknowledged.
2. The wait time is as follows:
• When vectored interrupt servicing is carried out: 11 to 13 clocks
• When vectored interrupt servicing is not carried out: 3 to 5 clocks
(1) When CPU clock is high-speed Ring-OSC clock or external input clock
HALT
instruction
Reset signal
Note Operation is stopped (277 µs (MIN.), 544 µs (TYP.), 1.075 ms (MAX.)) because the option byte is
referenced.
HALT
instruction
Reset signal
Note Operation is stopped (276 µs (MIN.), 544 µs (TYP.), 1.074 ms (MAX.)) because the option byte is
referenced.
×: don’t care
Caution Because an interrupt request signal is used to clear the standby mode, if there is an interrupt
source with the interrupt request flag set and the interrupt mask flag reset, the standby
mode is immediately cleared if set. Thus, in the STOP mode, the normal operation mode is
restored after the STOP instruction is executed and then the operation is stopped for 34 µs
(TYP.) (after an additional wait time for stabilizing the oscillation set by the oscillation
stabilization time select register (OSTS) has elapsed when crystal/ceramic oscillation is
used).
Note “Cannot be stopped” or “Stopped by software” is selected for low-speed Ring-OSC by the option byte (for the
option byte, see CHAPTER 18 OPTION BYTE).
<1> If high-speed Ring-OSC clock or external input clock is selected as system clock to be supplied
STOP mode
is released.
STOP mode
System clock
oscillation
STOP mode
is released.
STOP mode
System clock
oscillation
Interrupt
request
STOP
instruction
Standby release
signal
Operation Operation
mode STOP mode stopsNote. Operation mode
CPU status
Interrupt
request
STOP
instruction
Standby release
signal
Remark The broken lines indicate the case when the interrupt request that has released the standby mode is
acknowledged.
STOP
instruction
Reset signal
Note Operation is stopped (277 µs (MIN.), 544 µs (TYP.), 1.075 ms (MAX.)) because the option byte is
referenced.
STOP
instruction
Reset signal
Note Operation is stopped (276 µs (MIN.), 544 µs (TYP.), 1.074 ms (MAX.)) because the option byte is
referenced.
External and internal resets have no functional differences. In both cases, program execution starts at the address
at 0000H and 0001H when the reset signal is input.
A reset is applied when a low level is input to the RESET pin, the watchdog timer overflows, or by POC and LVI
circuit voltage detection, and each item of hardware is set to the status shown in Table 15-1. Each pin is high
impedance during reset signal generation or during the oscillation stabilization time just after reset release, except for
P130, which is low-level output.
When a high level is input to the RESET pin, the reset is released and program execution starts using the CPU
clock after referencing the option byte (after the option byte is referenced and the clock oscillation stabilization time
elapses if crystal/ceramic oscillation is selected). A reset generated by the watchdog timer source is automatically
released after the reset, and program execution starts using the CPU clock after referencing the option byte (after the
option byte is referenced and the clock oscillation stabilization time elapses if crystal/ceramic oscillation is selected).
(see Figures 15-2 to 15-4). Reset by POC and LVI circuit power supply detection is automatically released when VDD
> VPOC or VDD > VLVI after the reset, and program execution starts using the CPU clock after referencing the option
byte (after the option byte is referenced and the clock oscillation stabilization time elapses if crystal/ceramic oscillation
is selected) (see CHAPTER 16 POWER-ON-CLEAR CIRCUIT and CHAPTER 17 LOW-VOLTAGE DETECTOR).
Cautions 1. For an external reset, input a low level for 2 µs or more to the RESET pin.
2. During reset signal generation, the system clock and low-speed Ring-OSC clock stop
oscillating.
3. When the RESET pin is used as an input-only port pin (P34), the 78K0S/KB1+ is reset if a low
level is input to the RESET pin after reset is released by the POC circuit and before the option
byte is referenced again. The reset status is retained until a high level is input to the RESET
pin.
Internal bus
WDTRF LVIRF
Reset signal to
RESET LVIM/LVIS register
Reset signal of
power-on-clear circuit
Caution The LVI circuit is not reset by the internal reset signal of the LVI circuit.
Delay Delay
(TYP. 100 ns) (TYP. 100 ns)
Port pin Hi-Z
(except P130)
Port pin
Note 2
(P130)
Notes 1. The operation stop time is 277 µs (MIN.), 544 µs (TYP.), and 1.075 ms (MAX.).
2. When reset is effected, P130 outputs a low level. If P130 is set to output a high level before reset is
effected, the output signal of P130 can be dummy-output as the reset signal to the CPU.
Crystal/ceramic
oscillation clock
Delay Delay
(TYP. 100 ns) (TYP. 100 ns)
Port pin Hi-Z
(except P130)
Port pin
Note 2
(P130)
Notes 1. The operation stop time is 276 µs (MIN.), 544 µs (TYP.), and 1.074 ms (MAX.).
2. When reset is effected, P130 outputs a low level. If P130 is set to output a high level before reset is
effected, the output signal of P130 can be dummy-output as the reset signal to the CPU.
Normal operation Reset period Normal operation (reset processing, CPU clock)
CPU clock in progress (oscillation stops)
Operation stops because option
Watchdog overflow
byte is referencedNote 1.
Port pin
(P130) Note 2
Notes 1. The operation stop time is 277 µs (MIN.), 544 µs (TYP.), and 1.075 ms (MAX.).
2. When reset is effected, P130 outputs a low level. If P130 is set to output a high level before reset is
effected, the output signal of P130 can be dummy-output as the reset signal to the CPU.
Caution The watchdog timer is also reset in the case of an internal reset of the watchdog timer.
Crystal/ceramic
oscillation clock
Port pin
Note 2
(P130)
Notes 1. The operation stop time is 276 µs (MIN.), 544 µs (TYP.), and 1.074 ms (MAX.).
2. When reset is effected, P130 outputs a low level. If P130 is set to output a high level before reset is
effected, the output signal of P130 can be dummy-output as the reset signal to the CPU.
Caution The watchdog timer is also reset in the case of an internal reset of the watchdog timer.
Delay Delay
(TYP. 100 ns) (TYP. 100 ns)
Port pin Hi-Z
(except P130)
Port pin
Note 2
(P130)
Notes 1. The operation stop time is 277 µs (MIN.), 544 µs (TYP.), and 1.075 ms (MAX.).
2. When reset is effected, P130 outputs a low level. If P130 is set to output a high level before reset is
effected, the output signal of P130 can be dummy-output as the reset signal to the CPU.
Delay Delay
(TYP. 100 ns) (TYP. 100 ns)
Port pin Hi-Z
(except P130)
Port pin
Note 2
(P130)
Notes 1. The operation stop time is 276 µs (MIN.), 544 µs (TYP.), and 1.074 ms (MAX.).
2. When reset is effected, P130 outputs a low level. If P130 is set to output a high level before reset is
effected, the output signal of P130 can be dummy-output as the reset signal to the CPU.
Remarks 1. For the reset timing of the power-on-clear circuit and low-voltage detector, refer to CHAPTER 16
POWER-ON-CLEAR CIRCUIT and CHAPTER 17 LOW-VOLTAGE DETECTOR.
2. fX: System clock oscillation frequency
Notes 1. Only the contents of PC are undefined while reset is being generated and while the oscillation stabilization
time elapses. The statuses of the other hardware units remain unchanged.
2. The status after reset is held in the standby mode.
Reset Source RESET Input Reset by POC Reset by WDT Reset by LVI
Register
Many internal reset generation sources exist in the 78K0S/KB1+. The reset control flag register (RESF) is used to
store which source has generated the reset request.
RESF can be read by an 8-bit memory manipulation instruction.
Reset signal generation by RESET input or power-on-clear (POC) circuit, and reading RESF clear RESF to 00H.
Note
Address: FF54H After reset: 00H R
Symbol 7 6 5 4 3 2 1 0
Note The value after reset varies depending on the reset source.
The status of RESF when a reset request is generated is shown in Table 15-2.
Reset Source RESET Input Reset by POC Reset by WDT Reset by LVI
Flag
Cautions 1. If an internal reset signal is generated in the POC circuit, the reset control flag register
(RESF) is cleared to 00H.
2. Because the detection voltage (VPOC) of the POC circuit is in a range of 2.1 V ±0.1 V, use a
voltage in the range of 2.2 to 5.5 V.
Remark This product incorporates multiple hardware functions that generate an internal reset signal. A flag that
indicates the reset cause is located in the reset control flag register (RESF) for when an internal reset
signal is generated by the watchdog timer (WDT) or low-voltage-detection (LVI) circuit. RESF is not
cleared to 00H and the flag is set to 1 when an internal reset signal is generated by WDT or LVI.
For details of RESF, see CHAPTER 15 RESET FUNCTION.
VDD
VDD
+
Internal reset signal
Reference
voltage
source
In the power-on-clear circuit, the supply voltage (VDD) and detection voltage (VPOC = 2.1 V ±0.1 V) are compared,
and an internal reset signal is generated when VDD < VPOC, and an internal reset is released when VDD ≥ VPOC.
Time
In a system where the supply voltage (VDD) fluctuates for a certain period in the vicinity of the POC detection
voltage (VPOC), the system may be repeatedly reset and released from the reset status. In this case, the time from
release of reset to the start of the operation of the microcontroller can be arbitrarily set by taking the following action.
<Action>
After releasing the reset signal, wait for the supply voltage fluctuation period of each system by means of a
software counter that uses a timer, and then initialize the ports.
Reset
Power-on clear
Yes
Initialization
; Initialization of ports, etc.
processing
Notes 1. If reset is generated again during this period, initialization processing is not started.
2. A flowchart is shown on the next page.
Yes
WDTRF of RESF
register = 1?
No
Reset processing by
watchdog timer
Yes
LVIRF of RESF
register = 1?
No
Reset processing by low-voltage
detector
Power-on clear/external
reset generated
• Compares supply voltage (VDD) and detection voltage (VLVI), and generates an internal interrupt signal or
internal reset signal when VDD < VLVI.
• Detection levels (ten levels) of supply voltage can be changed by software.
• Interrupt or reset function can be selected by software.
• Operable in STOP mode.
When the low-voltage detector is used to reset, bit 0 (LVIRF) of the reset control flag register (RESF) is set to 1 if
reset occurs. For details of RESF, refer to CHAPTER 15 RESET FUNCTION.
VDD
Low-voltage detection level selector
VDD
N-ch
Internal reset signal
Selector
−
INTLVI
Reference
voltage source
Internal bus
Note 3
LVION Enabling low-voltage detection operation
0 Disable operation
1 Enable operation
0 Generate interrupt signal when supply voltage (VDD) < detection voltage (VLVI)
1 Generate internal reset signal when supply voltage (VDD) < detection voltage (VLVI)
Note 4
LVIF Low-voltage detection flag
Note
Address: FF51H, After reset: 00H R/W
Symbol 7 6 5 4 3 2 1 0
• Used as reset
Compares the supply voltage (VDD) and detection voltage (VLVI), and generates an internal reset signal when
VDD < VLVI, and releases internal reset when VDD ≥ VLVI.
• Used as interrupt
Compares the supply voltage (VDD) and detection voltage (VLVI), and generates an interrupt signal (INTLVI)
when VDD < VLVI.
Figure 17-4 shows the timing of generating the internal reset signal of the low-voltage detector. Numbers <1>
to <6> in this figure correspond to <1> to <6> above.
Cautions 1. <1> must always be executed. When LVIMK = 0, an interrupt may occur immediately
after the processing in <3>.
2. If supply voltage (VDD) ≥ detection voltage (VLVI) when LVIM is set to 1, an internal reset
signal is not generated.
<2> Time
LVIMK flag
(set by software) H
<1>
Note 1
LVION flag
(set by software) Not cleared Not cleared
<3>
Clear
<4> 0.2 ms or longer
LVIF flag
<5> Clear
Note 2
LVIMD flag
(set by software) Not cleared Not cleared
<6>
Clear
LVIRF flagNote 3
Remark <1> to <6> in Figure 17-4 above correspond to <1> to <6> in the description of “when starting operation”
in 17.4 (1) When used as reset.
Figure 17-5 shows the timing of generating the interrupt signal of the low-voltage detector. Numbers <1> to
<7> in this figure correspond to <1> to <7> above.
LVION flag
(set by software) <3>
LVIF flag
<5>
Note 2
INTLVI
LVIIF flag
<6>
Note 2 Cleared by software
Internal reset signal
Remark <1> to <7> in Figure 17-5 above correspond to <1> to <7> in the description of “when starting operation”
in 17.4 (2) When used as interrupt.
In a system where the supply voltage (VDD) fluctuates for a certain period in the vicinity of the LVI detection voltage
(VLVI), the operation is as follows depending on how the low-voltage detector is used.
<Action>
(1) When used as reset
After releasing the reset signal, wait for the supply voltage fluctuation period of each system by means of a
software counter that uses a timer, and then initialize the ports (see Figure 17-6).
Note For low voltage detection processing, the CPU clock speed is switched to slow speed and the A/D
converter is stopped, etc.
Reset
LVI
Start timer ; 8-bit timer H1 can operate with the low-speed Ring-OSC clock.
(set to 50 ms) Source: fRL (480 kHz (MAX.))/27 × compare value 200 = 53 ms
(fRL: low-speed Ring-OSC clock oscillation frequency)
Note 1
Yes
Yes
Notes 1. If reset is generated again during this period, initialization processing is not started.
2. A flowchart is shown on the next page.
No
Reset processing by
watchdog timer
LVIRF of RESF No
register = 1?
Yes
Power-on-clear/external
reset generated
Reset processing by
low-voltage detector
The 78K0S/KB1+ has an area called an option byte at address 0080H of the flash memory. When using the
product, be sure to set the following functions by using the option byte.
0FFFH/1FFFH
Flash memory
(4096/8192 × 8 bits)
0080H
Option byte
DEF DEF
1 1 RMCE OSCSEL1 OSCSEL0 RINGOSC
OSTS1 OSTS0
0000H
Address: 0080H
7 6 5 4 3 2 1 0
1 Cannot be stopped (oscillation does not stop even if 1 is written to the LSRSTOP bit)
0 Can be stopped by software (oscillation stops when 1 is written to the LSRSTOP bit)
Cautions 1. If it is selected that low-speed Ring-OSC clock oscillation cannot be stopped, the count
clock to the watchdog timer (WDT) is fixed to low-speed Ring-OSC.
2. If it is selected that low-speed Ring-OSC can be stopped by software, supply of the count
clock to WDT is stopped in the HALT/STOP mode, regardless of the setting of bit 0
(LSRSTOP) of the low-speed Ring-OSC mode register (LSRCM). Similarly, clock supply is
also stopped when a clock other than the low-speed Ring-OSC is selected as a count clock to
WDT. If low-speed Ring-OSC is selected as the count clock to 8-bit timer H1, however,
the count clock is supplied in the HALT/STOP mode while low-speed Ring-OSC operates
(LSRSTOP = 0).
Caution Because the X1 and X2 pins are also used as the P121 and P122 pins, the conditions under
which the X1 and X2 pins can be used differ depending on the selected system clock source.
(1) High-speed Ring-OSC clock
P121 and P122 can be used as I/O port pins.
(2) Crystal/ceramic oscillation clock
The X1 and X2 pins cannot be used as I/O port pins because they are used as clock input
pins.
(3) External clock input
Because the X1 pin is used as an external clock input pin, P121 cannot be used as an I/O
port pin.
Caution If a low level is input to the RESET pin after reset is released by the power-on clear function
and before the option byte is referenced again, the 78K0S/KB1+ is reset, and the status is
held until a high level is input to the RESET pin.
DEFOSTS1 DEFOSTS0 Oscillation stabilization time on power application or after reset release
10
0 0 2 /fx (102.4 µs)
12
0 1 2 /fx (409.6 µs)
15
1 0 2 /fx (3.27 ms)
17
1 1 2 /fx (13.1 ms)
Caution The setting of this option is valid only when the crystal/ceramic oscillation clock is selected
as the system clock source. No wait time elapses if the high-speed Ring-OSC or external
clock input is selected as the system clock source.
Remarks 1. ( ): fX = 10 MHz
2. For the oscillation stabilization time of the resonator, refer to the characteristics of the resonator
to be used.
An example of software coding for setting the option bytes is shown below.
OPT OSEG AT 0080H
DB 10010101B ; Sets to option byte
; Low-Speed Ring-OSC cannot be stopped
; Selects the high-speed Ring-OSC as the system clock source
; Uses RESET pin as bit input-only port (P34)
10
; The oscillation stabilization time is minimum (2 /fX)
19.1 Features
The internal flash memory of the 78K0S/KB1+ has the following features.
The 4/8 KB internal flash memory area is divided into 16/32 blocks and can be programmed/erased in block units.
All the blocks can also be erased at once.
FFFFH
FF00H
FEFFH • µPD78F9234
1FFFH
Internal high-speed RAM
(256 bytes) Block 31 (256 bytes)
FE00H 1F00H
FDFFH 1EFFH
Block 30 (256 bytes)
1E00H
1DFFH
Block 29 (256 bytes)
1D00H
Use prohibited 1CFFH
• µ PD78F9232 1000H
0FFFH
Block 15 (256 bytes) Block 15 (256 bytes)
0F00H
0EFFH
Block 14 (256 bytes) Block 14 (256 bytes)
0E00H
0DFFH
Block 13 (256 bytes) Block 13 (256 bytes)
0D00H
0CFFH
0300H
Flash memory
02FFH
(4/8 KB) Block 2 (256 bytes) Block 2 (256 bytes)
0200H
01FFH
Block 1 (256 bytes) Block 1 (256 bytes)
0100H
00FFH
Block 0 (256 bytes) Block 0 (256 bytes)
0000H 0000H
4 KB 8 KB
The internal flash memory of the 78K0S/KB1+ can be rewritten by using the rewrite function of the dedicated flash
programmer, regardless of whether the 78K0S/KB1+ has already been mounted on the target system or not (on-
board/off-board programming).
The function for rewriting a program with the user program (self programming), which is ideal for an application
when it is assumed that the program is changed after production/shipment of the target system, is provided.
In addition, a security function that prohibits rewriting the user program written to the internal flash memory is also
supported, so that the program cannot be changed by an unauthorized person.
Refer to 19.7.4 Security settings for details on the security function.
On-board programming Flash memory can be rewritten after the device is mounted on the Flash memory
target system, by using a dedicated flash programmer. programming mode
Off-board programming Flash memory can be rewritten before the device is mounted on the
target system, by using a dedicated flash programmer and a dedicated
program adapter board (FA series).
Self programming Flash memory can be rewritten by executing a user program that has Self programming mode
been written to the flash memory in advance by means of on-board/off-
board programming.
Remarks 1. The FA series is a product of Naito Densei Machida Mfg. Co., Ltd.
2. Refer to the following sections for details on the flash memory writing control function.
• 19.7 On-Board and Off-Board Flash Memory Programming
• 19.8 Flash Memory Programming by Self Writing
The following two types of dedicated flash programmers can be used for writing data to the internal flash memory
of the 78K0S/KB1+.
Data can be written to the flash memory on-board or off-board, by using a dedicated flash programmer.
Remark The FL-PR4 and FA series are products of Naito Densei Machida Mfg. Co., Ltd.
The environment required for writing a program to the flash memory is illustrated below.
FlashPro4
RS-232C Axxxx
XXXXXX
XXXX YYYY
Bxxxxx
XXXX
Cxxxxxx
STATVE
XXXXX
XXX YYY
PG-FP4 (Flash Pro4)
VDD
USB
VSS
RESET
PG-FPL2 DGCLKNote
MODE
DGDATANote
USB Target 3V
Note DGCLK and DGDATA are single-wire bidirectional communication interfaces. They use UART as the
communication mode.
A host machine that controls the dedicated flash programmer is necessary. When using the PG-FP4 or FL-PR4,
data can be written with just the dedicated flash programmer after downloading the program from the host machine.
UART is used for manipulation such as writing and erasing when interfacing between the dedicated flash
programmer and the 78K0S/KB1+. To write the flash memory off-board, a dedicated program adapter (FA series) is
necessary.
Download the latest programmer firmware, GUI, and parameter file from the download site for development tools
(http://www.necel.com/micro/ods/jpn/index.html).
Note In the 78K0S/KB1+, the CLK and FLMD0 signals are connected to the X1 pin and the SI/RxD and SO/TxD
signals to the X2 signal; therefore, these signals need to be directly connected.
FlashPro4
signal name 1 30
2 29
CLK 3 28
4 27
FLMD0 5 26
6 25
SI/RxD 7 24
8 23
SO/TxD 9 22
10 21
/RESET 11 20
12 19
VDD 13 18
14 17
15 16
GND
78K0S/KB1+
PG-FPL2
signal name
DGCLK
DGDATA
/RESET
VDD
GND
78K0S/KB1+
To write the flash memory on-board, connectors that connect the dedicated flash programmer must be provided on
the target system. First provide a function that selects the normal operation mode or flash memory programming
mode on the board.
When the flash memory programming mode is set, all the pins not used for programming the flash memory are in
the same status as immediately after reset. Therefore, if the external device does not recognize the state immediately
after reset, the pins must be processed as described below.
The state of the pins in the self programming mode is the same as that in the HALT mode.
(1) Mount the minimum-possible test pads between the device and the resonator, and connect the flash
programmer via the test pad. Keep the wiring as short as possible (refer to Figure 19-5 and Table 19-4).
(2) Set the oscillation frequency of the communication clock for writing using the GUI software of the dedicated
flash programmer. Research the series/parallel resonant and antiresonant frequencies of the resonator used,
and set the oscillation frequency so that it is outside the range of the resonant frequency ±10% (refer to Figure
19-6 and Table 19-5).
Test pad
VSS X1 X2
Table 19-5. Oscillation Frequency and PG-FP4 GUI Software Setting Value Example
78K0S/KB1+
Output pin
In the flash memory programming mode, the signal output by the reset
signal generator collides with the signal output by the dedicated flash
programmer. Therefore, isolate the signal of the reset signal generator.
Start
No
End?
Yes
End
FlashPro4
Axxxx
XXXXXX
XXXX YYYY
Bxxxxx
XXXX
Cxxxxxx
STATVE
XXXXX
XXX YYY
Command
PG-FPL2
Response command
MODE
Target 3V
PG-FPL2
Power Status Target
78K0S/KB1+
Dedicated flash programmer
The flash memory control commands of the 78K0S/KB1+ are listed in the table below. All these commands are
issued from the programmer and the 78K0S/KB1+ perform processing corresponding to the respective commands.
Erase Batch erase (chip erase) command Erases the contents of the entire memory
Block erase command Erases the contents of the memory of the specified block
Write Write command Writes to the specified address range and executes a verify
check of the contents.
Checksum Checksum command Reads the checksum of the specified address range and
compares with the written data.
Blank check Blank check command Confirms the erasure status of the entire memory.
Security Security setting command Prohibits batch erase (chip erase) command, block erase
command, and write command to prevent operation by third
parties.
The 78K0S/KB1+ returns a response command for the command issued by the dedicated flash programmer. The
response commands sent from the 78K0S/KB1+ are listed below.
Caution The security setting is valid when the programming mode is set next time. Therefore, when the
security setting command is executed, exit from the programming mode, then set the
programming mode again.
Caution After the security setting of the batch erase is set, erasure cannot be performed for the device.
In addition, even if a write command is executed, data different from that which has already
been written to the flash memory cannot be written because the erase command is disabled.
• Block erase
Execution of the block erase command for a specific block in the flash memory is prohibited. This prohibition
setting can be cancelled using the batch erase (chip erase) command.
• Write
Execution of the write and block erase commands for entire blocks in the flash memory is prohibited. This
prohibition setting can be cancelled using the batch erase (chip erase) command.
The batch erase (chip erase), block erase, and write commands are enabled by the default setting when the flash
memory is shipped. The above security settings are possible only for on-board/off-board programming. Each security
setting can be used in combination.
Table 19-8 shows the relationship between the erase and write commands when the 78K0S/KB1+ security function
is enabled.
Note Since the erase command is disabled, data different from that which has already been written to the
flash memory cannot be written.
Table 19-9 shows the relationship between the security setting and the operation in each programming mode.
Table 19-9. Relationship Between Security Setting and Operation In Each Programming Mode
The 78K0S/KB1+ supports a self programming function that can be used to rewrite the flash memory via a user
program, making it possible to upgrade programs in the field.
Caution Self programming processing must be included in the program before performing self writing.
Remark To use the internal flash memory of the 78K0S/KB1+ as the external EEPROM for storing data, refer to
“78K0S/Kx1+ EEPROM Emulation AN” (U17379E).
Remark Data written by self programming can be referenced with the MOV instruction.
Figure 19-10 shows a block diagram for self programming, Figure 19-11 shows the self programming state
transition diagram, Table 19-11 lists the commands for controlling self programming.
Internal bus
Flash programming command
Protect byte register (FLCMD)
PRSELF4 PRSELF3 PRSELF2 PRSELF1 PRSELF0 FLCMD2 FLCMD1 FLCMD0 Flash programming mode Flash protect command
Self programming mode
control register (FLPMC) register (PFCMD)
setting sequencer
Self programming mode setting register
5 3
HALT signal
Preliminary User’s Manual U17446EJ1V0UD
Flash address
pointer H (FLAPH)
Flash memory
Match
Flash address
pointer L (FLAPL)
Unmatch
Match
Internal bus
281
Free Datasheet http://www.datasheet4u.com/
CHAPTER 19 FLASH MEMORY
User program
Operation setting
Normal mode
Specific sequence
Operation
setting Register for
Self programming mode
self programming
Flash memory
control block (hardware)
Flash memory
Internal verify This command is used to check if data has been Internal verify for 1 block (internal verify
correctly written to the flash memory. After data has command executed once): 6.8 ms
been written to the memory, specify the block number, Internal verify for 1 byte: 27 µs
the start address, and the end address, then execute
this command.
Block erasure This command is used to erase a specified block. 8.5 ms
Specify the block number before execution.
Block blank check This command is used to check if data in a specified 480 µs
block has been erased. Specify the block number,
then execute this command.
Byte write This command is used to write 1-byte data to the 150 µs
specified address in the flash memory. Specify the
write address and write data, then execute this
command.
The 78K0S/KB1+ has an area called a protect byte at address 0081H of the flash memory.
0 Normal mode
Flash memory instructions can be fetched from all addresses.
1 Self programming mode
Before executing the HALT instruction, set the command, address offset, write
data, and set FLSPM to 1. After setting these items, execute the HALT
instruction; the flash memory mode is then shifted from the normal mode to the
flash memory programming mode.
PRSELF4 PRSELF3 PRSELF2 PRSELF1 PRSELF0 The set value of the protect byte
is read to these bits.
Notes 1. Bit 0 (FLSPM) is cleared to 0 when reset is released. The set value of the protect
byte is read to bits 2 to 6 (PRSELF0 to PRSELF4) after reset is released.
2. Bits 2 to 6 (PRSELF0 to PRSELF4) are read-only.
Cautions 1. Note the following when setting the self programming mode.
• If an interrupt occurs during self programming, the interrupt request flag
is set (1), and interrupt servicing is performed after the self programming
mode is released. To avoid this operation, disable interrupt servicing (by
setting MK0 and MK1 to FFH, and executing the DI instruction) during self
programming or before a mode is shifted from the normal mode to the self
programming mode with a specific sequence.
• No instructions can be executed while a self programming command is
being executed. Therefore, clear and restart the watchdog timer counter
in advance so that the watchdog timer does not overflow during self
programming. Refer to Table 19-11 for the time taken for the execution of
self programming.
• If the supply voltage drops or the reset signal is input while the flash
memory is being written or erased, writing/erasing is not guaranteed.
2. When the oscillator or the external clock is selected as the main clock, a
wait time of 16 µs is required from setting FLSPM to 1 to execution of the
HALT instruction.
This rewrites the value of the register, so that the register cannot be written illegally.
Occurrence of an illegal store operation can be checked by bit 0 (FPRERR) of the flash status register (PFS).
A5H must be written to PFCMD each time the value of FLPMC is changed.
PFCMD can be set with an 8-bit memory manipulation instruction.
Reset signal generation makes PFCMD undefined.
Caution Disable interrupt servicing (by setting MK0 and MK1 to FFH and executing the
DI instruction) while the specific sequence is under execution.
Remark The numbers in angle brackets above correspond to the those in (2) Flash protect command
register (PFCMD).
<Reset conditions>
• If 0 is written to the FPRERR flag
• If the reset signal is generated
If VCERR is set, it means that the flash memory has not been erased or written correctly. Erase or write the
memory again in the specified procedure.
Remark The VCERR flag may also be set if an erase or write protect error occurs.
<Reset conditions>
• When 0 is written to the VCERR flag
• When the reset signal is generated
<Reset conditions>
• When 0 is written to the WEPRERR flag
• When the reset signal is generated
Note If a value other than the above is set and the self programming mode is set, the self programming
mode is canceled immediately and no execution occurs. At this time, the flag of the PFS register is
not set.
0 0 0 0 FLA FLA FLA FLA FLA FLA FLA FLA FLA FLA FLA FLA
P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0
Caution Be sure to clear bits 4 to 7 of FLAPH and FLAPHC to 0 before executing the self
programming command. If the value of these bits is 1 when executing the self
programming command.
(6) Flash address pointer H compare register and flash address pointer L compare register (FLAPHC and
FLAPLC)
These registers are used to specify the address range in which the internal sequencer operates when the flash
memory is verified in the self programming mode.
Set FLAPHC to the same value as that of FLAPH. Set the last address of the range in which verification is to
be executed to FLAPLC.
These registers are set with a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation clears these registers to 00H.
Figure 19-17. Format of Flash Address Pointer H/L Compare Registers (FLAPHC/FLAPLC)
0 0 0 0 FLAP FLAP FLAP FLAP FLAP FLAP FLAP FLAP FLAP FLAP FLAP FLAP
C11 C10 C9 C8 C7 C6 C5 C4 C3 C2 C1 C0
Cautions 1. Be sure to clear bits 4 to 7 of FLAPH and FLAPHC to 0 before executing the self
programming command. If the value of these bits is 1 when executing the self
programming command.
2. Set the number of the block subject to a block erase, write, verify, or blank check
(same value as FLAPH) to FLAPHC.
3. Clear FLAPLC to 00H when a block erase is performed, and FFH when a blank check is
performed.
Address: 0081H
7 6 5 4 3 2 1 0
1 PRSELF4 PRSELF3 PRSELF2 PRSELF1 PRSELF0 1 1
• µPD78F9232
PRSELF4 PRSELF3 PRSELF2 PRSELF1 PRSELF0 Status
0 1 0 0 0 Blocks 15 to 0 are protected.
Blocks 13 to 0 are protected.
0 1 0 0 1
Blocks 14 and 15 can be written or erased.
Blocks 11 to 0 are protected.
0 1 0 1 0
Blocks 12 to 15 can be written or erased.
Blocks 9 to 0 are protected.
0 1 0 1 1
Blocks 10 to 15 can be written or erased.
Blocks 7 to 0 are protected.
0 1 1 0 0
Blocks 8 to 15 can be written or erased.
Blocks 5 to 0 are protected.
0 1 1 0 1
Blocks 6 to 15 can be written or erased.
Blocks 3 to 0 are protected.
0 1 1 1 0
Blocks 4 to 15 can be written or erased.
Blocks 1 and 0 are protected.
0 1 1 1 1
Blocks 2 to 15 can be written or erased.
1 1 1 1 1 All blocks can be written or erased.
Other than above Setting prohibited
<1> Disable interrupts if the interrupt function is used (by setting the interrupt mask flag registers (MK0, MK1) to
FFH and executing the DI instruction).
<2> Clear the flash status register (PFS).
<3> Set self programming mode using a specific sequence.
• Write a specific value (A5H) to PFCMD.
• Write 01H to FLPMC (writing in this step is invalid).
• Write 0FEH (inverted value of 01H) to FLPMC (writing in this step is invalid).
• Write 01H to FLPMC (writing in this step is valid).
<4> Check the execution result of the specific sequence using bit 0 (FPRERR) of PFS.
Abnormal → <2>, normal → <5>
<5> Mode shift is completed.
Caution Be sure to perform the series of operations described above using the user program at an
address where data is not erased nor written.
PFCMD = A5H
<3>
Abnormal
<4> Check execution result
(FPRERR flag)
Normal
<5> Termination
Caution Be sure to perform the series of operations described above using the user program at an
address where data is not erased nor written.
Remark <1> to <5> in Figure 19-20 correspond to <1> to <5> in 19.8.4 (previous page).
An example of the program list that shifts the mode to self programming mode is shown below.
;----------------------------
;START
;----------------------------
MOV MK0,#11111111B ; Masks all interrupts
MOV MK1,#11111111B
DI
ModeOnLoop:
MOV PFS,#00H
MOV PFCMD,#0A5H ; PFCMD register control
MOV FLPMC,#01H ; FLPMC register control (sets value)
MOV FLPMC,#0FEH ; FLPMC register control (inverts set value)
MOV FLPMC,#01H ; Sets self programming mode with FLPMC register
; control (sets value)
MOV A,PFS
CMP A,#00H
BNZ $ModeOnLoop ; Checks completion of write to specific registers
; Repeats the same processing when an error occurs.
;----------------------------
;END
;----------------------------
Caution Be sure to perform the series of operations described above using the user program at an
address where data is not erased nor written.
PFCMD = A5H
<2>
Abnormal
<3> Check execution result
(FPRERR flag)
Normal
<4> Enable interrupts (by executing
EI instruction and changing ; When interrupt function is used
MK0, MK1)
<5> Termination
Caution Be sure to perform the series of operations described above using the user program at an
address where data is not erased nor written.
Remark <1> to <5> in Figure 19-21 correspond to <1> to <5> in 19.8.5 (previous page).
An example of a program list that shifts the mode to normal mode is shown below.
;----------------------------
;START
;----------------------------
ModeOffLoop:
MOV PFS,#00H
MOV PFCMD,#0A5H ; PFCMD register control
MOV FLPMC,#00H ; FLPMC register control (sets value)
MOV FLPMC,#0FFH ; FLPMC register control (inverts set value)
MOV FLPMC,#00H ; Sets normal mode via FLPMC register control (sets value)
MOV A,PFS
CMP A,#00H
BNZ $ModeOffLoop ; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
EI
;----------------------------
;END
;----------------------------
<1> Set 03H (block erase) to the flash program command register (FLCMD).
<2> Set the block number to be erased, to flash address pointer H (FLAPH).
<3> Set flash address pointer L (FLAPL) to 00H.
<4> Write the same value as FLAPH to the flash address pointer H compare register (FLAPHC).
<5> Set the flash address pointer L compare register (FLAPLC) to 00H.
<6> Clear the flash status register (PFS).
<7> Write ACH to the watchdog timer enable register (WDTE) (clear and restart the watchdog timer counter)Note.
<8> Execute the HALT instruction then start self programming. (Execute an instruction immediately after the
HALT instruction if self programming has been executed.)
<9> Check if a self programming error has occurred using bit 1 (VCERR) and bit 2 (WEPRERR) of PFS.
Abnormal → <10>
Normal → <11>
<10> Block erase processing is abnormally terminated.
<11> Block erase processing is normally terminated.
Note This setting is not required when the watchdog timer is not used.
Block erasure
Normal Abnormal
Note This setting is not required when the watchdog timer is not used.
Remark <1> to <11> in Figure 19-22 correspond to <1> to <11> in 19.8.6 (previous page).
An example of a program list that performs a block erase in self programming mode is shown below.
;----------------------------
;START
;----------------------------
FlashBlockErase:
MOV FLCMD,#03H ; Sets flash control command (block erase)
MOV FLAPH,#07H ; Sets number of block to be erased (block 7 is specified here)
MOV FLAPL,#00H ; Fixes FLAPL to “00H”
MOV FLAPHC,#07H ; Sets erase block compare number (same value as that of FLAPH)
MOV FLAPLC,#00H ; Fixes FLAPLC to “00H”
;----------------------------
;END
;----------------------------
<1> Set 04H (block blank check) to the flash program command register (FLCMD).
<2> Set the number of block for which a blank check is performed, to flash address pointer H (FLAPH).
<3> Set flash address pointer L (FLAPL) to 00H.
<4> Write the same value as FLAPH to the flash address pointer H compare register (FLAPHC).
<5> Set the flash address pointer L compare register (FLAPLC) to FFH.
<6> Clear the flash status register (PFS).
<7> Write ACH to the watchdog timer enable register (WDTE) (clear and restart the watchdog timer counter)Note.
<8> Execute the HALT instruction then start self programming. (Execute an instruction immediately after the
HALT instruction if self programming has been executed.)
<9> Check if a self programming error has occurred using bit 1 (VCERR) and bit 2 (WEPRERR) of PFS.
Abnormal → <10>
Normal → <11>
<10> Block blank check is abnormally terminated.
<11> Block blank check is normally terminated.
Note This setting is not required when the watchdog timer is not used.
Figure 19-23. Example of Block Blank Check Operation in Self Programming Mode
Normal
Note This setting is not required when the watchdog timer is not used.
Remark <1> to <11>in Figure 19-23 correspond to <1> to <11> in 19.8.7 (previous page).
An example of a program list that performs a block blank check in self programming mode is shown below.
;----------------------------
;START
;----------------------------
FlashBlockBlankCheck:
MOV FLCMD,#04H ; Sets flash control command (block blank check)
MOV FLAPH,#07H ; Sets number of block for blank check (block 7 is specified
; here)
MOV FLAPL,#00H ; Fixes FLAPL to “00H”
MOV FLAPHC,#07H ; Sets blank check block compare number (same value as that of
; FLAPH)
MOV FLAPLC,#0FFH ; Fixes FLAPLC to “FFH”
;----------------------------
;END
;----------------------------
<1> Set 05H (byte write) to the flash program command register (FLCMD).
<2> Set the number of block to which data is to be written, to flash address pointer H (FLAPH).
<3> Set the address at which data is to be written, to flash address pointer L (FLAPL).
<4> Set the data to be written, to the flash write buffer register (FLW).
<5> Clear the flash status register (PFS).
<6> Write ACH to the watchdog timer enable register (WDTE) (clear and restart the watchdog timer counter)Note.
<7> Execute the HALT instruction then start self programming. (Execute an instruction immediately after the
HALT instruction if self programming has been executed.)
<8> Check if a self programming error has occurred using bit 1 (VCERR) and bit 2 (WEPRERR) of PFS.
Abnormal → <9>
Normal → <10>
<9> Byte write processing is abnormally terminated.
<10> Byte write processing is normally terminated.
Note This setting is not required when the watchdog timer is not used.
Caution If a write results in failure, erase the block once and write to it again.
Byte write
Normal
Note This setting is not required when the watchdog timer is not used.
Remark <1> to <10> in Figure 19-24 correspond to <1> to <10> in 19.8.8 (previous page).
An example of a program list that performs a byte write in self programming mode is shown below.
;----------------------------
;START
;----------------------------
FlashWrite:
MOV FLCMD,#05H ; Sets flash control command (byte write)
MOV FLAPH,#07H ; Sets address to which data is to be written, with
; FLAPH (block 7 is specified here)
MOV FLAPL,#20H ; Sets address to which data is to be written, with
; FLAPL (address 20H is specified here)
MOV FLW,#10H ; Sets data to be written (10H is specified here)
;----------------------------
;END
;----------------------------
<1> Set 01H (internal verify) to the flash program command register (FLCMD).
<2> Set the number of block for which internal verify is performed, to flash address pointer H (FLAPH).
<3> Sets the verify start address to flash address pointer L (FLAPL).
<4> Write the same value as that of FLAPH to the flash address pointer H compare register (FLAPHC).
<5> Sets the verify end address to the flash address pointer L compare register (FLAPLC).
<6> Clear the flash status register (PFS).
<7> Write ACH to the watchdog timer enable register (WDTE) (clear and restart the watchdog timer counter)Note.
<8> Execute the HALT instruction then start self programming. (Execute an instruction immediately after the
HALT instruction if self programming has been executed.)
<9> Check if a self programming error has occurred using bit 1 (VCERR) and bit 2 (WEPRERR) of PFS.
Abnormal → <10>
Normal → <11>
<10> Internal verify processing is abnormally terminated.
<11> Internal verify processing is normally terminated.
Note This setting is not required when the watchdog timer is not used.
Internal verify
Normal
Note This setting is not required when the watchdog timer is not used.
Remark <1> to <11> in Figure 19-25 correspond to <1> to <11> in 19.8.9 (previous page).
An example of a program list that performs an internal verify in self programming mode is shown below.
;----------------------------
;START
;----------------------------
FlashVerify:
MOV FLCMD,#01H ; Sets flash control command (internal verify)
MOV FLAPH,#07H ; Sets verify start address with FLAPH (block 7 is specified
; here)
MOV FLAPL,#00H ; Sets verify start address with FLAPL (Address 00H is
; specified here)
MOV FLAPHC,#07H
MOV FLAPLC,#20H ; Sets verify end address
;----------------------------
;END
;----------------------------
19.8.10 Examples of operation when command execution time should be minimized in self programming
mode
Examples of operation when the command execution time should be minimized in self programming mode are
explained below.
Figure 19-26. Example of Operation When Command Execution Time Should Be Minimized
(from Erasure to Blank Check)
Figure 19-22
<1> to <11>
<2> Check execution result Abnormal
(VCERR and WEPRERR flags)
Normal
Figure 19-23
<1> to <11>
Normal
Figure 19-21
<1> to <5> <4> Shift to normal mode
Note Perform processing to shift to normal mode in order to return to normal processing.
Remark <1> to <4> in Figure 19-26 correspond to <1> to <4> in 19.8.10 (1) above.
An example of a program list when the command execution time (from erasure to black check) should be
minimized in self programming mode is shown below.
;---------------------------------------------------------------------
;START
;---------------------------------------------------------------------
MOV MK0,#11111111B ; Masks all interrupts
MOV MK1,#11111111B
DI
ModeOnLoop:
MOV PFS,#00H
MOV PFCMD,#0A5H ; PFCMD register control
MOV FLPMC,#01H ; FLPMC register control (sets value)
MOV FLPMC,#0FEH ; FLPMC register control (inverts set value)
MOV FLPMC,#01H ; Sets self programming mode with FLPMC register control (sets
; value)
MOV A,PFS
CMP A,#00H
BNZ $ModeOnLoop ; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
FlashBlockErase:
MOV FLCMD,#03H ; Sets flash control command (block erase)
MOV FLAPH,#07H ; Sets number of block to be erased (block 7 is specified
; here)
MOV FLAPL,#00H ; Fixes FLAPL to “00H”
MOV FLAPHC,#07H ; Sets erase block compare number (same value as that of
; FLAPH)
MOV FLAPLC,#00H ; Fixes FLAPLC to “00H”
FlashBlockBlankCheck:
MOV FLCMD,#04H ; Sets flash control command (block blank check)
MOV FLAPH,#07H ; Sets number of block for blank check (block 7 is specified
; here)
MOV FLAPL,#00H ; Fixes FLAPL to “00H”
MOV FLAPHC,#07H ; Sets blank check block compare number (same value as of
; FLAPH)
MOV FLAPLC,#0FFH ; Fixes FLAPLC to “FFH”
MOV PFS,#00H ; Clears flash status register
MOV WDTE,#0ACH ; Clears & restarts WDT
HALT ; Self programming is started
MOV A,PFS
CMP A,#00H
BNZ $StatusError ; Checks blank check error
; Performs abnormal termination processing when an error
; occurs.
ModeOffLoop:
MOV PFS,#00H
MOV PFCMD,#0A5H ; PFCMD register control
MOV FLPMC,#00H ; FLPMC register control (sets value)
MOV FLPMC,#0FFH ; FLPMC register control (inverts set value)
MOV FLPMC,#00H ; Sets normal mode via FLPMC register control (sets value)
MOV A,PFS
CMP A,#00H
BNZ $ModeOffLoop ; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
EI
BR StatusNormal
;---------------------------------------------------------------------
;END (abnormal termination processing); Perform processing to shift to
normal mode in order to return to normal processing
;---------------------------------------------------------------------
StatusError:
;---------------------------------------------------------------------
;END (normal termination processing)
;---------------------------------------------------------------------
StatusNormal:
Figure 19-27. Example of Operation When Command Execution Time Should Be Minimized
(from Write to Internal Verify)
Figure 19-24
<1> to <10>
<3> Check execution result Abnormal
(VCERR and WEPRERR flags)
Normal
Yes
<4> All data written?
No
Figure 19-25
<1> to <11>
Normal
Note Perform processing to shift to normal mode in order to return to normal processing.
Remark <1> to <6> in Figure 19-27 correspond to <1> to <6> in 19.8.10 (2) above.
An example of a program list when the command execution time (from write to internal verify) should be minimized
in self programming mode is shown below.
;---------------------------------------------------------------------
;START
;---------------------------------------------------------------------
MOV MK0,#11111111B ; Masks all interrupts
MOV MK1,#11111111B
DI
ModeOnLoop:
MOV PFS,#00H
MOV PFCMD,#0A5H ; PFCMD register control
MOV FLPMC,#01H ; FLPMC register control (sets value)
MOV FLPMC,#0FEH ; FLPMC register control (inverts set value)
MOV FLPMC,#01H ; Sets self programming mode with FLPMC register control
; (sets value)
MOV A,PFS
CMP A,#00H
BNZ $ModeOnLoop ; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
FlashWrite:
MOVW HL,#DataAdrTop ; Sets address at which data to be written is located
MOVW DE,#WriteAdr ; Sets address at which data is to be written
FlashWriteLoop:
MOV FLCMD,#05H ; Sets flash control command (byte write)
MOV A,D
MOV FLAPH,A ; Sets address at which data is to be written
MOV A,E
MOV FLAPL,A ; Sets address at which data is to be written
MOV A,[HL]
MOV FLW,A ; Sets data to be written
FlashVerify:
MOVW HL,#WriteAdr ; Sets verify address
ModeOffLoop:
MOV PFS,#00H
MOV PFCMD,#0A5H ; PFCMD register control
MOV FLPMC,#00H ; FLPMC register control (sets value)
MOV FLPMC,#0FFH ; FLPMC register control (inverts set value)
MOV FLPMC,#00H ; Sets normal mode via FLPMC register control (sets value)
MOV A,PFS
CMP A,#00H
BNZ $ModeOffLoop ; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
EI
BR StatusNormal
;---------------------------------------------------------------------
;END (abnormal termination processing); Perform processing to shift to
normal mode in order to return to normal processing
;---------------------------------------------------------------------
StatusError:
;---------------------------------------------------------------------
;END (normal termination processing)
;---------------------------------------------------------------------
StatusNormal:
;---------------------------------------------------------------------
; Data to be written
;---------------------------------------------------------------------
DataAdrTop:
DB XXH
DB XXH
DB XXH
DB XXH
:
:
DB XXH
DataAdrBtm:
;---------------------------------------------------------------------
19.8.11 Examples of operation when interrupt-disabled time should be minimized in self programming mode
Examples of operation when the interrupt-disabled time should be minimized in self programming mode are
explained below.
Figure 19-22
<6> to <11>
<3> Check execution result Abnormal
(VCERR and WEPRERR flags)
Normal
Figure 19-21
<4> Shift to normal mode
<1> to <5>
Figure 19-23
<6> to <11>
<7> Check execution result Abnormal
(VCERR and WEPRERR flags)
Normal
Figure 19-21
<8> Shift to normal mode
<1> to <5>
Note Perform processing to shift to normal mode in order to return to normal processing.
Remark <1> to <8> in Figure 19-28 correspond to <1> to <8> in 19.8.11 (1) (previous page).
An example of a program list when the interrupt-disabled time (from erasure to blank check) should be minimized
in self programming mode is shown below.
;---------------------------------------------------------------------
;START
;---------------------------------------------------------------------
FlashBlockErase:
; Sets erase command
MOV FLCMD,#03H ; Sets flash control command (block erase)
MOV FLAPH,#07H ; Sets number of block to be erased (block 7 is specified here)
MOV FLAPL,#00H ; Fixes FLAPL to “00H”
MOV FLAPHC,#07H ; Sets erase block compare number (same value as that of FLAPH)
MOV FLAPLC,#00H ; Fixes FLAPLC to “00H”
BR StatusNormal
;---------------------------------------------------------------------
;END (abnormal termination processing); Perform processing to shift to
normal mode in order to return to normal processing
;---------------------------------------------------------------------
StatusError:
;---------------------------------------------------------------------
;END (normal termination processing)
;---------------------------------------------------------------------
StatusNormal:
;---------------------------------------------------------------------
;Processing to shift to self programming mode
;---------------------------------------------------------------------
ModeOn:
MOV MK0,#11111111B ; Masks all interrupts
MOV MK1,#11111111B
DI
ModeOnLoop:
MOV PFS,#00H
MOV PFCMD,#0A5H ; PFCMD register control
MOV FLPMC,#01H ; FLPMC register control (sets value)
MOV FLPMC,#0FEH ; FLPMC register control (inverts set value)
MOV FLPMC,#01H ; Sets self programming mode via FLPMC register control (sets
; value)
MOV A,PFS
CMP A,#00H
BNZ $ModeOnLoop ; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
RET
;---------------------------------------------------------------------
; Processing to shift to normal mode
;---------------------------------------------------------------------
ModeOff:
MOV PFS,#00H
MOV PFCMD,#0A5H ; PFCMD register control
MOV FLPMC,#00H ; FLPMC register control (sets value)
MOV A,PFS
CMP A,#00H
BNZ $ModeOff ; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
EI
RET
Figure 19-24
<5> to <10>
<4> Check execution result Abnormal
(VCERR and WEPRERR flags)
Normal
Figure 19-21
<5> Shift to normal mode
<1> to <5>
Yes
<6> All data written?
No
Figure 19-25
<6> to <10>
<9> Check execution result Abnormal
(VCERR and WEPRERR flags)
Normal
Figure 19-21
<10> Shift to normal mode
<1> to <5>
Note Perform processing to shift to normal mode in order to return to normal processing.
Remark <1> to <10> in Figure 19-29 correspond to <1> to <10> in 19.8.11 (2) (previous page).
An example of a program list when the interrupt-disabled time (from write to internal verify) should be minimized in
self programming mode is shown below.
;---------------------------------------------------------------------
;START
;---------------------------------------------------------------------
; Sets write command
FlashWrite:
MOVW HL,#DataAdrTop ; Sets address at which data to be written is located
MOVW DE,#WriteAdr ; Sets address at which data is to be written
FlashWriteLoop:
MOV FLCMD,#05H ; Sets flash control command (byte write)
MOV A,D
MOV FLAPH,A ; Sets address at which data is to be written
MOV A,E
MOV FLAPL,A ; Sets address at which data is to be written
MOV A,[HL]
MOV FLW,A ; Sets data to be written
EI
BR StatusNormal
;---------------------------------------------------------------------
;END (abnormal termination processing); Perform processing to shift to
normal mode in order to return to normal processing
;---------------------------------------------------------------------
StatusError:
;---------------------------------------------------------------------
;END (normal termination processing)
;---------------------------------------------------------------------
StatusNormal:
;---------------------------------------------------------------------
;Processing to shift to self programming mode
;---------------------------------------------------------------------
ModeOn:
MOV MK0,#11111111B ; Masks all interrupts
MOV MK1,#11111111B
DI
ModeOnLoop:
MOV PFS,#00H
MOV PFCMD,#0A5H ; PFCMD register control
MOV FLPMC,#01H ; FLPMC register control (sets value)
MOV FLPMC,#0FEH ; FLPMC register control (inverts set value)
MOV FLPMC,#01H ; Sets self programming mode via FLPMC register control (sets
; value)
MOV A,PFS
CMP A,#00H
BNZ $ModeOnLoop ; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
RET
;---------------------------------------------------------------------
; Processing to shift to normal mode
;---------------------------------------------------------------------
ModeOff:
MOV PFS,#00H
MOV PFCMD,#0A5H ; PFCMD register control
MOV FLPMC,#00H ; FLPMC register control (sets value)
MOV FLPMC,#0FFH ; FLPMC register control (inverts set value)
MOV FLPMC,#00H ; Sets normal mode via FLPMC register control (sets value)
MOV A,PFS
CMP A,#00H
BNZ $ModeOff ; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
EI
RET
;---------------------------------------------------------------------
;Data to be written
;---------------------------------------------------------------------
DataAdrTop:
DB XXH
DB XXH
DB XXH
DB XXH
:
:
DB XXH
DataAdrBtm:
;---------------------------------------------------------------------
This chapter lists the instruction set of the 78K0S/KB1+. For details of the operation and machine language
(instruction code) of each instruction, refer to 78K/0S Series Instructions User’s Manual (U11047E).
20.1 Operation
In the case of immediate data, describe an appropriate numeric value or a label. When using a label, be sure to
describe the #, !, $ and [ ] symbols.
For operand register identifiers, r and rp, either function names (X, A, C, etc.) or absolute names (names in
parentheses in the table below, R0, R1, R2, etc.) can be used for description.
addr16 0000H to FFFFH Immediate data or labels (only even addresses for 16-bit data transfer instructions)
addr5 0040H to 007FH Immediate data or labels (even addresses only)
Remark For symbols of special function registers, see Table 3-3 Special Function Registers.
(Blank): Unchanged
0: Cleared to 0
1: Set to 1
×: Set/cleared according to the result
R: Previously saved value is stored
Z AC CY
Note
r, A 2 4 r←A
1
A, saddr 2 4 A ← (saddr)
saddr, A 2 4 (saddr) ← A
A, sfr 2 4 A ← sfr
sfr, A 2 4 sfr ← A
A, !addr16 3 8 A ← (addr16)
!addr16, A 3 8 (addr16) ← A
A, PSW 2 4 A ← PSW
PSW, A 2 4 PSW ← A × × ×
A, [DE] 1 6 A ← (DE)
[DE], A 1 6 (DE) ← A
A, [HL] 1 6 A ← (HL)
[HL], A 1 6 (HL) ← A
XCH A, X 1 4 A↔X
Note
A, r 2 6 A↔r
2
A, saddr 2 6 A ↔ (saddr)
A, sfr 2 6 A ↔ sfr
A, [DE] 1 8 A ↔ (DE)
A, [HL] 1 8 A ↔ (HL)
Notes 1. Except r = A.
2. Except r = A, X.
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
Z AC CY
saddrp, AX 2 8 (saddrp) ← AX
Note
AX, rp 1 4 AX ← rp
Note
rp, AX 1 4 rp ← AX
Note
XCHW AX, rp 1 8 AX ↔ rp
A, r 2 4 A, CY ← A + r × × ×
A, saddr 2 4 A, CY ← A + (saddr) × × ×
A, !addr16 3 8 A, CY ← A + (addr16) × × ×
A, [HL] 1 6 A, CY ← A + (HL) × × ×
A, r 2 4 A, CY ← A + r + CY × × ×
A, saddr 2 4 A, CY ← A + (saddr) + CY × × ×
A, !addr16 3 8 A, CY ← A + (addr16) + CY × × ×
A, [HL] 1 6 A, CY ← A + (HL) + CY × × ×
A, r 2 4 A, CY ← A − r × × ×
A, saddr 2 4 A, CY ← A − (saddr) × × ×
A, !addr16 3 8 A, CY ← A − (addr16) × × ×
A, [HL] 1 6 A, CY ← A − (HL) × × ×
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
Z AC CY
A, r 2 4 A, CY ← A − r − CY × × ×
A, saddr 2 4 A, CY ← A − (saddr) − CY × × ×
A, !addr16 3 8 A, CY ← A − (addr16) − CY × × ×
A, [HL] 1 6 A, CY ← A − (HL) − CY × × ×
A, r 2 4 A←A∧r ×
A, saddr 2 4 A ← A ∧ (saddr) ×
A, !addr16 3 8 A ← A ∧ (addr16) ×
A, [HL] 1 6 A ← A ∧ (HL) ×
OR A, #byte 2 4 A ← A ∨ byte ×
A, r 2 4 A←A∨r ×
A, saddr 2 4 A ← A ∨ (saddr) ×
A, !addr16 3 8 A ← A ∨ (addr16) ×
A, [HL] 1 6 A ← A ∨ (HL) ×
A, r 2 4 A←A∨r ×
A, saddr 2 4 A ← A ∨ (saddr) ×
A, !addr16 3 8 A ← A ∨ (addr16) ×
A, [HL] 1 6 A ← A ∨ (HL) ×
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
Z AC CY
A, r 2 4 A−r × × ×
A, saddr 2 4 A − (saddr) × × ×
A, !addr16 3 8 A − (addr16) × × ×
A, [HL] 1 6 A − (HL) × × ×
INC r 2 4 r←r+1 × ×
DEC r 2 4 r←r−1 × ×
INCW rp 1 4 rp ← rp + 1
DECW rp 1 4 rp ← rp − 1
sfr.bit 3 6 sfr.bit ← 1
A.bit 2 4 A.bit ← 1
PSW.bit 3 6 PSW.bit ← 1 × × ×
[HL].bit 2 10 (HL).bit ← 1
sfr.bit 3 6 sfr.bit ← 0
A.bit 2 4 A.bit ← 0
PSW.bit 3 6 PSW.bit ← 0 × × ×
[HL].bit 2 10 (HL).bit ← 0
SET1 CY 1 2 CY ← 1 1
CLR1 CY 1 2 CY ← 0 0
NOT1 CY 1 2 CY ← CY ×
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
2nd Operand #byte A r sfr saddr !addr16 PSW [DE] [HL] [HL + byte] $addr16 1 None
1st Operand
A ADD MOVNote MOV MOV MOV MOV MOV MOV MOV ROR
ADDC XCHNote XCH XCH XCH XCH XCH ROL
SUB ADD ADD ADD ADD ADD RORC
SUBC ADDC ADDC ADDC ADDC ADDC ROLC
AND SUB SUB SUB SUB SUB
OR SUBC SUBC SUBC SUBC SUBC
XOR AND AND AND AND AND
CMP OR OR OR OR OR
XOR XOR XOR XOR XOR
CMP CMP CMP CMP CMP
B, C DBNZ
!addr16 MOV
[DE] MOV
[HL] MOV
Note Except r = A.
Note
2nd Operand #word AX rp saddrp SP None
1st Operand
saddrp MOVW
sp MOVW
A.bit BT SET1
BF CLR1
sfr.bit BT SET1
BF CLR1
saddr.bit BT SET1
BF CLR1
PSW.bit BT SET1
BF CLR1
[HL].bit SET1
CLR1
CY SET1
CLR1
NOT1
1st Operand
These specifications are only target values, and may not be satisfied by mass-produced products.
Caution Product quality may suffer if the absolute maximum rating is exceeded even momentarily for any
parameter. That is, the absolute maximum ratings are rated values at which the product is on the
verge of suffering physical damage, and therefore the product must be used under conditions that
ensure that the absolute maximum ratings are not exceeded.
Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins.
X1 Oscillator Characteristics (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V)
Resonator Recommended Circuit Parameter Conditions MIN. TYP. MAX. Unit
C1 C2
C1 C2
Notes 1. Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.1 V ±0.1 V.
2. Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time.
Caution When using the X1 oscillator, wire as follows in the area enclosed by the broken lines in the above
figures to avoid an adverse effect from wiring capacitance.
Remark For the resonator selection and oscillator constant, users are required to either evaluate the oscillation
themselves or apply to the resonator manufacturer for evaluation.
High-Speed Ring-OSC Oscillator Characteristics (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote 1, fX = 8 MHz Note 2)
Resonator Parameter Conditions MIN. TYP. MAX. Unit
Notes 1. Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.1 V ±0.1 V.
2. Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time.
Low-Speed Ring-OSC Oscillator Characteristics (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote, VSS = 0 V)
Resonator Parameter Conditions MIN. TYP. MAX. Unit
On-chip low-speed Ring-OSC Oscillation frequency (fRL) 120 240 480 kHz
Note Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.1 V ±0.1 V.
DC Characteristics (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote, VSS = 0 V) (1/2)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
Output current, high IOH1 Pins other than Per pin 2.0 V ≤ VDD ≤ 5.5 V –5 mA
P20 to P23 Total 4.0 V ≤ VDD ≤ 5.5 V –25 mA
2.0 V ≤ VDD < 4.0 V –15 mA
IOH2 P20 to P23 Per pin 2.0 V ≤ AVREF ≤ 5.5 V –5 mA
Total 2.0 V ≤ AVREF ≤ 5.5 V –15 mA
Output current, low IOL Per pin 2.0 V ≤ VDD ≤ 5.5 V 10 mA
Total of all pins 4.0 V ≤ VDD ≤ 5.5 V 30 mA
2.0 V ≤ VDD < 4.0 V 15 mA
Input voltage, high VIH1 P00 to P03, P30 to P34, P40 to P47, P120, P123 0.8VDD VDD V
VIH2 P20 to P23 0.7AVREF AVREF V
VIH3 P121, P122 0.8VDD VDD V
Input voltage, low VIL1 P00 to P03, P30 to P34, P40 to P47, P120, P123 0 0.2VDD V
VIL2 P20 to P23 0 0.3AVREF V
VIL3 P121, P122 0 0.3VDD V
Output voltage, high VOH1 Total of pins other than 4.0 V ≤ VDD ≤ 5.5 V VDD − 1.0 V
P20 to P23 IOH1 = –5 mA
IOH1 = –15 mA
IOH1 = –100 µA 2.0 V ≤ VDD < 4.0 V VDD – 0.5 V
VOH2 Total of pins P20 to P23 4.0 V ≤ AVREF ≤ 5.5 V AVREF – 1.0 V
IOH2 = –10 mA IOH2 = –5 mA
2.0 V ≤ AVREF < 4.0 V AVREF – 0.5 V
IOH2 = –5 mA
Output voltage, low VOL Total of pins 4.0 V ≤ VDD ≤ 5.5 V 1.3 V
IOL = 30 mA IOL = 10 mA
2.0 V ≤ VDD < 4.0 V 0.4 V
IOL = 400 µA
Input leakage current, high ILIH1 VI = VDD Pins other than X1 3 µA
Input leakage current, low ILIL1 VI = 0 V Pins other than X1 –3 µA
Output leakage current, high ILOH VO = VDD Pins other than X2 3 µA
Output leakage current, low ILOL VO = 0 V Pins other than X2 –3 µA
Note Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.1 V ±0.1 V.
Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins.
DC Characteristics (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V) (2/2)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
Pull-up RPU VI = 0 V 10 30 100 kΩ
resistance
Pull-down RPD P121, P122, reset status 10 30 100 kΩ
resistance
Note 3
Supply IDD1 Crystal/ceramic fX = 10 MHz When A/D converter is stopped 6.1 12.2 mA
Note 2 Note 4
current oscillation, external VDD = 5.0 V ±10% When A/D converter is operating
Note 8
7.6 15.2
clock input oscillation
Note 6 fX = 6 MHz When A/D converter is stopped 5.5 11.0 mA
operating mode Note 4
VDD = 5.0 V ±10% When A/D converter is operating
Note 8
14.0
fX = 5 MHz When A/D converter is stopped 3.0 6.0 mA
Note 5
VDD = 3.0 V ±10% When A/D converter is operating
Note 8
4.5 9.0
IDD2 Crystal/ceramic fX = 10 MHz When peripheral functions are stopped 1.7 3.8 mA
Note 4
oscillation, external VDD = 5.0 V ±10% When peripheral functions are operating 6.7
clock input HALT
Note 6 fX = 6 MHz When peripheral functions are stopped 1.3 3.0 mA
mode Note 4
VDD = 5.0 V ±10% When peripheral functions are operating 6.0
fX = 5 MHz When peripheral functions are stopped 0.48 1 mA
Note 5
VDD = 3.0 V ±10% When peripheral functions are operating 2.1
Note 3
IDD3 High-speed Ring-OSC fX = 8 MHz When A/D converter is stopped 5.5 11.0 mA
Note 7 Note 4
operating mode VDD = 5.0 V ±10% When A/D converter is operating
Note 8
7.0 14.0
IDD4 High-speed Ring- fX = 8 MHz When peripheral functions are stopped 1.4 3.2 mA
Note 7 Note 4
OSC HALT mode VDD = 5.0 V ±10% When peripheral functions are operating 5.9
IDD5 STOP mode VDD = 5.0 V ±10% When low-speed Ring-OSC is stopped 3.5 35.5 µA
When low-speed Ring-OSC is operating 17.5 63.5
VDD = 3.0 V ±10% When low-speed Ring-OSC is stopped 3.5 15.5 µA
When low-speed Ring-OSC is operating 11.0 30.5
Notes 1. Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.1 V ±0.1 V.
2. Total current flowing through the internal power supply (VDD). Peripheral operation current is included
(however, the current that flows through the pull-up resistors of ports is not included).
3. Peripheral operation current is included.
4. When the processor clock control register (PCC) is set to 00H.
5. When the processor clock control register (PCC) is set to 02H.
6. When crystal/ceramic oscillation clock, external clock input is selected as the system clock source using
the option byte.
7. When the high-speed Ring-OSC is selected as the system clock source using the option byte.
8. The current that flows through the AVREF pin is included.
AC Characteristics
(1) Basic operation (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
Cycle time (minimum TCY Crystal/ceramic oscillation 4.0 V ≤ VDD ≤ 5.5 V 0.2 16 µs
instruction execution time) clock, external clock input 3.0 V ≤ VDD < 4.0 V 0.33 16 µs
2.7 V ≤ VDD < 3.0 V 0.4 16 µs
2.0 V ≤ VDD < 2.7 V 1 16 µs
High-speed Ring-OSC 4.0 V ≤ VDD ≤ 5.5 V 0.23 4.22 µs
clock 2.7 V ≤ VDD < 4.0 V 0.47 4.22 µs
2.0 V ≤ VDD < 2.7 V 0.95 4.22 µs
TI000 input high-level width, tTIH, 4.0 V ≤ VDD ≤ 5.5 V 2/fsam+ µs
Note 2
low-level width tTIL 0.1
2.0 V ≤ VDD < 4.0 V 2/fsam+ µs
Note 2
0.2
Interrupt input high-level tINTH, 1 µs
width, low-level width tINTL
RESET input low-level tRSL 2 µs
width
Notes 1. Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.1 V ±0.1 V.
2. Selection of fsam = fXP, fXP/4, or fXP/256 is possible using bits 0 and 1 (PRM000, PRM001) of prescaler
mode register 00 (PRM00). Note that when selecting the TI000 valid edge as the count clock, fsam = fXP.
60
16
10
0.4
0.33
0.1
1 2 3 4 5 6
2.7 5.5
Supply voltage VDD [V]
60
10
Cycle time TCY [µs]
4.22
Guaranteed
operation range
1.0
0.95
0.47
0.23
0.1
1 2 3 4 5 6
2.7 5.5
Supply voltage VDD [V]
(2) Serial interface (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote, VSS = 0 V)
Note Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.1 V ±0.1 V.
0.8VDD 0.8VDD
Test points
0.2VDD 0.2VDD
Clock Timing
1/fX
tXL tXH
X1 input
TI000 Timing
tTIL tTIH
TI000
tINTL tINTH
INTP0 to INTP3
tRSL
RESET
A/D Converter Characteristics (TA = −40 to +85°C, 2.7 V ≤ AVREF ≤ VDD ≤ 5.5 V, VSS = AVSS = 0 V)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
Resolution 10 10 10 bit
Notes 1, 2
Overall error AINL 4.0 V ≤ AVREF ≤ 5.5 V ±0.2 ±0.4 %FSR
2.7 V ≤ AVREF < 4.0 V ±0.3 ±0.6 %FSR
Conversion time tCONV 4.5 V ≤ AVREF ≤ 5.5 V 3.0 100 µs
4.0 V ≤ AVREF < 4.5 V 4.8 100 µs
2.85 V ≤ AVREF < 4.0 V 6.0 100 µs
2.7 V ≤ AVREF < 2.85 V 14.0 100 µs
Notes 1, 2
Zero-scale error Ezs 4.0 V ≤ AVREF ≤ 5.5 V ±0.4 %FSR
2.7 V ≤ AVREF < 4.0 V ±0.6 %FSR
Notes 1, 2
Full-scale error Efs 4.0 V ≤ AVREF ≤ 5.5 V ±0.4 %FSR
2.7 V ≤ AVREF < 4.0 V ±0.6 %FSR
Note 1
Integral non-linearity error ILE 4.0 V ≤ AVREF ≤ 5.5 V ±2.5 LSB
2.7 V ≤ AVREF < 4.0 V ±4.5 LSB
Note 1
Differential non-linearity error DLE 4.0 V ≤ AVREF ≤ 5.5 V ±1.5 LSB
2.7 V ≤ AVREF < 4.0 V ±2.0 LSB
Analog input voltage VAIN VSS AVREF V
F r e e D a t a s h e
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES)
Supply voltage
(VDD)
tPW
Time
Notes 1. Time required from voltage detection to interrupt output or internal reset signal generation.
2. Time required from setting LVION to 1 to operation stabilization.
Remarks 1. VLVI0 > VLVI1 > VLVI2 > VLVI3 > VLVI4 > VLVI5 > VLVI6 > VLVI7 > VLVI8 > VLVI9
2. VPOC < VLVIm (m = 0 to 9)
Supply voltage
(VDD)
tLW
tLWAIT tLD
LVION 1 Time
Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics (TA = −40 to +85°C)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
Flash Memory Programming Characteristics (TA = –40 to +85°C, 2.7 V ≤ VDD ≤ 5.5 V, VSS = 0 V)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
Note Depending on the erasure count (NERASE), the erase time varies. Refer to the chip erase time and block erase
time parameters.
Remark When a product is first written after shipment, “erase → write” and “write only” are both taken as one rewrite.
30 16
F
G
P
L
1 1 5
A E U
I J
C N S B
D M M K
D 0.24 +0.08
−0.07
E 0.1±0.05
F 1.3±0.1
G 1.2
H 8.1±0.2
I 6.1±0.2
J 1.0±0.2
K 0.17±0.03
L 0.5
M 0.13
N 0.10
P 3° +5°
−3°
T 0.25
U 0.6±0.15
S30MC-65-5A4-2
The following development tools are available for development of systems using the 78K0S/KB1+. Figure A-1
shows development tools.
• WindowsTM
Unless stated otherwise, “Windows” refers to the following operating systems.
• Windows 98
• Windows NTTM Ver. 4.0
• Windows 2000
• Windows XP
• Software package
Control software
• Project Manager
(Windows version only)Note 2
Host machine
(PC or EWS)
Interface adapter
In-circuit emulatorNote 3
Flash programmer
Emulation boardNote 4
Flash memory
writing adapter
Flash memory
Target cable or emulation probe
Pin header or
conversion socket
Target system
Notes 1. The C library source file is not included in the software package.
2. The Project Manager PM plus is included in the assembler package.
PM plus is used only in the Windows environment.
3. All products other than the in-circuit emulators IE-78K0S-NS and IE-78K0S-NS-A are optional.
4. The in-circuit emulator IE-789234-NS-EM1 is provided with the target cable.
• Software package
Control software
• Project Manager
(Windows version only)Note 2
Host machine
(PC or EWS)
Interface adapter
QB-78K0SMINI
Flash programmer
Debug adapter
Flash memory
writing adapter
Flash memory
Target cable or emulation probe
Pin header
Target system
Notes 1. The C library source file is not included in the software package.
2. The Project Manager PM plus is included in the assembler package.
PM plus is used only in the Windows environment.
3. The in-circuit emulator QB-78K0SKX1MINI is provided with the integrated debugger ID78K0S-QB, the
flash memory programmer PG-FPL2, a power supply unit, and a target cable. Other products are
optional.
SP78K0S This is a package that bundles the software tools required for development of the 78K/0S Series.
Software package The following tools are included.
RA78K0S, CC78K0S, ID78K0S-NS, etc.
Remark ×××× in the part number differs depending on the operating system to be used.
µS××××SP78K0S
RA78K0S Program that converts program written in mnemonic into object code that can be executed by
Assembler package microcontroller.
In addition, automatic functions to generate symbol table and optimize branch instructions are also
provided. Used in combination with device file (DF789234) (sold separately).
<Caution when used in PC environment>
The assembler package is a DOS-based application but may be used under the Windows
environment by using PM plus (included in the assembler package).
CC78K0S Program that converts program written in C language into object codes that can be executed by
C library package microcontroller.
Used in combination with assembler package (RA78K0S) and device file (DF789234) (both sold
separately).
<Caution when used in PC environment>
The C compiler package is a DOS-based application but may be used under the Windows
environment by using PM plus (included in the assembler package).
Notes 1. DF789234 is a common file that can be used with RA78K0S, CC78K0S, ID78K0S-NS, ID78K0S-QB,
and SM+ for 78K0S.
2. CC78K0S-L is not included in the software package (SP78K0S).
Remark ×××× in the part number differs depending on the host machine and operating system to be used.
µS××××RA78K0S
µS××××CC78K0S
µS××××CC78K0S-L
µS××××DF789234
PM plus This is control software designed so that the user program can be efficiently developed
Project manager in the Windows environment. With this software, a series of user program
development operations, including starting the editor, build, and starting the debugger,
can be executed on PM plus.
<Caution>
PM plus is included in the assembler package (RA78K0S). It can be used only in the
Windows environment.
Flashpro4 (FL-PR4, PG-FP4) Flash programmer dedicated to the microcontrollers incorporating a flash memory
Flash memory programmer
FA-30MC-5A4-A Flash memory writing adapter. Used in connection with Flash programmer.
Flash memory writing adapter Designed for use with a 30-pin plastic SSOP (MC-5A4 type).
Remark FL-PR4 and FA-30MC-5A4-A are products of Naito Densei Machida Mfg. Co., Ltd.
For further information, contact: Naito Densei Machida Mfg. Co., Ltd. (TEL +81-45-475-4191)
IE-78K0S-NS In-circuit emulator for debugging hardware and software of application system using 78K/0S
In-circuit emulator Series. Supports integrated debugger (ID78K0S-NS). Used in combination with AC adapter,
emulation probe, and interface adapter for connecting the host machine.
IE-78K0S-NS-A This in-circuit emulator has a coverage function in addition to the functions of the IE-78K0S-
In-circuit emulator NS, and enhanced debugging functions such as an enhanced tracer function and timer
function.
IE-70000-MC-PS-B Adapter for supplying power from 100 to 240 VAC outlet.
AC adapter
IE-70000-CD-IF-A PC card and interface cable required when using a notebook type PC as the host machine
PC card interface (PCMCIA socket supported).
IE-70000-PC-IF-C Adapter required when using IBM PC/AT and compatibles as the host machine (ISA bus
Interface adapter supported).
IE-70000-PCI-IF-A Adapter required when using a personal computer incorporating the PCI bus is used as the
Interface adapter host machine.
IE-789234-NS-EM1 Emulation board for emulating the peripheral hardware inherent to the device.
Emulation board Used in combination with in-circuit emulator. A target cable is provided.
NP-30MC This probe is used to connect the in-circuit emulator to the target system and is designed for
Emulation probe use with a 30-pin plastic SSOP (MC-5A4 type).
NSPACK30BK This conversion connector connects the NP-30MC to a target system board designed to mount
YSPACK30BK a 30-pin plastic SSOP (MC-5A4 type).
Conversion connector • NSPACK30BK: Connector for connecting target
• YSPACK30BK: Connector for connecting emulator
QB-80-EP-01T This emulation probe is flexible type and used to connect the in-circuit emulator and target
Emulation probe system. This probe is designed for use with a 30-pin plastic SSOP (MC-5A4 type).
QB-30MC-EA-01T This exchange adapter is used to perform pin conversion from the in-circuit emulator to target
connector.
QB-30MC-YQ-01T This YQ connector is used to connect the target connector and exchange adapter.
QB-78K0SKX1MINI In-circuit emulator for debugging hardware and software of application system using
In-circuit emulator 78K0S/Kx1+ Series. Supports integrated debugger (ID78K0S-QB). Used in combination with
AC adapter, target cable, and USB interface cable for connecting the host machine.
ID78K0S-NS This debugger supports the in-circuit emulators for the 78K/0S Series. ID78K0S-NS is Windows-
(supporting in-circuit based software.
emulator IE-78K0S-NS/ This debugger has enhanced debugging functions supporting C language. By using its window
IE-78K0S-NS-A) integration function that associates the source program, disassemble display, and memory display
Integrated debugger with trace results, the trace results can be displayed corresponding to the source program.
It is used with a device file (DF789234) (sold separately).
ID78K0S-QB This debugger supports the in-circuit emulators for the 78K0S/Kx1+ Series. ID78K0S-QB is
(supporting in-circuit Windows-based software.
emulator Provided with the debug function supporting C language, source programming, disassemble
QB-78K0SKX1MINI) display, and memory display are possible. This is used with the device file (DF789234) (sold
Integrated debugger separately).
It is provided with the in-circuit emulator QB-78K0SKX1MINI.
Ordering numberµS××××DF789234
µS××××ID78K0S-NS
µS××××ID78K0S-QB
µS××××SM789234-B
µS××××DF789234
The following show the conditions when connecting the emulation probe to the conversion connector and
conversion socket in the case using in-circuit emulator IE-78K0S-NS or IE-78K0S-NS-A. Follow the configuration
below and consider the shape of parts to be mounted on the target system when designing a system.
Figure B-1. Distance Between In-Circuit Emulator and Conversion Connector (When Using NP-30MC)
In-circuit emulator
IE-78K0S-NS, IE-78K0S-NS-A
Target system
Emulation board
IE-789234-NS-EM1
CN2
Emulation probe
NP-30MC Conversion connector
YSPACK30BK,
NSPACK30BK
Remarks 1. The NP-30MC is a product made by Naito Densei Machida Mfg. Co., Ltd.
2. The YSPACK30BK and NSPACK30BK are products by TOKYO ELETECH CORPORATION.
Figure B-2. Condition for Connecting Target System (When Using NP-30MC)
Emulation board
IE-789234-NS-EM1
Emulation probe
NP-30MC
13 mm
5 mm
15 mm
20 mm
37 mm
31 mm
Target system
Figure B-3. Distance Between In-Circuit Emulator and Conversion Connector (When Using QB-80-EP-01T)
In-circuit emulator
IE-78K0S-NS or IE-78K0S-NS-A
Target system
Emulation board
SIMPLE PROBE Board
234 mm
TGCN2
Figure B-4. Condition for Connecting Target System (When Using QB-80-EP-01T)
Emulation board
Emulation probe
QB-80-EP-01T
QB-30MC-EA-01T
Conversion connector
17 mm QB-30MC-YQ-01T
QB-30MC-NQ-01T
5 mm
20 mm 15 mm
21 mm 25 mm
Target system
[A]
A/D converter mode register (ADM) … 164
Analog input channel specification register (ADS) … 167
Asynchronous serial interface control register 6 (ASICL6) … 192
Asynchronous serial interface operation mode register 6 (ASIM6) … 186
Asynchronous serial interface reception error status register 6 (ASIS6) … 188
Asynchronous serial interface transmission status register 6 (ASIF6) … 189
[B]
Baud rate generator control register 6 (BRGC6) … 191
[C]
Capture/compare control register 00 (CRC00) … 92
Clock selection register 6 (CKSR6) … 190
[E]
External interrupt mode register 0 (INTM0) … 227
External interrupt mode register 1 (INTM1) … 228
[F]
Flash address pointer H (FLAPH) … 288
Flash address pointer L (FLAPL) … 288
Flash address pointer H compare register (FLAPHC) … 288
Flash address pointer L compare register (FLAPLC) … 288
Flash programming command register (FLCMD) … 287
Flash programming mode control register (FLPMC) … 283
Flash protect command register (PFCMD) … 285
[I]
Input switch control register (ISC) … 194
Interrupt mask flag register 0 (MK0) … 226
Interrupt mask flag register 1 (MK1) … 226
Interrupt request flag register 0 (IF0) … 225
Interrupt request flag register 1 (IF1) … 225
[L]
Low voltage detect register (LVIM) … 257
Low voltage detection level select register (LVIS) … 258
Low-speed Ring-OSC mode register (LSRCM) … 73
[M]
Multiplication data register A (MRA0) … 217
Multiplication data register B (MRB0) … 217
Multiplier control register 0 (MULC0) … 219
[O]
Oscillation stabilization time select register (OSTS) … 74, 236
[P]
Port mode control register 2 (PMC2) … 66, 168
Port mode register 0 (PM0) … 64
Port mode register 2 (PM2) … 64, 168
Port mode register 3 (PM3) … 64, 95
Port mode register 4 (PM4) … 64, 138, 194
Port mode register 12 (PM12) … 64
Port register 0 (P0) … 65
Port register 2 (P2) … 65
Port register 3 (P3) … 65
Port register 4 (P4) … 65
Port register 12 (P12) … 65
Port register 13 (P13) … 65
Preprocessor clock control register (PPCC) … 72
Prescaler mode register 00 (PRM00) … 94
Processor clock control register (PCC) … 72
Pull-up resistor option register 0 (PU0) … 67
Pull-up resistor option register 2 (PU2) … 67
Pull-up resistor option register 3 (PU3) … 67
Pull-up resistor option register 4 (PU4) … 67
Pull-up resistor option register 12 (PU12) … 67
[R]
Receive buffer register 6 (RXB6) … 185
Receive shift register 6 (RXS6) … 185
[T]
Transmit buffer register 6 (TXB6) … 185
Transmit shift register 6 (TXS6) … 185
[W]
Watchdog timer enable register (WDTE) … 152
Watchdog timer mode register (WDTM) … 151
[A]
ADCR: 10-bit A/D conversion result register … 167
ADCRH: 8-bit A/D conversion result register … 168
ADM: A/D converter mode register … 164
ADS: Analog input channel specification register … 167
ASICL6: Asynchronous serial interface control register 6 … 192
ASIF6: Asynchronous serial interface transmission status register 6 … 189
ASIM6: Asynchronous serial interface operation mode register 6 … 186
ASIS6: Asynchronous serial interface reception error status register 6 … 188
[B]
BRGC6: Baud rate generator control register 6 … 191
[C]
CKSR6: Clock selection register 6 … 190
CMP01: 8-bit timer H compare register 01 … 135
CMP11: 8-bit timer H compare register 11 … 135
CR000: 16-bit timer capture/compare register 000 … 87
CR010: 16-bit timer capture/compare register 010 … 89
CR80: 8-bit compare register 80 … 128
CRC00: Capture/compare control register 00 … 92
[F]
FLAPH: Flash address pointer H … 288
FLAPHC: Flash address pointer H compare register … 288
FLAPL: Flash address pointer L … 288
FLAPLC: Flash address pointer L compare register … 288
FLCMD: Flash programming command register … 287
FLPMC: Flash programming mode control register … 283
FLW: Flash write buffer register … 289
[I]
IF0: Interrupt request flag register 0 … 225
IF1: Interrupt request flag register 1 … 225
INTM0: External interrupt mode register 0 … 227
INTM1: External interrupt mode register 1 … 228
ISC: Input switch control register … 194
[L]
LSRCM: Low-speed Ring-OSC mode register … 73
LVIM: Low voltage detect register … 257
LVIS: Low voltage detection level select register … 258
[M]
MK0: Interrupt mask flag register 0 … 226
MK1: Interrupt mask flag register 1 … 226
MRA0: Multiplication data register A … 217
MRB0: Multiplication data register B … 217
MUL0H: 16-bit multiplication result storage register H … 37, 217
MUL0L: 16-bit multiplication result storage register L … 37, 217
MULC0: Multiplier control register 0 … 219
[O]
OSTS: Oscillation stabilization time select register … 74, 236
[P]
P0: Port register 0 … 65
P2: Port register 2 … 65
P3: Port register 3 … 65
P4: Port register 4 … 65
P12: Port register 12 … 65
P13: Port register 13 … 65
PCC: Processor clock control register … 72
PFCMD: Flash protect command register … 285
PFS: Flash status register … 286
PM0: Port mode register 0 … 64
PM2: Port mode register 2 … 64, 168
PM3: Port mode register 3 … 64, 95
PM4: Port mode register 4 … 64, 138, 194
PM12: Port mode register 12 … 64
PMC2: Port mode control register 2 … 66, 168
PPCC: Preprocessor clock control register … 72
PRM00: Prescaler mode register 00 … 94
PU0: Pull-up resistor option register 0 … 67
PU2: Pull-up resistor option register 2 … 67
PU3: Pull-up resistor option register 3 … 67
PU4: Pull-up resistor option register 4 … 67
PU12: Pull-up resistor option register 12 … 67
[R]
RESF: Reset control flag register … 251
RXB6: Receive buffer register 6 … 185
RXS6: Receive shift register 6 … 185
[T]
TM00: 16-bit timer counter 00 … 87
TM80: 8-bit timer counter 80 … 128
TMC00: 16-bit timer mode control register 00 … 90
TMC80: 8-bit timer mode control register 80 … 129
TMHMD1: 8-bit timer H mode register 1 … 136
TOC00: 16-bit timer output control register 00 … 93
[W]
WDTE: Watchdog timer enable register … 152
WDTM: Watchdog timer mode register … 151
(1/18)
Hard Classification
Function
Configu-
ration
Pin P121/X1 and The P121/X1 and P122/X2 pins are pulled down during reset. pp.
Chapter 2
Hard
space Address
SP: Stack pointer Since generation of reset signal makes the SP contents undefined, be sure to p.34
Soft
(2/18)
Soft Classification
Function Details of Cautions Page
Chapter
Chapter 5 Function
Main clock OSTS: Oscillation To set and then release the STOP mode, set the oscillation stabilization time p.74
stabilization time as follows.
select register Expected oscillation stabilization time of resonator ≤ Oscillation stabilization
time set by OSTS
The wait time after the STOP mode is released does not include the time from p.74
the release of the STOP mode to the start of clock oscillation (“a” in the figure
below), regardless of whether STOP mode was released by Reset signal
generation or interrupt generation.
The oscillation stabilization time that elapses on power application or after p.74
release of reset is selected by the option byte. For details, refer to CHAPTER
18 OPTION BYTE.
Hard
Crystal/ − When using the crystal/ceramic oscillator, wire as follows in the area enclosed p.75
ceramic by the broken lines in Figure 5-6 to avoid an adverse effect from wiring
oscillator capacitance.
• Keep the wiring length as short as possible.
• Do not cross the wiring with the other signal lines. Do not route the wiring
near a signal line through which a high fluctuating current flows.
• Always make the ground point of the oscillator capacitor the same potential
as VSS. Do not ground the capacitor to a ground pattern through which a
high current flows.
• Do not fetch signals from the oscillator.
Chapter 6
Hard
16-bit TM00: 16-bit Even if TM00 is read, the value is not captured by CR010. p.87
timer/event timer counter 00 During TM00 is read, the count clock is stopped. p.87
counter 00
Soft
CR000: 16-bit Set CR000 to other than 0000H in the clear & start mode entered on match p.88
timer capture/ between TM00 and CR000. This means a 1-pulse count operation cannot be
compare register performed when this register is used as an external event counter. However,
000 in the free-running mode and in the clear & start mode using the valid edge of
TI000 pin, if CR000 is set to 0000H, an interrupt request (INTTM000) is
generated when CR000 changes from 0000H to 0001H following overflow
(FFFFH).
If the new value of CR000 is less than the value of 16-bit timer counter 0 p.88
(TM00), TM00 continues counting, overflows, and then starts counting from 0
again. If the new value of CR000 is less than the old value, therefore, the
timer must be reset to be restarted after the value of CR000 is changed.
The value of CR000 after 16-bit timer/event counter 00 has stopped is not p.88
guaranteed.
Hard
The capture operation may not be performed for CR000 set in compare mode p.88
even if a capture trigger is input.
When P31 is used as the input pin for the valid edge of TI010, it cannot be p.88
used as a timer output (TO00). Moreover, when P31 is used as TO00, it
cannot be used as the input pin for the valid edge of TI010.
(3/18)
Hard Classification Function Details of Cautions Page
Chapter
Function
Chapter 6
16-bit CR000: 16-bit If the register read period and the input of the capture trigger conflict when p.88
timer/event timer capture/ CR000 is used as a capture register, the capture trigger input takes
counter 00 compare register precedence and the read data is undefined. Also, if the count stop of the timer
000 and the input of the capture trigger conflict, the capture trigger is undefined.
Soft
Changing the CR000 setting may cause a malfunction. To change the setting, p.88
refer to 6.5 Cautions Related to 16-Bit Timer/Event Counter 00 (17) Changing
compare register during timer operation.
CR010: 16-bit In the free-running mode and in the clear & start mode using the valid edge of p.89
timer capture/ the TI000 pin, if CR010 is set to 0000H, an interrupt request (INTTM010) is
compare register generated when CR010 changes from 0000H to 0001H following overflow
010 (FFFFH).
If the new value of CR010 is less than the value of 16-bit timer counter 0 p.89
(TM00), TM00 continues counting, overflows, and then starts counting from 0
again. If the new value of CR010 is less than the old value, therefore, the
timer must be reset to be restarted after the value of CR010 is changed.
The value of CR010 after 16-bit timer/event counter 00 has stopped is not p.89
guaranteed.
Hard
The capture operation may not be performed for CR010 set in compare mode p.89
even if a capture trigger is input.
If the register read period and the input of the capture trigger conflict when p.89
CR010 is used as a capture register, the capture trigger input takes
precedence and the read data is undefined. Also, if the timer count stop and
the input of the capture trigger conflict, the capture data is undefined.
Soft
Changing the CR010 setting during TM00 operation may cause a malfunction. p.89
To change the setting, refer to 6.5 Cautions Related to 16-Bit Timer/Event
Counter 00 (17) Changing compare register during timer operation.
TMC00: 16-Bit 16-bit timer counter 00 (TM00) starts operation at the moment TMC002 and p.90
Timer Mode TMC003 (operation stop mode) are set to a value other than 0, 0, respectively.
Control Register Set TMC002 and TMC003 to 0, 0 to stop the operation.
00 The timer operation must be stopped before writing to bits other than the p.91
OVF00 flag.
Hard
Regardless of the CPU’s operation mode, when the timer stops, the signals p.91
input to pins TI000/TI010 are not acknowledged.
Soft
Except when TI000 pin valid edge is selected as the count clock, stop the p.91
timer operation before setting STOP mode or system clock stop mode;
otherwise the timer may malfunction when the system clock starts.
Set the valid edge of the TI000 pin with bits 4 and 5 of prescaler mode register p.91
00 (PRM00) after stopping the timer operation.
If the clear & start mode entered on a match between TM00 and CR000, clear p.91
& start mode at the valid edge of the TI000 pin, or free-running mode is
selected, when the set value of CR000 is FFFFH and the TM00 value changes
from FFFFH to 0000H, the OVF00 flag is set to 1.
(4/18)
Function Details of Cautions Page
Classification
Chapter Function
Even if the OVF00 flag is cleared before the next count clock is counted p.91
Chapter 6
Soft
pulse longer than two cycles of the count clock selected by prescaler mode
register 00 (PRM00) (refer to Figure 6-17).
TOC00: 16-bit Timer operation must be stopped before setting other than OSPT00. p.93
Soft
timer output
If LVS00 and LVR00 are read, 0 is read. p.93
control register
00 OSPT00 is automatically cleared after data is set, so 0 is read. p.93
Do not set OSPT00 to 1 other than in one-shot pulse output mode. p.93
A write interval of two cycles or more of the count clock selected by prescaler p.93
Hard
with the 8-bit memory manipulation instruction. When the TOE00 is 1, the
LVS00 and LVR00 can be set with the 1-bit memory manipulation instruction.
PRM00: Always set data to PRM00 after stopping the timer operation. p.95
Prescaler mode
register 00 If the valid edge of the TI000 pin is to be set as the count clock, do not set the p.95
clear/start mode and the capture trigger at the valid edge of the TI000 pin.
In the following cases, note with caution that the valid edge of the TI0n0 pin is p.95
Hard
detected.
<1> Immediately after a system reset, if a high level is input to the TI0n0 pin,
the operation of the 16-bit timer counter 00 (TM00) is enabled
→ If the rising edge or both rising and falling edges are specified as the valid
edge of the TI0n0 pin, a rising edge is detected immediately after the TM00
operation is enabled.
<2> If the TM00 operation is stopped while the TI0n0 pin is high level, TM00
operation is then enabled after a low level is input to the TI0n0 pin
→ If the falling edge or both rising and falling edges are specified as the valid
edge of the TI0n0 pin, a falling edge is detected immediately after the TM00
operation is enabled.
<3> If the TM00 operation is stopped while the TI0n0 pin is low level, TM00
operation is then enabled after a high level is input to the TI0n0 pin
→ If the rising edge or both rising and falling edges are specified as the valid
edge of the TI0n0 pin, a rising edge is detected immediately after the TM00
operation is enabled.
(5/18)
Classification Function Details of Cautions Page
Chapter
Function
16-bit PRM00: The sampling clock used to eliminate noise differs when a TI000 valid edge is p.95
Chapter 6
Hard
timer/event Prescaler mode used as the count clock and when it is used as a capture trigger. In the former
counter 00 register 00 case, the count clock is fXP, and in the latter case the count clock is selected
by prescaler mode register 00 (PRM00). The capture operation is not
performed until the valid edge is sampled and the valid level is detected twice,
thus eliminating noise with a short pulse width.
When using P31 as the input pin (TI010) of the valid edge, it cannot be used p.95
as a timer output (TO00). When using P31 as the timer output pin (TO00), it
cannot be used as the input pin (TI010) of the valid edge.
Interval timer Changing the CR000 setting during TM00 operation may cause a malfunction. p.96
Soft
software trigger, do not change the level of the TI000 pin or its alternate-
function port pin.
Because the external trigger is valid even in this case, the timer is cleared and
started even at the level of the TI000 pin or its alternate-function port pin,
resulting in the output of a pulse at an undesired timing.
Do not set 0000H to the CR000 and CR010 registers. p.116
Soft
16-bit timer counter 00 starts operating as soon as a value other than 00 p.117
(operation stop mode) is set to the TMC003 and TMC002 bits.
(6/18)
Function Details of Cautions Page
Classification
Chapter Function
16-bit One-shot pulse Do not input the external trigger again while the one-shot pulse is being p.117
Chapter 6
Hard
timer/event output with output. To output the one-shot pulse again, wait until the current one-shot
counter 00 external trigger pulse output is completed.
Do not set the CR000 and CR010 registers to 0000H. p.118
Soft
16-bit timer counter 00 starts operating as soon as a value other than 00 p.119
(operation stop mode) is set to the TMC002 and TMC003 bits.
Timer start errors An error of up to one clock may occur in the time required for a match signal to p.120
Hard
be generated after timer start. This is because 16-bit timer counter 00 (TM00)
is started asynchronously to the count clock.
One-shot pulse One-shot pulse output normally operates only in the free-running mode or in p.121
Soft
output the clear & start mode at the valid edge of the TI000 pin. Because an overflow
does not occur in the clear & start mode on a match between TM00 and
CR000, one-shot pulse output is not possible.
Capture If both the rising and falling edges are selected as the valid edges of the TI000 p.123
operation pin, capture is not performed.
When the CRC001 bit value is 1, the TM00 count value is not captured in the p.123
CR000 register when a valid edge of the TI010 pin is detected, but the input
from the TI010 pin can be used as an external interrupt source because
INTTM000 is generated at that timing.
Changing With the 16-bit timer capture/compare register 0n0 (CR0n0) used as a p.124
compare register compare register, when changing CR0n0 around the timing of a match
during timer between 16-bit timer counter 00 (TM00) and 16-bit timer capture/compare
operation register 0n0 (CR0n0) during timer counting, the change timing may conflict
with the timing of the match, so the operation is not guaranteed in such cases.
To change CR0n0 during timer counting, follow the procedure below using an
INTTM000 interrupt.
If CR010 is changed during timer counting without performing processing <1> p.124
above, the value in CR010 may be rewritten twice or more, causing an
inversion of the output level of the TO00 pin at each rewrite.
8-bit timer CR80: 8-bit When changing the value of CR80, be sure to stop the timer operation. If the p.128
Chapter 7
Soft
80 compare register value of CR80 is changed with the timer operation enabled, a match interrupt
80 request signal may be generated immediately.
TMC80: 8-bit Be sure to set TMC80 after stopping the timer operation. p.129
timer mode
control register Be sure to clear bits 0 and 6 to 0. p.129
80
Interval timer When changing the value of CR80, be sure to stop the timer operation. If the p.130
value of CR80 is changed with the timer operation enabled, a match interrupt
request signal may be generated immediately.
If the count clock of TMC80 is set and the operation of TM80 is enabled at the p.130
same time by using an 8-bit memory manipulation instruction, the error of one
cycle after the timer is started may be 1 clock or more. Therefore, be sure to
follow the above sequence when using TM80 as an interval timer.
(7/18)
Classification Function Details of Cautions Page
Chapter
Function
8-bit timer Error when timer The time from starting the timer to generation of the match signal includes an p.132
Chapter 7
Hard
80 starts error of up to 1.5 clocks. This is because, if the timer is started while the count
clock is high, the rising edge may be immediately detected and the counter
may be incremented (refer to Figure 7-6).
CR80: 8-bit 8-bit compare register 80 (CR80) can be set to 00H. p.132
Soft
compare register
80
STOP mode Before executing the STOP instruction, be sure to stop the timer operation p.132
(TCE80 = 0).
8-bit timer CMP01: 8-bit CMP01 cannot be rewritten during timer count operation. p.135
Chapter 8
Soft
H1 timer H compare
register 01
CMP11: 8-bit In the PWM output mode, be sure to set CMP11 when starting the timer count p.135
timer H compare operation (TMHE1 = 1) after the timer count operation was stopped (TMHE1 =
register 11 0) (be sure to set again even if setting the same value to CMP11).
TMHMD1: 8-bit When TMHE1 = 1, setting the other bits of the TMHMD1 register is prohibited. p.137
timer H mode In the PWM output mode, be sure to set 8-bit timer H compare register 11 p.137
register 1 (CMP11) when starting the timer count operation (TMHE1 = 1) after the timer
count operation was stopped (TMHE1 = 0) (be sure to set again even if setting
the same value to the CMP11 register).
PWM output In PWM output mode, three operation clocks (signal selected using the CKS12 p.143
Hard
to CKS10 bits of the TMHMD1 register) are required to transfer the CMP11
register value after rewriting the register.
Be sure to set the CMP11 register when starting the timer count operation p.143
Soft
(TMHE1 = 1) after the timer count operation was stopped (TMHE1 = 0) (be
sure to set again even if setting the same value to the CMP11 register).
Make sure that the CMP11 register setting value (M) and CMP01 register p.144
setting value (N) are within the following range.
00H ≤ CMP11 (M) < CMP01 (N) ≤ FFH
Watchdog WDTM : Set bits 7, 6, and 5 to 0, 1, and 1, respectively (when “low-speed Ring-OSC p.152
Chapter 9
Soft
timer Watchdog timer cannot be stopped” is selected by the option byte, other values are ignored).
mode register After reset is released, WDTM can be written only once by an 8-bit memory p.152
manipulation instruction. If writing is attempted a second time, an internal
reset signal is generated.
WDTM cannot be set by a 1-bit memory manipulation instruction. p.152
When using the flash memory self programming by self writing, set the p.152
overflow time for the watchdog timer so that enough everflow time is secured
(Example 1-byte writing: 200 µs MIN., 1-block deletion: 10 ms MIN.).
If a value other than ACH is written to WDTE, an internal reset signal is p.152
generated.
If a 1-bit memory manipulation instruction is executed for WDTE, an internal p.152
reset signal is generated.
(8/18)
Function Details of Cautions Page
Classification
Chapter Function
Watchdog When “low-speed In this mode, operation of the watchdog timer cannot be stopped even during p.153
Chapter 9
Hard
timer Ring-OSC cannot STOP instruction execution. For 8-bit timer H1 (TMH1), a division of the low-
be stopped” is speed Ring-OSC clock can be selected as the count source, so clear the
selected by watchdog timer using the interrupt request of TMH1 before the watchdog timer
option byte overflows after STOP instruction execution. If this processing is not
performed, an internal reset signal is generated when the watchdog timer
overflows after STOP instruction execution.
When “low-speed In this mode, watchdog timer operation is stopped during HALT/STOP p.155
Ring-OSC can be instruction execution. After HALT/STOP mode is released, counting is started
stopped by again using the operation clock of the watchdog timer set before HALT/STOP
software” is instruction execution by WDTM. At this time, the counter is not cleared to 0
selected by but holds its value.
option byte
A/D Sampling time The above sampling time and conversion time do not include the clock p.161
Chapter 10
Soft
Converter and conversion frequency error. Select the conversion time taking the clock frequency error
time into consideration.
ADM : A/D The above sampling time and conversion time do not include the clock p.166
converter mode frequency error. Select the conversion time taking the clock frequency error
register into consideration.
If a bit other than ADCS of ADM is manipulated while A/D conversion is p.166
stopped (ADCS = 0) and then A/D conversion is started, execute two NOP
instructions or an instruction equivalent to two machine cycles, and set ADCS
to 1.
A/D conversion must be stopped (ADCS = 0) before rewriting bits FR0 to FR2. p.166
Be sure to clear bits 6, 2, and 1 to 0. p.166
ADS: Analog Be sure to clear bits 2 to 7 of ADS to 0. p.167
input channel
specification
register
ADCR: 10-bit A/D When writing to the A/D converter mode register (ADM) and analog input p.167
conversion result channel specification register (ADS), the contents of ADCR may become
register undefined. Read the conversion result following conversion completion before
writing to ADM and ADS. Using timing other than the above may cause an
incorrect conversion result to be read.
PMC2: Port When PMC20 to PMC23 are set to 1, the P20/ANI0 to P23/ANI3 pins cannot p.168
mode control be used as port pins.
register 2
A/D converter Make sure the period of <1> to <4> is 1 µs or more. p.173
operations It is no problem if the order of <1> and <2> is reversed. p.173
<1> can be omitted. However, ignore the data resulting from the first p.173
conversion after <4> in this case.
The period from <5> to <8> differs from the conversion time set using bits 5 to p.173
3 (FR2 to FR0) of ADM. The period from <7> to <8> is the conversion time set
using FR2 to FR0.
(9/20)
Classification Function Details of Cautions Page
Chapter
Function
A/D Operating current The A/D converter stops operating in the STOP mode. At this time, the p.176
Chapter 10
Hard
Converter in STOP mode operating current can be reduced by clearing bit 7 (ADCS) and bit 0 (ADCE) of
the A/D converter mode register (ADM) to 0.
Input range of Observe the rated range of the ANI0 to ANI3 input voltage. If a voltage of p.176
ANI0 to ANI3 AVREF or higher and AVSS or lower (even in the range of absolute maximum
ratings) is input to an analog input channel, the converted value of that
channel becomes undefined. In addition, the converted values of the other
channels may also be affected.
Conflicting ADCR, ADCRH read has priority. After the read operation, the new p.176
Soft
(10/18)
Function Details of Cautions Page
Classification
Chapter Function
A/D ADIF: Interrupt The interrupt request flag (ADIF) is not cleared even if the analog input p.177
Chapter 10
Soft
interface the reception side. To use this function, the reception side must be ready for
UART6 reception of inverted data.
If clock supply to serial interface UART6 is not stopped (e.g., in the HALT p.179
Soft
(11/18)
Classification Function Details of Function Cautions Page
Chapter
Chapter 11
Soft
Serial ASIM6: Asynchro- At startup, set POWER6 to 1 and then set TXE6 to 1. To stop the operation, p.187
interface nous serial clear TXE6 to 0, and then clear POWER6 to 0.
UART6 interface operation At startup, set POWER6 to 1 and then set RXE6 to 1. To stop the operation, p.187
mode register 6 clear RXE6 to 0, and then clear POWER6 to 0.
Set POWER6 to 1 and then set RXE6 to 1 while a high level is input to the p.187
RxD6 pin. If POWER6 is set to 1 and RXE6 is set to 1 while a low level is
input, reception is started.
Clear the TXE6 and RXE6 bits to 0 before rewriting the PS61, PS60, and CL6 p.187
bits.
Fix the PS61 and PS60 bits to 0 when mounting the device on LIN. p.187
Make sure that TXE6 = 0 when rewriting the SL6 bit. Reception is always p.187
performed with “the number of stop bits = 1”, and therefore, is not affected by
the set value of the SL6 bit.
Make sure that RXE6 = 0 when rewriting the ISRM6 bit. p.187
ASIS6: The operation of the PE6 bit differs depending on the set values of the PS61 p.188
Asynchronous and PS60 bits of asynchronous serial interface operation mode register 6
serial interface (ASIM6).
reception error The first bit of the receive data is checked as the stop bit, regardless of the p.188
status register 6 number of stop bits.
If an overrun error occurs, the next receive data is not written to receive buffer p.188
register 6 (RXB6) but discarded.
ASIF6: To transmit data continuously, write the first transmit data (first byte) to the p.189
Asynchronous TXB6 register. Be sure to check that the TXBF6 flag is “0”. If so, write the
serial interface next transmit data (second byte) to the TXB6 register. If data is written to the
transmission status TXB6 register while the TXBF6 flag is “1”, the transmit data cannot be
register 6 guaranteed.
To initialize the transmission unit upon completion of continuous transmission, p.189
be sure to check that the TXSF6 flag is “0” after generation of the transmission
completion interrupt, and then execute initialization. If initialization is executed
while the TXSF6 flag is “1”, the transmit data cannot be guaranteed.
CKSR6: Clock Make sure POWER6 = 0 when rewriting TPS63 to TPS60. p.190
selection register 6
BRGC6: Baud rate Make sure that bit 6 (TXE6) and bit 5 (RXE6) of the ASIM6 register = 0 when p.191
generator control rewriting the MDL67 to MDL60 bits.
register 6
Hard
The baud rate is the output clock of the 8-bit counter divided by 2. p.191
Soft
ASICL6: ASICL6 can be refreshed (the same value is written) by software during a p.192
Asynchronous communication operation (when bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 =
serial interface 1 or bit 7 (POWER6) and bit 5 (RXE6) of ASIM6 = 1). However, if the SBRT6
control register 6 = 1 and SBTT = 1 are set in the refresh operation during the SBF reception
(SBRF6 = 1) or SBF transmission (between the SBTT6 setting (1) and the
INTST6 occurrence), it triggers the SBF reception and SBF transmission
again, so do not set.
In the case of an SBF reception error, return the mode to the SBF reception p.193
mode again and hold (1) the status of the SBRF6 flag.
(12/18)
Function Details of Cautions Page
Classification
Chapter
Chapter 11 Function
Soft
Serial ASICL6: Before setting the SBRT6 bit to 1, make sure that bit 7 (POWER6) and bit 5 p.193
interface Asynchronous (RXE6) of ASIM6 = 1. Moreover, after setting the SBRT6 bit to 1, do not clear
UART6 serial interface the SBRT6 bit to 0 before the SBF reception ends (an interrupt request signal
control register 6 is generated).
The read value of the SBRT6 bit is always 0. SBRT6 is automatically cleared p.193
to 0 after SBF reception has been correctly completed.
Before setting the SBTT6 bit to 1, make sure that bit 7 (POWER6) and bit 6 p.193
(TXE6) of ASIM6 = 1. Moreover, after setting the SBTT6 bit to 1, do not clear
the SBTT6 bit to 0 before the SBF transmission ends (an interrupt request
signal is generated).
The read value of the SBTT6 bit is always 0. SBTT6 is automatically cleared p.193
to 0 at the end of SBF transmission.
Before rewriting the DIR6 and TXDLV6 bits, clear the TXE6 and RXE6 bits to p.193
0.
Bits 7, 6, and 5 Clear POWER6 to 0 after clearing TXE6 and RXE6 to 0 to set the operation p.195
(POWER6, stop mode.
TXE6, and To start the operation, set POWER6 to 1, and then set TXE6 and RXE6 to 1.
RXE6) of ASIM6
UART mode Take relationship with the other party of communication into consideration p.196
when setting the port mode register and port register.
Parity types and Fix the PS61 and PS60 bits to 0 when the device is incorporated in LIN. p.200
operation
Continuous The TXBF6 and TXSF6 flags of the ASIF6 register change from “10” to “11”, p.202
transmission and to “01” during continuous transmission. To check the status, therefore, do
not use a combination of the TXBF6 and TXSF6 flags for judgment. Judge
whether continuous transmission is possible or not by reading only the TXBF
flag.
When the device is incorporated in a LIN, the continuous transmission function p.202
cannot be used. Make sure that asynchronous serial interface transmission
status register 6 (ASIF6) is 00H before writing transmit data to transmit buffer
register 6 (TXB6).
TXBF6 during To transmit data continuously, write the first transmit data (first byte) to the p.202
Continuous TXB6 register. Be sure to check that the TXBF6 flag is “0”. If so, write the
Transmission: Bit next transmit data (second byte) to the TXB6 register. If data is written to the
1 of ASIF6 TXB6 register while the TXBF6 flag is “1”, the transmit data cannot be
guaranteed.
TXSF6 during To initialize the transmission unit upon completion of continuous transmission, p.202
Continuous be sure to check that the TXSF6 flag is “0” after generation of the transmission
Transmission: Bit completion interrupt, and then execute initialization. If initialization is executed
0 of ASIF6 while the TXSF6 flag is “1”, the transmit data cannot be guaranteed.
During continuous transmission, an overrun error may occur, which means p.202
that the next transmission was completed before execution of INTST6 interrupt
servicing after transmission of one data frame. An overrun error can be
detected by developing a program that can count the number of transmit data
and by referencing the TXSF6 flag.
F r e e D a t a s h e e t
APPENDIX D LIST OF CAUTIONS
(13/18)
Classification Function Details of Cautions Page
Chapter
Function
Serial Normal reception Be sure to read receive buffer register 6 (RXB6) even if a reception error p.206
Chapter 11
Soft
interface occurs. Otherwise, an overrun error will occur when the next data is received,
UART6 and the reception error status will persist.
Reception is always performed with the “number of stop bits = 1”. The second p.206
stop bit is ignored.
Be sure to read asynchronous serial interface reception error status register 6 p.206
(ASIS6) before reading RXB6.
Generation of Keep the baud rate error during transmission to within the permissible error p.212
serial clock range at the reception destination.
Make sure that the baud rate error during reception satisfies the range shown p.212
in (4) Permissible baud rate range during reception.
Permissible baud Make sure that the baud rate error during reception is within the permissible p.214
rate range during error range, by using the calculation expression shown below.
reception
Multiplier MUL0: 16-bit Although this register is manipulated with a 16-bit memory manipulation p.217
Chapter 12
Soft
function address
IF0, IF1: Interrupt Because P30, P31, P41, and P43 have an alternate function as external pp.
Soft
request flag interrupt inputs, when the output level is changed by specifying the output 225,
registers 0, 1 mode of the port function, an interrupt request flag is set. Therefore, the 226
MK0, MK1: interrupt mask flag should be set to 1 before using the output mode.
Interrupt mask
flag registers 0, 1
INTM0: External Be sure to clear bits 0 and 1 to 0. p.227
interrupt mode Before setting the INTM0 register, be sure to set the corresponding interrupt p.227
register 0 mask flag (××MK× = 1) to disable interrupts. After setting the INTM0 register,
clear the interrupt request flag (××IF× = 0), then clear the interrupt mask flag
(××MK× = 0), which will enable interrupts.
INTM1: External Be sure to clear bits 2 to 7 to 0. p.228
interrupt mode Before setting INTM1, set PMK3 to 1 to disable interrupts. p.228
register 1 To enable interrupts, clear PIF3 to 0, then clear PMK3 to 0.
Interrupt request Interrupt requests will be held pending while the interrupt request flag registers p.231
pending 0, 1 (IF0, IF1) or interrupt mask flag registers 0, 1 (MK0, MK1) are being
accessed.
F r e e D a t a s h e e t
APPENDIX D LIST OF CAUTIONS
(14/18)
Function Details of Cautions Page
Classification
Chapter Function
Standby − The LSRSTOP setting is valid only when “Can be stopped by software” is set p.234
Chapter 14
Soft
Oscillation as follows.
stabilization time Expected oscillation stabilization time of resonator ≤ Oscillation stabilization
select register time set by OSTS
The wait time after the STOP mode is released does not include the time from p.236
Hard
the release of the STOP mode to the start of clock oscillation (“a” in the figure
below), regardless of whether STOP mode was released by reset signal
generation or interrupt generation.
The oscillation stabilization time that elapses on power application or after p.236
Soft
release of reset is selected by the option byte. For details, refer to CHAPTER
18 OPTION BYTE.
Settings and Because an interrupt request signal is used to clear the standby mode, if there p.237
operating is an interrupt source with the interrupt request flag set and the interrupt mask
statuses in HALT flag reset, the standby mode is immediately cleared if set.
mode
Settings and Because an interrupt request signal is used to clear the standby mode, if there p.240
operating is an interrupt source with the interrupt request flag set and the interrupt mask
statuses in STOP flag reset, the standby mode is immediately cleared if set. Thus, in the STOP
mode mode, the normal operation mode is restored after the STOP instruction is
executed and then the operation is stopped for 34 µs (TYP.) (after an
additional wait time for stabilizing the oscillation set by the oscillation
stabilization time select register (OSTS) has elapsed when crystal/ceramic
oscillation is used).
Reset − For an external reset, input a low level for 2 µs or more to the RESET pin. p.244
Chapter 15
Hard
function During reset signal generation, the system clock and low-speed Ring-OSC p.244
clock stop oscillating.
When the RESET pin is used as an input-only port pin (P34), the 78K0S/KB1+ p.244
is reset if a low level is input to the RESET pin after reset is released by the
POC circuit and before the option byte is referenced again. The reset status is
retained until a high level is input to the RESET pin.
The LVI circuit is not reset by the internal reset signal of the LVI circuit. p.245
Timing of reset by The watchdog timer is also reset in the case of an internal reset of the p.247
overflow of watchdog timer.
watchdog timer
F r e e D a t a s h e e t
APPENDIX D LIST OF CAUTIONS
(15/18)
Classification Function Details of Cautions Page
Chapter
Function
Reset RESF: Reset Do not read data by a 1-bit memory manipulation instruction. p.251
Chapter 15
Soft
Power-on- Functions of If an internal reset signal is generated in the POC circuit, the reset control flag p.252
Chapter 16
Soft
power-on-clear the vicinity of the POC detection voltage (VPOC), the system may be
circuit repeatedly reset and released from the reset status. In this case, the time
from release of reset to the start of the operation of the microcontroller can be
arbitrarily set by taking the following action.
Low- LVIM: Low- To stop LVI, follow either of the procedures below. p.257
Chapter 17
Soft
voltage voltage detect • When using 8-bit manipulation instruction: Write 00H to LVIM.
detector register • When using 1-bit memory manipulation instruction: Clear LVION to 0.
Be sure to set bits 2 to 6 to 0. p.257
LVIS: Low- Bits 4 to 7 must be set to 0. p.258
voltage detection
level select
register
When used as <1> must always be executed. When LVIMK = 0, an interrupt may occur p.259
reset immediately after the processing in <3>.
If supply voltage (VDD) ≥ detection voltage (VLVI) when LVIM is set to 1, an p.259
internal reset signal is not generated.
Cautions for low- In a system where the supply voltage (VDD) fluctuates for a certain period in p.262
voltage detector the vicinity of the LVI detection voltage (VLVI), the operation is as follows
depending on how the low-voltage detector is used.
<1> When used as reset
The system may be repeatedly reset and released from the reset status.
In this case, the time from release of reset to the start of the operation of the
microcontroller can be arbitrarily set by taking action (1) below.
<2> When used as interrupt
Interrupt requests may be frequently generated. Take action (2) below.
Option Low-speed Ring- If it is selected that low-speed Ring-OSC clock oscillation cannot be stopped, p.266
Chapter 18
Hard
byte OSC clock the count clock to the watchdog timer (WDT) is fixed to low-speed Ring-OSC.
oscillation If it is selected that low-speed Ring-OSC can be stopped by software, supply p.266
of the count clock to WDT is stopped in the HALT/STOP mode, regardless of
the setting of bit 0 (LSRSTOP) of the low-speed Ring-OSC mode register
(LSRCM). Similarly, clock supply is also stopped when a clock other than the
low-speed Ring-OSC is selected as a count clock to WDT. If low-speed Ring-
OSC is selected as the count clock to 8-bit timer H1, however, the count clock
is supplied in the HALT/STOP mode while low-speed Ring-OSC operates
(LSRSTOP = 0).
F r e e D a t a s h e e t
APPENDIX D LIST OF CAUTIONS
(16/18)
Function Details of Cautions Page
Classification
Chapter
Chapter 18 Function
Hard
Option Selection of Because the X1 and X2 pins are also used as the P121 and P122 pins, the p.266
byte system clock conditions under which the X1 and X2 pins can be used differ depending on
source the selected system clock source.
(1) High-speed Ring-OSC clock
P121 and P122 can be used as I/O port pins.
(2) Crystal/ceramic oscillation clock
The X1 and X2 pins cannot be used as I/O port pins because they are used
as clock input pins.
(3) External clock input
Because the X1 pin is used as an external clock input pin, P121 cannot be
used as an I/O port pin.
Control of RESET If a low level is input to the RESET pin after reset is released by the power-on p.266
pin clear function and before the option byte is referenced again, the 78K0S/KB1+
is reset, and the status is held until a high level is input to the RESET pin.
Oscillation The setting of this option is valid only when the crystal/ceramic oscillation clock p.267
stabilization time is selected as the system clock source. No wait time elapses if the high-speed
on power Ring-OSC or external clock input is selected as the system clock source.
application or
after reset release
Chapter 19
Soft
Flash PG-FP4 GUI The above is a recommendation value. A value may change according to the p.275
memory Software setting environment to be used.
value example Set up after surely performing sufficient evaluation.
Security settings The security setting is valid when the programming mode is set next time. p.279
Therefore, when the security setting command is executed, exit from the
programming mode, then set the programming mode again.
After the security setting of the batch erase is set, erasure cannot be p.279
performed for the device. In addition, even if a write command is executed,
data different from that which has already been written to the flash memory
cannot be written because the erase command is disabled.
Self programming Self programming processing must be included in the program before p.280
function performing self writing.
If an interrupt occurs during self programming, the interrupt request flag is set p.283
(1), and interrupt servicing is performed after the self programming mode is
released. To avoid this operation, disable interrupt servicing (by setting MK0
and MK1 to FFH, and executing the DI instruction) during self programming or
before a mode is shifted from the normal mode to the self programming mode
with a specific sequence.
No instructions can be executed while a self programming command is being p.283
executed. Therefore, clear and restart the watchdog timer counter in advance
so that the watchdog timer does not overflow during self programming. Refer
to Table 19-11 for the time taken for the execution of self programming.
RAM is not used while a self programming command is being executed. p.283
If the supply voltage drops or the reset signal is input while the flash memory is p.283
being written or erased, writing/erasing is not guaranteed.
The value of the blank data set during block erasure is FFH. p.283
F r e e D a t a s h e e t
APPENDIX D LIST OF CAUTIONS
(17/18)
Classification Function Details of Cautions Page
Chapter
Function
Chapter 19
Soft
Flash Self programming When the oscillator or the external clock is selected as the main clock, a wait p.283
memory function time of 16 µs is required starting from the setting of the self programming
mode to the execution of the HALT instruction.
The state of the pins in self programming mode is the same as that in HALT p.283
mode.
Since the security function set via on-board/off-board programming is disabled p.283
in self programming mode, the self programming command can be executed
regardless of the security function setting. To disable write or erase
processing during self programming, set the protect byte.
Be sure to clear bits 4 to 7 of flash address pointer H (FLAPH) and flash p.283
address pointer H compare register (FLAPHC) to 0 before executing the self
programming command. If the value of these bits is 1 when executing the self
programming command.
Format of flash Note the following when setting the self programming mode. p.284
programming • If an interrupt occurs during self programming, the interrupt request flag is
mode control set (1), and interrupt servicing is performed after the self programming mode
register (FLPMC) is released. To avoid this operation, disable interrupt servicing (by setting
MK0 and MK1 to FFH, and executing the DI instruction) during self
programming or before a mode is shifted from the normal mode to the self
programming mode with a specific sequence.
• No instructions can be executed while a self programming command is being
executed. Therefore, clear and restart the watchdog timer counter in
advance so that the watchdog timer does not overflow during self
programming. Refer to Table 19-11 for the time taken for the execution of
self programming.
• If the supply voltage drops or the reset signal is input while the flash memory
is being written or erased, writing/erasing is not guaranteed.
When the oscillator or the external clock is selected as the main clock, a wait p.284
time of 16 µs is required from setting FLSPM to 1 to execution of the HALT
instruction.
PFCMD: Flash Disable interrupt servicing (by setting MK0 and MK1 to FFH and executing the p.285
protect command DI instruction) while the specific sequence is under execution.
register
FLAPH and Be sure to clear bits 4 to 7 of FLAPH and FLAPHC to 0 before executing the p.288
FLAPL: Flash self programming command. If the value of these bits is 1 when executing the
address pointers self programming command.
H and L
FLAPHC and Be sure to clear bits 4 to 7 of FLAPH and FLAPHC to 0 before executing the p.288
FLAPLC: Flash self programming command. If the value of these bits is 1 when executing the
address pointer H self programming command.
compare register Set the number of the block subject to a block erase, write, verify, or blank p.288
and flash address check (same value as FLAPH) to FLAPHC.
pointer L
Clear FLAPLC to 00H when a block erase is performed, and FFH when a p.288
compare register
blank check is performed.
F r e e D a t a s h e e t
APPENDIX D LIST OF CAUTIONS
(18/18)
Function Details of Cautions Page
Classification
Chapter Function
Flash Shifting to self Be sure to perform the series of operations described above using the user pp.
Chapter 19
Soft
memory programming program at an address where data is not erased nor written. 291,
mode 292,
Shifting to normal 294,
mode 295
Byte write If a write results in failure, erase the block once and write to it again. p.303
operation
Electrical Absolute Product quality may suffer if the absolute maximum rating is exceeded even p.337
Chapter 21
Hard
specifica- maximum ratings momentarily for any parameter. That is, the absolute maximum ratings are
tions rated values at which the product is on the verge of suffering physical damage,
and therefore the product must be used under conditions that ensure that the
absolute maximum ratings are not exceeded.
X1 Oscillator When using the X1 oscillator, wire as follows in the area enclosed by the p.338
broken lines in the above figures to avoid an adverse effect from wiring
capacitance.
• Keep the wiring length as short as possible.
• Do not cross the wiring with the other signal lines.
• Do not route the wiring near a signal line through which a high fluctuating
current flows.
• Always make the ground point of the oscillator capacitor the same potential
as VSS.
• Do not ground the capacitor to a ground pattern through which a high current
flows.
• Do not fetch signals from the oscillator.