hm90860-cm44-10130-2e.pdf

FUJITSU SEMICONDUCTOR
CONTROLLER MANUAL
CM44-10130-2E
F2MC-16LX
16-BIT MICROCONTROLLER
MB90860A Series
HARDWARE MANUAL
F2MC-16LX
16-BIT MICROCONTROLLER
MB90860A Series
HARDWARE MANUAL
Be sure to refer to the “Check Sheet” for the latest cautions on development.
“Check Sheet” is seen at the following support page
URL : http://www.fujitsu.com/global/services/microelectronics/product/micom/support/index.html
“Check Sheet” lists the minimal requirement items to be checked to prevent problems beforehand in system development.
FUJITSU LIMITED
PREFACE
■ Objectives and intended reader
The MB90860A series has been developed as a general-purpose version of the F2MC-16LX
series, which is an original 16-bit single-chip microcontroller compatible with the Application
Specific IC (ASIC).
This manual explains the functions and operation of the MB90860A series for designers who
actually use the MB90860A series to design products. Please read this manual first.
■ Trademark
F2MC is the abbreviation of FUJITSU Flexible Microcontroller.
Embedded Algorithm is a trademark of Advanced Micro Devices Inc.
Other system and product names in this manual are trademarks of respective companies or
organizations.
■ License
Purchase of Fujitsu I2C components conveys a license under the Philips I2C Patent Rights to use,
these components in an I2C system provided that the system conforms to the I2C Standard
Specification as defined by Philips.
■ Structure of this preliminary manual
CHAPTER 1 "OVERVIEW"
The MB90860A Series is a family member of the F2MC-16LX microcontrollers.
CHAPTER 2 "CPU"
This chapter explains the CPU.
CHAPTER 3 "INTERRUPTS"
This chapter explains the interrupt functions and operations.
CHAPTER 4 "DELAYED INTERRUPTS"
This chapter explains the functions and operations of the delayed interrupt.
CHAPTER 5 "CLOCKS"
This chapter explains the functions and operations of clocks.
CHAPTER 6 "CLOCK MODULATOR"
This chapter explains the functions and operation of the clock modulator.
CHAPTER 7 "RESETS"
This chapter describes resets for the MB90860A series.
CHAPTER 8 "LOW-POWER CONTROL CIRCUIT"
This chapter explains the functions and operations of the low-power control circuits.
i
CHAPTER 9 "MEMORY ACCESS MODES"
This chapter explains the functions and operations of the memory access modes.
CHAPTER 10 "I/O PORTS"
This chapter explains the functions and operations of the I/O ports.
CHAPTER 11 "TIMEBASE TIMER"
This chapter explains the functions and operations of the timebase timer.
CHAPTER 12 "WATCH-DOG TIMER"
This chapter explains the functions and operations of the watch-dog timer.
CHAPTER 13 "16-BIT I/O TIMER"
This chapter explains the functions and operations of the 16-bit I/O timer.
CHAPTER 14 "16-BIT RELOAD TIMER (WITH EVENT COUNT FUNCTION)"
This chapter explains the functions and operations of the 16-bit reload timer (with the event
count function).
CHAPTER 15 "WATCH TIMER"
This chapter explains the functions and operations of the Watch Timer.
CHAPTER 16 "8/16-BIT PPG"
This chapter explains the 8/16-bit PPG and explains its functions.
CHAPTER 17 "DTP/EXTERNAL INTERRUPTS"
This chapter explains the functions and operations of the DTP/external interrupts.
CHAPTER 18 "8/10-BIT A/D CONVERTER"
This chapter explains the functions and operations of the A/D converter.
CHAPTER 19 "CLOCK MONITOR"
This chapter explains the functions and operations of the clock monitor.
CHAPTER 20 "UART"
This chapter explains the functions and operation of the LIN-UART.
CHAPTER 21 "400 kHz I2C INTERFACE"
This chapter explains the functions and operation of the I2C interface.
CHAPTER 22 "ADDRESS MATCH DETECTION FUNCTION"
This chapter explains the address match detection function and operation.
CHAPTER 23 "ROM MIRRORING MODULE"
This chapter explains the ROM mirroring module.
CHAPTER 24 "1M-BIT FLASH MEMORY"
This chapter explains the functions and operation of the 1M-bit flash memory.
CHAPTER 25 "EXAMPLES OF MB90F867A SERIAL PROGRAMMING CONNECTION"
This chapter provides examples of F2MC-16LX MB90F867A(S) serial programming connection.
APPENDIX
The appendixes provide I/O maps, instructions, and other information.
ii
•
•
•
•
•
•
The contents of this document are subject to change without notice. Customers are advised to consult with FUJITSU sales
representatives before ordering.
The information, such as descriptions of function and application circuit examples, in this document are presented solely for the
purpose of reference to show examples of operations and uses of FUJITSU semiconductor device; FUJITSU does not warrant
proper operation of the device with respect to use based on such information. When you develop equipment incorporating the
device based on such information, you must assume any responsibility arising out of such use of the information. FUJITSU
assumes no liability for any damages whatsoever arising out of the use of the information.
Any information in this document, including descriptions of function and schematic diagrams, shall not be construed as license of
the use or exercise of any intellectual property right, such as patent right or copyright, or any other right of FUJITSU or any third
party or does FUJITSU warrant non-infringement of any third-party's intellectual property right or other right by using such
information. FUJITSU assumes no liability for any infringement of the intellectual property rights or other rights of third parties
which would result from the use of information contained herein.
The products described in this document are designed, developed and manufactured as contemplated for general use, including
without limitation, ordinary industrial use, general office use, personal use, and household use, but are not designed, developed and
manufactured as contemplated (1) for use accompanying fatal risks or dangers that, unless extremely high safety is secured, could
have a serious effect to the public, and could lead directly to death, personal injury, severe physical damage or other loss (i.e.,
nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass transport control, medical life support
system, missile launch control in weapon system), or (2) for use requiring extremely high reliability (i.e., submersible repeater and
artificial satellite). Please note that FUJITSU will not be liable against you and/or any third party for any claims or damages arising
in connection with above-mentioned uses of the products.
Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such failures
by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and prevention of
over-current levels and other abnormal operating conditions.
If any products described in this document represent goods or technologies subject to certain restrictions on export under the
Foreign Exchange and Foreign Trade Law of Japan, the prior authorization by Japanese government will be required for export of
those products from Japan.
Copyright ©2003-2006 FUJITSU LIMITED All rights reserved
iii
iv
CONTENTS
CHAPTER 1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
CHAPTER 2
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.7.1
2.7.2
2.7.3
2.7.4
2.8
2.9
2.10
CPU ............................................................................................................ 27
Outline of CPU ..................................................................................................................................
Memory Space ..................................................................................................................................
Memory Space Map ..........................................................................................................................
Linear Addressing .............................................................................................................................
Bank Addressing Types ....................................................................................................................
Multi-byte Data in Memory Space .....................................................................................................
Registers ...........................................................................................................................................
Accumulator (A) ...........................................................................................................................
User Stack Pointer (USP) and System Stack Pointer (SSP) .......................................................
Processor Status (PS) .................................................................................................................
Program Counter (PC) .................................................................................................................
Register Bank ...................................................................................................................................
Prefix Codes .....................................................................................................................................
Interrupt Disable Instructions ............................................................................................................
CHAPTER 3
3.1
3.2
3.3
3.4
3.5
3.5.1
3.5.2
3.5.3
3.6
3.7
3.7.1
3.7.2
3.8
3.9
3.9.1
OVERVIEW ................................................................................................... 1
Product Overview ............................................................................................................................... 2
Features .............................................................................................................................................. 3
Block Diagram of MB90V340(S) ......................................................................................................... 5
Block Diagram of Flash/Mask ROM Version ...................................................................................... 6
Pin Assignment ................................................................................................................................... 7
Package Dimensions .......................................................................................................................... 9
Pin Functions .................................................................................................................................... 11
Input-Output Circuits ......................................................................................................................... 18
Handling Device ................................................................................................................................ 23
28
29
32
33
34
36
37
40
41
42
45
46
48
50
INTERRUPTS ............................................................................................. 51
Outline of Interrupts ..........................................................................................................................
Interrupt Vector .................................................................................................................................
Interrupt Control Registers (ICR) ......................................................................................................
Interrupt Flow ....................................................................................................................................
Hardware Interrupts ..........................................................................................................................
Hardware Interrupt Operation ......................................................................................................
Occurrence and Release of Hardware Interrupt ..........................................................................
Multiple interrupts ........................................................................................................................
Software Interrupts ...........................................................................................................................
Extended Intelligent I/O Service (EI2OS) ..........................................................................................
Extended Intelligent I/O Service Descriptor (ISD) .......................................................................
EI2OS Status Register (ISCS) .....................................................................................................
Operation Flow of and Procedure for Using the Extended Intelligent I/O Service (EI2OS) ..............
µDMAC Interrupt ...............................................................................................................................
µDMAC Functions .......................................................................................................................
v
52
56
58
61
63
64
65
67
68
70
72
74
76
79
80
3.9.2
µDMAC Registers ........................................................................................................................
3.9.2.1 DMA Descriptor Channel Specification Register (DCSR) ........................................................
3.9.2.2 DMA Status Register (DSR) .....................................................................................................
3.9.2.3 DMA Stop Status Register (DSSR) ..........................................................................................
3.9.2.4 DMA Enable Register (DER) ....................................................................................................
3.9.3
DMA Descriptor window register (DDWR) ...................................................................................
3.9.3.1 Data Counter (DCT) .................................................................................................................
3.9.3.2 I/O Register Address Pointer (IOA) ..........................................................................................
3.9.3.3 DMA Control Register (DMACS) ..............................................................................................
3.9.3.4 Buffer Address Pointer (BAP) ...................................................................................................
3.9.4
µDMAC Operation .......................................................................................................................
3.10 Exceptions ........................................................................................................................................
CHAPTER 4
4.1
4.2
4.3
CLOCK MODULATOR ............................................................................. 119
RESETS .................................................................................................... 125
Resets .............................................................................................................................................
Reset Cause and Oscillation Stabilization Wait Times ...................................................................
External Reset Pin ..........................................................................................................................
Reset Operation ..............................................................................................................................
Reset Cause Bits ............................................................................................................................
Status of Pins in a Reset ................................................................................................................
CHAPTER 8
8.1
8.2
8.3
8.4
8.5
102
104
106
107
111
113
117
118
Overview ......................................................................................................................................... 120
Clock Modulator Control Register (CMCR) ..................................................................................... 121
Application Note .............................................................................................................................. 123
CHAPTER 7
7.1
7.2
7.3
7.4
7.5
7.6
CLOCKS ................................................................................................... 101
Clocks .............................................................................................................................................
Block Diagram of Clock Generation Block ......................................................................................
Clock Selection Registers ...............................................................................................................
Clock Selection Register (CKSCR) ...........................................................................................
PLL/Subclock Control Register (PSCCR) ..................................................................................
Clock Mode .....................................................................................................................................
Oscillation Stabilization Wait Interval ..............................................................................................
Connection of an Oscillator or an External Clock to Microcontroller ...............................................
CHAPTER 6
6.1
6.2
6.3
DELAYED INTERRUPT ............................................................................. 97
Outline of Delayed Interrupt Module ................................................................................................. 98
Delayed Interrupt Register ................................................................................................................ 99
Delayed Interrupt Operation ........................................................................................................... 100
CHAPTER 5
5.1
5.2
5.3
5.3.1
5.3.2
5.4
5.5
5.6
81
82
84
85
86
87
88
89
90
92
93
96
126
128
130
131
133
135
LOW-POWER CONSUMPTION MODE ................................................... 137
Overview of Low-Power Consumption Mode ..................................................................................
Block Diagram of the Low-Power Consumption Control Circuit .....................................................
Low-Power Consumption Mode Control Register (LPMCR) ...........................................................
CPU Intermittent Operation Mode ..................................................................................................
Standby Mode .................................................................................................................................
vi
138
141
143
146
147
8.5.1
Sleep Mode ...............................................................................................................................
8.5.2
Timebase Timer Mode ...............................................................................................................
8.5.3
Watch Mode ..............................................................................................................................
8.5.4
Stop Mode .................................................................................................................................
8.6
Status Change Diagram .................................................................................................................
8.7
Status of Pins in Standby Mode and during Hold and Reset ..........................................................
8.8
Usage Notes on Low-Power Consumption Mode ...........................................................................
CHAPTER 9
149
152
154
156
159
161
166
MEMORY ACCESS MODES .................................................................... 169
9.1
Outline of Memory Access Modes ..................................................................................................
9.1.1
Mode Pins ..................................................................................................................................
9.1.2
Mode Data .................................................................................................................................
9.1.3
Memory Space in Each Bus Mode ............................................................................................
9.2
External Memory Access (Bus Pin Control Circuit) ........................................................................
9.2.1
External Memory Access (External Bus Pin Control Circuit) Registers .....................................
9.2.2
Automatic Ready Function Selection Register (ARSR) .............................................................
9.2.3
External Address Output Control Register (HACR) ...................................................................
9.2.4
Bus Control Signal Selection Register (ECSR) .........................................................................
9.3
External Memory Access Control Signal Operation ........................................................................
9.3.1
Ready Function .........................................................................................................................
9.3.2
Hold Function ............................................................................................................................
170
171
172
173
175
176
177
179
180
182
184
186
CHAPTER 10 I/O PORTS ................................................................................................ 187
10.1 I/O Ports ..........................................................................................................................................
10.2 I/O Port Registers ...........................................................................................................................
10.2.1 Port Data Register .....................................................................................................................
10.2.2 Data Direction Register .............................................................................................................
10.2.3 Pull-up Control Register (PUCR) ...............................................................................................
10.2.4 Analog Input Enable Register ....................................................................................................
10.2.5 Input Level Select Register ........................................................................................................
188
189
190
192
194
195
196
CHAPTER 11 TIMEBASE TIMER ................................................................................... 199
11.1
11.2
11.3
Outline of Timebase Timer ............................................................................................................. 200
Timebase Timer Control Register ................................................................................................... 201
Operations of Timebase Timer ....................................................................................................... 203
CHAPTER 12 16-BIT I/O TIMER ..................................................................................... 205
12.1 Outline of 16-Bit I/O Timer ..............................................................................................................
12.2 16-Bit I/O Timer Registers ..............................................................................................................
12.3 16-bit Free-running Timer ...............................................................................................................
12.3.1 Data Register .............................................................................................................................
12.3.2 Control Status Register .............................................................................................................
12.3.3 16-bit Free-running Timer Operation .........................................................................................
12.4 Output Compare .............................................................................................................................
12.4.1 Output Compare Register ..........................................................................................................
12.4.2 Control Status Register of Output Compare ..............................................................................
12.4.3 16-bit Output Compare Operation .............................................................................................
vii
206
208
210
211
212
215
217
218
219
224
12.5 Input Capture .................................................................................................................................. 229
12.5.1 Input Capture Register Details .................................................................................................. 230
12.5.2 16-bit Input Capture Operation .................................................................................................. 235
CHAPTER 13 WATCH-DOG TIMER ............................................................................... 237
13.1
13.2
Outline of Watch-Dog Timer ........................................................................................................... 238
Watch-dog Timer Operation ........................................................................................................... 241
CHAPTER 14 16-BIT RELOAD TIMER (WITH EVENT COUNT FUNCTION) ................ 243
14.1 Outline of 16-Bit Reload Timer (with Event Count Function) ..........................................................
14.2 16-Bit Reload Timer (with Event Count Function) ..........................................................................
14.2.1 Timer Control Status Register (TMCSR) ...................................................................................
14.2.2 Register Layout of 16-bit Timer Register (TMR)/16-bit Reload Register (TMRLR) ...................
14.3 Internal Clock and External Clock Operations of 16-bit Reload Timer ...........................................
14.4 Underflow Operation of 16-bit Reload Timer ..................................................................................
14.5 Output Pin Functions of 16-bit Reload Timer ..................................................................................
14.6 Counter Operation State .................................................................................................................
244
245
246
249
250
252
253
254
CHAPTER 15 WATCH TIMER ........................................................................................ 255
15.1
15.2
15.3
Outline of Watch Timer ................................................................................................................... 256
Watch Timer Control Register (WTC) ............................................................................................. 257
Watch Timer Operation ................................................................................................................... 259
CHAPTER 16 8/16-BIT PPG ........................................................................................... 261
16.1 Outline of 8/16-bit PPG ...................................................................................................................
16.2 Block Diagram of 8/16-bit PPG .......................................................................................................
16.3 8/16-bit PPG Registers ...................................................................................................................
16.3.1 PPG0 Operation Mode Control Register (PPGC0) ....................................................................
16.3.2 PPG1 Operation Mode Control Register (PPGC1) ....................................................................
16.3.3 PPG0/PPG1 Clock Select Register (PPG01) ............................................................................
16.3.4 Reload Register (PRLL/PRLH) ..................................................................................................
16.4 Operations of 8/16-bit PPG .............................................................................................................
16.5 Selecting a Count Clock for 8/16-bit PPG .......................................................................................
16.6 Controlling Pin Output of 8/16-bit PPG Pulses ...............................................................................
16.7 8/16-bit PPG Interrupts ...................................................................................................................
16.8 Initial Values of 8/16-bit PPG Hardware .........................................................................................
262
264
266
267
269
271
273
274
276
277
278
279
CHAPTER 17 DTP/EXTERNAL INTERRUPTS .............................................................. 281
17.1
17.2
17.3
17.4
17.5
Outline of DTP/External Interrupts ..................................................................................................
DTP/External Interrupt Registers ....................................................................................................
Operations of DTP/External Interrupts ............................................................................................
Switching between External Interrupt and DTP Requests ..............................................................
Notes on Using DTP/External Interrupt functions ...........................................................................
282
284
287
289
290
CHAPTER 18 A/D CONVERTER .................................................................................... 291
18.1
18.2
Features of A/D Converter .............................................................................................................. 292
Block Diagram of A/D Converter ..................................................................................................... 295
viii
18.3 Registers for A/D Converter ............................................................................................................
18.3.1 Control status register (ADCS0) ................................................................................................
18.3.2 Control status register (ADCS1) ................................................................................................
18.3.3 Data Register (ADCR0/ADCR1) ................................................................................................
18.3.4 Setting Register (ADSR0/ADSR1) .............................................................................................
18.4 Operation of A/D Converter ............................................................................................................
18.5 Conversion Using EI2OS ................................................................................................................
18.5.1 Example of activating of EI2OS in single mode .........................................................................
18.5.2 Example of activating of EI2OS in continuous mode .................................................................
18.5.3 Example of activating of EI2OS in stop mode ............................................................................
18.6 Convert Data Protection Function ...................................................................................................
296
297
299
302
303
307
309
310
312
314
316
CHAPTER 19 CLOCK MONITOR FUNCTION ................................................................ 319
19.1
19.2
Clock Monitor Function ................................................................................................................... 320
Clock Output Enable Register (CLKR) ........................................................................................... 321
CHAPTER 20 UART ........................................................................................................ 323
20.1 Overview of UART ..........................................................................................................................
20.2 Configuration of UART ....................................................................................................................
20.3 UART Pins ......................................................................................................................................
20.4 UART Registers ..............................................................................................................................
20.4.1 Serial Control Register (SCR) ...................................................................................................
20.4.2 Serial Mode Register (SMR) ......................................................................................................
20.4.3 Serial Status Register (SSR) .....................................................................................................
20.4.4 Reception and Transmission Data Register (RDR/TDR) ...........................................................
20.4.5 Extended Status/Control Register (ESCR) ................................................................................
20.4.6 Extended Communication Control Register (ECCR) .................................................................
20.4.7 Baud Rate/Reload Counter Register 0 and 1 (BGRn0/BGRn1) ................................................
20.5 UART Interrupts ..............................................................................................................................
20.5.1 Reception Interrupt Generation and Flag Set Timing ................................................................
20.5.2 Transmission Interrupt Generation and Flag Set Timing ...........................................................
20.6 UART Baud Rates ..........................................................................................................................
20.6.1 Setting the Baud Rate ...............................................................................................................
20.6.2 Restarting the Reload Counter ..................................................................................................
20.7 Operation of UART .........................................................................................................................
20.7.1 Operation in Asynchronous Mode (Operation Modes 0 and 1) .................................................
20.7.2 Operation in Synchronous Mode (Operation Mode 2) ...............................................................
20.7.3 Operation with LIN Function (Operation Mode 3) ......................................................................
20.7.4 Direct Access to Serial Pins ......................................................................................................
20.7.5 Bidirectional Communication Function (Normal Mode) .............................................................
20.7.6 Master-Slave Communication Function (Multiprocessor Mode) ................................................
20.7.7 LIN Communication Function ....................................................................................................
20.7.8 Sample Flowcharts for UART in LIN communication (Operation Mode 3) ................................
20.8 Notes on Using UART ....................................................................................................................
324
327
332
333
334
336
338
340
342
344
346
347
350
352
354
356
359
361
363
365
368
371
372
374
377
378
380
CHAPTER 21 400 kHz I2C INTERFACE ......................................................................... 383
21.1
I2C Interface Overview .................................................................................................................... 384
ix
21.2 I2C Interface Registers ...................................................................................................................
21.2.1 I2C Bus Status Register (IBSR) .................................................................................................
21.2.2 I2C Bus Control Register (IBCR) ...............................................................................................
21.2.3 I2C Ten Bit Slave Address Register (ITBAH/ITBAL) .................................................................
21.2.4 I2C Ten Bit Address Mask Register (ITMKH/ITMKL) .................................................................
21.2.5 I2C Seven Bit Slave Address Register (ISBA) ...........................................................................
21.2.6 I2C Data Register (IDAR) ..........................................................................................................
21.2.7 I2C Clock Control Register (ICCR) ............................................................................................
21.3 I2C Interface Operation ...................................................................................................................
21.4 Programming Flow Charts ..............................................................................................................
386
388
391
397
398
399
401
402
405
408
CHAPTER 22 ADDRESS MATCH DETECTION FUNCTION ......................................... 411
22.1
22.2
22.3
22.4
Outline of the Address Match Detection Function ..........................................................................
Registers of the Address Match Detection Function .......................................................................
Operation of the Address Match Detection Function ......................................................................
Example of the Address Match Detection Function ........................................................................
412
413
415
416
CHAPTER 23 ROM MIRRORING MODULE ................................................................... 419
23.1
23.2
Outline of ROM Mirroring Module ................................................................................................... 420
ROM Mirroring Register (ROMM) ................................................................................................... 421
CHAPTER 24 1M-BIT FLASH MEMORY ........................................................................ 423
24.1 Overview of 1M-bit Flash Memory ..................................................................................................
24.2 Block Diagram of the Entire Flash Memory and Sector Configuration of the Flash Memory ..........
24.3 Write/Erase Modes .........................................................................................................................
24.4 Flash Memory Control Status Register (FMCS) .............................................................................
24.5 Starting the Flash Memory Automatic Algorithm ............................................................................
24.6 Confirming the Automatic Algorithm Execution State .....................................................................
24.6.1 Data Polling Flag (DQ7) ............................................................................................................
24.6.2 Toggle Bit Flag (DQ6) ................................................................................................................
24.6.3 Timing Limit Exceeded Flag (DQ5) ...........................................................................................
24.6.4 Sector Erase Timer Flag (DQ3) .................................................................................................
24.6.5 Toggle Bit-2 Flag (DQ2) ............................................................................................................
24.7 Detailed Explanation of Writing to and Erasing Flash Memory .......................................................
24.7.1 Setting The Read/Reset State ...................................................................................................
24.7.2 Writing Data ...............................................................................................................................
24.7.3 Erasing All Data (Erasing Chips) ...............................................................................................
24.7.4 Erasing Optional Data (Erasing Sectors) ...................................................................................
24.7.5 Suspending Sector Erase ..........................................................................................................
24.7.6 Restarting Sector Erase ............................................................................................................
24.8 Notes on using 1M-bit Flash Memory .............................................................................................
24.9 Flash Security Feature ....................................................................................................................
24.10 Example of Programming 1M-bit Flash Memory ............................................................................
424
425
427
429
431
433
435
437
438
439
440
442
443
444
446
447
449
450
451
453
454
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
.................................................................................................................... 459
25.1
Basic Configuration of MB90F867A(S) Serial Programming Connection ....................................... 460
x
25.2
25.3
25.4
25.5
Example of Serial Programming Connection (User Power Supply Used) ...................................... 464
Example of Serial Programming Connection (Power Supplied from the Programmer) .................. 466
Example of Minimum Connection to the Flash Microcomputer Programmer (User Power Supply Used)
468
Example of Minimum Connection to the Flash Microcomputer Programmer (Power Supplied from the
Programmer) ................................................................................................................................... 470
CHAPTER 26 ROM SECURITY FUNCTION ................................................................... 473
26.1
Overview of ROM security function ................................................................................................ 474
APPENDIX ......................................................................................................................... 475
APPENDIX A I/O Maps ..............................................................................................................................
APPENDIX B Instructions ...........................................................................................................................
B.1 Instruction Types ............................................................................................................................
B.2 Addressing .....................................................................................................................................
B.3 Direct Addressing ...........................................................................................................................
B.4 Indirect Addressing ........................................................................................................................
B.5 Execution Cycle Count ...................................................................................................................
B.6 Effective address field ....................................................................................................................
B.7 How to Read the Instruction List ....................................................................................................
B.8 F2MC-16LX Instruction List ............................................................................................................
B.9 Instruction Map ...............................................................................................................................
APPENDIX C Timing Diagrams in Flash Memory Mode ............................................................................
APPENDIX D MB90860A Series List of Interrupt Vectors ..........................................................................
xi
476
491
492
493
495
501
509
512
513
516
530
552
560
xii
Main changes in this edition
Page
Changes (For details, refer to main body.)
24
Figure 1.9-1 Using External Clock is changed
(open pin is added)
68
■ Software interrupts is changed
(Sets I → Sets "1")
354
● Baud rates determined using the dedicated baud rate generator (reload counter) is changed
((BGR0/1) → (BGRn0/BGRn1))
384
■ Features is changed
(400 KBit → 400 kbps)
403
bit 14 in Table 21.2-8 Function of Each Bit of the I2C Clock Control Register (ICCR0/ICCR1) is changed
(above 100KBit → above 100kbps)
404
The unit in Table 21.2-10 Common Machine Clock Frequencies is changed
(Bit rate [K bit] → Bit rate kbps)
473, 474
528
CHAPTER 26 ROM SECURITY FUNCTION is added
Table B.8-17 6 Accumulator Operation Instructions (Byte, Word) is changed
(SWAPW / XCHW A,T → SWAPW)
xiii
xiv
CHAPTER 1
OVERVIEW
The MB90860A Series is a family member of the F2MC16LX micro controllers.
1.1 Product Overview
1.2 Features
1.3 Block Diagram of MB90V340(S)
1.4 Block Diagram of Flash/Mask ROM Version
1.5 Pin Assignment
1.6 Package Dimensions
1.7 Pin Functions
1.8 Input-Output Circuits
1.9 Handling Device
1
CHAPTER 1 OVERVIEW
1.1
Product Overview
Table 1.1-1 provides a quick outlook of the MB90860A Series.
■ Product Overview
Table 1.1-1 Product Overview
Features
MB90V340(S)
MB90F867A(S)
MB90867A(S)
Product type
Evaluation
sample
Flash version
Mask ROM version
CPU
F2MC-16LX CPU
System clock
On-chip PLL clock multiplier (x1, x2, x3, x4, x6, 1/2 when PLL stops)
Minimum instruction execution time: 42 ns (4 MHz osc. PLL x 6)
Flash memory
128K bytes
Mask ROM
128K bytes
ROM memory
External
RAM
30K bytes
Technology
0.35µm CMOS
with on-chip
voltage regulator
for internal
power supply
Package
PGA-299
QFP-100, LQFP-100
Power supply for
emulator*
Provided
-
6K bytes
0.35µm CMOS with on-chip voltage
0.35µm CMOS with on-chip voltage
regulator for internal power supply + Flash regulator for internal power supply
memory with on-chip charge pump for
programming voltage
*: It is setting of Jumper switch (TOOL VCC) when Emulator (MB2147-01) is used. Please refer to the MB2147-01 or
MB2147-20 hardware manual "3.3 Emulator -dedicated Power Supply Switching" about details.
2
CHAPTER 1 OVERVIEW
1.2
Features
Table 1.2-1 lists the features of the MB90860A series.
■ Features
Table 1.2-1 MB90860A Features (1/2)
Part Number
Parameter
UART
MB90F867A(S), MB90867A(S)
MB90V340(S)
4 channels
5 channels
Wide range of baud rate settings using a dedicated reload timer
Special synchronous options for adapting to different synchronous serial protocols
LIN functionality working either as master or slave LIN device
I2C (400kbps)
2 channels
24 channels
24 input channels
A/D Converter
10-bit or 8-bit resolution
Conversion time: Minimum 3 µs include sample time (per one channel)
16-bit Reload Timer
(4 channels)
Operation clock frequency: fsys/21, fsys/23, fsys/25 (fsys = System clock frequency)
Supports External Event Count function
16-bit I/O Timer
(2 channels)
Signals an interrupt when overflowing
Supports Timer Clear when a match with Output Compare (ch0, ch4)
Operation clock freq.: fsys, fsys/21, fsys/22, fsys/23, fsys/24, fsys/25, fsys/26, fsys/27
(fsys = System clock freq.)
I/O Timer 0 (clock input FRCK0) corresponds to ICU0/ICU1/ICU2/ICU3, OCU0/OCU1/
OCU2/OCU3
I/O Timer 1 (clock input FRCK1) corresponds to ICU4/ICU5/ICU6/ICU7, OCU4/OCU5/
OCU6/OCU7
16-bit Output Compare
(8 channels)
Signals an interrupt when a match with 16-bit I/O Timer 16-bit compare registers.
The output signal can be generated by combining up to three compare registers.
16-bit Input Capture
(8 channels)
Rising edge, falling edge or rising & falling edge sensitive
Signals an interrupt upon external event
8/16-bit Programmable
Pulse Generator
(8 channels)
Supports 8-bit and 16-bit operation modes
Sixteen 8-bit reload counters
Sixteen 8-bit reload registers for L pulse width
Sixteen 8-bit reload registers for H pulse width
A pair of 8-bit reload counters can be configured as one 16-bit reload counter or as 8-bit
prescaler plus 8-bit reload counter
Operation clock freq.: fsys, fsys/21, fsys/22, fsys/23, fsys/24 or 102.4µs fosc=@5MHz
(fsys = System clock frequency, fosc = Oscillation clock frequency)
CAN Interface
-
3 channels
3
CHAPTER 1 OVERVIEW
Table 1.2-1 MB90860A Features (2/2)
Part Number
Parameter
MB90F867A(S), MB90867A(S)
External Interrupt
(16 channels)
D/A converter
Up to 100kHz Subclock
for low power operation
Can be programmed edge sensitive or level sensitive
-
2 channels
Devices without "S"-suffix: yes
Devices with "S"-suffix: --
I/O Ports
Virtually all external pins can be used as general purpose I/O
All push-pull outputs
Bit-wise programmable as input/output or peripheral signal
Programmable in groups of 8 as CMOS / Automotive inputs (default)
TTL input level programmable for external bus (default for external reset vector fetch)
Flash Memory
Supports automatic programming, Embedded AlgorithmTM*
Write/Erase/Erase-Suspend/Resume commands
A flag indicating completion of the algorithm
Number of erase cycles: 10,000 times
Data retention time: 10 years
Boot block configuration
Erase can be performed on each block
Block protection with external programming voltage
Flash Security Feature for protecting the content of the Flash
*: Embedded Algorithm is a trademark of Advanced Micro Devices, Inc.
4
MB90V340(S)
CHAPTER 1 OVERVIEW
1.3
Block Diagram of MB90V340(S)
Figure 1.3-1 shows a block diagram of the MB90V340(S).
■ Block Diagram of MB90V340(S)
Figure 1.3-1 Block Diagram of MB90V340(S)
MB90V340(S)
X0,X1
X0A,X1A*
RST
Clock
Controller
F2MC-16LX
CPU
16-bit
IO Timer 0
Input
Capture
8 channels
RAM
30K bytes
Output
Compare
8 channels
16-bit
IO Timer 1
UART
5 channels
CAN
Controller
3 channels
AVCC
AVSS
AN23 to AN0
AVRH
AVRL
ADTG
10-bit ADC
24 channels
DA01, DA00
10-bit
DAC
2 channels
PPGF to PPG0
8/16-bit
PPG
16 channels
SDA1, SDA0
SCL1, SCL0
16-bit
Reload Timer
4 channels
I2C
Interface
2 channels
DMA
*:Only for MB90V340
F2MC-16 Bus
SOT4 to SOT0
SCK4 to SCK0
SIN4 to SIN0
Prescaler
5 channels
FRCK0
IN7 to IN0
OUT7 to OUT0
FRCK1
RX2 to RX0
TX2 to TX0
TIN3 to TIN0
TOT3 to TOT0
External
Bus
Interface
AD15 to AD00
A23 to A16
ALE
RD
WRL
WRH
HRQ
HAK
RDY
CLK
DTP/
External
Interrupt
(INT15R to INT8R)
Clock
Monitor
INT15 to INT8
INT7 to INT0
CKOT
(without 'S'-Suffix)
5
CHAPTER 1 OVERVIEW
1.4
Block Diagram of Flash/Mask ROM Version
Figure 1.4-1 shows a block diagram of Flash/Mask ROM version.
■ Block Diagram of Flash/Mask ROM Version
Figure 1.4-1 Block Diagram of Flash/Mask ROM Version
X0,X1
X0A,X1A*
RST
Clock
Controller
F2MC-16LX
CPU
16-bit
IO Timer 0
Input
Capture
8 channels
RAM
6K bytes
ROM/Flash
Output
Campare
8 channels
16-bit
IO Timer 1
128K bytes
Prescaler
4 channels
AVCC
AVSS
AN15 to AN0
AN23 to AN16
AVRH
AVRL
ADTG
10-bit ADC
16/24
channels
16-bit
Reload
Timer
4 channels
SDA1, SDA0
SCL1, SCL0
8/16-bit
PPG
16 channels
I2C
interface
2 channels
DMA
* : Only for devices without 'S' Suffix
6
OUT7 to OUT0
FRCK1
TIN3 to TIN0
TOT3 to TOT0
AD15 to AD00
A23 to A16
ALE
External
Bus
Interface
PPGF to PPG0
INT7 to INT0
UART
4 channels
F2MC-16LX Bus
SOT3 to SOT0
SCK3 to SCK0
SIN3 to SIN0
FRCK0
DTP/
External
Interrupt
Clock
Monitor
RD
WRL
WRH
HRQ
HAK
RDY
CLK
INT15 to INT8
(INT15R to INT8R)
INT7 to INT0
CKOT
CHAPTER 1 OVERVIEW
1.5
Pin Assignment
This chapter shows the pin assignments for the MB90860A series.
■ Pin Assignment
MD2
MD0
MD1
RST
P76/INT6
P77/INT7
P80/TIN0/ADT G/INT12R
P81/TOT0/CKOT /INT13R
P82/SIN0/TIN2/INT 14R
P83/SOT0/TOT2
P84/SCK0/INT15R
P85/SIN1
P86/SOT1
P87/SCK1
Vcc
Vss
P90/PPG1(0)
P91/PPG3(2)
P92/PPG5(4)
P93/PPG7(6)
P94/OUT0
P95/OUT1
P96/OUT2
P97/OUT3
PA0/INT8R
PA1
P00/AD00/INT8
P01/AD01/INT9
P02/AD02/INT10
P03/AD03/INT11
Figure 1.5-1 Pin Assignment for QFP-100
80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
P04/AD04/INT12
81
50
P75/INT5
P05/AD05/INT13
82
49
P74/INT4
P06/AD06/INT14
83
48
P73/INT3
P07/AD07/INT15
84
47
P72/INT2
P10/AD08/TIN1
85
46
P71/INT1
P11/AD09/TOT1
86
45
P70/INT0
P12/AD10/SIN3/NT11R
87
44
Vss
P13/AD11/SOT3
88
43
P67/AN7/PPGE(F)
P14/AD12/SCK3
89
42
P66/AN6/PPGC(D)
Vcc
90
41
P65/AN5/PPGA(B)
Vss
91
40
P64/AN4/PPG8(9)
X1
92
39
P63/AN3/PPG6(7)
X0
93
38
P62/AN2/PPG4(5)
P15/AD13
94
37
P61/AN1/PPG2(3)
P16/AD14
95
36
P60/AN0/PPG0(1)
P17/AD15
96
35
AVss
P20/A16/PPG9(8)
97
34
AVRL
P21/A17/PPGB(A)
98
33
AVRH
P22/A18/PPGD(C)
99
32
AVcc
P23/A19/PPGF(E)
100
31
P57/AN15
QFP - 100
P56/AN14
P55/AN13
P54/AN12/TOT3
P53/AN11/TIN3
P40/X0A
P52/AN10/SCK2
P34/HRQ/OUT4
P51/AN 9/SOT 2
P33/WRH
P50/AN8/SIN2
P32/WRL /WR/INT10R
P47
P31/RD/IN5
P46
P30/ALE/IN4
P45/F RCK1
P27/A23/IN3
P44/F RCK0
P26/A22/IN2
P43/IN7
P25/A21/IN1
P42/IN6/INT9R
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
C
8
Vss
7
Vcc
6
P41/X1A *
5
*
4
P37/CLK/OUT7
3
P36/RDY/OUT6
2
P35/HAK /OUT5
1
P24/A20/IN0
Package code (mold)
FPT-100P-M06
(FPT-100P-M06)
*: MB90F867A,MB90867A : X0A, X1A
MB90F867AS,MB867AS : P40, P41
7
CHAPTER 1 OVERVIEW
MD0
RST
P76/INT6
P77/INT7
P80/TIN0/ADT G/INT12R
P81/TOT0/CKOT/INT 13R
P82/SIN0/TIN2/INT 14R
P01/AD01/INT9
76
75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
50
MD1
P02/AD02/INT10
77
49
MD2
P03/AD03/INT11
78
48
P75/INT5
P04/AD04/INT12
79
47
P74/INT4
P05/AD05/INT13
80
46
P73/INT3
P06/AD06/INT14
81
45
P72/INT2
P07/AD07/INT15
82
44
P71/INT1
P10/AD08/TIN1
83
43
P70/INT0
P11/AD09/TOT1
84
42
Vss
P12/AD10/SIN3/NT11R
85
41
P67/AN7/PPGE(F)
P13/AD11/SOT3
86
40
P66/AN6/PPGC(D)
P14/AD12/SCK3
87
39
P65/AN5/PPGA(B)
Vcc
88
38
P64/AN4/PPG8(9)
Vss
89
37
P63/AN3/PPG6(7)
X1
90
36
P62/AN2/PPG4(5)
LQFP - 100
Package code (mold)
FPT-100P-M05
33
AVss
P17/AD15
94
32
AVRL
P20/A16/PPG9(8)
95
31
AVRH
P21/A17/PPGB(A)
96
30
AVcc
P22/A18/PPGD(C)
97
29
P57/AN15
P23/A19/PPGF(E)
98
28
P56/AN14
P24/A20/IN0
99
27
P55/AN13
P25/A21/IN1
100
*: MB90F867A,MB90867A : X0A, X1A
MB90F867AS,MB90867AS : P40, P41
P53/AN11/TIN3
P52/AN10/SCK2
P51/AN9/SOT2
P50/AN8/SIN2
P47
P46
P45/FRCK1
P44/FRCK0
P43/IN7
P42/IN6/INT9R
C
Vss
Vcc
26
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
P41/X1A
7 8
*
6
*
5
P40/X0A
4
P37/CLK/OUT7
3
P36/RDY/OUT 6
2
P35/HAK/OUT5
1
P33/WRH
P34/HRQ/OUT4
93
P32/WRL /WR /INT10R
P60/AN0/PPG0(1)
P16/AD14
P31/RD/IN5
P61/AN1/PPG2(3)
34
P30/ALE/IN4
35
92
P27/A23/IN3
91
P26/A22/IN2
X0
P15/AD13
(FPT-100P-M05)
8
P83/SOT 0/TOT2
P84/SCK0/INT15R
P85/SIN1
P86/SOT 1
P87/SCK1
Vcc
Vss
P90/PPG1(0)
P91/PPG3(2)
P92/PPG5(4)
P93/PPG7(6)
P94/OUT0
P95/OUT1
P96/OUT2
P97/OUT3
PA0/INT8R
PA1
P00/AD00/INT8
Figure 1.5-2 Pin Assignment for LQFP-100
P54/AN12/TOT3
CHAPTER 1 OVERVIEW
1.6
Package Dimensions
Figure 1.6-1 shows the package dimensions of the MB90860A series.
Note that the dimensions show below are reference dimensions. For formal dimensions
of each package, contact us.
■ Package Dimensions
Figure 1.6-1 FPT-100P-M05 Package Dimensions
100-pin plastic LQFP
Lead pitch
0.50 mm
Package width ×
package length
14.0 × 14.0 mm
Lead shape
Gullwing
Sealing method
Plastic mold
Mounting height
1.70 mm MAX
Weight
0.65g
Code
(Reference)
P-LFQFP100-14×14-0.50
(FPT-100P-M05)
100-pin plastic LQFP
(FPT-100P-M05)
Note 1) * : These dimensions do not include resin protrusion.
Note 2) Pins width and pins thickness include plating thickness.
Note 3) Pins width do not include tie bar cutting remainder.
16.00±0.20(.630±.008)SQ
* 14.00±0.10(.551±.004)SQ
75
51
76
50
0.08(.003)
Details of "A" part
+0.20
100
26
25
1
C
2003 FUJITSU LIMITED F100007S-c-4-6
0.20±0.05
(.008±.002)
0.08(.003)
M
0.10±0.10
(.004±.004)
(Stand off)
0˚~8˚
"A"
0.50(.020)
+.008
1.50 –0.10 .059 –.004
(Mounting height)
INDEX
0.145±0.055
(.0057±.0022)
0.50±0.20
(.020±.008)
0.60±0.15
(.024±.006)
0.25(.010)
Dimensions in mm (inches).
Note: The values in parentheses are reference values.
9
CHAPTER 1 OVERVIEW
Figure 1.6-2 FPT-100P-M06 Package Dimensions
100-pin plastic QFP
Lead pitch
0.65 mm
Package width ×
package length
14.00 × 20.00 mm
Lead shape
Gullwing
Sealing method
Plastic mold
Mounting height
3.35 mm MAX
Code
(Reference)
P-QFP100-14×20-0.65
(FPT-100P-M06)
100-pin plastic QFP
(FPT-100P-M06)
Note 1) * : These dimensions do not include resin protrusion.
Note 2) Pins width and pins thickness include plating thickness.
Note 3) Pins width do not include tie bar cutting remainder.
23.90±0.40(.941±.016)
* 20.00±0.20(.787±.008)
80
51
81
50
0.10(.004)
17.90±0.40
(.705±.016)
*14.00±0.20
(.551±.008)
INDEX
Details of "A" part
100
1
30
0.65(.026)
"A"
C
10
0.25(.010)
+0.35
3.00 –0.20
+.014
.118 –.008
(Mounting height)
0~8˚
31
2002 FUJITSU LIMITED F100008S-c-5-5
0.32±0.05
(.013±.002)
0.13(.005)
M
0.17±0.06
(.007±.002)
0.80±0.20
(.031±.008)
0.88±0.15
(.035±.006)
0.25±0.20
(.010±.008)
(Stand off)
Dimensions in mm (inches).
Note: The values in parentheses are reference values.
CHAPTER 1 OVERVIEW
1.7
Pin Functions
Table 1.7-1 describes the pin functions of the MB90860A series.
■ Pin Functions
Table 1.7-1 Pin Description (1/7)
Pin no.
Pin name
LQFP100*2
QFP100*1
90
92
Circuit
type
X1
Function
Oscillation output
A
91
93
X0
52
54
RST
Oscillation input
E
P00 to P07
75 to 82
77 to 84
AD00 to
AD07
General purpose I/O
G
INT8 to
INT15
85
AD08
General purpose I/O
G
TIN1
86
AD09
General purpose I/O
G
TOT1
General purpose I/O
AD10
87
N
SIN3
Second external interrupt request input pin for INT1
P13
88
AD11
SOT3
I/O pin for the external address/data bus
This function is enabled when the external bus is enabled.
Serial data input pin for UART3
INT11R
86
I/O pin for the external address/data bus
This function is enabled when the external bus is enabled.
Output pin for the reload timer 1
P12
85
I/O pin for the external address/data bus
This function is enabled when the external bus is enabled.
Event input pin for the reload timer 1.
P11
84
I/O pins for lower 8 bits of external address/data bus
These functions is enabled when the external bus is enabled.
External interrupt request input pins for INT8 to INT15
P10
83
Reset input
General purpose I/O
G
I/O pin for the external address/data bus
This function is enabled when the external bus is enabled.
Serial data output pin for UART3
11
CHAPTER 1 OVERVIEW
Table 1.7-1 Pin Description (2/7)
Pin no.
Pin name
LQFP100
*2
QFP100
*1
Circuit
type
P14
87
89
AD12
General purpose IO
G
SCK3
93
94
95
AD13
General purpose IO
N
Serial data input pin for UART4 (MB90V340 only)
P16
General purpose IO
AD14
G
AD15
General purpose IO
G
SCK4
95 to 98
97 to 100
1 to 4
P20 to P23
General purpose IO
A16 to A19
Output pins for A16 to A17 of the external address bus
This function is enabled when the external bus is enabled.
PPG9(8),
PPGB(A),
PPGD(C),
PPGF(E)
G
Output pins for PPGs
A20 to A23
General purpose IO
G
IN0 to IN3
5
ALE
IN4
12
Output pins for A20 to A23 of the external address bus
This function is enabled when the external bus is enabled.
Data sample input pins for input captures ICU0 to ICU3
P30
3
I/O pin for the external address/data bus
This function is enabled when the external bus is enabled.
Clock I/O pin for UART4 (MB90V340 only)
P24 to P27
99, 100,
1, 2
I/O pin for the external address/data bus
This function is enabled when the external bus is enabled.
Serial data output pin for UART4 (MB90V340 only)
P17
96
I/O pin for the external address/data bus
This function is enabled when the external bus is enabled.
SIN4
SOT4
94
I/O pin for the external address/data bus
This function is enabled when the external bus is enabled.
Clock I/O pin for UART3
P15
92
Function
General purpose IO
G
Address latch enable output pin
This function is enabled when the external bus is enabled.
Data sample input pin for input capture ICU4.
CHAPTER 1 OVERVIEW
Table 1.7-1 Pin Description (3/7)
Pin no.
Pin name
*2
LQFP100
QFP100
*1
Circuit
type
P31
4
6
RD
General purpose IO
G
Data sample input pin for input capture ICU5
P32
General purpose IO
7
G
7
8
9
RX input pin for CAN2 Interface (MB90V340 only)
INT10R
Second external interrupt request input pin for INT10
WRH
General purpose IO
G
TX Output pin for CAN2 (MB90V340 only).
P34
General purpose IO
HRQ
G
HAK
General purpose IO
G
OUT5
11
RDY
OUT6
Hold acknowledge output pin
This function is enabled when both the external bus and the
hold function are enabled.
Waveform output pin for output compares OCU5
P36
9
Hold request input pin
This function is enabled when both the external bus and the
hold function are enabled.
Waveform output pin for output compares OCU4
P35
10
Write strobe output pin for the 8 higher bits of the data bus
This function is enabled when the external bus is enabled, when
the external bus 16-bit mode is selected, and when the WRH
output pin is enabled.
TX2
OUT4
8
Write strobe output pin for the data bus
This function is enabled when both the external bus and the
WR/WRL pin output are enabled. WRL is used to write-strobe
8 lower bits of the data bus in 16-bit access while WR is used to
write-strobe 8 bits of the data bus in 8-bit access.
RX2
P33
6
Read strobe output pin for the data bus
This function is enabled when the external bus is enabled.
IN5
WRL /WR
5
Function
General purpose IO
G
Ready input pin
This function is enabled when both the external bus and the
external ready function are enabled.
Waveform output pin for output compares OCU6
13
CHAPTER 1 OVERVIEW
Table 1.7-1 Pin Description (4/7)
Pin no.
Pin name
LQFP100
*2
QFP100
*1
Circuit
type
P37
10
12
CLK
General purpose IO
G
OUT7
11, 12
P40, P41
F
General purpose IO (only for devices with S-suffix)
X0A, X1A
B
Oscillator input pins for sub-clock (only for devices without Ssuffix)
13, 14
General purpose IO
IN6
18
Data sample input pin for input capture ICU6
F
RX1
RX input pin for CAN1 Interface (MB90V340 only)
INT9R
Second external interrupt request input pin for INT10
P43
17
18
19
20
IN7
General purpose IO
F
TX Output pin for CAN1 (MB90V340 only)
P44
General purpose IO
SDA0
H
SCL0
General purpose IO
H
FRCK1
22
General purpose IO
H
SDA1
P47
21
23
P50
24
AN8
SIN2
14
Serial data I/O pin for I2C 1
General purpose IO
H
SCL1
22
Serial clock I/O pin for I2C 0
Input for the 16-bit IO Timer 1
P46
20
Serial data I/O pin for I2C 0
Input for the 16-bit IO Timer 0
P45
21
Data sample input pin for input capture ICU7
TX1
FRCK0
19
CLK output pin
This function is enabled when both the external bus and CLK
output are enabled.
Waveform output pin for output compares OCU7
P42
16
Function
Serial clock I/O pin for I2C 1
General purpose IO
O
Analog input pin for the A/D converter
Serial data input pin for UART2.
CHAPTER 1 OVERVIEW
Table 1.7-1 Pin Description (5/7)
Pin no.
Pin name
*2
LQFP100
QFP100
*1
Circuit
type
P51
23
25
AN9
General purpose IO
I
SOT2
26
AN10
General purpose IO
I
SCK2
27
AN11
General purpose IO
I
TIN3
28
AN12
General purpose IO
I
TOT3
29
General purpose IO
I
AN13
Analog input pin for the A/D converter
P56, P57
28, 29
30, 31
AN14, AN15
General purpose IO
J
DA00, DA01
General purpose IO
AN0 to AN7
36 to 43
PPG0(1),
PPG2(3),
PPG4(5),
PPG6(7),
PPG8(9),
PPGA(B),
PPGC(D),
PPGE(F)
Analog input pins for the A/D converter
I
Output pins for PPGs
P70 to P77
43 to 48,
53, 54
45 to 50,
55, 56
AN16 to
AN23
INT0 to INT7
Analog input pins for the A/D converter
D/A converter analog output pins (MB90V340 only)
P60 to P67
34 to 41
Analog input pin for the A/D converter
Output pin for the reload timer 3
P55
27
Analog input pin for the A/D converter
Event input pin for the reload timer 3
P54
26
Analog input pin for the A/D converter
Clock I/O pin for UART2
P53
25
Analog input pin for the A/D converter
Serial data output pin for UART2
P52
24
Function
General purpose IO
I
Analog input pins for the A/D converter
External interrupt request input pins for INT0 to INT7
15
CHAPTER 1 OVERVIEW
Table 1.7-1 Pin Description (6/7)
Pin no.
Pin name
LQFP100
*2
QFP100
*1
Circuit
type
P80
General purpose IO
TIN0
55
57
Event input pin for the reload timer 0
F
ADTG
Trigger input pin for the A/D converter
INT12R
Second external interrupt request input pin for INT12
P81
General purpose IO
TOT0
56
58
Output pin for the reload timer 0
F
CKOT
Output pin for the clock monitor
INT13R
Second external interrupt request input pin for INT13
P82
General purpose IO
SIN0
57
59
Serial data input pin for UART0
M
TIN2
Event input pin for the reload timer 2
INT14R
Second external interrupt request input pin for INT14
P83
58
60
SOT0
General purpose IO
F
TOT2
61
SCK0
General purpose IO
F
INT15R
62
General purpose IO
M
SIN1
Serial data input pin for UART1
P86
61
63
General purpose IO
F
SOT1
Serial data output pin for UART1
P87
62
64
General purpose IO
F
SCK1
Clock I/O pin for UART1
P90 to P93
65 to 68
16
67 to 70
Clock I/O pin for UART0
Second external interrupt request input pin for INT15
P85
60
Serial data output pin for UART0
Output pin for the reload timer 2
P84
59
Function
PPG1(0),
PPG3(2),
PPG5(4),
PPG7(6)
General purpose IO
F
Output pins for PPGs
CHAPTER 1 OVERVIEW
Table 1.7-1 Pin Description (7/7)
Pin no.
Pin name
*2
LQFP100
QFP100
*1
Circuit
type
P94 to P97
69 to 72
71 to 74
OUT0 to
OUT3
General purpose IO
F
PA0
73
75
RX0
F
General purpose IO
F
TX0
30
32
RX input pin for CAN0 Interface (MB90V340 only)
Second external interrupt request input pin for INT8
PA1
76
Waveform output pins for output compares OCU0 toOCU3
This function is enabled when the OCU enables waveform
output.
General purpose IO
INT8R
74
Function
AVCC
TX Output pin for CAN0 (MB90V340 only)
K
VCC power input pin for analog circuits
31
33
AVRH
L
Reference voltage input for the A/D Converter
Supply voltage to AVCC pin must be kept higher than or equal
to AVRH pin voltage specially when the supply voltage to
AVRH is turned on or off.
32
34
AVRL
K
Lower reference voltage input for the A/D Converter
33
35
AVSS
K
VSS power input pin for analog circuits
50, 51
52, 53
MD1, MD0
C
Input pins for specifying the operating mode
The pins must be directly connected to VCC or VSS
49
51
MD2
D
Input pin for specifying the operating mode
The pins must be directly connected to VCC or VSS
13
63
88
15
65
90
VCC
Power (3.5V to 5.5V) input pins
13
42
64
89
16
44
66
91
VSS
Power (0V) input pins
15
17
C
K
This is the power supply stabilization capacitor pin
It should be connected to a higher than or equal to 0.1µF
ceramic capacitor.
*1: FPT-100P-M06
*2: FPT-100P-M05
17
CHAPTER 1 OVERVIEW
1.8
Input-Output Circuits
Table 1.8-1 lists the input-output circuits.
■ Input-output Circuits
Table 1.8-1 I/O Circuit Types (1/5)
Type
Circuit
Remarks
A
X1
Xout
Oscillation circuit
High-speed oscillation feedback resistor =
approx. 1 MΩ
X0
Standby control signal
B
X1A
Xout
Oscillation circuit
Low-speed oscillation feedback resistor =
approx. 10 MΩ
X0A
Standby control signal
C
R
Mask ROM and EVA device:
CMOS hysteresis input pin
CMOS
hysteresis
inputs
D
R
Pull-down
Resistor
18
CMOS
hysteresis
inputs
Flash device:
CMOS input pin
Mask ROM and EVA device:
• CMOS hysteresis input pin
• Pull-down resistor value: approx. 50 kΩ
Flash device:
• CMOS input pin
• No Pull-down
CHAPTER 1 OVERVIEW
Table 1.8-1 I/O Circuit Types (2/5)
Type
Circuit
Remarks
E
• CMOS hysteresis input pin
• Pull-up resistor value: approx. 50 kΩ
Pull-up
Resistor
R
CMOS
hysteresis
inputs
• CMOS level output (IOL = 4 mA, IOH = -4 mA)
F
Pout
Nout
• CMOS hysteresis inputs (With the standby-time
input shutdown function)
• Automotive input (With the standby-time input
shutdown function)
R
CMOS hysteresis inputs
Automotive inputs
Standby control for
input shutdown
• CMOS level output (IOL = 4 mA, IOH = -4 mA)
G
pull-up control
Pout
Nout
R
• CMOS hysteresis inputs (With the standby-time
input shutdown function)
• Automotive input (With the standby-time input
shutdown function)
• TTL input (With the standby-time input
shutdown function)
• Programmable pull-up resistor: 50 kΩ approx.
CMOS hysteresis inputs
Automotive inputs
TTL input
Standby control for
input shutdown
19
CHAPTER 1 OVERVIEW
Table 1.8-1 I/O Circuit Types (3/5)
Type
Circuit
Remarks
• CMOS level output (IOL = 3 mA, IOH = -3 mA)
H
Pout
Nout
• CMOS hysteresis inputs (With the standby-time
input shutdown function)
• Automotive input (With the standby-time input
shutdown function)
R
CMOS hysteresis inputs
Automotive inputs
Standby control for
input shutdown
• CMOS level output (IOL = 4 mA, IOH = -4 mA)
I
Pout
Nout
• CMOS hysteresis inputs (With the standby-time
input shutdown function)
• Automotive input (With the standby-time input
shutdown function)
• A/D analog input
R
CMOS hysteresis inputs
Automotive inputs
Standby control for
input shutdown
Analog input
J
• CMOS level output (IOL = 4 mA, IOH = -4 mA)
• D/A analog output
Pout
Nout
R
CMOS hysteresis inputs
Automotive inputs
Standby control for
input shutdown
Analog input
Analog output
20
• CMOS hysteresis inputs (With the standby-time
input shutdown function)
• Automotive input (With the standby-time input
shutdown function)
• A/D analog input
CHAPTER 1 OVERVIEW
Table 1.8-1 I/O Circuit Types (4/5)
Type
Circuit
Remarks
K
Power supply input protection circuit
L
A/D converter ref+ (AVRH) power supply input
pin, With the protection circuit
ANE
AVR
Flash devices do not have a protection circuit
against VCC for pin AVRH
ANE
• CMOS level output (IOL = 4 mA, IOH = -4 mA)
M
Pout
Nout
• CMOS inputs (With the standby-time input
shutdown function)
• Automotive input (With the standby-time input
shutdown function)
R
CMOS inputs
Automotive inputs
Standby control for
input shutdown
N
• CMOS level output (IOL = 4 mA, IOH= -4 mA)
pull-up control
Pout
Nout
R
• CMOS inputs (With the standby-time input
shutdown function)
• Automotive input (With the standby-time input
shutdown function)
• TTL input (With the standby-time input
shutdown function)
• Programmable pull-up resistor:50 kΩ approx
CMOS inputs
Automotive inputs
TTL input
Standby control for
input shutdown
21
CHAPTER 1 OVERVIEW
Table 1.8-1 I/O Circuit Types (5/5)
Type
Circuit
Remarks
• CMOS level output (IOL = 4 mA, IOH = -4 mA)
O
Pout
Nout
R
CMOS inputs
Automotive inputs
Standby control for
input shutdown
Analog input
22
• CMOS inputs (With the standby-time input
shutdown function)
• Automotive input (With the standby-time input
shutdown function)
• A/D analog input
CHAPTER 1 OVERVIEW
1.9
Handling Device
Special care is required for the following when handling the device:
• Preventing latch-up
• Treatment of unused pins
• Using external clock
• Precautions for when not using a sub clock signal
• Notes on during operation of PLL clock mode
• Power supply pins (VCC/VSS)
•
•
•
•
•
•
•
•
•
Pull-up/down resistors
Crystal Oscillator Circuit
Turning-on Sequence of Power Supply to A/D Converter and Analog Inputs
Connection of Unused Pins of A/D Converter
Note on Energization
Initialization
Stabilization of power supply voltage
Output of Port0 to port3 during power-on (External-bus mode)
Flash security Function
■ Handling the Device
● Preventing latch-up
CMOS IC chips may suffer latch-up under the following conditions:
• A voltage higher than VCC or lower than VSS is applied to an input or output pin.
• A voltage higher than the rated voltage is applied between VCC and VSS.
• The AVCC power supply is applied before the VCC voltage.
Latch-up may increase the power supply current drastically, causing thermal damage to the device.
For the same reason, also be careful not to let the analog power-supply voltage (AVCC, AVRH) exceed the
digital power-supply voltage.
● Treatment of unused pins
Leaving unused input pins open may result in misbehavior or latch up and possible permanent damage of
the device. Therefore they must be pulled up or pulled down through resistors. In this case those resistors
should be more than 2 kΩ.
Unused bidirectional pins should be set to the output state and can be left open, or the input state with the
above described connection.
23
CHAPTER 1 OVERVIEW
● Using external clock
To use external clock, drive the X0 pin and leave X1 pin open.
Figure 1.9-1 Using External Clock
MB90860A Ser
ies
MB90590
Series
X0 (X0A)
open
X1 (X1A)
● Precautions for when not using a sub clock signal
If you do not connect pins X0A and X1A to an oscillator, use pull-down handling on the X0A pin, and
leave the X1A pin open.
● Notes on during operation of PLL clock mode
If the PLL clock mode is selected, the microcontroller attempt to be working with the self-oscillating circuit
even when there is no external oscillator or external clock input is stopped. Performance of this operation,
however, cannot be guaranteed.
● Power supply pins (VCC/VSS)
• If there are multiple VCC and VSS pins, from the point of view of device design, pins to be of the same
potential are connected the inside of the device to prevent such malfunctioning as latch up.
To reduce unnecessary radiation, prevent malfunctioning of the strobe signal due to the rise of ground
level, and to keep the recommended DC characteristics specified as the total output current, be sure to
connect the VCC and VSS pins to the power supply and ground externally.
• Connect VCC and VSS to the device from the power supply with lowest possible impedance.
• As a measure against power supply noise, connect a capacitor of about 0.1 µF as a bypass capacitor
between VCC and VSS in the vicinity of VCC and VSS pins of the device
24
CHAPTER 1 OVERVIEW
Figure 1.9-2 Power Supply Pins (VCC/VSS)
Vcc
Vss
Vcc
Vss
Vss
Vcc
MB90860A
Series
Vcc
Vss
Vss
Vcc
● Pull-up/down resistors
The MB90860A Series does not support internal pull-up/down resistors (except Port0 to Port3:
programmable pull-up resistors). Use external components where needed.
● Crystal Oscillator Circuit
Noises around X0 or X1 pins may be possible causes of abnormal operations. Make sure to provide bypass
capacitors via shortest distance from X0, X1 pins, crystal oscillator (or ceramic resonator) and ground lines,
and make sure, to the utmost effort, that lines of oscillation circuit not cross the lines of other circuits.
It is highly recommended to provide a printed circuit board art work surrounding X0 and X1 pins with a
ground area for stabilizing the operation.
● Turning-on Sequence of Power Supply to A/D Converter and Analog Inputs
Make sure to turn on the A/D converter power supply (AVCC, AVRH, AVRL) and analog inputs (AN0 to
AN23) after turning-on the digital power supply (VCC).
Turn-off the digital power after turning off the A/D converter supply and analog inputs. In this case, make
sure that the voltage not exceed AVRH or AVCC (turning on/off the analog and digital power supplies
simultaneously is acceptable).
● Connection of Unused Pins of A/D Converter
Connect unused pins of A/D converter as AVCC = VCC, AVSS = AVRH = AVRL = VSS.
25
CHAPTER 1 OVERVIEW
● Initialization
In the device, there are internal registers which are initialized only by a power-on reset. To initialize these
registers, turn on the power again.
● Stabilization of power supply voltage
If the power supply voltage varies acutely even within the operation assurance range of the VCC power
supply voltage, a malfunction may occur. The VCC power supply voltage must therefore be stabilized. As
stabilization guidelines, stabilize the power supply voltage so that VCC ripple fluctuations (peak to peak
value) in the commercial frequencies (50 to 60 Hz) fall within 10% of the standard VCC power supply
voltage and the transient fluctuation rate becomes 0.1V/ms or less in instantaneous fluctuation for power
supply switching.
● Output of Port0 to Port3 during Power-on (External-bus mode)
As shown below, when power is turned on in External-Bus mode, there is a possibility that output signal of
Port0 to Port3 might be unstable.
Figure 1.9-3 Output of Port0 to Port3 when Power is Turning
VDD5
VDD3
Port0 to Port3
Port0~3 outputs
might be unstable
Port0 to 3 outputs = Hi-Z
● Flash security Function
The security byte is located in the area of the flash memory.
If protection code "01H" is written in the security byte, the flash memory is in the protected state by
security.
Therefore, please do not write "01H" in this address if you do not use the security function.
Please refer to following table for the address of the security byte.
MB90F867A(S)
26
Flash memory size
Address for security byte
Embedded 1 Mbit Flash Memory
FE0001H
CHAPTER 2
CPU
This chapter explains the CPU.
2.1 Outline of CPU
2.2 Memory Space
2.3 Memory Space Map
2.4 Linear Addressing
2.5 Bank Addressing Types
2.6 Multi-byte Data in Memory Space
2.7 Registers
2.8 Register Bank
2.9 Prefix Codes
2.10 Interrupt Disable Instructions
27
CHAPTER 2 CPU
2.1
Outline of CPU
The F2MC-16LX CPU core is a 16-bit CPU designed for applications that require highspeed real-time processing, such as home-use or vehicle-mounted electronic
appliances. The F2MC-16LX instruction set is designed for controller applications, and
is capable of high-speed, highly efficient control processing.
■ Outline of the CPU
In addition to 16-bit data, the F2MC-16LX CPU core can process 32-bit data by using an internal 32-bit
accumulator. (32-bit data can be processed with some instructions.) Up to 16M bytes of memory space
(expandable) can be used, which can be accessed by either the linear pointer or bank method. The
instruction system, based on the F2MC-8 A-T architecture, has been reinforced by adding instructions
compatible with high-level languages, expanding addressing modes, reinforcing multiplication and division
instructions, and enhancing bit processing. The features of the F2MC-16LX CPU are explained below.
● Minimum instruction execution time: 42 ns (at 4-MHz oscillation, 6 times clock multiplication)
● Maximum memory space: 16M bytes, accessed in linear or bank mode
● Instruction set optimized for controller applications
• Rich data types: Bit, byte, word, long word
• Extended addressing modes: 23 types
• High-precision operation (32-bit length) based on 32-bit accumulator
● Powerful interrupt functions
Eight priority levels (programmable)
● CPU-independent automatic transfer
• Up to 16 channels of the extended intelligent I/O service
• Up to 16 channels of DMAC
● Instruction set compatible with high-level language (C)/multitasking
System stack pointer/instruction set symmetry/barrel-shift instructions
● Improved execution speed: 4-byte queue
28
CHAPTER 2 CPU
2.2
Memory Space
An F2MC-16LX CPU has a 16-Mbyte memory space. All data program input and output
managed by the F2MC-16LX CPU are located in this 16-Mbyte memory space. The CPU
accesses the resources by indicating their addresses using a 24-bit address bus.
■ Outline of CPU Memory Space
All I/O, programs and data are located in the 16-megabyte memory space of the F2MC-16LX CPU. The
CPU is able to access each resource through an address indicated by the 24-bit address bus.
Figure 2.2-1 shows a sample relationship between the F2MC-16LX system and memory map.
Figure 2.2-1 Sample Relationship between F2MC-16LX System and Memory
F2MC-16LX device
FFFFFFH
FFFC00H
Programs
FF0000H (*1)
Vector table area
Program area
ROM area
External area (*3)
010000H
Peripheral circuits
008000H
2
F MC-16LX
CPU
Internal Bus
007900H
001900H (*2)
Data
EI2OS
000380H
000180H
000100H
ROM Mirror area
(FF bank image)
Peripheral Function
Control Register Area
I/O area
Data Area
General-Purpose Register
EI2OS
Descriptor area
RAM area
External area (*3)
Peripheral circuits
Interrupts
0000F0H
0000C0H
0000B0H
Peripheral circuits
General-purpose
ports
000020H
000000H
Peripheral Function
Control Register Area
Interrupt Control
Register Area
Peripheral Function
Control Register Area
I/O Port Control
Register Area
I/O area
*1 The size of the internal ROM differs for each model.
*2 The size of the internal RAM differs for each model.
*3 Access is not possible in single-chip mode.
29
CHAPTER 2 CPU
■ ROM Area
● Vector table area (address: FFFC00H to FFFFFFH)
This area is used as a vector table for vector call instructions, interrupt vectors, and reset vectors.
This area is allocated at the highest addresses of the ROM area. The start address of the corresponding
processing routine is set as data in each vector table address.
● Program area (address: Up to FFFBFFH)
ROM is built in as an internal program area.
The size of internal ROM differs for each model.
■ RAM Area
● Data area (address: From 000100H to 0018FFH (for 6KByte))
The static RAM is built in as an internal data area.
The size of internal RAM differs for each model.
● General-purpose register area (address: 000180H to 00037FH)
Auxiliary registers used for 8-bit, 16-bit, and 32-bit arithmetic operations and transfer are allocated in this
area.
Since this area is allocated to a part of the RAM area, it can be used as ordinary RAM.
When this area is used as a general-purpose register, general-purpose register addressing enables highspeed access with short instructions.
● Extended intelligent I/O service (EI2OS) descriptor area (address: 000100H to 00017FH)
This area retains the transfer modes, I/O addresses, transfer count, and buffer addresses.
Since this area is allocated to a part of the RAM area, it can be used as ordinary RAM.
■ I/O Area
● Interrupt control register area (address: 0000B0H to 0000BFH)
The interrupt control registers (ICR00 to ICR15) correspond to all peripheral functions that have an
interrupt function. These registers set interrupt levels and control the extended intelligent I/O service
(EI2OS).
● Peripheral function control register area
(address: 000020H to 0000AFH , 0000C0H to 0000EFH , 007900H to 007FFFH)
This register controls the built-in peripheral functions and inputs and outputs data.
● I/O port control register area (address: 000000H to 00001FH)
This register controls I/O ports, and inputs and outputs data.
30
CHAPTER 2 CPU
■ Address Generation Types
The F2MC-16LX has the following two addressing modes:
● Linear addressing
An entire 24-bit address is specified by an instruction.
● This register Bank addressing.
The eight high-order bits of an address are specified by an appropriate bank register, and the remaining 16
low-order bits are specified by an instruction.
31
CHAPTER 2 CPU
2.3
Memory Space Map
The memory space of the MB90860A Series is shown in Figure 2.3-1.
■ Memory Space Map
The ROM data in the high-order portion of FF-bank can be seen as an image in the higher 00-bank in order
to support the small model C compiler. Since the low-order 16 bits are identical, this part of the ROM data
can be referenced without using the far specification in the pointer declaration.
For example, when "00C000H" is accessed, the contents of ROM at "FFC000H" are read. However, since
the ROM area in the FF bank exceeds 32K bytes, its entire image cannot be mirrored in the 00 bank.
The image between "FF8000H" and "FFFFFFH" is visible in bank 00, whereas the data between "FF0000H"
and "FF7FFFH" is only visible in bank FF.
Figure 2.3-1 Memory Space Map
MB90867A/S
MB90F867A/S
MB90V340
FFFFFFH
FFFFFFH
ROM(FF bank)
FF0000H
FEFFFFH
ROM(FE bank)
FC0000H
FBFFFFH
FB0000H
FAFFFFH
FA0000H
ROM(FE bank)
FE0000H
FE0000H
FDFFFFH
FD0000H
FCFFFFH
ROM(FF bank)
FF0000H
FEFFFFH
ROM(FD bank)
ROM(FC bank)
ROM(FB bank)
ROM(FA bank)
F9FFFFH
F90000H
F8FFFFH
ROM(F9 bank)
ROM(F8 bank)
F80000H
00FFFFH ROM (image of FF
bank)
008000H
007FFFH
Peripheral
007900H
0078FFH
00FFFFH ROM (image of FF
bank)
008000H
007FFFH
Peripheral
007900H
RAM 30K bytes
0018FFH
RAM 6K bytes
000100H
000100H
0000EFH
000000H
Peripheral
Access prohibited
32
0000EFH
000000H
Peripheral
CHAPTER 2 CPU
2.4
Linear Addressing
There are two types of linear addressing:
• 24-bit operand specification: Directly specifies a 24-bit address using operands.
• 32-bit register indirect specification:Indirectly specifies the 24 low-order bits of a 32bit general-purpose register value as the
address.
■ 24-bit Operand Specification
Figure 2.4-1 shows an example of 24-bit operand specification. Figure 2.4-2 shows an example of 32-bit
register indirect specification.
Figure 2.4-1 Example of Linear Method (24-bit Register Operand Specification)
JMPP 123456 H
Old program counter
+ program bank
17
17452D H
452D
JMPP 123456 H
123456 H
New program counter
+ program bank
12
Next instruction
3456
Figure 2.4-2 Example of Linear Method (32-bit Register Indirect Specification)
MOV A, @RL1+7
Old AL
090700 H
XXXXH
3A
+7
RL1
240906F9
(The high-order eight bits are ignored.)
New AL
003AH
33
CHAPTER 2 CPU
2.5
Bank Addressing Types
In the bank method, the 16-Mbyte space is divided into 256 64-Kbyte banks. The
following five bank registers are used to specify the banks corresponding to each
space:
• Program bank register (PCB)
• Data bank register (DTB)
• User stack bank register (USB)
• System stack bank register (SSB)
• Additional data bank register (ADB)
■ Bank Addressing Types
● Program bank register (PCB)
The 64-Kbyte bank specified by the PCB is called a program (PC) space. The PC space contains instruction
codes, vector tables, and immediate value data, for example.
● Data bank register (DTB)
The 64-Kbyte bank specified by the DTB is called a data (DT) space. The DT space contains readable/
writable data, and control/data registers for internal and external resources.
● User stack bank register (USB)/system stack bank register (SSB)
The 64-Kbyte bank specified by the USB or SSP is called a stack (SP) space. The SP space is accessed
when a stack access occurs during a push/pop instruction or interrupt register saving. The S flag in the
condition code register determines the stack space to be accessed.
● Additional data bank register (ADB)
The 64-Kbyte bank specified by the ADB is called an additional (AD) space. The AD space, for example,
contains data that cannot fit into the DT space.
Table 2.5-1 lists the default spaces used in each addressing mode, which are pre-determined to improve
instruction coding efficiency. To use a non-default space for an addressing mode, specify a prefix code
corresponding to a bank before the instruction. This enables access to the bank space corresponding to the
specified prefix code.
After reset, the DTB, USB, SSB, and ADB are initialized to "00H". The PCB is initialized to a value
specified by the reset vector. After reset, the DT, SP, and AD spaces are allocated in bank "00H"
("000000H" to "00FFFFH"), and the PC space is allocated in the bank specified by the reset vector.
34
CHAPTER 2 CPU
Table 2.5-1 Default Space
Default space
Program space
Addressing mode
PC indirect, program access, branch
Data space
Addressing mode using @RW0, @RW1, @RW4, or @RW5, @A, addr16, and dir
Stack space
Addressing mode using PUSHW, POPW, @RW3, or @RW7
Additional space
Addressing mode using @RW2 or @RW6
Figure 2.5-1 is an example of a memory space divided into register banks.
Figure 2.5-1 Physical Addresses of Each Space
FFFFFF H
Program space
FF0000 H
FF H
:
PCB (Program bank register)
B3 H
: ADB (Additional data bank register)
92 H
: USB (User stack bank register)
68 H
: DTB (Data bank register)
4B H
: SSB (System stack bank register)
B3FFFF H
Additional space
Physical address
B30000 H
92FFFF H
User stack space
920000 H
68FFFF H
680000 H
Data space
4BFFFF H
System stack space
4B0000 H
000000 H
35
CHAPTER 2 CPU
2.6
Multi-byte Data in Memory Space
Data is written to memory from the low-order addresses. Therefore, for a 32-bit data
item, the low-order 16 bits are transferred before the high-order 16 bits.
If a reset signal is input immediately after the low-order bits are written, the high-order
bits might not be written.
■ Multi-byte Data Allocation in Memory Space
Figure 2.6-1 is a diagram of multi-byte data configuration in memory. The low-order eight bits of a data
item are stored at address n, then address n+1, address n+2, address n+3, etc.
Figure 2.6-1 Sample Allocation of Multi-byte Data in Memory
MSB
"H"
LSB
01010101B
11001100B
11111111B
00010100B
01010101B
11001100B
11111111B
Address n
00010100B
"L"
■ Accessing Multi-byte Data
Fundamentally, accesses are made within a bank. For an instruction accessing a multi-byte data item,
address "FFFFH" is followed by address "0000H" of the same bank. Figure 2.6-2 is an example of an
instruction accessing multi-byte data.
Figure 2.6-2 Execution of MOVW A, 080FFFFH
"H"
80FFFF H
AL before execution
??
AL after execution
23 H
??
01H
·
·
·
800000 H
23 H
"L"
36
01H
CHAPTER 2 CPU
2.7
Registers
The F2MC-16LX registers are largely classified into two types: special registers in the
CPU and general-purpose registers in memory. The special registers are dedicated
internal hardware of the CPU, and they have specific use defined by the CPU
architecture. The general-purpose registers share the CPU address space with RAM.
The general-purpose registers are the same as the special registers in that they can be
accessed without using an address. The applications of the general-purpose registers
can be specified by the user however, as is ordinary memory space.
■ Special Registers
The F2MC-16LX CPU core has the following special registers:
• Accumulator (A=AH:AL): Two 16-bit accumulators (Can be used as a single 32-bit accumulator.)
• User stack pointer (USP): 16-bit pointer indicating the user stack area
• System stack pointer (SSP): 16-bit pointer indicating the system stack area
• Processor status (PS): 16-bit register indicating the system status
• Program counter (PC): 16-bit register holding the address of the program
• Program bank register (PCB): 8-bit register indicating the PC space
• Data bank register (DTB): 8-bit register indicating the DT space
• User stack bank register (USB): 8-bit register indicating the user stack space
• System stack bank register (SSB): 8-bit register indicating the system stack space
• Additional data bank register (ADB): 8-bit register indicating the AD space
• Direct page register (DPR): 8-bit register indicating a direct page
Figure 2.7-1 is a diagram of the special registers.
37
CHAPTER 2 CPU
Figure 2.7-1 Special Registers
AH
AL
Accumulator
USP
User stack pointer
SSP
System stack pointer
PS
Processor status
PC
Program counter
DPR
Direct page register
PCB
Program bank register
DTB
Data bank register
USB
User stack bank register
SSB
System stack bank register
ADB
Additional data bank register
8 bit
16 bit
32 bit
38
CHAPTER 2 CPU
■ General-purpose Registers
The F2MC-16LX general-purpose registers are located from addresses "000180H" to "00037FH" (maximum
configuration) of main storage. The register bank pointer (RP) indicates which of the above addresses are
currently being used as a register bank. Each bank has the following three types of registers. These registers
are mutually dependent as described in Figure 2.7-2.
• R0 to R7: 8-bit general-purpose register
• RW0 to RW7: 16-bit general-purpose register
• RL0 to RL3: 32-bit general-purpose register
Figure 2.7-2 General-purpose Registers
MSB
LSB
16 bit
000180 H + RP*10 H
RW0
Low-order
RL0
First address of
general-purpose register
RW1
RW2
RL1
RW3
R1
R0
RW4
R3
R2
RW5
R5
R4
RW6
R7
R6
RW7
RL2
RL3
High-order
The relationship between the high-order and low-order bytes of a byte or word register is expressed as
follows:
RW (i+4) = R (i×2+1) × 256+R (i×2) [i=0 to 3]
The relationship between the high-order and low-order bytes of Rli and RW can be expressed as follows:
RL (i) = RW (i×2+1) × 65536+RW (i×2) [i=0 to 3]
39
CHAPTER 2 CPU
2.7.1
Accumulator (A)
The accumulator (A) register consists of two 16-bit arithmetic operation registers (AH
and AL), and is used as a temporary storage for operation results and transfer data.
■ Accumulator (A)
The A register consists of two 16-bit arithmetic operation registers (AH and AL). The A register is used as
a temporary storage for operation results and transfer data. During 32-bit data processing, AH and AL are
used together. Only AL is used for word processing in 16-bit data processing mode or for byte processing
in 8-bit data processing mode (see Figure 2.7-3 and Figure 2.7-4). The data stored in the A register can be
operated upon with the data in memory or registers (Ri, Rwi, or Rli). In the same manner as with the
F2MC-8L, when a word or shorter data item is transferred to AL, the previous data item in AL is
automatically sent to AH (data preservation function). The data preservation function and operation
between AL and AH help improve processing efficiency.
When a byte or shorter data item is transferred to AL, the data is sign-extended or zero-extended and stored
as a 16-bit data item in AL. The data in AL can be handled either as word or byte long.
When a byte-processing arithmetic operation instruction is executed on AL, the high-order eight bits of AL
before operation are ignored. The high-order eight bits of the operation result all become zeroes.
The A register is not initialized by a reset. The A register holds an undefined value immediately after a
reset.
Figure 2.7-3 32-bit Data Transfer
MO VL A,@R W1+6
Old A
XXXX H
MSB
XXXX H
A6 H
DTB
New A
8F74 H
AH
LSB
A61540 H
8F H
74 H
A6153E H
2B H
52 H
15 H
38 H
+6
2B52 H
RW1
AL
Figure 2.7-4 AL-AH Transfer
MSB
MO VW A,@R W1+6
Old A
XXXX H
1234 H
DTB
New A
40
1234 H
1234 H
A6 H
LSB
A61540 H
8F H
74 H
A6153E H
2B H
52 H
15 H
38 H
+6
RW1
CHAPTER 2 CPU
2.7.2
User Stack Pointer (USP) and System Stack Pointer
(SSP)
USP and SSP are 16-bit registers that indicate the memory addresses for saving and
restoring data when a push/pop instruction or subroutine is executed.
■ User Stack Pointer (USP) and System Stack Pointer (SSP)
USP and SSP are 16-bit registers that indicate the memory addresses for saving and restoring data in the
event of a push/pop instruction or subroutine execution. The USP and SSP registers are used by stack
instructions. The USP register is enabled when the S flag in the processor status register is "0", and the SSP
register is enabled when the S flag is "1" (see Figure 2.7-5). Since the S flag is set when an interrupt is
accepted, register values are always saved in the memory area indicated by SSP during interrupt
processing. SSP is used for stack processing in an interrupt routine, while USP is used for stack processing
outside an interrupt routine. If the stack space is not divided, use only the SSP.
During stack processing, the high-order eight bits of an address are indicated by SSB (for SSP) or USB (for
USP). USP and SSP are not initialized by a reset. Instead, they hold undefined values.
Figure 2.7-5 Stack Manipulation Instruction and Stack Pointer
Example 1 PUSHW A when the S flag is '0'
Before execution
AL
S flag
After execution
AL
MSB
C6F326 H
LSB
A624 H
USB
C6 H
USP
F328 H
0
SSB
56 H
SSP
1234 H
A624 H
USB
C6 H
USP
F326 H
0
SSB
56 H
SSP
1234 H
C6F326 H
A6 H
24 H
A624 H
USB
C6 H
USP
F328 H
561232 H
XX
XX
1
SSB
56 H
SSP
1234 H
A624 H
USB
C6 H
USP
F328 H
561232 H
A6 H
24 H
1
SSB
56 H
SSP
1232 H
XX
XX
User stack is used because
the S flag is '0.'
Example 2 PUSHW A when the S flag is '1'
AL
AL
System stack is used because
the S flag is "1".
Note:
Specify an even-numbered address in the stack pointer whenever possible.
41
CHAPTER 2 CPU
2.7.3
Processor Status (PS)
The PS register consists of the bits controlling the CPU Operation and the bits
indicating the CPU status.
■ Processor Status (PS)
As shown in Figure 2.7-6, the high-order byte of the PS register consists of a register bank pointer (RP) and
an interrupt level mask register (ILM). The RP indicates the start address of a register bank. The low-order
byte of the PS register is a condition code register (CCR), containing the flags to be set or reset depending
on the results of instruction execution or interrupt occurrences.
Figure 2.7-6 Processor Status (PS) Structure
15
PS
13 12
0
8 7
ILM
CCR
RP
■ Condition Code Register (CCR)
Figure 2.7-7 is a diagram of condition code register configuration.
Figure 2.7-7 Condition Code Register (CCR) Configuration
Initial value
7
6
5
4
3
2
1
0
-
I
S
T
N
Z
V
C
-
0
1
*
*
*
*
*
: CCR
*: Undefined
● I: Interrupt enable flag:
Interrupts other than software interrupts are enabled when the I flag is 1 and are masked when the I flag is
0. The I flag is cleared by a reset.
● S: Stack flag:
When the S flag is 0, USP is enabled as the stack manipulation pointer.
When the S flag is 1, SSP is enabled as the stack manipulation pointer.
The S flag is set by an interrupt reception or a reset.
42
CHAPTER 2 CPU
● T: Sticky bit flag:
1 is set in the T flag when there is at least one "1" in the data shifted out from the carry after execution of a
logical right/arithmetic right shift instruction. Otherwise, 0 is set in the T flag. In addition, "0" is set in the
T flag when the shift amount is zero.
● N: Negative flag:
The N flag is set when the MSB of the operation result is "1", and is otherwise cleared.
● Z: Zero flag:
The Z flag is set when the operation result is all zeroes, and is otherwise cleared.
● V: Overflow flag:
The V flag is set when an overflow of a signed value occurs as a result of operation execution and is
otherwise cleared.
● C: Carry flag:
The C flag is set when a carry-up or carry-down from the MSB occurs as a result of operation execution,
and is otherwise cleared.
■ Register Bank Pointer (RP)
The RP register indicates the relationship between the general-purpose registers of the F2MC-16LX and the
internal RAM addresses. Specifically, the RP register indicates the first memory address of the currently
used register bank in the following conversion expression: [00180H + (RP) × 10H] (see Figure 2.7-8). The
RP register consists of five bits, and can take a value between "00H" and "1FH". Register banks can be
allocated at addresses from "000180H" to "00037H" in memory. Even within that range, however, the
register banks cannot be used as general-purpose registers if the banks are not in internal RAM. The RP
register is initialized to all zeroes by a reset. An instruction may transfer an eight-bit immediate value to the
RP register; however, only the low-order five bits of that data are used.
Figure 2.7-8 Register Bank Pointer (RP)
Initial value
B4
B3
B2
B1
0
0
0
0
B0
: RP
0
43
CHAPTER 2 CPU
■ Interrupt Level Mask Register (ILM)
The ILM register consists of three bits, indicating the CPU interrupt masking level. An interrupt request is
accepted only when the level of the interrupt is higher than that indicated by these three bits. Level 0 is the
highest priority interrupt, and level 7 is the lowest priority interrupt (see Table 2.7-1). Therefore, for an
interrupt to be accepted, its level value must be smaller than the current ILM value. When an interrupt is
accepted, the level value of that interrupt is set in ILM. Thus, an interrupt of the same or lower level cannot
be accepted subsequently. ILM is initialized to all zeroes by a reset. An instruction may transfer an eight-bit
immediate value to the ILM register, but only the low-order three bits of that data are used.
Figure 2.7-9 Interrupt Level Register (ILM)
Initial value
ILM2
ILM1
ILM0
0
0
0
: ILM
Table 2.7-1 Levels Indicated By the Interrupt Level Mask (ILM) Register
44
ILM2
ILM1
ILM0
Level value
Acceptable interrupt level
0
0
0
0
Interrupt disabled
0
0
1
1
0 only
0
1
0
2
Level value smaller than 1
0
1
1
3
Level value smaller than 2
1
0
0
4
Level value smaller than 3
1
0
1
5
Level value smaller than 4
1
1
0
6
Level value smaller than 5
1
1
1
7
Level value smaller than 6
CHAPTER 2 CPU
2.7.4
Program Counter (PC)
The PC register is a 16-bit counter that indicates the low-order 16 bits of the memory
address of an instruction code to be executed by the CPU. The high-order eight bits of
the address are indicated by the PCB. The PC register is updated by a conditional
branch instruction, subroutine call instruction, interrupt, or reset.The PC register can
also be used as a base pointer for operand access.
■ Program Counter (PC)
Figure 2.7-10 shows the program counter.
Figure 2.7-10 Program Counter
PCB
FE H
PC
ABCD H
Next instruction to be executed
FEABCD H
45
CHAPTER 2 CPU
2.8
Register Bank
A register bank consists of eight words. The register bank can be used as the following
general-purpose registers for arithmetic operations: byte registers R0 to R7, word
registers RW0 to RW7, and long word registers RL0 to RL3. In addition, the register
bank can be used as instruction pointers.
■ Register Bank
Table 2.8-1 lists the functions of the registers. Table 2.8-2 indicates the relationship between the registers.
In the same manner as for an ordinary RAM area, the register bank values are not initialized by a reset. The
status before a reset is maintained. When the power is turned on, however, the register bank will have an
undefined value.
Table 2.8-1 Register Functions
R0 to R7
Used as operands of instructions.
Note: R0 is also used as a counter for barrel shift or normalization instructions.
RW0 to RW7
Used as pointers.
Used as operands of instructions.
Note: RW0 is used as a counter for string instructions.
RL0 to RL3
Used as long pointers.
Used as operands of instructions.
Table 2.8-2 Relationship between Registers
RW0
RL0
RW1
RW2
RL1
RW3
R0
RW4
R1
RL2
R2
RW5
R3
R4
RW6
R5
RL3
R6
RW7
R7
46
CHAPTER 2 CPU
● Direct page register (DPR) <Initial value: 01H>
DPR specifies addr8 to addr15 of the instruction operands in direct addressing mode as shown in Figure
2.8-1. DPR is eight bits long, and is initialized to "01H" by a reset. DPR can be read or written to by an
instruction.
Figure 2.8-1 Generating a Physical address in Direct Addressing Mode
DTB register
DPR register
Direct address during instruction
αααααααα
ββββββββ
γγγγγγγγ
LSB
MSB
24-bit physical
address
ααααααααββββββββγγγγγγγγ
● Program counter bank register (PCB) <Initial value: Value in reset vector>
● Data bank register (DTB) <Initial value: 00H>
● User stack bank register (USB) <Initial value: 00H>
● System stack bank register (SSB) <Initial value: 00H>
● Additional data bank register (ADB) <Initial value: 00H>
Each bank register indicates the memory bank where the PC, DT, SP (user), SP (system), or AD space is
allocated. All bank registers are one byte long. PCB is initialized to "00H" by a reset. Bank registers other
than PCB can be read or written to. PCB can be read but cannot be written to.
PCB is updated when the JMPP, CALLP, RETP, RETIQ, or RETF instruction branching to the entire 16Mbyte space is executed or when an interrupt occurs. For operation of each register, see Section "2.2
Memory Space".
47
CHAPTER 2 CPU
2.9
Prefix Codes
Placing a prefix code before an instruction partially changes the operation of the
instruction. Three types of prefix codes can be used: bank select prefix, common
register bank prefix, and flag change disable prefix.
■ Bank Select Prefix
The memory space used for accessing data is determined for each addressing mode.
When a bank select prefix is placed before an instruction, the memory space used for accessing data by that
instruction can be selected regardless of the addressing mode.
Table 2.9-1 lists the bank select prefixes and the corresponding memory spaces.
Table 2.9-1 Bank Select Prefix
Bank select prefix
Space selected
PCB
PC space
DTB
Data space
ADB
AD space
SPB
Either the SSP or USP space is used according to the stack flag value.
Use the following instructions with care:
● String instructions (MOVS, MOVSW, SCEQ, SCWEQ, FILS, FILSW)
The bank register specified by an operand is used regardless of the prefix.
● Stack manipulation instructions (PUSHW, POPW)
SSB or USB is used according to the S flag regardless of the prefix.
● I/O access instructions
MOV A, io / MOV io, A /MOVX A, io / MOVW A, io /MOVW io, A / MOV io, #imm8
MOV io, #imm16 / MOVB A, io:bp / MOB io:bp, A /SETB io:bp / CLRB io:bp
BBC io:bp, rel / BBS io:bp, rel WBTC, WBTS
The I/O space of the bank is used regardless of the prefix.
● Flag change instructions (AND CCR,#imm8, OR CCR,#imm8)
The instruction is executed normally, but the prefix affects the next instruction.
● POPW PS
SSB or USB is used according to the S flag regardless of the prefix. The prefix affects the next instruction.
● MOV ILM,#imm8
The instruction is executed normally, but the prefix affects the next instruction.
48
CHAPTER 2 CPU
● RETI
SSB is used regardless of the prefix.
■ Common Register Bank Prefix (CMR)
To simplify data exchange between multiple tasks, the same register bank must be accessed relatively
easily regardless of the RP value. When CMR is placed before an instruction that accesses a register bank,
that instruction accesses the common bank (the register bank selected when RP=0) at addresses from
"000180H" to "00018FH" regardless of the current RP value. Use the following instructions with care:
● String instructions (MOVS, MOVSW, SCEQ, SCWEQ, FILS, FILSW)
If an interrupt request occurs during execution of a string instruction with a prefix code, the prefix code
becomes invalid when the string instruction is resumed after the interrupt is processed. Thus, the string
instruction is executed falsely after the interrupt is processed. Do not prefix any of the above string
instructions with CMR.
● Flag change instructions (AND CCR,#imm8, OR CCR,#imm8, POPW PS)
The instruction is executed normally, but the prefix affects the next instruction.
● MOV ILM,#imm8
The instruction is executed normally, but the prefix affects the next instruction.
■ Flag Change Disable Prefix (NCC)
To disable flag changes, use the flag change disable prefix code (NCC). Placing NCC before an instruction
disables flag changes associated with that instruction. Use the following instructions with care:
● String instructions (MOVS, MOVSW, SCEQ, SCWEQ, FILS, FILSW)
If an interrupt request occurs during execution of a string instruction with a prefix code, the prefix code
becomes invalid when the string instruction is resumed after the interrupt is processed. Thus, the string
instruction is executed incorrectly after the interrupt is processed. Do not prefix any of the above string
instructions with NCC.
● Flag change instructions (AND CCR,#imm8, OR CCR,#imm8, POPW PS)
The instruction is executed normally, but the prefix affects the next instruction.
● Interrupt instructions (INT #vct8, INT9, INT addr16, INTP addr24, RETI)
CCR changes according to the instruction specifications regardless of the prefix.
● JCTX @A
CCR changes according to the instruction specifications regardless of the prefix.
● MOV ILM,#imm8
The instruction is executed normally, but the prefix affects the next instruction.
49
CHAPTER 2 CPU
2.10
Interrupt Disable Instructions
Interrupt requests are not sampled for the following ten instructions:
- MOV ILM,#imm8
- PCB
- SPB
- OR
CCR,#imm8
- AND CCR,#imm8
- ADB
- CMR
- POPW PS
- NCC
- DTB
■ Interrupt Disable Instructions
If a valid interrupt request occurs during execution of any of the above instructions, the interrupt can be
processed only when an instruction other than the above is executed. For details, see Figure 2.10-1.
Figure 2.10-1 Interrupt Disable Instruction
Interrupt disable instruction
••••••••
(a)
•••
(a) Ordinary
instruction
Interrupt request
Interrupt acceptance
■ Restrictions on Interrupt Disable Instructions and Prefix Instructions
When a prefix code is placed before an interrupt disable instruction, the prefix code affects the first
instruction after the code other than the interrupt disable instruction. For details, see Figure 2.10-2.
Figure 2.10-2 Interrupt Disable Instructions and Prefix Codes
Interrupt disable instruction
MOV A, FF H
NCC
••••
MOV ILM,#imm8
ADD A,01 H
CCR:XXX10XXB
CCR:XXX10XXB
CCR does not change with NCC.
■ Consecutive Prefix Codes
When competitive prefix codes are placed consecutively, the latter becomes valid.
In the figure below, competitive prefix codes are PCB, ADB, DTB, and SPB. For details, see Figure 2.10-3.
Figure 2.10-3 Consecutive Prefix Codes
Prefix code
•••••
ADB
DTB
PCB
ADD A,01H
••••
PCB is valid as the prefix code
50
CHAPTER 3
INTERRUPTS
This chapter explains the interrupt functions and
operations.
3.1 Outline of Interrupts
3.2 Interrupt Vector
3.3 Interrupt Control Registers (ICR)
3.4 Interrupt Flow
3.5 Hardware Interrupts
3.6 Software Interrupts
3.7 Extended Intelligent I/O Service (EI2OS)
3.8 Operation Flow of and Procedure for Using the Extended Intelligent
I/O Service (EI2OS)
3.9 µDMAC Interrupt
3.10 Exceptions
51
CHAPTER 3 INTERRUPTS
3.1
Outline of Interrupts
The F2MC-16LX has interrupt functions that terminate the currently executing
processing and transfer control to another specified program when a specified event
occurs. There are five types of interrupt functions:
• Hardware interrupt : Interrupt processing due to an internal resource event
• Software interrupt : Interrupt processing due to a software event occurrence
instruction
• Extended intelligent I/O service (EI2OS): Transfer processing due to an internal
resource event
• DMAC: Transfer processing due to an internal resource event.
• Exception: Termination due to an operation exception
■ Hardware Interrupts
A hardware interrupt is activated by an interrupt request from an internal resource. A hardware interrupt
request occurs when both the interrupt request flag and the interrupt enable flag in an internal resource are
set. Therefore, an internal resource must have an interrupt request flag and interrupt enable flag to issue a
hardware interrupt request.
● Specifying an interrupt level
An interrupt level can be specified for the hardware interrupt. To specify an interrupt level, use
the level setting bits (IL0, IL1, and IL2) of the interrupt controller.
● Masking a hardware interrupt request
A hardware interrupt request can be masked by using the I flag of the processor status register
(PS) in the CPU and the ILM bits (IL0, IL1, and IL2). When an unmasked interrupt request
occurs, the CPU saves 12 bytes of data that consists of registers PS, PC, PCB, DTB, ADB, DPR,
and A in the memory area indicated by the SSB and SSP registers.
52
CHAPTER 3 INTERRUPTS
Figure 3.1-1 Overview of Hardware Interrupts
PS
Register file
I
ILM
IR
F2MC-16 bus
Microcode
Check
Comparator
PS
I
ILM
IR
:
:
:
:
Processor status
Interrupt enable flag
Interrupt level mask register
Instruction register
F2M C - 1 6 LX . CPU
Enable FF
AND
Cause FF
Interrupt level IL
Level comparator
Peripheral
Interrupt
controller
■ Software Interrupts
Interrupts requested by executing the INT instruction are software interrupts. An interrupt request by the
INT instruction does not have an interrupt request or enable flag. An interrupt request is issued always by
executing the INT instruction.
No interrupt level is assigned to the INT instruction. Therefore, ILM is not updated when the INT
instruction is used. Instead, the I flag is cleared and the continuing interrupt requests are suspended.
Figure 3.1-2 Overview of Software Interrupts
PS
Register file
I
F2MC-16
bus
IR
B unit
Microcode
F 2 M C - 1 6 LX · C P U
S
Queue
PS
I
ILM
IR
B unit
:
:
:
:
:
Processor status
Interrupt enable flag
Interrupt level mask register
Instruction register
Bus interface unit
Fetch
Save
Instruction bus
RAM
53
CHAPTER 3 INTERRUPTS
■ Extended Intelligent I/O Service (EI2OS)
The extended intelligent I/O service automatically transfers data between an internal resource and memory.
This processing is traditionally performed by an interrupt processing program, but the EI2OS enables data
to be transferred in a manner similar to a DMA (direct memory access) operation.
To activate the extended intelligent I/O service function from an internal resource, the interrupt control
register (ICR) of the interrupt controller must have an extended intelligent I/O service enable flag (ISE).
The extended intelligent I/O service is started when an interrupt request occurs with 1 specified in the ISE
flag. To generate a normal interrupt using a hardware interrupt request, set the ISE flag to 0.
Figure 3.1-3 Overview of the Extended Intelligent I/O Service (EI2OS)
Memory space
by IOA
I/O register
I/O register
Peripheral
Interrupt request
CPU
➂
➂
ISD
by ICS
➁
➀
Interrupt control register
Interrupt controller
by BAP
➃
54
Buffer
➀ I/O requests transfer.
➁ The interrupt controller selects the
descriptor.
➂ The transfer source and the transfer
destination are read from the
by DCT
descriptor.
➃ Data is transferred between I/O and
memory.
CHAPTER 3 INTERRUPTS
■ Direct Memory access (DMA)
DMA is a function used to automatically transfer data between peripheral functions and memory. Previous
data transfers by an interrupt processing program is provided in the same way as the direct memory access
(DMA). When a transfer of data of a specified count is completed, an interrupt processing program is
automatically executed.
Interrupt by DMA is a type of hardware interrupts.
Figure 3.1-4 Overview of the Direct Memory access (DMA)
Memory space IOA
I/O register
I/O register
Peripheral
function
(I/O)
RAM for
descriptor
(1)
(4)(a)
(2)
(3)
DMA controller
DMA
descriptor
(2)
(4) (b)
BAP
Buffer
CPU
Interrupt controller
IOA: I/O address pointer
BAP: Buffer address pointer
DER: DMA enable register
DCT: Data counter
DCT
(1) The peripheral resource (I/O) requests DMA transfer.
(2) When the corresponding bit of DMA enable register (DER) is "1", DMAC reads from the descriptor the transfer data
such as the transfer source address, transfer destination address, and transfer count of specified channels.
(3) DMA data transfer is started between I/O and memory.
(4) After one item(either Byte data or Word data) transferred
(a) Transfer has not been completed (DCT does not reached to 0):
µDMAC requests to clear the DMA transfer request to the peripheral resource.
(b) At transfer end(DCT reached to 0):
After completion of DMA transfer, the flag indicating completion of transfer is set in the DMA status register,
outputting an interrupt request to the interrupt controller.
* Write access to the internal registers DCSR, DSRH, DSRL, DSSR, DERH, and DERL is prohibited during DMA transfer.
■ Exceptions
Exception processing is basically the same as interrupt processing. When an exception is detected between
instructions, exception processing is performed. In general, exception processing occurs as a result of an
unexpected operation. Therefore, use exception processing only for debugging programs or for activating
recovery software in an emergency.
55
CHAPTER 3 INTERRUPTS
3.2
Interrupt Vector
An interrupt vector uses the same area for both hardware and software interrupts. For
example, interrupt request number INT42 is used for a delayed hardware interrupt and
for software interrupt INT #42. Therefore, the delayed interrupt and INT #42 call the
same interrupt processing routine. Interrupt vectors are allocated between addresses
"FFFC00H" and "FFFFFFH" as shown in Table 3.2-1.
■ Interrupt Vector
Table 3.2-1 Interrupt Vectors (1/2)
Interrupt
request
Interrupt cause
Interrupt control
register
Number
Address
Vector
address L
Vector
address H
Vector
address
bank
Mode
register
INT 0 *
-
-
-
FFFFFCH
FFFFFDH
FFFFFEH
Unused
INT 1 *
-
-
-
FFFFF8H
FFFFF9H
FFFFFAH
Unused
-
-
-
.
.
.
.
.
.
.
.
.
.
.
.
-
-
-
FFFFE0H
FFFFE1H
FFFFE2H
Unused
.
.
.
INT 7 *
INT 8
Reset
-
-
FFFFDCH
FFFFDDH
FFFFDEH
FFFFDFH
INT 9
INT9 instruction
-
-
FFFFD8H
FFFFD9H
FFFFDAH
Unused
INT 10
Exception
-
-
FFFFD4H
FFFFD5H
FFFFD6H
Unused
INT 11
Reserved
FFFFD1H
FFFFD2H
Unused
0000B0H
FFFFD0H
ICR00
FFFFCCH
FFFFCDH
FFFFCEH
Unused
FFFFC8H
FFFFC9H
FFFFCAH
Unused
FFFFC4H
FFFFC5H
FFFFC6H
Unused
FFFFC0H
FFFFC1H
FFFFC2H
Unused
FFFFBCH
FFFFBDH
FFFFBEH
Unused
FFFFB8H
FFFFB9H
FFFFBAH
Unused
FFFFB4H
FFFFB5H
FFFFB6H
Unused
FFFFB0H
FFFFB1H
FFFFB2H
Unused
FFFFACH
FFFFADH
FFFFAEH
Unused
FFFFA8H
FFFFA9H
FFFFAAH
Unused
FFFFA4H
FFFFA5H
FFFFA6H
Unused
INT 12
Reserved
INT 13
Input Capture 6
ICR01
INT 14
Input Capture 7
INT 15
I2C 0
INT 16
(Reserved)
INT 17
16-bit Reload Timer 0
ICR02
ICR03
INT 18
16-bit Reload Timer 1
INT 19
16-bit Reload Timer 2
ICR04
INT 20
16-bit Reload Timer 3
INT 21
PPG0/PPG1/PPG4/PPG5
ICR05
INT 22
56
PPG2/PPG3/PPG6/PPG7
0000B1H
0000B2H
0000B3H
0000B4H
0000B5H
CHAPTER 3 INTERRUPTS
Table 3.2-1 Interrupt Vectors (2/2)
Interrupt
request
INT 23
Interrupt cause
Interrupt control
register
Number
Address
ICR06
0000B6H
PPG8/PPG9/PPGC/PPGD
INT 24
PPGA/PPGB/PPGE/PPGF
INT 25
Time Base Timer
INT 26
External Interrupt 0 to 3/8
to 11
INT 27
Watch Timer
INT 28
External Interrupt 4 to 7/12
to 15
INT 29
A/D Converter
ICR07
ICR08
ICR09
INT 30
I/O Timer 0/1
INT 31
Input Capture 4/5 / I2C1
INT 32
Output Compare 0/1/4/5
INT 33
Input Capture 0 to 3
ICR10
ICR11
INT 34
Output Compare 2/3/6/7
INT 35
UART 0 RX
ICR12
INT 36
UART 0 TX
INT 37
UART 1 RX / UART3 RX
ICR13
INT 38
UART 1 TX / UART 3 TX
INT 39
UART 2 RX / UART 4 RX
ICR14
INT 40
UART 2 TX / UART 4 TX
INT 41
Flash Memory
ICR15
INT 42
INT 43
Delayed Interrupt
0000B7H
0000B8H
0000B9H
0000BAH
0000BBH
0000BCH
0000BDH
0000BEH
0000BFH
Vector
address L
Vector
address H
Vector
address
bank
Mode
register
FFFFA0H
FFFFA1H
FFFFA2H
Unused
FFFF9CH
FFFF9DH
FFFF9EH
Unused
FFFF98H
FFFF99H
FFFF9AH
Unused
FFFF94H
FFFF95H
FFFF96H
Unused
FFFF90H
FFFF91H
FFFF92H
Unused
FFFF8CH
FFFF8DH
FFFF8EH
Unused
FFFF88H
FFFF89H
FFFF8AH
Unused
FFFF84H
FFFF85H
FFFF86H
Unused
FFFF80H
FFFF81H
FFFF82H
Unused
FFFF7CH
FFFF7DH
FFFF7EH
Unused
FFFF78H
FFFF79H
FFFF7AH
Unused
FFFF74H
FFFF75H
FFFF76H
Unused
FFFF70H
FFFF71H
FFFF72H
Unused
FFFF6CH
FFFF6DH
FFFF6EH
Unused
FFFF68H
FFFF69H
FFFF6AH
Unused
FFFF64H
FFFF65H
FFFF66H
Unused
FFFF60H
FFFF61H
FFFF62H
Unused
FFFF5CH
FFFF5DH
FFFF5EH
Unused
FFFF58H
FFFF59H
FFFF5AH
Unused
FFFF54H
FFFF55H
FFFF56H
Unused
-
-
-
FFFF50H
FFFF51H
FFFF52H
Unused
-
-
-
.
.
.
.
.
.
.
.
.
.
.
.
INT 254
-
-
-
FFFC04H
FFFC05H
FFFC06H
Unused
INT 255
-
-
-
FFFC00H
FFFC01H
FFFC02H
Unused
.
.
.
*: When PCB is "FFH", the vector area for the CALLV instruction is the same as that for INT #vct8 (#0 to #7).
Care must be taken when using the vector for the CALLV instruction.
57
CHAPTER 3 INTERRUPTS
3.3
Interrupt Control Registers (ICR)
The interrupt control registers are in the interrupt controller. Each interrupt control
register has a corresponding I/O that has an interrupt function. The interrupt control
registers have the following three functions:
• Setting an interrupt level for corresponding peripherals
• Selecting whether to use an ordinary interrupt or extended intelligent I/O service for
the corresponding peripherals
• Selecting the extended intelligent I/O service channel
Do not access an interrupt control register by using a read-modify-write instruction, as
doing so causes a misoperation.
■ Interrupt Control Register (ICR)
Figure 3.3-1 is a diagram of the bit configuration of an interrupt control register.
Figure 3.3-1 Interrupt Control Register (ICR)
8/0
15/7
14/6
13/5
12/4
11/3
10/2
9/1
ICS3
ICS2
ICS1
or
S1
ICS0
or
S0
ISE
IL2
IL1
IL0
W
W
R/W
R/W
R/W
R/W
*
*
Interrupt control register
00000111B when reset
*: "1" is read always. ICS1 and ICS0 are valid for write only. S1 and S0 are valid for read only.
Note:
ICS3 to ICS0 are valid only when EI2OS is activated. Set "1" in ISE to activate EI2OS, and set "0" in
ISE not to activate it. When EI2OS is not to be activated, any value can be set in ICS3 to ICS0.
[bit10 to bit8, bit2 to bit0] IL0, IL1, and IL2 (interrupt level setting bits)
These bits are readable and writable, and specify the interrupt level of the corresponding internal
resources. Upon a reset, these bits are initialized to level 7 (no interrupt). Table 3.3-1 describes the
relationship between the interrupt level setting bits and interrupt levels.
58
CHAPTER 3 INTERRUPTS
Table 3.3-1 Interrupt Level Setting Bits and Interrupt Levels
IL2
IL1
IL0
Level
0
0
0
0 (Strongest)
0
0
1
1
0
1
0
2
0
1
1
3
1
0
0
4
1
0
1
5
1
1
0
6 (Weakest)
1
1
1
7 (No interrupt)
[bit11, bit3] ISE (extended intelligent I/O service enable bits)
The ISE bit is readable and writable. In response to an interrupt request, EI2OS is activated when '1' is
set in the ISE bit and an interrupt sequence is activated when '0' is set in the ISE bit. Upon completion
of EI2OS, the ISE bit is cleared to a zero. If the corresponding peripheral does not have the EI2OS
function, the ISE bit must be set to '0' on the software side.
Upon a reset, the ISE bit is initialized to '0'.
[bit15 to bit12, bit7 to bit4] ICS 3 to ICS 0 (extended intelligent I/O service channel select bits)
ICS3 to ICS0 are write-only bits. These bits specify the EI2OS channel. The values set in these bits
determined the intelligent I/O service descriptor addresses in memory, which is explained later. The ICS
bits are initialized by a reset.
Table 3.3-2 describes the correspondence between the ICS bits, channel numbers, and descriptor
addresses.
59
CHAPTER 3 INTERRUPTS
Table 3.3-2 ICS Bits, Channel Numbers, and Descriptor Addresses
ICS3
ICS2
ICS1
ICS0
Selected channel
Descriptor address
0
0
0
0
0
000100H
0
0
0
1
1
000108H
0
0
1
0
2
000110H
0
0
1
1
3
000118H
0
1
0
0
4
000120H
0
1
0
1
5
000128H
0
1
1
0
6
000130H
0
1
1
1
7
000138H
1
0
0
0
8
000140H
1
0
0
1
9
000148H
1
0
1
0
10
000150H
1
0
1
1
11
000158H
1
1
0
0
12
000160H
1
1
0
1
13
000168H
1
1
1
0
14
000170H
1
1
1
1
15
000178H
[bit13 and bit12, bit5 and bit4] S0 and S1 (extended intelligent I/O service status)
S0 and S1 are read-only bits. The values set in these bits indicate the end condition of EI2OS. These bits
are initialized to '00' upon a reset.
Table 3.3-3 shows the relationship between the S bits and the end conditions.
Table 3.3-3 S Bits and End Conditions
60
S1
S0
End condition
0
0
EI2OS running or not activated
0
1
Termination by count
1
0
Reserved
1
1
Termination by request from resource
CHAPTER 3 INTERRUPTS
3.4
Interrupt Flow
Figure 3.4-1 shows the interrupt flow.
■ Interrupt Flow
Figure 3.4-1 Interrupt Flow
START
I & IF & IE = 1
AND
ILM > IL
I:Flag in CCR
ILM:Level register in CPU
IF:Internal resource interrupt request
IE:Internal resource interrupt enable flag
ENx:Request flag excuting DMA of DMA Enable Register
ISE: EI 2OS enable flag
IL:Internal resource interruptrequest level
S:Flag in CCR
YES
NO
YES
ENx=1?
DMA processing
NO
Has the specified number of
YES
times been completed?
Or did a peripheral function
issue a complete request?
NO
NO
YES
ISE = 1
Fetching and decoding
the next instruction
Saving PS, PC, PCB, DTB,
ADB, DPR, and A into the
stack of SSP, and setting ILM=IL
Executing the extended
intelligent I/O service
YES
INT instruction
NO
Executing an ordinary
instruction
NO
Completion of
string instruction
repetition
YES
Saving PS, PC, PCB, DTB, ADB,
DPR, and A into the stack of SSP,
and setting I=O and ILM=IL
1
S
Fetching the interrupt vector
Updating PC
61
CHAPTER 3 INTERRUPTS
Figure 3.4-2 Register Saving during Interrupt Processing
Word (16 bits)
MSB
LSB
"H"
SSP (SSP value before interrupt)
AH
AL
DPR
ADB
DPB
PCB
PC
PS
"L"
62
SSP (SSP value after interrupt)
CHAPTER 3 INTERRUPTS
3.5
Hardware Interrupts
In response to an interrupt request signal from an internal resource, the CPU pauses
current program execution and transfers control to the interrupt processing program
defined by the user. This function is called the hardware interrupt function.
■ Hardware Interrupts
A hardware interrupt occurs when the relevant conditions are satisfied as a result of two operations:
comparison between the interrupt request level and the value in the interrupt level mask register (ILM) of
PS in the CPU, and hardware reference to the I flag value of PS.
The CPU performs the following processing when a hardware interrupt occurs:
•
Saves the values in the PC, PS, AH, AL, PCB, DTB, ADB, and DPR registers of the CPU to the system
stack.
•
Sets ILM in the PS register. The currently requested interrupt level is automatically set.
•
Fetches the corresponding interrupt vector value and branches to the processing indicated by that value.
■ Structure of Hardware Interrupt
Hardware interrupts are handled by the following three sections:
● Internal resources
Interrupt enable and request bits: Used to control interrupt requests from resources.
● Interrupt controller
ICR: Assigns interrupt levels and determines the priority levels of simultaneously requested interrupts.
● CPU
I and ILM: Used to compare the requested and current interrupt levels and to identify the interrupt enable
status.
Microcode: Interrupt processing step
The status of these sections are indicated by the resource control registers for internal resources, the ICR
for the interrupt controller, and the CCR value for the CPU. To use a hardware interrupt, set the three
sections beforehand by using software.
The interrupt vector table referenced during interrupt processing is assigned to addresses "FFFC00H" to
"FFFFFFH" in memory. These addresses are shared with software interrupts.
63
CHAPTER 3 INTERRUPTS
3.5.1
Hardware Interrupt Operation
An internal resource that has the hardware interrupt request function has an interrupt
request flag and interrupt enable flag. The interrupt request flag indicates whether an
interrupt request exists, and the interrupt enable flag indicates whether the relevant
internal resource requests an interrupt to the CPU. The interrupt request flag is set
when an event occurs that is unique to the internal resource. When the interrupt enable
flag indicates "enable", the resource issues an interrupt request to the interrupt
controller.
■ Hardware Interrupt Operation
When two or more interrupt requests are received at the same time, the interrupt controller compares the
interrupt levels (IL) in ICR, selects the request at the highest level (the smallest IL value), then reports that
request to the CPU. If multiple requests are at the same level, the interrupt controller selects the request
with the lowest interrupt number. The relationship between the interrupt requests and ICRs is determined
by the hardware.
The CPU compares the received interrupt level and the ILM in the PS register. If the interrupt level is
smaller than the ILM value and the I bit of the PS register is set to 1, the CPU activates the interrupt
processing microcode after the currently executing instruction is completed. The CPU references the ISE
bit of the ICR of the interrupt controller at the beginning of the interrupt processing microcode, checks that
the ISE bit is 0 (interrupt), and activates the interrupt processing body.
The interrupt processing body saves 12 bytes (PS, PC, PCB, DTB, ADB, DPR, and A) to the memory area
indicated by SSB and SSP, fetches three bytes of interrupt vector and loads them onto PC and PCB,
updates the ILM of PS to a level value of the received interrupt, sets the S flag, then performs branch
processing. As a result, the interrupt processing program defined by the user is executed next.
Figure 3.5-1 illustrates the flow from the occurrence of a hardware interrupt until there is no interrupt
request in the interrupt processing program.
64
CHAPTER 3 INTERRUPTS
3.5.2
Occurrence and Release of Hardware Interrupt
Figure 3.5-1 shows the processing flow from occurrence of a hardware interrupt to
release of the interrupt request in an interrupt processing program.
■ Occurrence and Release of Hardware Interrupt
Figure 3.5-1 Occurrence and Release of Hardware Interrupt
PS
I
ILM
IR
Microcode
Check
Comparator
PS
I
ILM
IR
:
:
:
:
Processor status
Interrupt enable flag
Interrupt level mask register
Instruction register
F M C - 1 6 LX . C P U
Peripheral
Enable FF
AND
Cause FF
Interrupt level IL
2
Level comparator
F2MC-16LX bus
Register file
Interrupt
controller
An interrupt cause occurs in a peripheral.
The interrupt enable bit in the peripheral is referenced. If interrupts are enabled, the peripheral issues an interrupt request to
the interrupt controller.
Upon reception of the interrupt request, the interrupt controller determines the priority levels of simultaneously requested
interrupts. Then, the interrupt controller transfers the interrupt level of the corresponding interrupt to the CPU.
The CPU compares the interrupt level requested by the interrupt controller with the ILM bit of the processor status register.
If the comparison shows that the requested level is higher than the current interrupt processing level, the I flag value of
the same processor status register is checked.
If the check in step 5. shows that the I flag indicates interrupt enable status, the requested level is written to the ILM bit.
Interrupt processing is performed as soon as the currently executing instruction is completed, then control is transferred to
the interrupt processing routine.
When the interrupt cause of step 1. is cleared by software in the user interrupt processing routine, the interrupt request is
completed.
65
CHAPTER 3 INTERRUPTS
The time required for the CPU to execute the interrupt processing in steps 6. and 7. is shown below.
Interrupt start:
24 + 6 × (Table 3.3-2 machine cycles)
Interrupt return: 15 + 6 × (Table 3.3-2 machine cycles) RETI instruction
Table 3.5-1 Compensation Values for Interrupt Processing Cycle Count
Address pointed to by the stack pointer
66
Compensation value [cycles]
External 8-bit
+4
External even-numbered address
+1
External odd-numbered address
+4
Internal even-numbered address
0
Internal odd-numbered address
+2
CHAPTER 3 INTERRUPTS
3.5.3
Multiple interrupts
As a special case, no hardware interrupt request can be accepted while data is being
written to the I/O area. This is intended to prevent the CPU from operating falsely
because of an interrupt request issued while an interrupt control register for a resource
is being updated. If an interrupt occurs during interrupt processing, a higher-level
interrupt is processed first.
■ Multiple Interrupts
The F2MC-16LX CPU supports multiple interrupts. If an interrupt of a higher level occurs while another
interrupt is being processed, control is transferred to the high-level interrupt after the currently executing
instruction is completed. After processing of the high-level interrupt is completed, the original interrupt
processing is resumed. An interrupt of the same or lower level may be generated while another interrupt is
being processed. If this happens, the new interrupt request is suspended until the current interrupt
processing is completed, unless the ILM value or I flag is changed by an instruction. The extended
intelligent I/O service cannot be activated from multiple sources; while an extended intelligent I/O service
is being processed, all other interrupt requests or extended intelligent I/O service requests are suspended.
Figure 3.5-2 shows the order of the registers saved in the stack.
Figure 3.5-2 Registers Saved in Stack
Word (16 bits)
MSB
LSB
"H"
SSP (SSP value before interrupt)
AH
AL
DPR
ADB
DPB
PCB
PC
PS
SSP (SSP value after interrupt)
"L"
67
CHAPTER 3 INTERRUPTS
3.6
Software Interrupts
In response to execution of a special instruction, control is transferred from the
program currently executed by the CPU to the interrupt processing program defined by
the user. This is called the software interrupt function. A software interrupt occurs
always when the software interrupt instruction is executed.
■ Software Interrupts
The CPU performs the following processing when a software interrupt occurs:
•
Saves the values in the PC, PS, AH, AL, PCB, DTB, ADB, and DPR registers of the CPU to the system
stack.
•
Sets "1" in the PS register. Interrupts are automatically disabled.
•
Fetches the corresponding interrupt vector value, then branches to the processing indicated by that
value.
A software interrupt request issued by the INT instruction has no interrupt request or enable flag. A
software interrupt request is always issued by executing the INT instruction.
The INT instruction does not have an interrupt level. Therefore, the INT instruction does not update ILM.
The INT instruction clears the I flag to suspend subsequent interrupt requests.
■ Structure of Software Interrupts
Software interrupts are handled within the CPU:
CPU.....Microcode: Interrupt processing step
■ List of Interrupt Vectors
Table D-1 lists the interrupt vectors of the MB90860A series.
As shown in Table D-1, software interrupts share the same interrupt vector area with hardware interrupts.
For example, interrupt request number INT 12 is used for external interrupt #0 to #7 of a hardware interrupt
as well as for INT #12 of a software interrupt. Therefore, external interrupt #0 and INT #12 call the same
interrupt processing routine.
■ Software Interrupt Operation
When the CPU fetches and executes the software interrupt instruction, the software interrupt processing
microcode is activated. The software interrupt processing microcode saves 12 bytes (PS, PC, PCB, DTB,
ADB, DPR, and A) to the memory area indicated by SSB and SSP. The microcode then fetches three bytes
of interrupt vector and loads them onto PC and PCB, resets the I flag, and sets the S flag. Then, the
microcode performs branch processing. As a result, the interrupt processing program defined by the user
application program is executed next.
Figure 3.6-1 illustrates the flow from the occurrence of a software interrupt until there is no interrupt
request in the interrupt processing program.
68
CHAPTER 3 INTERRUPTS
Figure 3.6-1 Occurrence and Release of Software Interrupt
➀
PS
F2MC-16LX bus
Register file
➁
I
IR
B unit
Microcode
F 2 M C - 1 6 LX . C P U
S
Queue
Fetch
P
:
I
:
ILM :
I
:
B unit :
Processor status
Interrupt enable flag
Interrupt level mask register
Instruction register
Bus interface unit
Save
Instruction bus
RAM
➀ The software interrupt instruction is executed.
➁ Special CPU registers in the register file are saved according to the microcode corresponding to the software interrupt
instruction.
The interrupt processing is completed with the RETI instruction in the user interrupt processing routine.
■ Others
When the program bank register (PCB) is "FFH", the CALLV instruction vector area overlaps the table of
the INT #vct8 instruction. When designing software, ensure that the CALLV instruction does not use the
same address as that of the #vct8 instruction.
Table D-2 shows the relationship of interrupt cause, interrupt vector, and interrupt control register in the
MB90860A series.
69
CHAPTER 3 INTERRUPTS
3.7
Extended Intelligent I/O Service (EI2OS)
The EI2OS function automatically transfers data between input and output and memory.
An interrupt processing program was conventionally used for such processing, but
EI2OS enables data transfer to be performed like DMA (direct memory access).
■ Extended Intelligent I/O Service (EI2OS)
EI2OS has the following advantages over the conventional method:
•
The program size can be small because it is not necessary to write a transfer program.
•
No internal register is used for transfer, eliminating the need for register saving and increasing the
transfer speed.
•
Transfer can be terminated from I/O, preventing unnecessary data from being transferred.
•
The buffer address may either be incremented or left unupdated.
•
The I/O register address may either be incremented or left unupdated.
At the end of EI2OS, processing automatically branches to an interrupt processing routine after the end
condition is set. Thus, the user can identify the end condition.
To implement EI2OS, the hardware is distributed in two blocks. Each block has the following registers and
descriptors.
•
Interrupt control register: Exists in the interrupt controller and indicates the ISD address.
•
Extended intelligent I/O service descriptor (ISD):Exists in RAM and holds the transfer mode, I/O
address, number of transfers, and buffer address.
Figure 3.7-1 outlines the extended intelligent I/O service.
70
CHAPTER 3 INTERRUPTS
Figure 3.7-1 Outline of Extended Intelligent I/O Service
Memory space
by IOA
I/O register
••• ••• ••• ••• •••
I/O register
Peripheral
CPU
Interrupt request ➀
➂
ISD
➂
by ICS
➁
Interrupt control register
Interrupt controller
by BAP
➃
Buffer
➀ I/O requests transfer.
➁ The interrupt controller selects the
descriptor.
➂ The transfer source and the transfer
by
destination are read from the descriptor.
DCT
➃ Data is transferred between I/O and
memory.
Notes:
• The area that can be specified by IOA is between "000000H" and "00FFFFH".
• The area that can be specified by BAP is between "000000H" and "FFFFFFH".
• The maximum transfer count that can be specified by DCT is 65536.
■ Structure
EI2OS is handled by the following four sections:
Internal resources
Interrupt enable and request bits: Used to control interrupt requests from resources.
Interrupt controller
ICR: Assigns interrupt levels, determines the priority levels of simultaneously requested interrupts,
and selects the EI2OS operation.
CPU
I and ILM:
Used to compare the requested and current interrupt levels and to identify the interrupt
enable status
Microcode:
EI2OS processing step
RAM
Descriptor:
Describes the EI2OS transfer information.
71
CHAPTER 3 INTERRUPTS
3.7.1
Extended Intelligent I/O Service Descriptor (ISD)
The extended intelligent I/O service descriptor exists between "000100H" and "00017FH"
in internal RAM, and consists of the following items:
• Data transfer control data
• Status data
• Buffer address pointer
■ Extended Intelligent I/O Service Descriptor (ISD)
Figure 3.7-2 shows the configuration of the extended intelligent I/O service descriptor.
Figure 3.7-2 Extended Intelligent I/O Service Descriptor Configuration
"H"
High-order 8 bits of data counter (DCTH)
Low-order 8 bits of data counter (DCTL)
High-order 8 bits of I/O register address pointer (IOAH)
Low-order 8 bits of I/O register address pointer (IOAL)
EI 2OS status (ISCS)
High-order 8 bits of buffer address pointer (BAPH)
000100 H + 8 × ICS
Medium-order 8 bits of buffer address pointer (BAPM)
ISD start address
Low-order 8 bits of buffer address pointer (BAPL)
"L"
■ Data Counter (DCT)
This is a 16-bit register that works as a counter corresponding to the number of data items transferred. This
counter is decremented by one before data transfer. EI2OS is terminated when this counter reaches 0.
Figure 3.7-3 is a diagram of the data counter configuration.
Figure 3.7-3 Data Counter Configuration
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
B15 B14 B13 B12 B11 B10 B09 B08 B07 B06 B05 B04 B03 B02 B01 B00
72
DCT
(Undefined when reset)
CHAPTER 3 INTERRUPTS
■ I/O Register address Pointer (IOA)
This is a 16-bit register that indicates the low-order address (A15 to A0) of the buffer and I/O register used
for data transfer. The high-order address (A23 to A16) are all zeroes, and any I/O between addresses
"000000H" and "00FFFFH" can be specified. Figure 3.7-4 is a diagram of the IOA configuration.
Figure 3.7-4 I/O Register address Pointer Configuration
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00
IOA
(Undefined when reset)
■ Buffer address Pointer (BAP)
This 24-bit register holds the address used for the next EI2OS transfer. BAP exists for each EI2OS channel.
Therefore, each EI2OS channel can be used for transfer with anywhere in the 16-Mbyte space. If the BF bit
of ISCS is set to '0' (update enabled), only the low-order 16 bits of BAP changes and BAPH does not
change.
73
CHAPTER 3 INTERRUPTS
EI2OS Status Register (ISCS)
3.7.2
This eight-bit register indicates the update direction (increment/decrement), transfer
data format (byte/word), and transfer direction of the buffer address pointer and the I/O
register address pointer. This register also indicates whether the buffer address pointer
or I/O register address pointer is updated or fixed.
■ EI2OS Status Register (ISCS)
Figure 3.7-5 is a diagram of the ISCS configuration.
Figure 3.7-5 ISCS Configuration
7
6
5
Reserved Reserved Reserved
4
IF
3
2
1
0
BW
BF
DIR
SE
ISCS
(Undefined when reset)
* Always write 0 to bits 7 to 5 of ISCS.
Each bit is described below.
[bit4] IF
Specify whether the I/O register address pointer is updated or fixed.
0: The I/O register address pointer is updated after data transfer.
1: The I/O register address pointer is not updated after data transfer.
Note:
Only increment is allowed.
[bit3] BW
Specify the transfer data length.
0: Byte
1: Word
[bit2] BF
Specify whether the buffer address pointer is updated or fixed.
0: The buffer address pointer is updated after data transfer.
1: The buffer address pointer is not updated after data transfer.
Note:
Only the low-order 16 bits of the buffer address are updated. Only increment is allowed.
74
CHAPTER 3 INTERRUPTS
[bit1] DIR
Specify the data transfer direction.
0: I/O → Buffer
1: Buffer → I/O
[bit0] SE
Control the termination of the extended intelligent I/O service based on resource requests.
0: The extended intelligent I/O service is not terminated by a resource request.
1: The extended intelligent I/O service is terminated by a resource request.
75
CHAPTER 3 INTERRUPTS
3.8
Operation Flow of and Procedure for Using the Extended
Intelligent I/O Service (EI2OS)
Figure 3.8-1 is a diagram of the EI2OS operation flow.
Figure 3.8-2 is a diagram of the EI2OS use procedure.
■ EI2OS Operation Flow
Figure 3.8-1 EI2OS Operation Flow
BAP
I/OA
ISD
ISCS
DCT
ISE
S1 and S0
Interrupt request issued
from internal resource
ISE = 1
:
:
:
:
:
:
:
Buffer address pointer
I/O address pointer
EI 2OS descriptor
EI2 OS status
Data counter
EI2OS enable bit
EI2OS end status
NO
Interrupt sequence
YES
Reading ISD/ISCS
End request from resource
YES
SE = 1
NO
DIR = 1
YES
NO
Data indicated by IOA
⇓ (Data transfer)
Memory indicated by BAP
IF = 0
YES
NO
BF = 0
Data indicated by BAP
⇓ (Data transfer)
Memory indicated by IOA
Update value
depends on BW.
Updating IOA
Update value
depends on BW.
Updating BAP
YES
NO
Decrementing DCT
DCT = 00B
NO
Setting S1 and S0
to '00B'
76
YES
Setting S1 and S0
to '01B'
Setting S1 and S0
to '11B'
Clearing resource
interrupt request
Clearing ISE to '0'
CPU operation return
Interrupt sequence
CHAPTER 3 INTERRUPTS
Figure 3.8-2 EI2OS Use Flow
Processing by EI2OS
Processing by CPU
EI2OS initialization
JOB execution
Normal
termination
(Interrupt request)
AND (ISE = 1)
Data transfer
Re-setting of extended intelligent
I/O service
(Switching channels)
Processing data in buffer
The extended EI2OS execution time for each flow is described below.
● When data transfer continues (when the stop condition is not satisfied)
("Table 3.8-1 Execution Time when the Extended EI2OS Continues" + "Table 3.8-2 Data Transfer
Compensation Values for Extended EI2OS Execution Time") machine cycles
● When a stop request is issued from a resource
(36 + 6 × "Table 3.8-3 Compensation Values for Interrupt Handling Times") machine cycles
● When the counting is completed
("Table 3.8-1 Execution Time when the Extended EI2OS Continues" + "Table 3.8-2 Data Transfer
Compensation Values for Extended EI2OS Execution Time" + 21 + 6 × "Table 3.8-3 Compensation
Values for Interrupt Handling Times") machine cycles
Table 3.8-1 Execution Time when the Extended EI2OS Continues
Set to "0"
ISCS SE bit
I/O address pointer
Set to "1"
Fixed
Updated
Fixed
Updated
Fixed
32
34
33
35
Updated
34
36
35
37
Buffer address pointer
77
CHAPTER 3 INTERRUPTS
Table 3.8-2 Data Transfer Compensation Values for Extended EI2OS Execution Time
Internal access
I/O address pointer
Buffer address pointer
B/E
O
B/E
0
+2
O
+2
+4
Internal access
B: Byte data transfer
E: Even address word transfer
O: Odd address word transfer
Table 3.8-3 Compensation Values for Interrupt Handling Times
Address pointed to by the stack pointer
78
Compensation value [cycles]
External 8-bit
+4
External even-numbered address
+1
External odd-numbered address
+4
Internal even-numbered address
0
Internal odd-numbered address
+2
CHAPTER 3 INTERRUPTS
3.9
µDMAC Interrupt
µDMAC is a simplified DMA with the same function as EI2OS
3.9.1 µDMAC Functions
3.9.2 µDMAC Registers
3.9.3 DMA Descriptor window register (DDWR)
3.9.4 µDMAC Operation
79
CHAPTER 3 INTERRUPTS
3.9.1
µDMAC Functions
This section describes the µDMAC functions.
■ µDMAC Functions
µDMAC function has the following functions:
• Automatic data transfer between peripheral resources (I/O) and memory
• CPU program execution stopped during starting of DMA
• 16 DMA transfer channels (The smaller the channel number, the higher the DMA transfer priority).
• Allow selection of whether or not to increment the transfer source, transfer destination addresses.
• DMA transfer started by peripheral resource (I/O) interrupts.
• DMA transfer controlled by:(a) DMA enable register (DER), (b) DMA stop status register (DSSR),
(c) DMA status register (DSR), (d) DMA descriptor channel specification
register (DCSR), and (e) Descriptor (DMACS)
• STOP requests are issued as a means to stop DMA transfers from a peripheral resource.
• After the end of a DMA transfer, a flag is set to the bit corresponding to the transfer end channel of the
DMA status register, and an end interrupt is then output to the interrupt controller.
80
CHAPTER 3 INTERRUPTS
3.9.2
µDMAC Registers
µDMAC has four registers: DCSR, DSR, DSSR, and DER. The DMA descriptor used to set
DMA transfer is explained in Section "3.9.3 DMA Descriptor window register (DDWR)".
■ Registers List
· DMA descriptor channel specification register (DCSR)
15
Address: 00009B H
Read/write
Initial value
14
13
12
11
10
9
8
STPctrl Reserved Reserved Reserved DCSR3 DCSR2 DCSR1 DCSR0
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
Bit No.
DCSR
(R/W)
00000000B
· DMA status register (DSR)
15
14
13
12
11
10
9
8
Address: 00009D H
Read/write
Initial value
DTE15 DTE14 DTE13 DTE12 DTE11 DTE10 DTE9
7
6
5
4
3
2
1
0
Address: 00009C H
Read/write
Initial value
DTE7
DTE6
DTE5
DTE4
DTE3
DTE2
DTE1
DTE0
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
DTE8
Bit No.
DSRH
(R/W)
00000000B
Bit No.
DSRL
00000000B
· DMA stop status register (DSSR)
15
14
13
12
11
10
9
8
Bit No.
DSSR
Address: 0000A4 H
Read/write
Initial value
STP15 STP14 STP13 STP12 STP11 STP10 STP9
7
6
5
4
3
2
1
0
Bit No.
Address: 0000A4 H
Read/write
Initial value
STP7
STP6
STP5
STP4
STP3
STP2
STP1
STP0
DSSR
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
STP8
(R/W)
00000000B
Bit 8 to 15 are used for DSSR when DCSR:STPctrl bit is "0",
while bit 0 to 7 are used when the bit is "1".
00000000B
· DMA enable register (DER)
15
14
13
12
11
10
9
8
Address: 0000AD H
Read/write
Initial value
EN15
EN14
EN13
EN12
EN11
EN10
EN9
EN8
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
7
6
5
4
3
2
1
0
Address: 0000AC H
Read/write
Initial value
EN7
EN6
EN5
EN4
EN3
EN2
EN1
EN0
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
Bit No.
DERH
00000000B
Bit No.
DERL
00000000B
81
CHAPTER 3 INTERRUPTS
3.9.2.1
DMA Descriptor Channel Specification Register
(DCSR)
This section describes the DMA descriptor channel specification register (DCSR).
■ DMA Descriptor Channel Specification Register (DCSR)
Figure 3.9-1 DMA Descriptor Channel Specification Register (DCSR) Configuration
15
Address: 00009B H
Read/write
Initial value
14
13
12
11
10
9
8
STPctrl Reserved Reserved Reserved DCSR3 DCSR2 DCSR1 DCSR0
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
Bit No.
DCSR
(R/W)
00000000B
[bit11 to bit8] DCSR3 to DCSR0: DMA Descriptor Channel Specification
Table 3.9-1 Relationship between DCSR and Selected Channels
DCSR3 to DCSR0
Selected Channels
Resource Interrupt Request
0000
0
16-bit Reload Timer 0
0001
1
16-bit Reload Timer 1
0010
2
16-bit Reload Timer 2
0011
3
External Interrupt 0-3, 8-11
0100
4
External Interrupt 4-7, 12-15
0101
5
A/D Converter
0110
6
Input Capture 4/5, I2C1
0111
7
Output Compare 0/1/4/5
1000
8
Input Capture 0-3
1001
9
Output Compare 2/3/6/7
1010
10
UART0 RX
1011
11
UART0 TX
1100
12
UART1 RX, UART3 RX
1101
13
UART1 TX, UART3 TX
1110
14
UART2 RX, UART4 RX
1111
15
UART2 TX, UART4 TX
One (descriptor channel) of 16 channels is selected by the DCSR setting. For details, see Section "3.9.3
DMA Descriptor window register (DDWR)".
82
CHAPTER 3 INTERRUPTS
[bit15] STPctrl: STP Control Bit
STPctrl bit
Function
0
[Initial value]
STP8 to STP15 are selected as DSSR.
1
STP0 to STP7 are selected as DSSR.
[bit14 to bit12] Reserved: Reserved Bits
Bit12 to bit14 (three bits) are reserved bits, so bit manipulation instructions cannot be executed for
them. When setting DSCR, always write "0" to these bits. Reading these bits always returns "0".
83
CHAPTER 3 INTERRUPTS
3.9.2.2
DMA Status Register (DSR)
This section describes the DMA status register (DSR).
■ DMA Status Register (DSR)
Figure 3.9-2 DMA Status Register (DSR) Configuration
15
Address: 00009D H
Read/write
Initial value
Address: 00009C H
Read/write
Initial value
14
13
12
11
10
9
DTE15 DTE14 DTE13 DTE12 DTE11 DTE10 DTE9
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
8
DTE8
Bit No.
DSRH
(R/W)
00000000B
7
6
5
4
3
2
1
0
DTE7
DTE6
DTE5
DTE4
DTE3
DTE2
DTE1
DTE0
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
Bit No.
DSRL
00000000B
[bit15 to bit0] DTE15 to DTE0: DMA Status
DTEx bit
0
[Initial value]
1
Function
Indicates no interrupt request present.
When DTEx is "0", write "0" to this bit.
Writing "1" to it is prohibited.
Indicates that DMA transfer completed and interrupt requested.
When DTEx is "1", writing "0" to this bit clears it to "0"; writing "1" to it retains the
previous data.
Note:
For write access to this register, always use a read - modify - write instruction.
84
CHAPTER 3 INTERRUPTS
3.9.2.3
DMA Stop Status Register (DSSR)
This section describes the DMA stop status register (DSSR)
■ DMA Stop Status Register (DSSR)
Figure 3.9-3 DMA Stop Status Register (DSSR) Configuration
(When DCSR:STPctrl=0)
14
13
12
11
10
9
STP15 STP14 STP13 STP12 STP11 STP10 STP9
Address: 0000A4 H
Read/write
Initial value
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
8
Bit No.
STP8
DSSR
(R/W)
00000000B
(When DCSR:STPctrl=1)
Address: 0000A4 H
Read/write
Initial value
15
7
6
5
4
3
2
1
0
Bit No.
STP7
STP6
STP5
STP4
STP3
STP2
STP1
STP0
DSSR
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
00000000B
[bit15 to bit0] STP15 to STP0: DMA Stop Status
STPx bit
0
[Initial value]
1
Function
No STOP request is accepted in a DMA transfer.
When STPx is "0", write "0" to this bit.
Writing "1" to it is prohibited.
Indicates that DMA transfer stopped due to STOP request issued by resource during
DMA transfer.
When the DMA control register SE bit is "1" and the corresponding channel receives
the STOP request, the corresponding bit of the DMA enable register is cleared to "0".
When STPx is "1", writing "0" to this bit clears it to "0"; writing "1" retains the
previous data.
Note:
DSSR is controlled by the MSB of DCSR (STPctrl). When STPctrl is "0", bit8 to bit15 are selected as
DSSR; when STPctrl is "1", bit0 to bit7 are. Since the initial value of STPctrl is "0", bit8 to bit15 are
selected as DSSR at first.
When writing to DSSR, use an RMW (read-modify-write) instruction.
The following three channels supports the STOP request:
Channels
Corresponding STPx bits
Resource
ch10
STP10
UART0RX
ch12
STP12
UART1RX, UART3RX
ch14
STP14
UART2RX, UART4RX
Note: Bits other than STP10, STP12, and STP14 have no meaning.
85
CHAPTER 3 INTERRUPTS
3.9.2.4
DMA Enable Register (DER)
This section describes DMA enable register (DER).
■ DMA Enable Register (DER)
Figure 3.9-4 DMA Enable Register (DER) Configuration
Address: 0000AD H
Read/write
Initial value
Address: 0000AC H
Read/write
Initial value
15
14
13
12
11
10
9
8
EN15
EN14
EN13
EN12
EN11
EN10
EN9
EN8
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
Bit No.
DERH
00000000B
7
6
5
4
3
2
1
0
EN7
EN6
EN5
EN4
EN3
EN2
EN1
EN0
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
Bit No.
DERL
00000000B
[bit15 to bit0] EN15 to EN0: DMA Enable
ENx bit
0
[Initial value]
1
Function
The interrupt request from the resource is output to the interrupt controller.
(The interrupt request from the resource is not processed as a DMA start request.)
The interrupt request from the resource is processed as a DMA start request. At
completion of DMA transfer, the interrupt request is output to the interrupt controller.
This bit is cleared to "0" when the DMA transfer byte count becomes "0" or when DMA
transfer is stopped by the STOP request from the resource.
When writing to DER, use an RMW (read-modify-write) instruction.
Note:
Before entering the sleep mode, these bits must be cleared to "0".
86
CHAPTER 3 INTERRUPTS
3.9.3
DMA Descriptor window register (DDWR)
The DMA descriptor consists of 8 bytes x 16 channels and is used to set DMA transfer.
One channel selected from the 16 channels is mapped to the DMA descriptor window
register (DDWR), making it possible to access this channel. DDWR addresses are
"0000D0H" to "0000D7H".
■ Configuration of DMA Descriptor Window Register (DDWR)
The DMA descriptor consists of 8 bytes x16 channels and the structure of each channel is as shown in
Figure 3.9-5. The descriptor for the channel selected by the DMA descriptor channel specification register
(DCSR) or by the interrupt request channel number is mapped onto the DMA descriptor window register
(DDWR). For the relationship between the DMA descriptor channel specification register (DCSR) and the
channels to be selected, see Table 3.9-1.
Figure 3.9-5 Configuration of DMA Descriptor Window Register (DDWR)
Address
0000D7H
Upper 8 bits of data counter (DCTH)
0000D6H
Lower 8 bits of data counter (DCTL)
0000D5H
Upper 8 bits of I/O Register address pointer (IOAH)
0000D4H
Lower 8 bits of I/O Register address pointer (IOAL)
0000D3H
DMA Control register (DMACS)
0000D2H
Upper 8 bits of buffer address pointer (BAPH)
0000D1H
Middle 8 bits of buffer address pointer (BAPM)
0000D0H
Lower 8 bits of buffer address pointer (BAPL)
■ Each Register of DMA Descriptor
Each register making up the DMA descriptor is explained in the following sections. The registers must be
initialized before setting ENx to "1" because their initial values become undefined when they are reset.
Note:
Access to the DDWR register is not allowed over 2 machine clock cycles after the setting of the
DCSR register is changed.
87
CHAPTER 3 INTERRUPTS
3.9.3.1
Data Counter (DCT)
This section describes the Data counter (DCT).
■ Data Counter (DCT)
The data counter (DCT) is a 16-bit register to store the transfer count. After each data transfer, the data
counter is decremented by 1 irrespective of whether the transfer is word or byte transfer. When the data
counter becomes "0", DMA transfer ends. Figure 3.9-6 shows the configuration of the data counter (DCT).
When "0" is set to DCT, the maximum data transfer count (65536) is set.
Figure 3.9-6 Data Counter (DCT) Configuration
DCTH
15
14
13
12
11
DCTL
10
09
08
07
06
05
04 03
02 01 00
Bit No.
Address:
DCT
0000D7H/0000D6H B15 B14 B13 B12 B11 B10 B09 B08 B07 B06 B05 B04 B03 B02 B01 B00
Read/write (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W) (R/W)
Initial value
XXXXXXXXXXXXXXXX B
R/W: Read/write
X : Undefined
■ Value in Data Counter
The table below explains the relationship between the number of bytes and the value in the DCT register.
DMACS register
DCT register
BW bit
BYTEL bit
0
-
N
1
0
N/2
1
1
(N+1)/2
N: Number of bytes
88
CHAPTER 3 INTERRUPTS
3.9.3.2
I/O Register Address Pointer (IOA)
This section describes the I/O register address pointer (IOA).
■ I/O Register address Pointer (IOA)
The I/O register address pointer (IOA) is a 16-bit register and indicates the lower addresses (A15 to A00)
of the I/O register. Its upper addresses (A23 to A16) are all "0", allowing any I/O address space in the range
from the "000000H" address to the "00FFFFH" address to be specified. When "Update Performed" is
specified with the IF bit (this bit selects whether to update IOA or fix IOA) of the DMA control register
(DMACS), IOA is incremented by 1 at byte transfer; and incremented by 2 at word transfer. When "Update
Not Performed" is specified with the IF bit, IOA is fixed (IOA does not change). Figure 3.9-7 shows the
configuration of the data counter (IOA).
Figure 3.9-7 I/O Register Address Pointer (IOA) Configuration
IOAH
IOAL
15
14 13
12
11
10
09
08
07
06 05
04
03
02
01 00
Bit No.
Address:
IOA
0000D5H/0000D4H A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
Read/write
Initial value
XXXXXXXXXXXXXXXXB
R/W: Read/write
X : Undefined
89
CHAPTER 3 INTERRUPTS
3.9.3.3
DMA Control Register (DMACS)
This section describes the DMA control register (DMACS).
■ DMA Control Register (DMACS)
The DMA control register (DMACS) is 8-bit long and is used to specify whether to update or fix the buffer
address pointer and the I/O register address pointer, to specify the transfer data format (byte or word), to
specify the transfer direction, to specify byte transfer, and to issue wait instructions. Figure 3.9-8 shows the
configuration of DMACS.
Figure 3.9-8 Configuration of DMACS
7
6
5
4
3
2
1
0
Address: 0000D3H
RDY2
RDY1
BYTEL
IF
BW
BF
DIR
SE
Read/write
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
DMA transfer end control bit
0
DMA transfer can not be stopped by a request from a peripheral function.
1
DMA transfer can be stopped by a request from a peripheral function.
Data transfer direction specification bit
0
I/O register address pointer
1
Buffer address pointer
Buffer address pointer
I/O register address pointer
BAP update/fix selection bit
BF
0
After data transfer, the buffer address pointer is updated.
1
After data transfer, the buffer address pointer is not updated.
BW
Transfer data length specification bit
0
Byte
1
Word
IF
BYTEL
IOA update/fix selection bit
0
After data transfer, the I/O register address pointer is updated.
1
After data transfer, the I/O register address pointer is not updated.
Byte transfer specification bit (only enabled for word transfer)
0
Even number of bytes
1
Odd number of bytes
(RDY2, RDY1)
90
XXXXXXXXB
SE
DIR
R/W: Read/write
X : Undefined
Bit No.
Initial value
Wait instruction bits (see Figure 3.9-9)
00B
No wait is inserted between transfers.
01B
A 1-cycle wait is inserted between transfers.
10B
A 2-cycle wait is inserted between transfers.
11B
A 3-cycle wait is inserted between transfers.
CHAPTER 3 INTERRUPTS
Figure 3.9-9 Explanation of Wait Instruction Bits
source
destination
wait
source
destination
The wait in the data transfer shown in the above
figure is defined using the RDY2 and RDY1 bits.
Note:
If writing transmission data to LIN-UART by using µDMAC, not setting RDY2 and RDY1 bit of
DMACS register in 00B.
91
CHAPTER 3 INTERRUPTS
3.9.3.4
Buffer Address Pointer (BAP)
This section describes the Buffer address pointer (BAP).
■ Buffer address Pointer (BAP)
The buffer address pointer (BAP) is a 24-bit register and is used to store addresses that will be used for
DMA transfer. There is an independent BPA for each DMA channel, so each DMA channel can transfer
data between any address in the 16-MByte address space and I/O. When "Update Performed" is specified
using the BF bit (selects whether to update BAP or fix BAP) of the DMA control register (DMACS), the
BAP lower 16 bits (BAPM, BAPL) are incremented by "1" at byte transfer and incremented by "2" at word
transfer. Its upper 8 bits do not change. Figure 3.9-10 shows the configuration of the buffer address pointer
(BAP).
Figure 3.9-10 Buffer Address Pointer (BAP)
Address:
0000D2H /0000D1H /0000D0H
Read/write
Initial value
23 to 16
15 to 08
07 to 00
BAPH
BAPM
BAPL
(R/W)
(R/W)
(R/W)
Bit No.
BAP
XXXXXXXXXXXXXXXXXXXXXXX B
R/W : Read/write
X : Undefined
Notes:
• The area that can be specified using the I/O register address pointer (IOA) is "000000H" to
"00FFFFH".
• The area that can be specified using the buffer address pointer (BAP) is "000000H" to "FFFFFFH".
• The following may not be specified for IOA and BAP: addresses of µDMA internal registers
(DCSR, DSRH, DSRL, DSSR, DERH, DERL); addresses of DMA descriptor window register
(DDWR).
92
CHAPTER 3 INTERRUPTS
3.9.4
µDMAC Operation
This section describes the µDMAC operation.
■ DMAC Operation
Figure 3.9-11 shows the µDMAC operation.
Data transfer using µDMAC is performed in the following order:
(1) The peripheral resource (I/O) requests DMA transfer.
(2) When the corresponding bit of DMA enable register (DER) is "1", µDMAC reads from the descriptor
the transfer data such as the transfer source address, transfer destination address, and transfer count of
specified channels.
(3) DMA data transfer is started between I/O and memory.
(4) After one item (either Byte data or Word data) transferred
(a) Transfer has not been completed (DCT does not reached to 0):
µDMAC requests to clear the DMA transfer request to the peripheral resource.
(b) At transfer end (DCT reached to 0):
After completion of DMA transfer, the flag indicating completion of transfer is set in the DMA
status register, outputting an interrupt request to the interrupt controller.
Note:
Write access to the internal registers DCSR, DSRH, DSRL, DSSR, DERH, and DERL is prohibited
during DMA transfer.
Figure 3.9-11 µDMAC Operation
Memory space IOA
I/O register
I/O register
Peripheral
function
(I/O)
RAM for
descriptor
(1)
(4) (a)
(2)
(3)
DMA controller
DMA
descriptor
(2)
(4) (b)
BAP
Buffer
CPU
Interrupt controller
IOA : I/O address pointer
BAP: Buffer address pointer
DER: DMA enable register
DCT: Data counter
DCT
93
CHAPTER 3 INTERRUPTS
■ Procedure for Using µDMAC
Figure 3.9-12 illustrates the procedure for using µDMAC.
Figure 3.9-12 Procedure for Using µDMAC
Software processing
Hardware processing
(Interrupt occurrence)
Start
No
ENx of corresponding
channel is "1"
Set the system stack area.
Initialize
Yes
Initialize the peripheral function.
Yes
STOP requests and SE=1
No
Set the interrupt control register.
DMA data transfer
(BAP)
Initialize the µDMAC.
BF = 0
(IOA)
Parallel processing
No
No
IF = 0
Yes
Execute the user program.
BW = 1
Yes
No
BW = 1
Yes
BYTEL = 0
No
Yes
BAP = BAP+2
STPx = 1
Yes
No
BYTEL = 0
No
DCT = 0
Yes
Yes
IOA = IOA+2
BAP = BAP+1
DCT = 0
Yes
(Jump to interrupt
processing routine)
DTEx = 0
ENx = 0
Interrupt processing
Processing end
ENx : Corresponding bit of DMA enable register
DTEx : Corresponding bit of DMA status register
STPx : Corresponding bit of DMA stop status register
* : Outputting interrupt request to interrupt controller
94
No
No
No
DCT = 0
Yes
IOA = IOA+1
CHAPTER 3 INTERRUPTS
■ Data Transferring Cycle Number (Internal Transfer)
If µDMAC should keep bus permission and data should transfer inside LSI, the transfer cycle number is
equal to following;
Table 3.9-2 Keep Bus Permission → Start Transferring
Matching between DCSR3 to DCSR0 of
DCSR and interrupt request channel
Matching failed between DCSR3 to DCSR0 of
DCSR and interrupt request channel
1 machine cycle
2 machine cycles
Table 3.9-3 Transferring Cycle
Address pointer
DMACS
Cycle number
*1:
*2:
BAP
IOA
BW
BYTEL
-
-
0
-
4 + (RDY2, RDY1) *1 machine cycle
Odd
Even
1
-
Even
Odd
6 + (RDY2, RDY1) *2 machine cycle
Odd
Odd
1
-
8 + (RDY2, RDY1) *2 machine cycle
Even
Even
1
-
4 + (RDY2, RDY1) *1 machine cycle
(RDY2 and RDY1) = 0 at the last transferring
At BYTEL = 1, the values are equal to 4 cycle, and (RDY2 and RDY1) = 0.
At BYTEL = 0, (RDY2 and RDY1) = 0.
Odd: Odd address
Even: Even address
95
CHAPTER 3 INTERRUPTS
3.10
Exceptions
The F2MC-16LX performs exception processing when the following event occurs:
■ Execution of an Undefined Instruction
Exception processing is fundamentally the same as interrupt processing. When an exception is detected
between instructions, exception processing is performed separately from ordinary processing. In general,
exception processing is performed as a result of an unexpected operation. Fujitsu recommends using
exception processing only for debugging or for activating emergency recovery software.
■ Exception Due to Execution of an Undefined Instruction
The F2MC-16LX handles all codes that are not defined in the instruction map as undefined instructions.
When an undefined instruction is executed, processing equivalent to the INT 10 software interrupt
instruction is performed. Specifically, the AL, AH, DPR, DTB, ADB, PCB, PC, and PS values are saved
into the system stack, and processing branches to the routine indicated by the interrupt number 10 vector. In
addition, the I flag is cleared and the S flag is set. The PC value saved in the stack is the address at which
the undefined instruction is stored. Processing can be restored by the RETI instruction, but is of no use,
however, because the same exception occurs again.
96
CHAPTER 4
DELAYED INTERRUPT
This chapter explains the functions and operations of
the delayed interrupt.
4.1 Outline of Delayed Interrupt Module
4.2 Delayed Interrupt Register
4.3 Delayed Interrupt Operation
97
CHAPTER 4 DELAYED INTERRUPT
4.1
Outline of Delayed Interrupt Module
The delayed interrupt source module is used to generate interrupts for switching tasks.
Using this module, interrupt requests to the F2MC-16LX CPU can be issued and
canceled by software.
■ Block Diagram of Delayed Interrupt
Figure 4.1-1 is a block diagram of the delayed interrupt source module.
Figure 4.1-1 Block Diagram
F2MC-16LX
Delayed interrupt cause issuance/cancellation decoder
Cause latch
■ Notes on Operation
The delayed interrupt signal is activated by writing "1" to the corresponding bit of DIRR and inactivated by
writing "0" to the same bit. Therefore, the interrupt bit in DIRR should be cleared to "0" within the
interrupt service routine. Otherwise the same interrupt is serviced again right after the first interrupt service
is completed.
98
CHAPTER 4 DELAYED INTERRUPT
4.2
Delayed Interrupt Register
DIRR controls issuance and cancellation of delayed interrupt requests. Writing "1" to
this register issues a delayed interrupt request, and writing "0" cancels the delayed
interrupt request. Upon a reset, the request is canceled.
■ Delayed Interrupt Cause Issuance/Cancellation Register (DIRR: Delayed Interrupt
Request Register)
Figure 4.2-1 Delayed Interrupt Cause/Cancel Register (DIRR)
Address
00009F H
R/W
X
-
:
:
:
bit15
bit14
bit13
bit12
bit11
bit10
bit9
bit8
Initial value
-
-
-
-
-
-
-
R0
XXXXXXX0B
-
-
-
-
-
-
-
R/W
Readable and writable
Undefined
Undefined bit
Table 4.2-1 Functional Explanation of Each Bit of the Delayed Interrupt Cause/Cancel Register (DIRR)
Bit name
bit15 to bit9
bit8
Function
-:
Undefined bit
• When these bits are read, the values are undefined.
• Writing to these bits does not affect operation.
R0:
Delayed interrupt
request output bit
•
•
•
•
This bit sets the generation/cancel of a delayed interrupt request.
When this bit is "1", a delayed interrupt request is output.
When this bit is "0", the delayed interrupt request is cleared.
When a reset is specified, interrupt causes are canceled (cleared to "0").
99
CHAPTER 4 DELAYED INTERRUPT
4.3
Delayed Interrupt Operation
When the CPU writes "1" to the relevant bit of DIRR by software, the request latch in the
delayed interrupt source module is set and an interrupt request is issued to the
interrupt controller.
■ Delayed Interrupt Occurrence
When the CPU writes "1" to the relevant bit of DIRR by software, the request latch in the delayed interrupt
source module is set and an interrupt request is issued to the interrupt controller. If this interrupt has the
highest priority or if there is no other interrupt request, the interrupt controller issues an interrupt request to
the F2MC-16LX CPU. The F2MC-16LX CPU compares the ILM bit of its internal CCR register and the
interrupt request, and starts the hardware interrupt processing microprogram as soon as the current
instruction is completed if the interrupt level of the request is higher than that of the ILM bit. The interrupt
processing routine for this interrupt is thus executed.
Figure 4.3-1 Delayed Interrupt Issuance
Delayed interrupt source module
Interrupt controller
F2MC-16LX CPU
WRITE
Other requests
ICR yy
IL
CMP
CMP
DIRR
ICR xx
ILM
INTA
100
CHAPTER 5
CLOCKS
This chapter explains the clocks used by MB90860A
series microcontrollers.
5.1 Clocks
5.2 Block Diagram of Clock Generation Block
5.3 Clock Selection Registers
5.4 Clock Mode
5.5 Oscillation Stabilization Wait Interval
5.6 Connection of an Oscillator or an External Clock to Microcontroller
101
CHAPTER 5 CLOCKS
5.1
Clocks
The clock generation block controls the operation of the internal clock that controls
operation of the CPU and peripheral functions. This internal clock is called the machine
clock. One internal clock cycle is called one machine cycle. Other clocks include a
clock generated by source oscillation, called an oscillation clock, and a clock generated
by the internal PLL oscillation, called a PLL clock.
■ Clocks
The clock generation block contains the oscillation circuit that generates the oscillation clock. An external
oscillator is attached to this circuit. The oscillation clock can also be supplied by inputting an external clock
to the clock generation block. The clock generation block also contains the PLL clock multiplier circuit,
which generates five clocks whose frequencies are multiples of the oscillation clock frequency. The clock
generation block controls the oscillation stabilization wait interval and PLL clock multiplication as well as
internal clock operation by changing the clock with a clock selector.
● Oscillation clock (HCLK)
The oscillation clock is generated either from an external oscillator attached to the oscillation circuit or by
the input of an external clock.
● Sub-clock (SCLK)
The sub-clock runs the watch timer and can also be used as a low-speed machine clock.
The sub-clock is generated either from an external oscillator attached to the oscillation circuit or by the
input of an external clock.
Frequency of the sub-clock is oscillation clock frequency divided by 2 or 4. The division ratio is
determined by SCDS bit of PLL/Subclock Control Register (PSCCR).
● Main clock (MCLK)
The main clock, whose frequency is the oscillation clock frequency divided by 2, supplies the clock input
to the timebase timer and the clock selector.
● PLL clock (PCLK)
The PLL clock is obtained by multiplying the oscillation clock frequency with the internal PLL clock
multiplier circuit (PLL oscillation circuit). Selection can be made from among five different PLL clocks.
● Machine clock (φ)
The machine clock controls the operation of the CPU and peripheral functions. One clock cycle is regarded
as one machine cycle (1/φ). An operating machine clock can be selected from among the main clock
(whose frequency is the source clock frequency divided by 2) and the other five clocks (whose frequencies
are multiples of the source clock frequency).
102
CHAPTER 5 CLOCKS
Note:
When the operating voltage is 5V, the OSC source oscillation can be between 3MHz and 16MHz.
When an external clock source is used, its frequency can be between 3MHz and 24MHz. The
highest operating frequency for the CPU and peripheral resource circuits is 24MHz, however. Normal
operation is not guaranteed if a multiplication factor resulting in a higher frequency than 24MHz is
specified. For example, if the external clock frequency is 16MHz, only 1 can be specified as the
multiplication factor.
The lowest operating frequency of the VCO oscillation is 4MHz, and an oscillation below 4MHz must
not be specified.
■ Clock Supply Map
Since the machine clock generated in the clock generation block is supplied as the clock that controls the
operation of the CPU and peripheral functions, the operation of the CPU and the peripheral functions is
affected by switching between the main clock, the PLL clock and the subclock (clock mode) and by a
change in the PLL clock multiplier. Since some peripheral functions receive frequency-divided output from
the timebase timer, a peripheral unit can select the clock best suited for this operation. Figure 5.1-1 shows
the clock supply map.
Figure 5.1-1 Clock Supply Map
Peripheral function
4
Watch timer
4
Timebase timer
Clock generation block
1
Pin
Pin
System clock
generation circuit
Pin
Pin
4
6
8/16-bit
PPG timer0 to F
Pins PPG0 to PPGF
16-bit
reload timer 0/1/2/3
Pins TIN0 to TIN3
Pins TOT0 to TOT3
ADC (24 channels)
Pins AN0 to AN23
UART0/UART1/
UART2/UART3/
UART4 + Serial IO
Pins SCK0 to SCK4
Pins SIN0 to SIN4
Pins SOT0 to SOT4
Clock Selector
Divide-by-4/2
Clock Modulator
SCLK
X0
X1
3
PLL multiplier circuit
PCLK
X0A
X1A
2
Watchdog timer
System clock
Divide-by-2
Clock Selector
generation circuit HCLK
MCLK
φ
Input output timer
µDMA
Output compare0 to 7
CPU
Pins OUT0 to OUT7
Free-runnning timer 0/1
Input capture0 to 7
HCLK : Oscillation clock
MCLK : Main clock
PCLK : PLL clock
SCLK : Subclock
φ : Machine clock
I2C 0/I2C 1
Clock monitor
4
Pins IN0 to IN7
Pins SDA0/SDA1
Pins SCL0/SCL1
Pin SKOT
Oscillation stabilization
wait control
103
CHAPTER 5 CLOCKS
5.2
Block Diagram of Clock Generation Block
The clock generation block consists of five blocks:
• System clock generation circuit
• PLL multiplier circuit
• Clock selector
• Clock selection register (CKSCR)
• Oscillation stabilization wait interval selector
■ Block Diagram of the Clock Generation Block
Figure 5.2-1 shows a block diagram of the clock generation block.
Figure 5.2-1 Block Diagram of the Clock Generation Block
Low Power Consumption Mode Control Register (LPMCR)
STP SLP SPL RST TMD CG1 CG0 RESV
CPU intermittend
operation cycle
selector
2
Stop signal
CPU clock
control circuit
Sleep signal
Peripheral clock
control circuit
S
Q
S
R
Reset
S
CPU operation
clock
Peripheral function
operation clock
Q
R
Q
S
Q
Interrupt
R
R
Standard Control Circuit
Clock
Selector
Oscillation
stabilization
wait time
interval selector
2
CS2
Bit8 of PLL/
Subclock control
register(PSCCR)
2
SCM MCM WS1 WS0 SCS MCS CS1 CS0
PLL multiplier circuit
Clock Selection register (CKSCR)
Mainclock
X0
Pin
HCLK
X1
Divideby-2
Divideby-512
Pin
Divideby-2
Divideby-2
Divideby-2
Watchdog Timer
Subclock generation circuit
Divideby 4 or 2
Watch Timer
Subclock
X1A Pin
SCDS
Bit10 of PLL/
Subclock control
register(PSCCR)
104
Divideby-2
Timebase Timer
System clock
generation circuit
X0A Pin
Divideby-4
Divideby-1024
Divideby-8
Divideby-2
Divideby-2
Divideby-2
Divideby-4
CHAPTER 5 CLOCKS
● Oscillation clock generation circuit
The oscillation clock generation circuit generates an oscillation clock (HCLK) from an external oscillator
attached to it. Alternatively, an external clock can be input to this circuit.
● Sub-clock generation circuit
The sub-clock generation circuit generates a sub-clock (SCLK) from an external oscillator attached to it.
An external clock can be also input to this circuit.
● PLL multiplier circuit
The PLL multiplier circuit multiplies the oscillation clock frequency through PLL oscillation and supplies a
clock whose frequency is a multiple of the oscillation clock frequency to the CPU clock selector.
● Clock selector
From among the main clock, five different PLL clocks and subclock, the clock selector selects the clock
that is supplied to the CPU and peripheral clock control circuits.
● Clock selection register (CKSCR)
The clock selection register is used to switch between the main clock, PLL clocks and subclock, also used
to select an oscillation stabilization wait interval and a PLL clock multiplier.
● PLL/Subclock Control Register (PSCCR)
The PLL/subclock control register is used to select multiplication factor of the PLL (CS2 bit in this register
in addition to CS1 and CS0 bit in the CKSCR register) and to specify division factor (1/4 or 1/2) of the
subclock.
● Oscillation stabilization wait interval selector
This oscillation stabilization wait interval selector selects an oscillation stabilization wait interval for the
oscillation clock when the stop mode is released or when a watchdog timer reset occurs. Selection is made
from among three different timebase timer outputs. In all other cases, an oscillation stabilization wait
interval is not selected.
105
CHAPTER 5 CLOCKS
5.3
Clock Selection Registers
This section lists the clock selection registers and describes the function of each
register in details.
■ Clock Selection Registers
Figure 5.3-1 shows the clock selection register (CKSCR) and PLL/Subclock Control Register (PSCCR).
Figure 5.3-1 Clock Selection Registers
15
Address: 0000A1H
Read/write
Address: 0000CFH
Read/write
Bit No.
CKSCR
14
13
12
11
10
9
8
SCM
MCM
WS1
WS0
SCS
MCS
CS1
CS0
(R)
(R)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
15
14
13
12
11
10
9
8
Reserved
SCDS
Reserved
CS2
Bit No.
PSCCR
(W)
(W)
(W)
(W)
Initial value
(
)
(
)
(
)
(
)
Initial value
11111100B
XXXX0000 B
R/W : Readable and writable
R : Read only
W : Write only
X : Undefined value
: Undefined
106
CHAPTER 5 CLOCKS
5.3.1
Clock Selection Register (CKSCR)
The clock selection register (CKSCR) is used to switch between the main clock, PLL
clocks and subclock, also used to select an oscillation stabilization wait interval and a
PLL clock multiplier.
■ Configuration of the Clock Selection Register (CKSCR)
Figure 5.3-2 shows the configuration of the clock selection register (CKSCR). Table 5.3-1 describes the
function of each bit of the clock selection register (CKSCR).
Figure 5.3-2 Configuration of the Clock Selection Register (CKSCR)
Address
0000A1H
bit15
bit13
bit12
bit11
bit10
bit9
bit8
SCM MCM WS1
WS0
SCS
MCS
CS1
CS0
R/W
R/W
R/W
R/W
R/W
R
bit14
R
R/W
bit7
bit0 Initial value
(LPMCR)
11111100B
CS2(PSCCR register : bit8)
CS2 CS1 CS0
Multiplier selection bits
The resulting clock for an oscillation clock
of 4 MHz is given in parentheses.
0
0
0
1 x HCLK (4MHz)
0
0
1
2 x HCLK (8MHz)
0
1
0
3 x HCLK (12MHz)
0
1
1
4 x HCLK (16MHz)
1
1
0
6 x HCLK (24MHz)
1
1
1
prohibited
Machine clock selection bit
MCS
0
PLL clock selected.
1
Main clock selected.
Machine clock selection bit (sub)
SCS
0
1
Subclock selected.
Main clock selected.
Oscillation stabilization wait interval selection bits
WS1 WS0 The corresponding time interval for an oscillation
clock of 4 MHz is given in parentheses.
0
0
210/ HCLK(approx. 256 µs)
0
1
213/ HCLK (aprox. 2.05 ms)
1
0
217/ HCLK (aprox. 32.77 ms)
1
1
215/ HCLK (aprox. 8.19 ms)*1
*1 When a power-on reset occurs, the oscillation
stabilization wait time is 216/HCLK (aprox. 16.38 ms).
MCM
0
Machine clock indication bit
Running on a PLL clock.
1
Running on the main clock.
SCM
HCLK : Oscillation clock
R/W : Read/write
: Read only
R
: Initial value
Machine clock indication bit (sub)
0
Running on the subclock.
1
Running on the main clock.
107
CHAPTER 5 CLOCKS
Note:
The machine clock selection bit is initialized to main clock selection at a reset.
Table 5.3-1 Function Description of Each Bit of the Clock Selection Register (CKSCR) (1/3)
Bit name
bit15
SCM:
Machine clock
indication bit (sub)
Function
•
•
•
bit14
MCM:
Machine clock
indication bit
•
•
•
bit13
bit12
108
WS1 and WS0:
Oscillation
stabilization wait
interval selection
bits
•
This bit indicates whether the main clock or sub-clock has been selected as the
machine clock.
When this bit is "0", the sub-clock has been selected. When it is "1", the main clock
has been selected.
If SCS = 1 and SCM = 0, the main clock oscillation stabilization wait interval is in
effect.
This bit indicates whether the main clock or a PLL clock has been selected as the
machine clock.
When this bit is 0, a PLL clock has been selected. When it is 1, the main clock has
been selected.
If MCS = 0 and MCM = 1, the PLL clock oscillation stabilization wait interval is in
effect.
These bits select an oscillation stabilization wait interval of the oscillation clock
when stop mode was released, when transition occurred from sub-clock mode to main
clock mode, or when transition occurred from sub-clock mode to PLL clock mode.
• These bits are initialized to "11B" by all reset causes.
Note:
The oscillation stabilization wait interval must be set to a value appropriate for the
oscillator used. See Section "7.2 Reset Cause and Oscillation Stabilization Wait
Times". These bits can be reset to "00B" only for main clock mode.
Reference:
When main clock mode is switched to PLL clock mode, the oscillation stabilization
wait interval is fixed at 214/HCLK (that is, the oscillation stabilization wait interval is
approximately 4.1 ms when the oscillation clock frequency is 4 MHz). When subclock mode is switched to PLL clock mode or when PLL stop mode is released, the
oscillation stabilization wait interval uses the specified values in the WS1 and WS0
bits. For PLL oscillation stabilization, at least 214/HCLK is required. Accordingly,
when sub-clock mode is switched to PLL clock mode, or when PLL clock mode is
switched to PLL stop mode, set WS1 and WS0 bits to "10B" or "11B".
CHAPTER 5 CLOCKS
Table 5.3-1 Function Description of Each Bit of the Clock Selection Register (CKSCR) (2/3)
Bit name
Function
bit11
SCS:
Machine clock
selection bit (sub)
•
This bit specifies whether the main clock or sub-clock is selected as the machine
clock.
• If 0 is written when this bit is 1, the mode is switched to the subclock mode by
synchronizing with the subclock (about 130 µs when the sub-clock oscillation
frequency is 32kHz and is divided by 4).
• If this bit has been set to "0" and "1" is written to it, the oscillation stabilization wait
interval for the main clock starts. As a result, the timebase timer is automatically
cleared.
• When the sub-clock has been selected, the operating clock frequency is the oscillation
clock frequency divided by 2 or 4 (that is, the machine clock frequency is 16kHz or 8
kHz when the oscillation clock frequency is 32 kHz).
• The subclock division ratio is determined by SCDS bit of PLL/Subclock Control
Register (PSCCR).
• If both the SCS and MCS bits are "0", the SCS bit takes precedence, that is, the subclock is selected.
• This bit is initialized to "1" by all reset causes.
Note:
The oscillation stabilization wait time of the subclock (about 2s, when the sub-clock
oscillation frequency is 32 kHz and is divided by 4) is generated when the power is
turned on or the stop mode is canceled. Thus, if the mode is switched from the main
cock mode to the subclock mode during this period, an oscillation stabilization wait
time is generated.
bit10
MCS:
Machine clock
selection bit
• This bit specifies whether the main clock or a PLL clock is selected as the machine
clock.
• When this bit is "0", a PLL clock is selected. When it is 1, the main clock is selected.
• If this bit has been set to "1" and "0" is written to it, the oscillation stabilization wait
interval for the PLL clock starts. As a result, the timebase timer is automatically
cleared, and the TBOF bit of the timebase timer control register (TBTC) is also
cleared.
• When main clock mode is switched to PLL clock mode, the oscillation stabilization
wait interval is fixed at 214/HCLK (that is, the oscillation stabilization wait interval is
approximately 4.1 ms when the oscillation clock frequency is 4 MHz). When subclock mode is switched to PLL clock mode or when PLL stop mode is released, the
oscillation stabilization wait interval uses the specified values in the WS1 and WS0
bits. For PLL oscillation stabilization, at least 214/HCLK is required. Accordingly,
when sub-clock mode is switched to PLL clock mode, or when PLL clock mode is
switched to PLL stop mode, set the WS1 and WS0 bits to "10B" or "11B."
• When the main clock has been selected, the operating clock frequency is the
oscillation clock frequency divided by 2 (that is, the operating clock is 2 MHz when
the oscillation clock frequency is 4 MHz).
• This bit is initialized to "1" by all reset causes.
Note:
When the MCS bit is "1", write "0" to it only when the timebase timer interrupt is
masked by the TBIE bit of the timebase timer control register (TBTC) or the interrupt
level register (ILM).
109
CHAPTER 5 CLOCKS
Table 5.3-1 Function Description of Each Bit of the Clock Selection Register (CKSCR) (3/3)
Bit name
bit9
bit8
CS1 and CS0:
Multiplier selection
bits
Function
• These bits and CS2 bits in PSCCR register select a PLL clock multiplier.
• Selection can be made from among five different multipliers.
• These bits are initialized to "00B" by all reset causes.
• Recommended setting of CS2, CS1, CS0:
CS2
CS1
CS0
PLL clock Multiplex time
0
0
0
x 1
0
0
1
x 2
0
1
0
x 3
0
1
1
x 4
1
1
0
x 6
1
1
1
prohibited
Note:
When the MCS or MCM bit is "0", writing to these bits is not possible. Write to the
CS0, CS1 and CS2 bits only after setting the MCS bit to "1" (main clock mode).
HCLK: Oscillation clock
110
CHAPTER 5 CLOCKS
5.3.2
PLL/Subclock Control Register (PSCCR)
PLL/Subclock control register adds the selection of a PLL clock multiplier.
■ Configuration of the PLL/Subclock Control Register (PSCCR)
Figure 5.3-3 shows the configuration of the PLL/Subclock control register (PSCCR).
Figure 5.3-3 Configuration of the PLL/Subclock Control Register (PSCCR)
Address
0000CFH
bit15
bit14
bit13
bit12
bit11
bit10
bit9
Reserved SCDS Reserved
W
W
W
bit8
bit7
bit0 Initial value
XXXX0000B
CS2
W
CS2
Additional multiplier selection bit
0
1
Reserved
0
Refer to the description for CS1 and CS0 bits
in the CKSCR register
Reserved bit
Always write "0" to this bit.
The value read from this bit is always "1".
SCDS Sub Clock Division Select bit
W
X
: Write only
: Undefined value
: Undefined
: Initial value
0
Sub clock divided by 4
1
Sub clock divided by 2
Reserved
0
Reserved bit
Always write "0" to this bit.
The value read from this bit is always "1".
111
CHAPTER 5 CLOCKS
Table 5.3-2 Function Description of Each Bit of the PLL/Subclock Control Register (PSCCR)
Bit name
Function
bit15
to
bit12
Unused bits
• These bits are unused.
• Writing to these bits has no effect.
• Reading these bits always returns "1".
bit11,
bit9
Reserved:
Reserved bit
• These bits are reserved bits.
• Always write "0" to these bits
• Reading these bits always returns "1".
bit10
SCDS:
Sub clock division
ratio select bit
• This bit selects the sub clock division ratio.
• Writing "0" to this bit sets operating clock in sub clock mode to sub clock oscillation
frequency divided by 4.
Writing "1" to this bit sets the clock to the oscillation frequency divided by 2.
• This bit is initialized to "0" by all reset causes.
bit8
CS2:
Multiplier selection
bit2
•
This bit and CS1 and CS0 bits of the Clock selection register (CKSCR) select a PLL
clock multiplier.
• About the relationship between setting CS2,CS1 and CS0 bits and the PLL clock
multiplier selection, please refer to the description for the CS1 and CS0 bits of the
CKSCR register.
• This bit is initialized to "0" by all reset causes.
Note:
When the MCS or MCM bit is "0", changing the setting of this bit is not allowed.
Change this bit only after setting the MCS bit to "1" (main clock mode).
Note:
The PSCCR is a write-only register, so the read value is different from the write value. Therefore,
instructions that perform a read-modify-write (RMW) operation, such as the INC/DEC instruction,
cannot be used.
112
CHAPTER 5 CLOCKS
5.4
Clock Mode
Three clock modes are provided: main clock mode, PLL clock mode and sub-clock
mode.
■ Main Clock Mode, PLL Clock Mode and Sub-clock Mode
● Main clock mode
In main clock mode, a clock whose frequency is the oscillation clock frequency divided by 2 is used as the
operating clock for the CPU and peripheral resources, and the PLL clocks are disabled.
● PLL clock mode
In PLL clock mode, a PLL clock is used as the operating clock for the CPU and peripheral resources. A
PLL clock multiplier is selected with the clock selection register (CKSCR: CS1 and CS0) and PLL/
Subclock control register (PSCCR: CS2).
● Sub-clock mode
In sub-clock mode, a clock whose frequency is the oscillation clock frequency divided by 2 or 4 is used as
the operating clock for the CPU and peripheral resources, and the main clock and PLL clocks are disabled.
The subclock division ratio is determined by SCDS bit of PLL/Subclock Control Register (PSCCR).
■ Clock Mode Transition
Transition among main clock mode, PLL clock mode, and sub-clock mode is performed by writing to the
MCS and SCS bits of the clock selection register (CKSCR).
● Transition from main clock mode to PLL clock mode
When the MCS bit of the clock selection register (CKSCR) is rewritten from "1" to "0" in main clock
mode, switching from the main clock to a PLL clock occurs after the PLL clock oscillation stabilization
wait interval (214/HCLK).
● Transition from PLL clock mode to main clock mode
When the MCS bit of the clock selection register (CKSCR) is rewritten from "0" to "1" in PLL clock mode,
switching from the PLL clock to the main clock occurs when the edges of the PLL clock and the main
clock coincide (after 1 to 12 PLL clocks).
● Transition from main clock mode to sub-clock mode
When the SCS bit of the clock selection register (CKSCR) is rewritten from "1" to "0" in main clock mode,
switching from the main clock to a sub-clock occurs by synchronizing with the subclock (about 130µs
when the sub-clock oscillation frequency is 32kHz and is divided by 4).
113
CHAPTER 5 CLOCKS
● Transition from sub-clock mode to main clock mode
When the SCS bit of the clock selection register (CKSCR) is rewritten from "0" to "1" in sub-clock mode,
switching from the sub-clock to the main clock occurs after the main clock oscillation stabilization wait
interval. The oscillation stabilization wait interval is selected based on the WS1 and WS0 bits of the clock
selection register (CKSCR).
● Transition from PLL clock mode to sub-clock mode
When the SCS bit of the clock selection register (CKSCR) is rewritten from "1" to "0" in PLL clock mode,
switching from the PLL clock to the sub-clock occurs.
● Transition from sub-clock mode to PLL clock mode
When the SCS bit of the clock selection register (CKSCR) is rewritten from "0" to "1" in sub-clock mode,
switching from the sub-clock to a PLL clock occurs after the main clock oscillation stabilization wait
interval. The oscillation stabilization wait interval is selected based on the WS1 and WS0 bits of the clock
selection register (CKSCR).
Note:
Even though the MCS and SCS bits of the clock selection register (CKSCR) are rewritten, machine
clock switching does not occur immediately. When operating a resource that depends on the
machine clock, confirm that machine clock switching has been performed by referring to the MCM
and SCM bits of the clock selection register (CKSCR) before operating the resource.
When the clock mode is switched, do not switch to other clock mode and low power consumption
mode before this switching is completed. Confirm the completion of clock mode switching by
referring to the MCM and SCM bits of the clock selection register (CKSCR).
If both the SCS and MSC bits are "0", the SCS bit takes precedence, that is, sub-clock mode is
selected.
■ Selection of a PLL Clock Multiplier
Writing a value from "00B" to "11B" to the CS1 and CS0 bits of the clock selection register (CKSCR) and
"0" or "1" to the CS2 bit of the PLL/Subclock control register (PSCCR) selects a PLL clock multiplier of 1
to 4 (when CS2=0), 2 to 6 (when CS2=1, CS1=1, CS0=0).
■ Machine Clock
The machine clock may be a PLL clock output from the PLL multiplier circuit, a clock whose frequency is
the source oscillation frequency divided by 2, or a clock whose frequency is the sub-clock oscillation
frequency divided by 4 or 2. This machine clock is supplied to the CPU and peripheral functions. The main
clock, PLL clock, or sub-clock can be selected by writing to the MCS or SCS bit of the clock selection
register (CKSCR). And the sub-clock division ratio, 4 or 2, can be selected by writing to SCDS bit of the
PLL/Subclock control register (PSCCR).
Figure 5.4-1 shows the status change caused by machine clock switching.
114
CHAPTER 5 CLOCKS
Figure 5.4-1 Status Change Diagram for Machine Clock Selection
Main
MCS = 1
MCM = 1
SCS = 1
SCM = 1
CS1, CS0 = xxB
CS2=x
(10)
(12)
(20)
(13)
(8)
(9)
(9)
(9)
(9)
(11)
(1)
Main
PLLx
MCS = 0
MCM = 1
SCS = 1
SCM = 1
CS1, CS0 = xxB
CS2=x
(9)
Main
Sub
MCM = 1
SCS = 0
SCM = 1
CS1, CS0 = xxB
CS2=x
(2)
(3)
(4)
(5)
(6)
Sub
Main
MCM = 1
SCS = 1
SCM = 0
CS1, CS0 = xxB
CS2=x
(12)
Sub
MCS = X
MCM = 1
SCS = 0
SCM = 0
CS1, CS0 = xxB
CS2=x
(11)
(10)
(14)
(15)
(16)
(17)
(18)
Sub
PLL
MCS = 0
MCM = 1
SCS = 1
SCM = 0
CS1, CS0 = xxB
CS2=0
PLL1
Main
MCS = 1
MCM = 0
SCS = 1
SCM = 1
CS1, CS0 = 00B
CS2=0
PLL1: Multiplied
MCS = 0
MCM = 0
SCS = 1
SCM = 1
(8) CS1, CS0 = 00B (10)
CS2=0
PLL1
Sub
MCS = 1
MCM = 0
SCS = 0
SCM = 1
CS1, CS = 00B
CS2=0
PLL2
Main
MCS = 1
MCM = 0
SCS = 1
SCM = 1
CS1, CS0 = 01B
CS2=0
PLL2: Multiplied
MCS = 0
MCM = 0
SCS = 1
(10)
(8) SCM = 1
CS1, CS0 = 01B
CS2=0
PLL2
Sub
(21)
MCS = 1
MCM = 0
SCS = 0
SCM = 1
CS1, CS0 = 01B
CS2=0
PLL3
Main
MCS = 1
MCM = 0
SCS = 1
SCM = 1
CS1, CS0 = 10B
CS2=0
PLL3: Multiplied
MCS = 0
MCM = 0
SCS = 1
(10)
(8) SCM = 1
CS1, CS0 = 10B
CS2=0
PLL4
Main
MCS = 1
MCM = 0
SCS = 1
SCM= 1
CS1, CS0 = 11B
CS2=0
PLL4: Multiplied
MCS = 0
MCM = 0
SCS = 1
(10)
(8) SCM = 1
CS1, CS0 = 11B
CS2=0
PLL6
Main
MCS = 1
MCM = 0
SCS = 1
SCM = 1
CS1, CS0 = 10B
CS2=1
PLL6: Multiplied
MCS = 0
MCM = 0
SCS = 1
(10)
(8) SCM = 1
CS1, CS0 = 10B
CS2=1
(21)
PLL3
Sub
(21)
MCS = 1
MCM = 0
SCS = 0
SCM = 1
CS1, CS0 =10B
CS2=0
PLL4
Sub
(21)
MCS = 1
MCM = 0
SCS = 0
SCM = 1
CS1, CS0 = 11B
CS2=0
(21)
PLL6
Sub
MCS = 1
MCM = 0
SCS = 0
SCM = 1
CS1, CS0 =10B
CS2=1
115
CHAPTER 5 CLOCKS
(1)
Writing "0" to the MCS bit
(2)
End of PLL clock oscillation stabilization wait & CS1 and CS0 = 00B & CS2 = 0
(3)
End of PLL clock oscillation stabilization wait & CS1 and CS0 = 01B & CS2 = 0
(4)
End of PLL clock oscillation stabilization wait & CS1 and CS0 = 10B & CS2 = 0
(5)
End of PLL clock oscillation stabilization wait & CS1 and CS0 = 11B & CS2 = 0
(6)
End of PLL clock oscillation stabilization wait & CS1 and CS0 = 10B & CS2 = 1
(8)
Writing "1" to the MCS bit (including reset)
(9)
Timing of synchronization between the PLL clock and the main clock
(10)
Writing "0" to the SCS bit
(11)
Timing of synchronization between the main clock and the sub-clock.
(12)
Writing "1" to the SCS bit (MCS = 1)
(13)
End of main clock oscillation stabilization wait
(14)
End of main clock oscillation stabilization wait & CS1 and CS0 = 00B & CS2 = 0
(15)
End of main clock oscillation stabilization wait & CS1 and CS0 = 01B & CS2 = 0
(16)
End of main clock oscillation stabilization wait & CS1 and CS0 = 10B & CS2 = 0
(17)
End of main clock oscillation stabilization wait & CS1 and CS0 = 11B & CS2 = 0
(18)
End of main clock oscillation stabilization wait & CS1 and CS0 = 10B & CS2 = 1
(20)
Writing "1" to the SCS bit (MCS = 0)
(21)
Timing of synchronization between the PLL clock and the sub-clock
MCS
: Machine clock selection bit of the clock selection register (CKSCR)
MCM
: Machine clock indication bit of the clock selection register (CKSCR)
SCS
: Machine clock selection bit of the clock selection register (CKSCR) (sub)
SCM
: Machine clock indication bit of the clock indication register (CKSCR) (sub)
CS1, CS0
: Multiplier selection bits of the clock selection register (CKSCR)
CS2
: Multiplier selection bits of the PLL/subclock control register (PSCCR)
Notes:
• The initial value for the machine clock setting is main clock (CKSCR: MCS = 1, SCS = 1).
• If both the SCS and MCS bits are "0", the SCS bit takes precedence, that is, the sub-clock is
selected.
• When sub-clock mode is switched to PLL clock mode, set the WS1 and WS0 bits of CKSCR to
"10B" or "11B".
116
CHAPTER 5 CLOCKS
5.5
Oscillation Stabilization Wait Interval
When the power is turned on, when stop mode is released, or switching from the subclock to the main clock or from sub-clock to the PLL clock occurs, an oscillation
stabilization wait interval is required after oscillation begins because there is no
oscillation. When switching from the main clock to the PLL clock or from the main clock
to the sub-clock occurs, an oscillation stabilization wait interval is required.
■ Oscillation Stabilization Wait Interval
Ceramic and crystal oscillators generally require several to dozens of ms to stabilize at their natural
frequency (oscillation frequency) when oscillation starts. For this reason, CPU operation is not allowed
immediately after oscillation starts but is allowed only after full oscillation stabilization. After the
oscillation stabilization wait interval has elapsed, the clock is supplied to the CPU. Because the oscillation
stabilization time depends on the type of oscillator (crystal, ceramic, etc.), the proper oscillation
stabilization wait interval for the oscillator used must be selected. An oscillation stabilization wait interval
is selected by setting the clock selection register (CKSCR).
When clock mode is switched from main clock to PLL clock, main clock to subclock, subclock to main
clock, or subclock to PLL clock, the CPU runs in the clock mode set before switching for the oscillation
stabilization wait time. After the oscillation stabilization wait time has elapsed, the CPU changes to the
specified clock mode.
Figure 5.5-1 shows the operation immediately after oscillation starts.
Figure 5.5-1 Operation Immediately after Oscillation Starts
Oscillator-activated
oscillation time
Start of oscillation
Oscillation stabilization wait interval
Normal operation start or
switching to PLL clock/sub-clock
Stable oscillation
117
CHAPTER 5 CLOCKS
5.6
Connection of an Oscillator or an External Clock to
Microcontroller
The MB90860A series microcontroller contains a system clock generation circuit.
Connecting an external oscillator to this circuit generates the system clock.
Alternatively, an externally generated clock can be input to the microcontroller.
■ Connection of an Oscillator or an External Clock to the Microcontroller
● Example of connecting a crystal or ceramic oscillator to the microcontroller
Connect a crystal or ceramic oscillator as shown in the example in Figure 5.6-1.
Figure 5.6-1 Example of Connecting a Crystal or Ceramic Oscillator to the Microcontroller
MB90860A series
X0(X0A)
X1(X1A)
● Example of connecting an external clock to the microcontroller
As shown in the example in Figure 5.6-2, connect an external clock to pin X0 (X0A). Pin X1 (X1A) must
be open.
Figure 5.6-2 Example of Connecting an External Clock to the Microcontroller
MB90860A series
X0(X0A)
X1(X1A)
Open
118
CHAPTER 6
CLOCK MODULATOR
This chapter provides an overview of the Clock
Modulator and its features. It describes the register
structure and operation of the Clock Modulator.
6.1 Overview
6.2 Clock Modulator Control Register (CMCR)
6.3 Application Note
119
CHAPTER 6 CLOCK MODULATOR
6.1
Overview
This section describes an overview of the Clock Modulator.
■ Overview
The clock modulator is intended for the reduction of electromagnetic interference - EMI, by spreading the
spectrum of the clock signal over a wide range of frequencies.
The module is fed with an unmodulated reference clock provided by the PLL circuit. This reference clock
is phase modulated by a triangular waveform.
120
CHAPTER 6 CLOCK MODULATOR
6.2
Clock Modulator Control Register (CMCR)
The Control Register (CMCR) set the phase clock modulator to enable or disable.
■ Clock Modulator Control Register (CMCR)
Figure 6.2-1 Configuration of the Clock Modulator Control Register (CMCR)
7
0079C2H
6
5
4
3
Re- RePMOD Reserved served served
-
R/W R/W R/W R/W
-
2
1
0
ReReReserved served served
R
R/W R/W
CMCR
Initial value
0 0 0 1 X 0 0 0B
bit 0,1,2,4,5,6
Reserved
bit 0,1
Always write "0" to these bits
bit 2
Writing to this bit has no effect
bit 4
Always write "1" to this bit
bit 5,6
Always write "0" to these bits
bit 7
PMOD
R/W
R
X
-
:
:
:
:
Readable and writable
Read only
Undefined value
Undefined
:
Initial value
Phase modulation enabled
0
Phase modulation disabled
1
Phase modulation enabled
121
CHAPTER 6 CLOCK MODULATOR
■ Clock Modulator Control Register Contents
Table 6.2-1 Function of Each Bit of the Clock Modulator Control Register
Bit name
Function
bit7
PMOD:
Phase modulation
enable bit
Writing "0": Phase modulation disabled (default).
Writing "1": Modulator enabled, MCU is running with phase modulated clock
• To enable the modulator, PMOD must be set to 1.
• Before the modulator can be enabled, the PLL must deliver a stable reference clock
(PLL lock time must be elapsed - refer to the CLOCK chapter in the hardware
manual).
• Whenever the PLL output frequency is changed or the PLL is switched off e.g. in
power down modes, the modulator must be disabled before → PMOD=0 and 4 NOP
cycles must follow the PMOD-bit access.
• After enabling the clock modulator, the clock switches immediately to modulated
clock without glitches in the clock signal.
Please refer to the application note for a description of the recommended startup
sequence.
• The status of the clock signal is indicated by PMOD. PMOD=1 clock is phase
modulated.
• The pulse width of the phase modulated clock signal can vary +/- 0.8 ns.
E.g. at F0 = 24 MHz unmodulated input clock, T0 = 41.7ns. Tmodmin =
41.7ns - 0.8ns = 40.9ns → Fmodmax = 1/40.9 ns = 24.45 MHz.
bit6, bit5
Reserved
Always write "0" to these bits.
bit4
Reserved
Always write "1" to this bit.
bit3
Undefined
-
bit2
Reserved
This bit read only and writing to this bit has no effect. Reading this bit always returns 0.
bit1, bit0
Reserved
Always write "0" to these bits.
122
CHAPTER 6 CLOCK MODULATOR
6.3
Application Note
Startup/stop sequence for the clock modulator.
■ Recommended Startup Sequence for the Clock Modulator
start
1.
Switch on PLL
2.
Wait PLL lock time (refer to the MCM flag description in the CLOCK chapter of the
hardware manual).
3.
Enable the clock modulator (PMOD=1).
The clock switches immediately to modulated clock
... running...
stop
4.
Disable modulator PMOD=0
5.
4 NOP cycles
6.
Disable PLL, switch to power down mode, etc.
Note:
Do not enable the modulator before the PLL lock time has elapsed. Do not disable the PLL while the
modulator is running.
123
CHAPTER 6 CLOCK MODULATOR
124
CHAPTER 7
RESETS
This chapter describes resets for the MB90860A-series
microcontrollers.
7.1 Resets
7.2 Reset Cause and Oscillation Stabilization Wait Times
7.3 External Reset Pin
7.4 Reset Operation
7.5 Reset Cause Bits
7.6 Status of Pins in a Reset
125
CHAPTER 7 RESETS
7.1
Resets
If a reset is generated, the CPU immediately stops the current execution process and
waits for the reset to be cleared. The CPU then begins processing at the address
indicated by the reset vector.
The four causes of a reset are as follows
• Power-on reset
• Watchdog timer overflow
• External reset request via the RST pin
• Software reset request
■ Causes of a Reset
Table 7.1-1 lists the causes of a reset.
Table 7.1-1 Causes of a Reset
Type of reset
Cause
Machine clock
Watchdog timer
Oscillation
stabilization
wait
When the power is
turned on
Main clock
(MCLK)
Stop
Yes
L level input to RST
pin
Main clock
(MCLK)
Stop
No
Main clock
(MCLK)
Software
A "0" is written to the
RST bit of the low
power consumption
mode control register
(LPMCR).
Stop
No
Watchdog
timer
Watchdog timer
overflow
Main clock
(MCLK)
Stop
No
Power-on
External pin
Main clock: Oscillation clock frequency divided by 2
● External reset
An external reset is generated by the L level input to an external reset pin (RST pin). The minimum
required period of the L level is 500ns. The oscillation stabilization wait time is not required for external
resets.
In the MB90860A series the external reset has to be min. 100 µs for wake-up from Main-Time base timer
mode.
If the reset cause is generated during a write operation (during the execution of a transfer instruction such
as MOV), the CPU waits for the reset to be cleared after completion of the instruction only for reset
requests via the RST pin. Therefore, the normal write operation is completed even though a reset is input
concurrently.
126
CHAPTER 7 RESETS
Note that a reset may prevent the data transfer requested by a string-processing instruction (such as MOVS)
from being completed because the reset is accepted before a specified number of bytes are transferred.
Also note that when the RDY signal of the external bus interface is kept active, the external reset takes its
effect after 16 machine clock cycles.
When the external reset is applied while in the stop mode, subclock mode, sub-sleep mode and watch
mode, the external reset signal must be kept active for more than the duration of the required stabilization
time of the external oscillator plus 100µs.
When the external reset is applied while in the timebase timer mode, the external reset signal must be kept
active for more than 100µs.
● Software reset
A software reset is an internal reset generated by writing "0" to the RST bit of the low power consumption
mode control register (LPMCR). The oscillation stabilization wait time is not required for a software reset.
● Watchdog timer reset
A watchdog timer reset is generated by a watchdog timer overflow that occurs when "0" is written to the
WTE bit of the watchdog timer control register (WDTC) within a given time after the watchdog timer is
activated. The oscillation stabilization wait time can be set by the clock selection register (CKSCR).
● Power-on reset
A power-on reset is generated when the power is turned on. The oscillation stabilization wait times at 216/
HCLK (approx. 16.38 ms, HCLK = 4 MHz). When the oscillation stabilization wait time has elapsed, the
reset is executed.
Reference Definition of clocks
HCLK: Oscillation clock
MCLK: Main clock
φ: Machine clock (CPU operating clock)
1/φ: Machine cycle (CPU operating clock period)
See "CHAPTER 5 CLOCKS", for details on machine clocks.
127
CHAPTER 7 RESETS
7.2
Reset Cause and Oscillation Stabilization Wait Times
The MB90860A series has four reset causes. The oscillation stabilization wait time for a
reset depends on the reset cause.
■ Reset Causes and Oscillation Stabilization Wait Times
Table 7.2-1 summarizes reset causes and oscillation stabilization wait times.
Table 7.2-1 Reset Causes and Oscillation Stabilization Wait Times
Oscillation stabilization wait time
The corresponding time interval for an oscillation clock frequency
of 4 MHz is given in parentheses.
Reset cause
Power-on reset
Always 216/HCLK (approx. 16.38 ms at 4 MHz oscillator)
Watchdog timer
None; though bits WS1 and WS0 are initialized to "11B".
External reset via the RST pin
None; though bits WS1 and WS0 are initialized to "11B".
Software reset
None; though bits WS1 and WS0 are initialized to "11B".
HCLK: Oscillation clock
WS1 and WS0: Oscillation stabilization wait time selection bits of the clock selection register (CKSCR)
Table 7.2-1 shows the oscillation stabilization wait times at a power-on reset.
Figure 7.2-1 Oscillation Stabilization Wait Times at a Power-on Reset
Evaluation/flash model
Vcc
215/HCLK
215/HCLK
CLK
CPU operation
Voltage step-down
circuit stabilization
wait interval
HCLK: Oscillation clock
128
Oscillation
stabilization wait
time
CHAPTER 7 RESETS
Note:
Ceramic and crystal oscillators generally require an oscillation stabilization wait time of several
milliseconds to 10 to 20 milliseconds, until stabilization at a natural frequency is attained. A proper
oscillation stabilization wait time must be set for the particular oscillator used.
See Section "5.5 Oscillation Stabilization Wait Interval", for details about oscillation stabilization wait
times.
■ Oscillation Stabilization Wait and Reset State
A reset operation in response to a power-on reset and other resets during stop mode or sub-clock mode is
performed after the oscillation stabilization wait time has elapsed. This time interval is generated by the
timebase timer. If the external reset has not been cleared after the interval, the reset operation is performed
after the external reset is cleared.
129
CHAPTER 7 RESETS
7.3
External Reset Pin
The external reset pin (RST pin) is an input pin used exclusively for a reset. Inputting an
L level signal generates an internal reset. For the MB90860A series, resets are
generated in synchronization with the CPU operating clock. However, initialization of
external pin is asynchronous with the CPU operating clock.
■ Block Diagrams of the External Reset Pin
● Block diagram of the external reset pin
Figure 7.3-1 Block Diagram of the External Reset Pin
CPU operating clock
(PLL multiplier circuit with an
HCLK frequency divided by 2)
RST
CPU
Pch
Synchronization
circuit
Pin
Nch
Input
buffer
Peripheral
functions
I/O port or
other pin
Note:
Inputs to the RST are accepted during cycles in which memory is not affected to prevent memory
from being destroyed by a reset during a write operation.
A clock is required to initialize the internal circuit. In particular, an operation with an external clock
requires clock input together with reset input.
130
CHAPTER 7 RESETS
7.4
Reset Operation
When the reset signal is inactivated, the reset vector and mode data is fetched from the
predetermined locations depending on the setting of the mode pins. This operation, the
mode fetch, then defines the operation mode of the CPU and the start address of the
first instruction. For the power on reset, reset from the stop mode or sub-clock mode,
the mode fetch is preformed after the oscillation stabilization wait time is elapsed.
■ Overview of Reset Operation
Figure 7.4-1 shows the reset operation flow.
Figure 7.4-1 Reset Operation Flow
Power-on reset
Stop mode
Sub clock mode
External reset
Software reset
Watchdog timer reset
During a reset
Oscillation stabilization wait
and reset state
Fetching the mode data
Mode fetch
(Reset operation)
Normal operation
(Run state)
Pin state and function
change associated with
external bus mode
Fetching the reset vector
CPU executes an instruction,
fetching instruction codes from
the address indicated by the
reset vector.
■ Mode Pins
Setting the mode pins (MD0 to MD2) specifies how to fetch the reset vector and the mode data. Fetching
the reset vector and the mode data is performed in the reset sequence. See Section "9.1.1 Mode Pins", for
details on mode pins.
131
CHAPTER 7 RESETS
■ Mode Fetch
When the reset is cleared, the CPU transfers the reset vector and the mode data to the appropriate registers
in the CPU core by hardware. The reset vector and mode data are allocated to the four bytes from
"FFFFDCH" to "FFFFDFH". The CPU outputs these addresses to the bus immediately after the reset is
cleared and then fetches the reset vector and mode data. Using mode fetching, the CPU can begin
processing at the address indicated by the reset vector.
Figure 7.4-2 shows the transfer of the reset vector and mode data.
Figure 7.4-2 Transfer of Reset Vector and Mode Data
Memory space
FFFFDF H
Mode data
FFFFDE H
Bits 23 to 16 of reset vector
FFFFDD H
Bits 15 to 8 of reset vector
FFFFDC H
Bits 7 to 0 of reset vector
F2MC-16LX CPU core
Mode
register
Reset
sequence
MicroROM
PCB
PC
● Mode data (address: FFFFDFH)
Only a reset operation changes the contents of the mode register. The mode register setting is valid after a
reset operation. See Section "9.1.2 Mode Data", for details on mode data.
● Reset vector (address: FFFFDCH to FFFFDEH)
The reset vector points to the start address after the reset sequence. The CPU starts to execute the first
instruction stored in the start address.
132
CHAPTER 7 RESETS
7.5
Reset Cause Bits
A reset cause can be identified by reading the watchdog timer control register (WDTC).
■ Reset Cause Bits
As shown in Figure 7.5-1, a flip-flop is associated with each reset cause. The contents of the flip-flops are
obtained by reading the watchdog timer control register (WDTC). If the cause of a reset must be identified
after the reset has been cleared, the value read from the WDTC should be processed by the software and a
branch made to the appropriate program.
Figure 7.5-1 Block Diagram of Reset Cause Bits
RST pin
No periodic clear
RST="L"
External reset
request
detection cirtuit
Power-on
detection
circuit
Watchdog timer
reset generation
detection cirtuit
Watchdog timer
control register
(WDTC)
RST bit set
LPMCR, RST
bit write
detection circuit
Clear
S
R
S
Q
R
S
R
Q
R
S
F/F
F/F
F/F
Delay
circuit
F/F
Q
Q
Reading of
watchdog timer
control register
(WDTC)
Internal data bus
S :
R :
Q :
F/F:
Set
Reset
Output
Flip Flop
■ Correspondence between Reset Cause Bits and Reset Causes
Figure 7.5-2 shows the configuration of the reset cause bits of the watchdog timer control register (WDTC).
Table 7.5-1 maps the correspondence between the reset cause bits and reset causes. See "Watchdog timer
control register (WDTC)" in Section "13.1 Outline of Watch-Dog Timer", for details.
Figure 7.5-2 Configuration of Reset Cause Bits (Watchdog Timer Control Register)
Watchdog timer control register (WDTC)
Address
0000A8 H
bit15
bit8 bit7
(TBTC)
bit6
PONR
-
R
-
bit5
bit4
bit3
bit2
bit1
bit0
Initial value
WRST ERST SRST WTE WT1 WT0 X X X X 1 1 1
R
R
R
W
W
B
W
R : Read only
W : Write only
X : Undefined
133
CHAPTER 7 RESETS
Table 7.5-1 Correspondence between Reset Cause Bits and Reset Causes
Reset cause
PONR
WRST
ERST
SRST
Power-on reset
1
X
X
X
Watchdog timer overflow
*
1
*
*
External reset request via RST pin
*
*
1
*
Software reset request
*
*
*
1
*: Previous state defined
X: Undefined
■ Notes about Reset Cause Bits
● Multiple reset causes generated at the same time
When multiple reset causes are generated at the same time, the corresponding reset cause bits of the
watchdog timer control register (WDTC) are also set to "1". If, for example, an external reset request via
the RST pin and the watchdog timer overflow occur at the same time, the ERST and the WRST bits are
both set to "1".
● Power-on reset
For a power-on reset, because the PONR bit is set to "1" but all other reset cause bits are undefined, the
software should be programmed so that it will ignore all reset cause bits except the PONR bit if it is "1".
● Clearing the reset cause bits
The reset cause bits are cleared only when the watchdog timer control register (WDTC) is read. Any bit
corresponding to a reset cause that has already been generated is not cleared even though another reset is
generated (a setting of "1" is retained).
Note:
If the power is turned on under conditions where no power-on reset occurs, the value in WDTC
register may not be guaranteed.
134
CHAPTER 7 RESETS
7.6
Status of Pins in a Reset
This section describes the status of pins when a reset occurs.
■ Status of Pins during a Reset
The status of pins during a reset depends on the settings of mode pins (MD2 to MD0).
● When internal vector mode has been set: (MD2 to MD0 = 011B)
All I/O pins (resource pins) are high impedance, and mode data is read from the internal ROM.
About status of each pins during reset, please see "8.7 Status of Pins in Standby Mode and during Hold and
Reset".
■ Status of Pins after Mode Data is Read
The status of pins after mode data has been read depends on the mode data (M1 and M0 = "00").
● When single-chip mode has been selected (M1 and M0 = 00B)
All I/O pins (resource pins) are high impedance.
Note:
For those pins that change to high impedance when a reset cause is generated, confirm that devices
connected to the pins do not malfunction.
135
CHAPTER 7 RESETS
136
CHAPTER 8
LOW-POWER
CONSUMPTION MODE
This chapter explains the low-power consumption mode
of MB90860A series microcontrollers.
8.1 Overview of Low-Power Consumption Mode
8.2 Block Diagram of the Low-Power Consumption Control Circuit
8.3 Low-Power Consumption Mode Control Register (LPMCR)
8.4 CPU Intermittent Operation Mode
8.5 Standby Mode
8.6 Status Change Diagram
8.7 Status of Pins in Standby Mode and during Hold and Reset
8.8 Usage Notes on Low-Power Consumption Mode
137
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.1
Overview of Low-Power Consumption Mode
The MB90860A series has the following CPU operating modes, any of which can be
used depending on operating clock selection and clock operation control:
• Clock mode (PLL clock mode, main clock mode, or sub-clock mode)
• CPU intermittent operating mode (PLL clock intermittent operating mode, main clock
intermittent operating mode, or sub-clock intermittent operating mode)
• Standby mode (sleep mode, timebase timer mode, stop mode, or watch mode)
■ CPU Operating Modes and Current Consumption
Figure 8.1-1 shows the relationship between the CPU operating modes and current consumption.
Figure 8.1-1 CPU Operating Mode and Current Consumption
Current consumption
Several tens
of mA
CPU operating
mode
PLL clock mode
Multiplied-by-six clock
Multiplied-by-four clock
Multiplied-by-three clock
Multiplied-by-two clock
Multiplied-by-one clock
Multiplied-by-six clock
PLL clock intermittent
operating mode
Multiplied-by-four clock
Multiplied-by-three clock
Multiplied-by-two clock
Multiplied-by-one clock
Main clock mode (HCLK/2)
Main clock intermittent operating mode
Subclock mode (SCLK/2 or SCLK/4)
Several mA
Subclock intermittent operating mode
Standby mode
Sleep mode
Timebase timer mode
Watch mode
Several A
Stop mode
Low-power consumption mode
Note:
This figure is only an indication of the degree of power consumption for each mode. Actual current
consumption values may not agree with those in the figure.
138
CHAPTER 8 LOW-POWER CONSUMPTION MODE
■ Clock Mode
● PLL clock mode
In this mode, a PLL clock that is a multiple of the oscillation clock (HCLK) is used to operate the CPU and
peripheral functions.
● Main clock mode
In this mode, the main clock, with the oscillation clock (HCLK) frequency divided by 2 is used to operate
the CPU and peripheral functions. In the main clock mode, the PLL multiplier circuit is inactive.
● Sub-clock mode
In this mode, the sub-clock, with the oscillation clock (SCLK) frequency divided by 2 or 4 is used to
operate the CPU and peripheral functions. In the sub-clock mode, the main clock and PLL multiplier circuit
are inactive.
The subclock oscillation stabilization wait time of 2~14/SCLK (Approx. 2s @32kHz, 1/4 division) takes
place when power-on reset and reactivation from stop mode. If a transition from main clock mode from
subclock mode is preformed during this oscillation stabilization wait time, actual transition may be delayed.
Reference:
For the clock mode, see Section "5.4 Clock Mode".
■ CPU Intermittent Operating Mode
In this mode, the CPU is operated intermittently while high-speed clock pluses are supplied to peripheral
functions, thereby reducing power consumption. In this mode, intermittent clock pulses are supplied only to
the CPU while it is accessing a register, internal memory, peripheral function, or external unit.
■ Standby Mode
In this mode, the low-power consumption control circuit stops supplying the clock to the CPU (sleep mode)
or the CPU and peripheral functions (timebase timer mode) or stops the oscillation clock itself (stop mode),
thereby reducing power consumption.
● PLL sleep mode
The PLL sleep mode is activated to stop the CPU operating clock in the PLL clock mode. Components
excluding the CPU operate on the PLL clock.
● Main sleep mode
The main sleep mode is activated to stop the CPU operating clock in the main clock mode. Components
excluding the CPU operate on the main clock.
● Sub-sleep mode
The subsleep mode activated to stop the CPU operating clock in the subclock mode. Components excluding
the CPU operate on the subclock oscillation frequency divided four or two.
139
CHAPTER 8 LOW-POWER CONSUMPTION MODE
● Timebase timer mode
The timebase timer mode causes the operation of functions, excluding the oscillation clock, timebase timer,
and watch timer, to stop. All functions other than the timebase timer and watch timer are inactivated.
● Watch mode
The watch mode operates the watch timer only. The subclock operates and the main clock and PLL
multiplier circuit stop.
● Stop mode
The stop mode cause the oscillation to stop. All functions are inactivated.
Note:
Because the stop mode turns the oscillation clock off, data can be retained by the lowest power
consumption.
When the clock mode is switched, do not switch to other clock mode and low-power consumption
mode before this switching is completed. Confirm the completion of clock mode switching by
referring to the MCM and SCM bits of the clock selection register (CKSCR).
140
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.2
Block Diagram of the Low-Power Consumption Control
Circuit
The low-power consumption control circuit consists of the following seven blocks:
• CPU intermittent operation selector
• Standby control circuit
• CPU clock control circuit
• Peripheral clock control circuit
• Pin high-impedance control circuit
• Internal reset generation circuit
• Low-power consumption mode control register (LPMCR)
■ Block Diagram of the Low-Power Consumption Control Circuit
Figure 8.2-1 shows a block diagram of the low-power consumption control circuit.
Figure 8.2-1 Block Diagram of the Low-Power Consumption Control Circuit
Low Power Consumption Mode Control Register (LPMCR)
STP SLP SPL RST TMD CG1 CG0 RESV
CPU intermittend
operation cycle
selector
2
Stop signal
CPU clock
control circuit
Sleep signal
Peripheral clock
control circuit
S
Q
S
R
Reset
S
CPU operation
clock
Peripheral function
operation clock
Q
R
Q
S
Q
Interrupt
R
R
Standard Control Circuit
Clock
Selector
Oscillation
stabilization
wait time
interval selector
2
CS2
Bit8 of PLL/
Subclock control
register(PSCCR)
2
SCM MCM WS1 WS0 SCS MCS CS1 CS0
PLL multiplier circuit
Clock Selection register (CKSCR)
Mainclock
X0
Pin
HCLK
X1
Divideby-2
Divideby-512
Pin
Divideby-2
Divideby-2
Divideby-2
Divideby-2
Divideby-2
Divideby-4
Timebase Timer
System clock
generation circuit
Watchdog Timer
Subclock generation circuit
X0A Pin
Divideby-4
Divideby 4 or 2
Watch Timer
Subclock
Divideby-1024
Divideby-8
Divideby-2
Divideby-2
X1A Pin
SCDS
Bit10 of PLL/
Subclock control
register(PSCCR)
141
CHAPTER 8 LOW-POWER CONSUMPTION MODE
● CPU intermittent operation selector
This selector selects the number of clock pulses to halt the CPU during the CPU intermittent operation
mode.
● Standby control circuit
The standby control circuit controls the CPU clock control and the peripheral clock control circuits and
turns the low-power consumption mode on and off.
● CPU clock control circuit
This circuit controls clocks supplied to the CPU. This circuit controls clocks supplied to peripheral
functions for the peripheral clock control circuit.
● Peripheral clock control circuit
This circuit controls clocks supplied to peripheral functions.
● Pin high-impedance control circuit
This circuit makes external pins high-impedance in the timebase timer mode and stop mode. For pins with
the pull-up option, this circuit disconnects the pull-up resistor in the stop mode.
● Internal reset generation circuit
This circuit generates an internal reset signal.
● Low-power consumption mode control register (LPMCR)
This register is used to switch to and release the standby mode and to set the CPU intermittent operation
function.
142
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.3
Low-Power Consumption Mode Control Register (LPMCR)
This register switches to or releases the low-power consumption mode. This register
also sets the number of CPU clock pulses to halt during the CPU intermittent operation
mode.
■ Low-Power Consumption Mode Control Register (LPMCR)
Figure 8.3-1 shows the configuration of the low-power consumption mode control register (LPMCR).
Figure 8.3-1 Configuration of the Low-power Consumption Mode Control Register (LPMCR)
bit15
Address
0000A0H
(CKSCR)
bit8
bit7
bit7
bit6
bit6
bit5
bit5
bit4
bit4
bit3
bit2
bit1
STP
SLP
SPL
RST
RESV
TMD
CG1
CG0 RESV
SSR
W
W
R/W
W
W
R/W
R/W
SSR
RESV
00011000B
R/W
DRAM
self refresh control bit
Reserved
Does
notwrite
control
Always
"0"DRAMC
to this self
bit refresh in the sleep mode.
1
Controls DRAMS self refresh in the sleep mode.
Count bit for CPU clock temporary halt cycle
0
0
0 cycles (CPU clock = Resource clock)
0
1
8 cycles (CPU clock:Resource clock = 1:3 to 4 approx.)
1
0
16 cycles (CPU clock:Resource clock = 1:5 to 6 approx.)
1
1
32 cycles (CPU clock:Resource clock = 1:9 to 10 approx.)
TMD
Timebase timer mode bit
0
Switches to the timebase timer mode or watch mode.
1
No change, no effect on operation
RST
Internal reset signal generation bit
0
Generates an internal reset signal of three machine cycles.
1
No change, no effect on operation
SPL
Watch and pin state setting bit
(for timebase timer mode and stop mode)
0
Previous pin state retained.
1
High impedance
SLP
Sleep mode bit
0
No change, no effect on operation
1
Switches to sleep mode.
STP
: Read/write
: Write-only
: initial value
Initial value
0
CG1 CG0
R/W
W
bit0
Stop mode bit
0
No change, no effect on operation
1
Switches to stop mode.
143
CHAPTER 8 LOW-POWER CONSUMPTION MODE
Table 8.3-1 Function Description of Each Bit of the Low-power Consumption Mode Control Register
(LPMCR)
Bit name
Function
bit7
STP:
Stop mode bit
•
•
•
•
•
This bit indicates switching to the stop mode.
When "1" is written to this bit, a switch to the stop mode is performed.
Writing "0" in this bit has no effect on operation.
This bit is cleared to "0" by a reset or when an interrupt request occurs.
The read value of this bit is always "0".
bit6
SLP:
Sleep mode bit
•
•
•
•
•
This bit indicates switching to a sleep mode.
When "1" is written to this bit, a switch to a sleep mode is performed.
Writing "0" in this bit has no effect on operation.
This bit is cleared to "0" by a reset or when an interrupt request occurs.
The read value of this bit is always "0".
bit5
SPL:
Pin state setting bit
(for watch mode,
timebase timer mode,
and stop mode)
•
•
•
•
This bit is enabled only in the watch mode, timebase timer mode, and stop mode.
When this bit is "0", the level of the external pins is retained.
When this bit is "1", the status of the external pins changes to high-impedance.
This bit is initialized to "0" by a reset.
bit4
RST:
Internal reset signal
generation bit
• When "0" is written to this bit, an internal reset signal of three machine cycles is
generated.
• Writing "1" in this bit has no effect on operation.
• The read value of this bit is always "1".
bit3
TMD:
Watch/timebase timer
mode bit
• This bit indicates switching to the watch mode or timebase timer mode.
• When "0" is written to this bit in the main clock mode or PLL clock mode, a switch
to timebase timer mode is performed.
• When "0" is written to this bit in the subclock mode, a switch to the watch mode is
performed.
• This bit is cleared to "1" by a reset or when an interrupt request occurs.
• The read value of this bit is always "1".
bit2
bit1
CG1, CG0:
Bits for selecting clock
count for CPU
temporary halt cycle
• These bits set the number of CPU clock pulses per cycle to halt the CPU for the CPU
intermittent operation function.
• The clock supplied to the CPU is stopped for the specified number of pulses after the
execution of each instruction.
• Four types of clock counts are selectable.
• These bits are initialized to "00B" by a reset.
bit0
RESV:
Reserved
Note:
Always write "0" to this bit.
144
CHAPTER 8 LOW-POWER CONSUMPTION MODE
Notes:
• Switching to a low-power consumption mode (including the stop mode, sleep mode, timebase
timer mode, and watch mode) is performed by writing the low-power consumption mode control
register. Only the instructions listed in Table 8.3-2 should be used for this purpose. If other
instructions are used for switching to a low-power consumption mode, operation cannot be
assured.
• The low-power consumption mode transition instruction in Table 8.3-2 must always be followed by
an array of instructions highlighted by a line below.
MOV LPMCR, #H’ xx
NOP
NOP
JMP $+3
MOV A, #H’ 10
; The low-power consumption mode transition instruction in Table 8.3-2
; jump to next instruction
; any instruction
The devices does not guarantee its operation after returning from the low-power consumption
mode if you place an array of instructions other than the one enclosed in the dine.
• To access the low-power consumption mode control register (LPMCR) with C language, refer to
"● Notes on Accessing the Low-Power Consumption Made Control Register (LPMCR) to Enter
the Standby Mode" in the section "8.8 Usage Notes on Low-Power Consumption Mode".
• When word-length is used for writing the low-power consumption mode control register, even
addresses must be used. Using odd addresses to switch to a low-power consumption mode may
result in a malfunction.
• To set a pin to high impedance when the pin is shared by a peripheral function and a port in stop
mode, watch mode or timebase timer mode, disable the output of peripheral functions, and set the
STP bit to 1 or set the TMD bit to 0.
Table 8.3-2 Instructions at Transition to Low-power Consumption Mode
MOV io,#imm8
MOV dir,#imm8
MOV eam,#imm8
MOV eam,Ri
MOV io,A
MOV dir, A
MOV addr16, A
MOV eam,A
MOVW io,#imm16
MOVW dir,#imm16
MOVW eam,#imm16
MOVW eam,RWi
MOVW io,A
MOVW dir,A
MOVW addr16,A
MOVW eam,A
SETB io:bp
SETB dir:bp
SETB addr16:bp
CLRB io:bp
CLRB dir:bp
CLRB addr16:bp
MOV @Rli+disp8,A
MOVW @Rli+disp8,A
145
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.4
CPU Intermittent Operation Mode
This mode is used for intermittent operation of the CPU while external buses and
peripheral functions continue to operate at high speeds. The purpose of this mode is to
reduce power consumption.
■ CPU Intermittent Operation Mode
This mode halts the supply of the clock pulse to the CPU for a certain period. The halt occurs after the
execution of every instruction that accesses a register, internal memory (ROM and RAM), I/O, peripheral
functions, or the external bus. Internal bus cycle activation is therefore delayed. While high-speed
peripheral clock pulses are supplied to peripheral functions, the execution speed of the CPU is reduced,
thereby enabling low-power consumption processing.
• The low-power consumption mode control register (LPMCR: CG1 and CG0) is used to select the
number of clock pulses per halt cycle of the clock supplied to the CPU.
• External bus operation uses the same clock as that used for peripheral functions.
• Instruction execution time in the CPU intermittent mode can be calculated. A correction value should be
obtained by multiplying the execution count of instructions that access a register, internal memory,
internal peripheral functions, or the external bus by the number of clock pulses per halt cycle. Add this
corrective value to the normal execution time. Figure 8.4-1 shows the operating clock pulses during the
CPU intermittent operation mode.
Figure 8.4-1 Clock Pulses during the CPU Intermittent Operation
Peripheral clock
CPU clock
Halt cycle
Execution
cycle of one
instruction
Internal bus activation
146
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5
Standby Mode
The standby mode includes the sleep (PLL sleep, main sleep, subsleep), watch, and
stop modes.
■ Operation Status during Standby Mode
Figure 8.5-1 shows operation statuses during standby mode.
Table 8.5-1 Operation Statuses during Standby Mode
Standby mode
Sleep mode
PLL sleep mode
SCS=1
MCS=0
SLP=1
Main sleep mode
SCS=1
MCS=1
SLP=1
Subsleep mode
Timebase
timer mode
Watch mode
Stop mode
Condition
for switch
SCS=0
SLP=1
MCS=X
Timebase timer mode
(SPL=0)
SCS=1
MCS=X
TMD=0
Timebase timer mode
(SPL=1)
SCS=1
MCS=X
TMD=0
Watch mode
(SPL=0)
TMD=0
MCS=X
SCS=0
Watch mode
(SPL=1)
TMD=0
MCS=X
SCS=0
Stop mode
(SPL=0)
STP=1
Stop mode
(SPL=1)
STP=1
Main
clock
Subclock
Machine
clock
CPU
Peripheral
Pin
Release
event
Active
Active
Active
Active
External reset
Interrupt
Inactive
Active
Retained
Active
Inactive
External reset
Inactive *1
Hi-Z
*6
Interrupt
*3
Retained
Inactive
Inactive
External reset
*2
Hi-Z
*6
Interrupt
*4
Inactive
Retained
Inactive
Inactive
Hi-Z
*6
External reset
Interrupt
*5
*1: The timebase timer and watch timer operate.
*2: The watch timer operates.
*3: Watch timer, timebase timer and external interrupt
*4: Watch timer and external interrupt
*5: External interrupt
*6: Input pins for DTP/External interrupt are enabled.
SPL: Pin state setting bit of low-power consumption mode control register (LPMCR)
SLP: Sleep mode bit of low-power consumption mode control register (LPMCR)
STP: Stop mode bit of low-power consumption mode control register (LPMCR)
TMD: Watch and timebase timer mode bit of low-power consumption mode control register (LPMCR)
MCS: Machine clock selection bit of clock selection register (CKSCR)
SCS: Machine clock selection bit (sub) of clock selection register (CKSCR)
Hi-Z: High-impedance
147
CHAPTER 8 LOW-POWER CONSUMPTION MODE
Note:
For those external pins shared between port functions and peripheral functions, disable output for
the peripheral functions then set the STP bit to "1" or reset the TMD bit to "0" to set these pins in
high impedance state.
148
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5.1
Sleep Mode
This mode causes the CPU operating clock to stop while other components continue to
operate. When the low-power consumption mode control register (LPMCR) indicates a
switch to a sleep mode, a switch to the PLL sleep mode occurs if the PLL clock mode
has been set. A switch to the main clock mode occurs if the main clock mode has been
set. A switch to the subsleep mode occurs if the subclock mode has been set.
■ Switching to Sleep Mode
Writing 1 in the SLP bit and the TMD bit and 0 in the STP bit of the low-power consumption mode control
register (LPMCR) triggers a switch to a sleep mode. At this time, if the MSC bit is 0 and the SCS bit is 1 in
the clock selection register (CKSCR), a switch to the PLL sleep mode is triggered. If the MSC bit and the
SCS bit are 1, a switch to the main sleep mode is triggered. If the SCS bit is 0, a switch to the subsleep
mode is triggered.
Note:
When 1 is written to the SLP and STP bits at the same time, the STP bit setting overrides the SLP bit
setting and the mode switches to the stop mode. When 1 is written to the SLP bit and 0 is written to
the TMD bit at the same time, the TMD bit setting overrides the SLP bit setting and the mode
switches to the timebase timer mode or watch mode.
● Data retention function
In a sleep mode, the contents of dedicated registers, such as accumulators, and the internal RAM are
retained.
● Hold function
During a sleep mode, the external bus hold function is active. This function sets the hold status when
requested to do so.
● Operation during an interrupt request
Writing 1 in the SLP bit of the low-power consumption mode control register during an interrupt request
does not trigger a switch to a sleep mode. If the CPU does not accept the interrupt, the CPU executes the
next instruction. If the CPU accepts the interrupt, CPU operation immediately branches to the interrupt
processing routine.
● Status of pins
During a sleep mode, all pins (excluding those used for bus I/O or bus control) retain their previous status.
■ Release of Sleep Mode
The low-power consumption control circuit releases sleep modes when a reset is input or an interrupt
occurs.
149
CHAPTER 8 LOW-POWER CONSUMPTION MODE
● Return by a reset
A sleep mode is initialized to the main clock mode by a reset.
Note:
When the sub-sleep mode is switched to main clock mode using an external reset pin (RST pin),
input level "L" for at least the oscillation time of the oscillator * + 100 µs + 16 machine cycles.
*: The oscillation time of the oscillator is the time required to reach 90% of amplitude. It takes
several to dozens of ms for crystal oscillators, hundreds of µs to several ms for FAR/ceramic
oscillators, and 0 ms for external clocks.
● Return by an interrupt
If an interrupt request of higher than level seven is issued from a peripheral circuit during a sleep mode, the
sleep mode is released. After the mode is released, the interrupt is handled as an ordinary interrupt. If the
interrupt is accepted according to the setting of the I flag of the condition code register (CCR), interrupt
level mask register (ILM), and interrupt control register (ICR), the CPU executes the interrupt processing.
If the interrupt is not accepted, the CPU executes the instruction following the instruction specifying the
sleep mode.
Figure 8.5-1 shows the release of a sleep mode when an interrupt occurs.
Figure 8.5-1 Release of Sleep Mode By Interrupt Occurrence
Interrupt from peripheral function
Set the enable flag.
IL smaller than 7
INT occurrence?
(IL smaller than 7)
Sleep mode is
not released.
Next instruction
is executed.
ILM smaller than IL
Sleep mode is
not released.
Sleep mode is
released.
Next instruction
is executed.
Interrupt is executed.
Note:
When interrupt processing is executed, the CPU normally executes the instruction that follows the
instruction in which switching to a sleep mode has been specified. The CPU then proceeds to
interrupt processing. If the switching to sleep mode and acceptance of an external bus hold request
occur at the same time, however, the CPU may proceed to interrupt processing before executing the
next instruction.
Figure 8.5-2 shows a return from the Sleep mode.
150
CHAPTER 8 LOW-POWER CONSUMPTION MODE
Figure 8.5-2 Release of the Sleep Mode (External Reset)
RST pin
Sleep mode
Main clock
Oscillating
PLL clock
Oscillating
CPU clock
PLL clock
CPU operation
inactive
Sleep mode release
Reset sequence
Execution
Reset cleared
151
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5.2
Timebase Timer Mode
This mode causes all functions, excluding oscillation, the timebase timer, and the watch
timer, to stop. In this mode, only the timebase timer and watch timer operate.
■ Switching to the Timebase Timer Mode
When 0 is written to the TMD bit of the low-power consumption mode control register (LPMCR) in the
PLL clock mode or main clock mode (CKSCR: SCS = 1), switching to the timebase timer mode occurs.
● Data retention function
In the timebase timer mode, the contents of dedicated registers, such as accumulators, and the internal
RAM are retained.
● Hold function
During the timebase timer mode, because the external bus hold function is inactive, a hold request is not
accepted even if it is input. If a hold request is input during switching to the timebase timer mode, the bus
may remain at high-impedance and prevent the HAK signal from going low.
● Operation during an interrupt request
Writing 0 in the TMD bit of the low-power consumption mode control register (LPMCR) during an
interrupt request does not trigger a switch to the timebase timer mode.
● Status of pins
Whether the external pins in the timebase timer mode retain the state they had immediately before
switching to the timebase timer mode or go to the high-impedance state can be controlled by the low-power
consumption mode control register (LPMCR: SPL).
■ Release of Timebase Timer Mode
The low-power consumption control circuit releases the timebase timer mode when a reset is input or an
interrupt occurs.
● Return by a reset
The timebase timer mode is initialized to the main clock mode by a reset.
● Return by an interrupt
If a watch timer, timebase timer, or external interrupt generates an interrupt request at an interrupt level
higher than 7 during the timebase timer mode (IL2, IL1, and IL0 of the interrupt control register (ICR) do
not indicate 111B), the low-power consumption mode control circuit releases the timebase timer mode.
After the mode is released, the interrupt is handled as an ordinary interrupt. If the interrupt is accepted
according to the setting of the I flag of the condition code register (CCR), interrupt level mask register
(ILM), or interrupt control register (ICR), the CPU executes the interrupt processing. If the interrupt is not
accepted, the CPU executes the instruction following the instruction specifying the timebase timer mode.
152
CHAPTER 8 LOW-POWER CONSUMPTION MODE
Note:
When interrupt processing is executed, the CPU normally executes the instruction following the
instruction in which switching to the timebase timer mode has been specified. The CPU then
proceeds to interrupt processing. If the switching to the timebase timer mode and acceptance of an
external bus hold request occur at the same time, however, the CPU may proceed to interrupt
processing before executing the next instruction.
Figure 8.5-3 shows a return from the timebase timer mode.
Figure 8.5-3 Release of the Timebase Timer Mode (External Reset)
RST pin
Timebase
timer mode
Main clock
Oscillating
PLL clock
Oscillation stabilization wait time
Main clock
CPU clock
CPU operation
inactive
Timebase timer mode release
Reset sequence
Oscillating
PLL clock
Execution
Reset cleared
153
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5.3
Watch Mode
This mode causes all functions, excluding the subclock and watch timer, to stop. In this
mode almost all chip functions stop.
■ Switching to the Watch Mode
When 0 is written to the TMD bit of the low-power consumption mode control register (LPMCR) in the
subclock run mode (CKSCR: SCS = 0), switching to the watch mode occurs.
● Data retention function
In the watch mode, the contents of the dedicated registers, such as accumulators, and the internal RAM are
retained.
● Hold function
During the watch mode, because the external bus hold function is inactive, a hold request is not accepted
even if it is input. If a hold request is input during switching to the watch mode, the bus may remain at
high-impedance and prevent the HAK signal from going low.
● Operation during an interrupt request
Writing 1 in the TMD bit of the low-power consumption mode control register (LPMCR) during an
interrupt request does not trigger a switch to the watch mode.
● Status of pins
Whether the external pins in the watch mode retain the state they had immediately before switching to the
watch mode or go to the high-impedance state can be controlled by the SPL bit of the low-power
consumption mode control register (LPMCR).
154
CHAPTER 8 LOW-POWER CONSUMPTION MODE
■ Release of Watch Mode
The low-power consumption control circuit releases the watch mode when a reset is input or an interrupt
occurs.
● Return by a reset
The watch mode is released by a reset to the oscillation stabilization wait reset state. The reset sequence is
executed after the oscillation stabilization wait time.
The period of reset assertion depends on quality of main clock crystal oscillator.
● Return by an interrupt
If a watch timer or external interrupt generates an interrupt request at an interrupt level higher than 7 during
the watch mode (IL2, IL1, and IL0 of the interrupt control register (ICR) do not indicate 111B), the lowpower consumption mode control circuit releases the watch mode and causes switching to the subclock
mode immediately. After the switching, the interrupt is handled as an ordinary interrupt. If the interrupt is
accepted according to the setting of the I flag of the condition code register (CCR), interrupt level mask
register (ILM), and interrupt control register (ICR), the CPU executes the interrupt processing. If the
interrupt is not accepted, the CPU executes the instruction following the instruction specifying the watch
mode.
Note:
When interrupt processing is executed, the CPU normally executes the instruction following the
instruction in which switching to the watch mode has been specified. The CPU then proceeds to
interrupt processing. If the switching to the watch mode and acceptance of an external bus hold
request occur at the same time, however, the CPU may proceed to interrupt processing before
executing the next instruction.
Figure 8.5-4 shows a return from the watch mode.
Figure 8.5-4 Release of the Watch Mode (External Reset)
RST pin
Watch mode
Main clock
PLL clock
Subclock
Oscillation stabilization wait
Oscillating
Inactive
Oscillating
CPU clock
Inactive
Main clock
CPU operation
Inactive
Reset sequence Execution
Reset cleared.
Watch mode released.
155
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.5.4
Stop Mode
Because this mode causes oscillation to stop and inactivates all functions, data can be
retained by the lowest power consumption.
■ Switching to the Stop Mode
When 1 is written to the STP bit of the low-power consumption mode control register (LPMCR), switching
to the stop mode occurs.
● Data retention function
In the stop mode, the contents of the dedicated registers, such as accumulators, and the internal RAM are
retained.
● Hold function
During the stop mode, because the external bus hold function is inactive, a hold request is not accepted
even if it is input. If a hold request is input during switching to the stop mode, the bus may remain at highimpedance and prevent the HAK signal from going low.
● Operation during an interrupt request
Writing 1 in the STP bit of the low-power consumption mode control register (LPMCR) does not trigger a
switch to the stop mode.
● Status of pins
Whether the external pins in the stop mode retain the state they had immediately before switching to the
stop mode or go to the high-impedance state can be controlled by the SPL bit of the low-power
consumption mode control register (LPMCR).
Note:
If "1" is specified for both the STP bit and the SLP bit of the low-power consumption mode control
(LPMCR) simultaneously, the STP bit takes precedence, and a transition to stop mode occurs.
For those external pins shared between port functions and peripheral functions, disable output for
the peripheral functions then set the STP bit to "1" or reset the TMD bit to "0" to set these pins in
high impedance state.
156
CHAPTER 8 LOW-POWER CONSUMPTION MODE
■ Release of Stop Mode
The low-power consumption control circuit releases the stop mode when a reset is input or an interrupt
occurs. Because the oscillation clock (HCLK) and sub-clock (SCLK) are halted, the stop mode is released
after the oscillation stabilization wait interval of the main clock or sub-clock.
● Return by a reset
After the stop mode is released by a reset, the oscillation stabilization wait state is set. The reset sequence is
executed after the oscillation stabilization wait time.
The period of reset assertion depends on quality of main clock crystal oscillator.
● Return by an interrupt
If an external interrupt generates an interrupt request at interrupt level higher than 7 during the stop mode
(IL2, IL1, and IL0 of the interrupt control register (ICR) do not indicate 111B), the low-power consumption
mode control circuit releases the stop mode. The interrupt is then handled as an ordinary interrupt after the
oscillation stabilization wait time of the main clock specified by the WS1 and WS0 bits of the clock
selection register (CKSCR). If the interrupt is accepted according to the setting of the I flag of the condition
code register (CCR), interrupt level mask register (ILM), and interrupt control register (ICR), the CPU
executes the interrupt processing. If the interrupt is not accepted, the CPU executes the instruction
following the instruction specifying the stop mode.
Notes:
• When interrupt processing is executed, the CPU normally executes the instruction following the
instruction in which switching to the stop mode has been specified. The CPU then proceeds to
interrupt processing. If the switching to the stop mode and acceptance of an external bus hold
request occur at the same time, however, the CPU may proceed to interrupt processing before
executing the next instruction.
• In PLL stop mode, the main clock and PLL multiplication circuit stop. During recovery from PLL
stop mode, it is necessary to allot the main clock oscillation stabilization wait time and PLL clock
oscillation stabilization wait time. The oscillation stabilization wait times for the main clock and
PLL clock are counted simultaneously according to the value specified in the oscillation
stabilization wait time selection bits (CKSCR: WS1, WS0) in the clock selection register. The
oscillation stabilization wait time selection bits (CKSCR: WS1, WS0) in the clock selection register
must be selected accordingly to account for the longer of main clock and PLL clock oscillation
stabilization wait time. The PLL clock oscillation stabilization wait time, however, requires 214/
HCLK or more. Set the oscillation stabilization wait time selection bits (CKSCR: WS1, WS0) in the
clock selection register to "10B" or "11B".
Figure 8.5-5 shows a return from the stop mode.
157
CHAPTER 8 LOW-POWER CONSUMPTION MODE
Figure 8.5-5 Release of the Stop Mode (External Reset)
RST pin
Stop mode
Main clock
PLL clock
Oscillation stabilization wait
Inactive
Main clock
CPU clock
CPU operation
Inactive
Reset cleared.
Stop mode released.
158
Oscillating
Reset sequence Execution
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.6
Status Change Diagram
Figure 8.6-1 shows the status change diagram of the MB90860A series.
■ Status Change Diagram
Figure 8.6-1 Status Change Diagram
External reset, watchdog timer
reset, software reset
Power-on
Reset
Power-on reset
Oscillation stabilization
wait end
SCS=0
SCS=1
MCS=0
Main clock mode
Interrupt
Main sleep mode
InterTMD=0
rupt
Timebase
timer mode
STP=1
Main stop
mode
Inter- Oscillation
rupt
stabilization
wait end
Main clock oscillation
stabilization wait
Subclock mode
PLL clock mode
MCS=1
SLP=1
SCS=0
SCS=1
SLP=1
Interrupt
PLL sleep mode
TMD=0
Interrupt
Timebase
timer mode
Interrupt
Subsleep mode
Interrupt
TMD=0
Watch mode
STP=1
STP=1
PLL stop mode
Interrupt
SLP=1
Oscillation
stabilization
wait end
Main clock oscillation
stabilization wait
Subclock
stop mode
Interrupt
Oscillation
stabilization
wait end
Subclock oscillation
stabilization wait
Note:
During reading this diagram, refer to the priority of the standby modes (see "Priorities of the STP,
SLP, and TMD Bits" in Section "8.3 Low-Power Consumption Mode Control Register (LPMCR)".
When the clock mode is switched, do not switch to other clock mode and low-power consumption
mode before this switching is completed. Confirm the completion of clock mode switching by
referring to the MCM and SCM bits of the clock selection register (CKSCR).
159
CHAPTER 8 LOW-POWER CONSUMPTION MODE
■ Operation Status in Each Operating Mode Table
Table 8.6-1 lists the operation status in each operating mode.
Table 8.6-1 Operation Status in Each Operating Mode
Operation status
Main
clock
Subclock
PLL
clock
PLL
CPU
Peripheral
Watch
Timebase
timer
Active
Active
Clock
source
Active
Active
PLL sleep
Active
Active
Active
Timebase timer *1
PLL clock
PLL stop
Inactive
Inactive
Inactive
PLL oscillation
stabilization wait
Active
Active
Active
Inactive
Inactive
Inactive
Inactive
Active
Active
Active
Active
Active
Main
Active
Main sleep
Active
Active
Timebase timer
*2
Inactive
Main clock
Inactive
Main stop
Inactive
Inactive
Main oscillation
stabilization wait
Active
Active
Inactive
Sub
Inactive
Inactive
Active
Active
Active
Active
Subsleep
Watch
Active
Inactive
Inactive
Subclock stop
Inactive
Subclock oscillation
stabilization wait
Active
Power-on reset
Inactive
Inactive
Inactive
Sub-clock
Active
Main clock
Inactive
Active
Inactive
Active
Reset
*1: During the PLL clock mode
*2: During the main clock mode
160
Active
Active
Inactive
Active
Inactive
Active
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.7
Status of Pins in Standby Mode and during Hold and Reset
The status of pins in the standby mode and during hold and reset are described for
each memory access mode.
■ Status of Each Pin in the Single Chip Mode
Table 8.7-1 shows the Status of Each Pin in the Single Chip Mode.
Table 8.7-1 Status of Each Pin in the Single Chip Mode
Standby/timebase timer/watch mode
Stop *6
Pin name
Reset
Sleep
SPL = 0
SPL = 1
P10 to P17
P20 to P27
P30 to P37
P40 to P47
Input disabled *4 /
status before the mode
retained *2
P50 to P57
P60 to P67
Input disabled *4/
output Hi-Z *5
Input not possible *3 /
output Hi-Z *5
Status before the mode
retained (*2)
P80 to P87
P90 to P97
PA0 to PA1
P00 to P07*7
P70 to P77
PA0, P42, P32, P12,
P80 to P82, P84*8
Input enabled *1 /
status before the mode
retained *2
Input enabled *1/
output Hi-Z *5
*1: "Input enabled" means that the input function is available. The pull-up or pull-down option or external input is required. When the
pin is used as an output port, the status is the same as other ports.
*2: "Status before the mode retained" means that it keep previous output state when output or that the input is "not possible" when input.
*3: "Input not possible" means that the gate connected to the input pin is functioning as input but the internal circuit can not accept this
input signal because the internal circuit is not functioning.
*4: "Input disabled" means that the gate connected to the input pin is disabled.
*5: "Output Hi-Z" means that the pin driving transistor is placed in the drive prohibited state to set the pin to high impedance.
*6: The pull-up option is disconnected from each port pin in stop mode.
*7: These pins are "Input enabled" in STOP mode only if INTxR bit of External interrupt source select register (EISSR) is "0".
Otherwise they are "Input disabled".
*8: These pins are "Input enabled" in STOP mode only if INTxR bit of External interrupt source select register (EISSR) is "1".
Otherwise they are "Input disabled".
Note:
In the stop mode up to sixteen external signals can be input and the frequency of each signal must
be 1 kHz or less.
161
CHAPTER 8 LOW-POWER CONSUMPTION MODE
■ Status of Each Pin in the External BUS 16-bit Data Bus Mode
Table 8.7-2 shows the Status of Each Pin in the External Bus 16-bit Data Bus Mode.
Table 8.7-2 Status of Each Pin in the External Bus 16-bit Data Bus Mode
Standby/timebase timer/watch mode
Stop
Pin name
Hold
Reset
Sleep
SPL = 0
P00 to P07
(AD00 to
AD07)
P10 to P17
(AD08 to
AD15)
P20 to P27
(A16 to
A23)
P37(CLK)
P36(RDY)
P35(HAK)
P34(HRQ)
Input not
possible /
output Hi-Z
SPL = 1
Input
disabled /
output Hi-Z
Input not
possible /
output Hi-Z
Output state Output state
*1, *3
*1, *3
Input not
possible /
output
enabled*2, *3
Input not
possible /
output state
Input not
possible /
output Hi-Z*3
Input not
possible /
output
enabled*2, *3
*1, *3
Input
Input
disabled /
Status before disabled /
output Hithe mode
status before
Z*5
the mode
retained*4
retained*4
P33(WRH)
At internal
ROM access
immediately
after reset
release
At internal
ROM access
after external
ROM access
Output Hi-Z /
input enabled
Output Hi-Z /
input enabled
Output state*1
Hold the
address
immediately
before
Output Hi-Z /
input enabled
Output Hi-Z /
input enabled
Input not
possible /
output Hi-Z
Input not
possible /
output Hi-Z*3
"L" output*3
"1" input*3
"H" output*3 "H" output*3
Input not
possible /
output Hi-Z*3
"H" output
"H" output
"H" output
P30(ALE)
"L" output
Input not
possible /
output Hi-Z
"L" output
"L" output
"L" output
P40 to P47
P50 to P57
P60 to P67
P80 to P87
P90 to P97
PA0, PA1
Input
disabled /
status before
the mode
Status before retained*4
the mode
Input
retained*4
enabled /
status before
the mode
retained*4
Status before
the mode
retained*4
Input not
possible /
output Hi-Z
Output Hi-Z /
input enabled
Output Hi-Z /
input enabled
P32(WRL)
P31(RD)
P70 to P77
PA0, P42,
P32, P12,
P80 to P82,
P84 *6
162
"L" output
Input
enabled /
output HiZ*5
CHAPTER 8 LOW-POWER CONSUMPTION MODE
*1: "Output state" means that the output is being driven by the internal circuit but the internal circuit is on hold. Thus the
output value is fixed to either "0" or "1". When the internal circuit is in operation, the output value changes accordingly
except during reset.
*2: "Output enabled" means that the output is being driven and propagate the signal from the internal circuit in operation.
*3: When used as output, it retains the previous output value.
*4: "Status before the mode retained" means that it keeps the previous output state when output or that input is "not possible"
when input. "Input not possible" means that the gate connected to the input pin is functioning as input but the internal
circuit can not accept this input signal because the internal circuit is not functioning.
*5: "Input disabled" means that the gate connected to the input pin is disabled.
*6: These pins are "Input enabled" in STOP mode if the INTxR bit of External interrupt source select register (EISSR) is "1".
Otherwise they are disabled.
Note:
For those external pins shared between port functions and peripheral functions, disable output for
the peripheral functions then set the STP bit to "1" or reset the TMD bit to "0" to set these pins in
high impedance state.
163
CHAPTER 8 LOW-POWER CONSUMPTION MODE
■ Status of Each Pin in the External BUS 8-bit Data Bus Mode
Table 8.7-3 shows the Status of Each Pin in the External Bus 8-bit Data Bus Mode.
Table 8.7-3 Status of Each Pin in the External Bus 8-bit Data Bus Mode
Pin name
Standby mode
Sleep
Reset
Stop
SPL = 0
P00 to P07
(AD00 to
AD07)
P10 to P17
(AD08 to
AD15)
Hold
SPL = 1
At internal
ROM access
immediately
after reset
release
At internal
ROM access
after external
ROM access
Input not
possible /
output Hi-Z
Input disabled/
output Hi-Z
Input not
possible / output
Hi-Z
Output Hi-Z / Output Hi-Z /
input enabled input enabled
P20 to P27
Output state
(A16 to A23) *1, *3
Output state*1,
Input not
possible / output
Hi-Z *3
Output state*1 Hold the address
immediately
before
P37(CLK)
Input not
possible /
output
enabled*2, *3
P36(RDY)
P35(HAK)
P34(HRQ)
Status before
the mode
retained*4
P33
P32(WR)
"H" output*3
P31(RD)
"H" output
P30(ALE)
"L" output
P40 to P47
P50 to P57
P60 to P67
P80 to P87
P90 to P97
P51 to P54
P90, P91,
P95, PA0
P70 to P77
PA0, P42,
P32, P12,
P80 to P82,
P84*6
164
*3
Input not
possible /
output state *1,
*3
Input not
possible / output Input not
enabled *2, *3
possible /
output Hi-Z
Input not
possible / output
Hi-Z *3
Input
Input disabled/ disabled /
status before
output Hi-Z "L" output*3
the mode
*5
*4
retained
"1" input*3
Input not
possible /status
before the mode
"H" output*3
retained*4
output Hi-Z*3
"H" output
Input not
"H" output
possible /
"L" output
"L" output
output Hi-Z
Output Hi-Z / Output Hi-Z /
input enabled input enabled
"H" output
"L" output
"H" output
"L" output
Input disabled/
status before
the mode
retained*4
Status before
the mode
retained*4
Input
Status before the Input disabled/ Output Hi-Z / Output Hi-Z /
enabled /
input enabled input enabled
mode retained*4 output Hi-Z
Input enabled/ output Hi-Z
status before *5
the mode
retained
CHAPTER 8 LOW-POWER CONSUMPTION MODE
*1: "Output state" means that the output is being driven by the internal circuit but the internal circuit is on hold. Thus the
output value is fixed to either "0" or "1". When the internal circuit is in operation, the output value changes accordingly
except during reset.
*2: "Output enabled" means that the output is being driven and propagate the signal from the internal circuit in operation.
*3: When used as output, it retains the previous output value.
*4: "Status before the mode retained" means that it keeps the previous output state when output or that input is "not possible"
when input. "Input not possible" means that the gate connected to the input pin is functioning as input but the internal
circuit can not accept this input signal because the internal circuit is not functioning.
*5: "Input disabled" means that the gate connected to the input pin is disabled.
*6: These pins are "Input enabled" in STOP mode if the INTxR bit of External interrupt source select register (EISSR) is "1".
Otherwise they are disabled.
Note:
For those external pins shared between port functions and peripheral functions, disable output for
the peripheral functions then set the STP bit to "1" or reset the TMD bit to "0" to set these pins in
high impedance state.
165
CHAPTER 8 LOW-POWER CONSUMPTION MODE
8.8
Usage Notes on Low-Power Consumption Mode
Note the following five items when using the low-power consumption mode:
• Switching to a standby mode and interrupt
• Release of a standby mode by an interrupt
• Release of the stop mode
• Oscillation stabilization wait time Oscillation
• Clock mode switching
■ Switching to a Standby Mode and Interrupt
When there is a pending interrupt request to the CPU, writing "1" to the STP bit or SLP bit or writing "1" to
the TMD bit in the LPMCR register does not takes its effect. In other words, the desired mode transition is
not performed even after the interrupt service is completed. If the interrupt is being serviced already and the
interrupt request is cleared and if there are no other pending requests, the desired mode transition can be
performed. Note that this behavior is not dependent on whether the setting in the PS register allows the
CPU to accept the interrupt request.
● Release of the Standby Mode by an Interrupt
If an interrupt request of interrupt level higher than seven priority is issued from a peripheral function
during the sleep, timebase timer, or stop mode, the standby mode is released, which does not depend on
whether the CPU accepts the interrupt.
After the release of the standby mode by an interrupt, normal processing is performed. The CPU branches
to the interrupt handling routine provided that the priority of the interrupt request indicated by the interrupt
level setting bits (IL2, IL1, and IL0 of ICR) is higher than the interrupt level mask register (ILM) and the
interrupt enable flag ((I) of the condition code register (CCR) is set to 1 (enabled).
If the interrupt is not accepted, the CPU starts the execution with the instruction following the instruction in
which switching to the standby mode has been specified.
When interrupt is accepted, the CPU first executes the instruction following the instruction in which
switching to the standby mode has been specified. The CPU then proceeds to interrupt processing.
Depending on the condition when switching to a standby mode was performed, however, the CPU may
proceed to interrupt processing before executing the next instruction.
Note:
If the CPU should not branch to the interrupt processing routine immediately after a return, action
such as interrupt disabling must be taken before a standby mode is set.
● Release of the Stop Mode
The stop mode can be released by an input that has been set as an external interrupt input cause before the
system enters the stop mode. As an input cause, an H-level signal, L-level signal, rising edge, or falling
edge can be selected.
166
CHAPTER 8 LOW-POWER CONSUMPTION MODE
■ Oscillation Stabilization Wait Time
● Clock oscillation stabilization wait time
Because the oscillator is halted in the stop mode, an oscillation stabilization wait time is required. A time
period selected by the WS1 and WS0 bits of the clock selection register (CKSCR) is used as the oscillation
stabilization wait time.
● PLL clock oscillation stabilization wait time
In main clock mode, the PLL multiplication circuit stops. When changing to PLL clock mode, it is
necessary to reserve the PLL clock oscillation stabilization wait time. The CPU runs in main clock mode
till the PLL clock oscillation stabilization wait time has elapsed. When the main clock mode is switched to
PLL clock mode, the PLL clock oscillation stabilization wait time is fixed at 214/HCLK (HCLK: oscillation
clock).
In sub-clock mode, the main clock and PLL multiplication circuit stop. When changing to PLL clock mode,
it is necessary to reserve the main clock oscillation stabilization wait time and PLL clock oscillation
stabilization wait time. The oscillation stabilization wait times for main clock and PLL clock are counted
simultaneously according to the value specified in the oscillation stabilization wait time selection bits
(CKSCR: WS1, WS0) in the clock selection register. The oscillation stabilization wait time selection bits
(CKSCR: WS1, WS0) in the clock selection register must be selected accordingly to account for the longer
of the main clock and PLL clock oscillation stabilization wait times. The PLL clock oscillation stabilization
wait time, however, requires 214/HCLK or more. Set the oscillation stabilization wait time selection bits
(CKSCR: WS1, WS0) in the clock selection register to "10B" or "11B".
In PLL stop mode, the main clock and PLL multiplication circuit stop. During recovery from PLL stop
mode, it is necessary to allot the main clock oscillation stabilization wait time and PLL clock oscillation
stabilization wait time. The oscillation stabilization wait times for the main clock and PLL clock are
counted simultaneously according to the value specified in the oscillation stabilization wait time selection
bits (CKSCR: WS1, WS0) in the clock selection register. The oscillation stabilization wait time selection
bits (CKSCR: WS1, WS0) in the clock selection register must be selected accordingly to account for the
longer of main clock and PLL clock oscillation stabilization wait time. The PLL clock oscillation
stabilization wait time, however, requires 214/HCLK or more. Set the oscillation stabilization wait time
selection bits (CKSCR: WS1, WS0) in the clock selection register to "10B" or "11B".
● Clock mode switching
When the clock mode is switched, do not switch to other clock mode and low-power consumption mode
before this switching is completed. Confirm the completion of clock mode switching by referring to the
MCM and SCM bits of the clock selection register (CKSCR).
● Notes on Accessing the Low-Power Consumption Made Control Register (LPMCR) to Enter the
Standby Mode
To access the low-power consumption mode control register (LPMCR) with assembler language
To set the low power consumption mode control register (LPMCR) to enter the standby mode, use the
instruction listed in Table 8.3-2.
The standby mode transition instruction in Table 8.3-2 must always be followed by an array of
167
CHAPTER 8 LOW-POWER CONSUMPTION MODE
instructions highlighted by a line below.
MOV LPMCR, #H’ xx
NOP
NOP
JMP $+3
MOV A, #H’ 10
; The low-power consumption mode transition instruction in Table 8.3-2
; Jump to the next instruction
; Arbitrary instruction
The devices does not guarantee its operation after returning from the standby mode if you place an array
of instructions other than the one enclosed in the line.
To access the low-power consumption mode (LPMCR) with C language
To enter the standby mode using the low power consumption mode control register (LPMCR), use one
of the following methods 1. to 3. to access the register:
1. Specify the standby mode transition instruction as a function and insert two __wait_nop() built-in
functions after that instruction.If any interrupt other than the interrupt to return from the standby mode
can occur within the function, optimize the function during compilation to suppress the LINK and
UNLINK instructions from occurring.
Example: Watch mode or timebase timer mode transition function
void enter_watch(){
IO_LPMCR.byte = 0x10; /* Set LPMCR TMD bit to "0" */
__wait_nop();
__wait_nop();
}
2. Define the standby mode transition instruction using __asm statements and insert two NOP and JMP
instructions after that instruction.
Example: Transition to sleep mode
__asm("MOV I:_IO_LPMCR, #H’ 58); /* Set LPMCR SLP bit to "1" */
__asm("NOP");
__asm("OP");
__asm("JMP $+3");
/* Jump to the next instruction*/
3. Define the standby mode transition instruction between #pragma asm and #pragma endasm and insert
two NOP and JMP instructions after that instruction.
Example: Transition to stop mode
#pragma asm
MOV I:_IO_LPMCR, #H’ 98
NOP
NOP
JMP $+3
168
/* Set LPMCR SLP bit to "1" */
/* Jump to the next instruction */
CHAPTER 9
MEMORY ACCESS MODES
This chapter explains the functions and operations of
the memory access modes.
9.1 Outline of Memory Access Modes
9.2 External Memory Access (Bus Pin Control Circuit)
9.3 External Memory Access Control Signal Operation
169
CHAPTER 9 MEMORY ACCESS MODES
9.1
Outline of Memory Access Modes
In the F2MC-16LX, various modes are provided for access methods and access areas.
■ Memory Access Modes
Table 9.1-1 Mode Pins and Modes
Operation mode
Bus mode
Access mode
Single chip
-
Internal ROM, external bus
8 bits
16 bits
RUN
External ROM, external bus
8 bits
16 bits
Flash programming
-
-
● Operation mode
Operation mode means the mode for controlling the device operation status. The operation mode is
specified by the MDx mode setting pin and the Mx bit in mode data. By selecting an operation mode,
normal operation activation or flash serial programming can be performed.
● Bus mode
Bus mode means the mode for controlling the internal ROM operation and external access function. The
bus mode is specified by the MDx mode setting pin and the Mx bit in mode data. The MDx mode setting
pin specifies the bus mode for reading the reset vector and mode data, and the Mx bit in mode data
specifies the bus mode for normal operation.
● Access mode
Access mode means the mode for controlling the external data bus width. The access mode is specified by
the MDx mode setting pin and the S0 bit in mode data. By selecting an access mode, an 8- or 16-bit
external data bus is specified.
170
CHAPTER 9 MEMORY ACCESS MODES
9.1.1
Mode Pins
Table 9.1-2 lists the operations that can be specified by combining the three external
pins MD2 to MD0.
■ Mode Pins
Table 9.1-2 Mode Pins and Modes
Mode pin setting
Mode name
Reset vector
access area
External data
bus width
Remarks
MD2
MD1
MD0
0
0
0
External vector mode 0
External
8 bits
0
0
1
External vector mode 1
External
16 bits
Reset vector, 16-bit bus
width access
0
1
0
Reserved
0
1
1
Internal vector mode
Internal
(Mode data)
Reset sequence and later
segments are controlled
based on mode data.
1
0
0
1
0
1
1
1
0
Flash memory serial
programming *
-
-
-
1
1
1
Flash memory
-
-
Mode when parallel writer
is used
Reserved
*: Flash serial programming mode involves other pin settings than the mode pins. For details, see "CHAPTER 25
EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION".
171
CHAPTER 9 MEMORY ACCESS MODES
9.1.2
Mode Data
Mode data is stored at "FFFFDFH" of main memory and used for controlling the CPU
operation. This data is fetched during a reset sequence and stored in the mode register
inside the device. The mode register value can be changed only by a reset sequence.
The setting of this register is valid after the reset sequence.
Always set the reserved bits to "0".
■ Mode Data
Figure 9.1-1 Mode Data Configuration
Mode data address
address FFFFDFH
7
6
5
M1
M0
4
3
Reserved Reserved
S0
2
1
0
Bit No.
Reserved Reserved Reserved
[bit7, bit6] M1, M0 (bus mode setting bits)
The M1 and M0 bits are used to specify the operation mode after the reset sequence is completed. Table
9.1-3 shows the relationship between the M1 and M0 bits and the functions.
Table 9.1-3 M1 and M0 (Bus Mode Setting Bit) Functions
M1
M0
Function
0
0
Single-chip mode
0
1
Internal ROM, external bus mode
1
0
External ROM, external bus mode
1
1
Setting prohibited
Remarks
[bit3] S0 (mode setting bit)
The S0 bit is used to specify the bus mode or access mode after the reset sequence is completed. Table
9.1-4 shows the relationship between the S0 bit and the functions.
Table 9.1-4 S0 (Mode Setting Bit) Functions
S0
172
Function
0
External 8-bit data bus mode
1
External 16-bit data bus mode
Remarks
CHAPTER 9 MEMORY ACCESS MODES
9.1.3
Memory Space in Each Bus Mode
Figure 9.1-2 shows the correspondence between the access areas and physical
addresses for each bus mode.
■ Memory Space in Each Bus Mode
Figure 9.1-2 Relationship between Access Areas and Physical Addresses for Each Bus Mode
Single chip
Internal ROM, external bus
ROM area
ROM area
ROM area
image of
bank FF
ROM area
image of
bank FF
Peripheral
Peripheral
External ROM, external bus
FFFFFFH
FE0000H
010000H
008000H
Peripheral
007900H
001900H
RAM
000100H
0000F0H
000000H
Register
RAM
Register
RAM
Register
: Internal
: External
Peripheral
Peripheral
: No access
Peripheral
■ Recommended Setting
Table 9.1-5 lists an example of recommended settings for mode pins and mode data.
Table 9.1-5 Example of Recommended Settings for Mode Pins and Mode Data
Sample setting
MD2
MD1
MD0
M1
M0
S0
Single chip
0
1
1
0
0
x
Internal ROM and external bus mode, 16-bit bus
0
1
1
0
1
1
Internal ROM and external bus mode, 8-bit bus
0
1
1
0
1
0
External ROM and external bus mode, 16-bit bus,
vector 16 bus width
0
0
1
1
0
1
External ROM and external bus mode, 8-bit bus
0
0
0
1
0
0
External pins have signal functions that depend on each mode.
173
CHAPTER 9 MEMORY ACCESS MODES
Table 9.1-6 External Pin Functions for Each Mode
Function
Pin name
External bus expansion
Single chip
Flash programming
8 bits
P07 to P00
16 bits
AD07 to AD00
P17 to P10
A15 to A08
DQ07 to DQ00
AD15 to AD08
AQ15 to AQ08
P27 to P20
A23 to A16 *
AQ07 to AQ00
P30
ALE
AQ16
P31
RD
CE
P32
P33
Port
WR
WRL
OE
Port
WRH *
WE
P34
HRQ *
AQ17
P35
HAK *
AQ18
P36
RDY *
BYTE
P37
CLK *
RY/BY
*: The upper address output pins and the WRL/WR, WRH, HRQ, HAK, RDY, and CLK pins can be used as ports
through function selection. See Section "9.2 External Memory Access (Bus Pin Control Circuit)" for details.
174
CHAPTER 9 MEMORY ACCESS MODES
9.2
External Memory Access (Bus Pin Control Circuit)
The external bus pin control circuit controls the external bus pins for external
expansion of the CPU address and data buses.
■ External Memory Access (Bus Pin Control Circuit)
The following address, data, and control signals are used to access external memory and peripherals of the
MB90860A series device:
•
CLK (P37): Machine cycle clock (KBP) output pin
•
RDY (P36): External ready input pin
•
WRH (P33): Write signal for upper 8 bits of data bus, Active only when 16 bit access
•
WRL/WR (P32): Write signal for lower 8 bits of data bus, Active both when 16 bit and 8 bit access
•
RD (P31): Read signal
•
ALE (P30): Address latch enable signal
The external bus pin control circuit is used to control the external bus pins to enable external expansion of
the CPU address and data buses.
■ Block Diagram of External Memory Access
Figure 9.2-1 Block Diagram of External Memory Access
P0
P0 data
P1
P2
P3
P3
P0
P0 direction
RB
Data control
Address control
Access control
Access control
175
CHAPTER 9 MEMORY ACCESS MODES
9.2.1
External Memory Access (External Bus Pin Control
Circuit) Registers
External memory access (external bus pin control circuit) uses the following three types
of registers:
• Automatic ready function selection register
• External address output control register
• Bus control signal selection register
■ External Memory Access Registers
Figure 9.2-2 External Memory access (External Bus Pin Control Circuit) Registers
Automatic ready function selection register
15
Address:0000A5H
Read/write
Initial value
14
13
12
11
10
IOR1 IOR0 HMR1 HMR0
(W)
(0)
9
8
LMR1 LMR0
(W)
(0)
(W)
(1)
(W)
(1)
(-)
(X)
(-)
(X)
(W)
(0)
(W)
(0)
7
6
5
4
3
2
1
0
E23
E22
E21
E20
E19
E18
E17
E16
Bit No.
ARSR
External address output control register
Address:0000A6H
Read/write
Initial value
(W)
(0)
(W)
(0)
(W)
(0)
(W)
(0)
(W)
(0)
(W)
(0)
(W)
(0)
(W)
(0)
15
14
13
12
11
10
9
8
Address:0000A7H
CKE
RYE
HDE
Read/write
Initial value
(W)
(0)
(W)
(0)
(W)
(0)
Bit No.
HACR
Bus control signal selection register
W: Write only
176
IOBS HMBS WRE LMBS
(W)
(0)
(W)
(0)
(W)
(0)
(W)
(0)
Bit No.
ECSR
(-)
(X)
CHAPTER 9 MEMORY ACCESS MODES
9.2.2
Automatic Ready Function Selection Register (ARSR)
The automatic ready function selection register (ARSR) is used to set the automatic
wait time for memory access for each area during external access.
■ Automatic Ready Function Selection Register (ARSR)
Figure 9.2-3 Automatic Ready Function Selection Register Configuration
Automatic ready function selection register
15
14
13
12
11
10
IOR1 IOR0 HMR1 HMR0
Address:0000A5H
Read/write
Initial value
(W)
(0)
(W)
(0)
(W)
(1)
(W)
(1)
9
8
Bit No.
LMR1 LMR0
(-)
(X)
(-)
(X)
(W)
(0)
ARSR
(W)
(0)
W: Write only
[bit15, bit14] IOR1, IOR0
The IOR1 and IOR0 bits are used to specify the automatic wait function for external access to the area
from "0000F0H" to "0000FFH". Table 9.2-1 lists the settings that can be specified by combining the
IOR1 and IOR0 bits.
Table 9.2-1 IOR1 and IOR0 (Automatic Wait Function Specification Bit) Functions
IOR1
IOR0
Function
0
0
Automatic wait disabled [initial value]
0
1
Automatic wait of 1 cycle is inserted for external access
1
0
Automatic wait of 2 cycles is inserted for external access
1
1
Automatic wait of 3 cycles is inserted for external access
[bit13, bit12] HMR1, HMR0
The HMR1 and HMR0 bits are used to specify the automatic wait function for external access to the
area from "800000H" to "FFFFFFH". Table 9.2-2 lists the settings that can be specified by combining
the HMR1 and HMR0 bits.
Table 9.2-2 HMR1 and HMR0 (Automatic Wait Function Specification Bit) Functions
HMR1
HMR0
Function
0
0
Automatic wait disabled
0
1
Automatic wait of 1 cycle is inserted for external access
1
0
Automatic wait of 2 cycles is inserted for external access
1
1
Automatic wait of 3 cycles is inserted for external access [initial value]
177
CHAPTER 9 MEMORY ACCESS MODES
[bit9, bit8] LMR1, LMR0
The LMR1 and LMR0 bits are used to specify the automatic wait function for external access to the
areas between "008000H" and "7FFFFFH". Table 9.2-3 lists the settings that can be specified by
combining the LMR1 and LMR0 bits.
Table 9.2-3 LMR1 and LMR0 (Automatic Wait Function Specification Bit) Functions
178
LMR1
LMR0
Function
0
0
Automatic wait disabled [initial value]
0
1
Automatic wait of 1 cycle is inserted for external access
1
0
Automatic wait of 2 cycles is inserted for external access
1
1
Automatic wait of 3 cycles is inserted for external access
CHAPTER 9 MEMORY ACCESS MODES
9.2.3
External Address Output Control Register (HACR)
The external address output control register (HACR) controls the external output of
addresses (A23 to A16). The bits correspond to addresses A23 to A16, which control
address output pins, as shown in Figure 9.2-4.
■ External Address Output Control Register (HACR)
Figure 9.2-4 External Address Output Control Register Configuration
External address output control register
7
6
5
4
3
2
1
0
Address:0000A6H
E23
E22
E21
E20
E19
E18
E17
E16
Read/write
Initial value
(W)
(0)
(W)
(0)
(W)
(0)
(W)
(0)
(W)
(0)
(W)
(0)
(W)
(0)
(W)
(0)
Bit No.
HACR
The HACR register controls output of addresses (A23 to A16) to the external circuit. The address output
pin is controlled as follows with the eight bits that correspond to address bits A23 to A16.
The HACR register cannot be accessed when the device is in single-chip mode, since all pins function as I/
O ports whatever the value of this register.
All bits of this register are write-only bits, and the value read from the bits is 1.
Table 9.2-4 External Address Output Control Register (E23 to E16 Bits) Functions
0
The corresponding pin is used for address output (AXX) [initial value].
1
The corresponding pin is used as an I/O port (PXX).
179
CHAPTER 9 MEMORY ACCESS MODES
9.2.4
Bus Control Signal Selection Register (ECSR)
The bus control signal selection register sets the bus operation control function in
external bus mode. This register cannot be accessed when the device is in single-chip
mode, since all pins function as I/O ports whatever the value of this register. All bits of
the bus control signal selection register are write-only bits, and the value from the bits
is 1.
■ Bus Control Signal Selection Register (ECSR)
Figure 9.2-5 Bus Control Signal Selection Register Configuration
Bus control signal selection register
15
14
Address:0000A7H
CKE
RYE
Read/write
Initial value
(W)
(0)
(W)
(0)
13
12
11
10
9
8
Bit No.
HDE IOBS HMBS WRE LMBS
(W)
(0)
(W)
(0)
(W)
(0)
(W)
(0)
(W)
(0)
ECSR
(-)
(X)
[bit15] CKE
The CKE bit controls output of the external clock signal pin (CLK), as shown in Table 9.2-5.
Table 9.2-5 CKE (External Clock (CLK) Output Control Bit) Functions
0
I/O port (P37) operation (clock output disabled) [initial value]
1
Clock signal (CLK) output enabled
[bit14] RYE
The RYE bit controls input of the external ready (RDY) signal pin, as shown in Table 9.2-6.
Table 9.2-6 RYE (External Ready (RDY) Input Control Bit) Functions
0
I/O port (P36) operation (external RDY input disabled) [initial value]
1
External ready (RDY) input enabled
[bit13] HDE
The HDE bit specifies that input-output of hold signals is enabled. The hold request input signal (HRQ)
and hold acknowledge output signal (HAK) are controlled according to the setting of the HDE bit, as
shown in Table 9.2-7.
Table 9.2-7 HDE (Hold Signal Input-Output Enable Specification Bit) Functions
180
0
I/O port (P35, P34) operation (hold function input-output disabled) [initial value]
1
Hold request (HRQ) input/hold acknowledge (HAK) output enabled
CHAPTER 9 MEMORY ACCESS MODES
[bit12] IOBS
The IOBS bit is used to specify the bus width for external access to the area from "0000F0H" to
"0000FFH" in external 16-bit data bus mode. Control is based on the setting of this bit, as shown in
Table 9.2-8.
Table 9.2-8 IOBS (Bus Width Specification Bit)
0
16-bit bus width access [initial value]
1
8-bit bus width access
[bit11] HMBS
The HMBS bit is used to specify the bus width for external access to the area from "800000H" to
"FFFFFFH" in external 16-bit data bus mode. Control is based on the setting of this bit, as shown in
Table 9.2-9.
Table 9.2-9 HMBS (Bus Width Specification Bit)
0
16-bit bus width access [initial value]
1
8-bit bus width access
[bit10] WRE
The WRE bit controls output of external write signals (both WRH and WRL pins in external 16-bit data
bus mode and WR pin in external 8-bit data bus mode), as shown in Table 9.2-10.
In external 8-bit data bus mode, P33 functions as the I/O port regardless of the setting value of this bit.
Table 9.2-10 WRE (External Write Signal Output Control Bit) Functions
0
I/O port (P33, P32) operation (write signal output disabled) [initial value]
1
Write strobe signal (WRH/WRL or WR only) output enabled
[bit9] LMBS
The LMBS bit is used to specify the bus width for external access to the area from "008000H" to
"7FFFFFH" in external 16-bit data bus mode. Control is based on the setting of this bit, as shown in
Table 9.2-11.
Table 9.2-11 LMBS (Bus Width Specification Bit)
0
16-bit bus width access [initial value]
1
8-bit bus width access
Notes:
• To use the WRE bit to enable the WRH and WRL functions in external 16-bit data bus mode,
place P33 and P32 in input mode (set bit3 and bit2 of the DDR3 register to 0).
• To use the WRE bit to enable the WR function in external 8-bit data bus mode, place P32 in input
mode (set bit2 of the DDR3 register to 0).
• If the RYE and HDE bits are used to enable the RDY and HRQ signals, the I/O port function of the
port is also enabled. Be sure to write 0 (input mode) to the DDR3 register that corresponds to the
port.
181
CHAPTER 9 MEMORY ACCESS MODES
9.3
External Memory Access Control Signal Operation
If the ready function is not used, external memory is accessed in three cycles. The 8-bit
bus width access function is used to read and write the 8-bit width peripheral chip when
the 8- and 16-bit width peripheral chips are connected together to the external bus.
■ External Memory Access Control Signal
The HMBS, LMBS, and IOBS bits are used to specify whether 16-bit bus width access or 8-bit bus width
access is to be used in external 16-bit data bus mode.
The ALE and address signals may be asserted even when no external bus access is performed. Do not use
the ALE signal only to allow access to the external component. The RDX, WRLX and WRHX signals must
be used together with the ALE signal to control the external access.
Figure 9.3-1 Access Timing Chart for External 8-bit Data Bus Mode)
Read
Read
Write
P37/CLK
P33/WRH
(Port data)
P32/WRL/WR
P31/RD
P30/ALE
P27 to P20/A23 to A16
Read address
Write address
Read address
P17 to P10/A15 to A08
Read address
Write address
Read address
P07 to P00/AD07 to AD00
Read
address
Write
address
Read address
Read data
182
Write data
CHAPTER 9 MEMORY ACCESS MODES
Figure 9.3-2 Access Timing Chart for External 16-bit Data Bus Mode
(16-bit Bus Width Access)
8-bit bus width byte read
Even address byte read
8-bit bus width byte write
Even address byte write
P37/CLK
P33/WRH
P32/WRL/WR
P31/RD
P30/ALE
P27 to P20/A23 to A16
P17 to P10/AD15 to AD08
Read address
P07 to P00/AD07 to AD00
Read address
Read address
Write address
Read address
Invalid
(Undefined)
Write address
Read address
Write address
Write data
Read data
Odd address byte read
Read address
Odd address byte write
P37/CLK
P33/WRH
P32/WRL/WR
P31/RD
P30/ALE
P27 to P20/A23 to A16
Write address
Read address
P17 to P10/AD15 to AD08
Read address
P07 to P00/AD07 to AD00
Read address
Read address
Read address
Write address
Invalid
Read address
Write data
Read data
Even address word read
(Undefined)
Write address
Even address word write
P37/CLK
P33/WRH
P32/WRL/WR
P31/RD
P30/ALE
P27 to P20/A23 to A16
Write address
Read address
Read address
P17 to P10/AD15 to AD08
Read address
Write address
Read address
P07 to P00/AD07 to AD00
Read address
Write address
Read address
Read data
Write data
Notes:
Set the external circuit so that data is always read in word mode.
The setting of P36/RDY pin or the automatic ready function selection register (ARSR) enables
access to low-speed memory and peripheral circuits.
183
CHAPTER 9 MEMORY ACCESS MODES
9.3.1
Ready Function
The setting of P36/RDY pin or the automatic ready function selection register (ARSR)
enables access to the low-speed memory and peripheral circuits.
If the RYE bit of the bus control signal selection register (EPCR) is set to 1, the wait
cycle is entered to enable extension of the access cycle while the L level is input to P36/
RDY signal during access to the external circuit.
■ Ready Function
Figure 9.3-3 Timing Chart for Ready Function
Even address word read
Even address word write
P37/CLK
P33/WRH
P32/WRL/WR
P31/RD
P30/ALE
P27 to P20/A23 to A16
Read address
Write address
P17 to P10/AD15 to AD08
Read address
Write address
P07 to P00/AD07 to AD00
Read address
Write address
P36/RDY
RDY pin fetch
Even address word write
Read data
Write data
Even address word read
P37/CLK
P33/WRH
P32/WRL/WR
P31/RD
P30/ALE
P27 to P20/A23 to A16
Read address
Write address
P17 to P10/AD15 to AD08
Write address
Read address
P07 to P00/AD07 to AD00
Write address
Read address
Write data
Cycle extended by auto ready
184
CHAPTER 9 MEMORY ACCESS MODES
The MB90860A series has two types of auto ready functions for external memory access. The auto ready
function can automatically insert 1 to 3 wait cycles to extend the access cycle without an external circuit for
access to the external areas at lower addresses "008000H " to "7FFFFFH" and at upper addresses "800000H"
to "FFFFFFH". This function is activated according to the setting of the LMR1 and LMR0 bits (external
areas at lower addresses) of ARSR and the HMR1 and HMR0 bits (external area at upper addresses) of
ARSR.
The MB90860A series also has an auto ready function for I/O that is independent of the auto ready function
for memory. When the IOR1 and IOR0 bits of the ARSR register are set to 0, 1 to 3 wait cycles can be
automatically inserted to extend the access cycle without an external circuit for access to the external area
from addresses "0000C0H " to "0000FFH".
If the RYE bit of the EPCR register is set to "1" and when the P36/RDY pin is signaled as "0", then the
wait cycle is extended even after the wait cycle by the auto ready function is completed.
185
CHAPTER 9 MEMORY ACCESS MODES
9.3.2
Hold Function
If the HDE bit in the bus control signal selection register (EPCR) is set to 1, the external
bus hold function specified by the P34/HRQ and P35/HAK pins is enabled.
■ Hold Function
If the high level is applied to the P34/HRQ pin, the hold state is set up at termination of a CPU instruction
(for a string instruction, at termination of 1-element data processing). The P35/HAK pin outputs the low
level to place the following pins in a high-impedance state:
•
Address output: P27/A23 to P20/A16
•
Address/data I/O: P17/AD15 to P00/AD00
•
Bus control signal: P30/ALE, P31/RD, P32/WRL/WR, P33/WRH
Thus, an external bus can be used from a device external circuit. When the low level is input to the P34/
HRQ pin, the P35/HAK pin outputs the high-level, thereby restoring the external pin state and restarting the
CPU operation. In the stop status, hold request can not be accepted.
Figure 9.3-4 shows the hold timing.
Figure 9.3-4 Hold Timing
Read cycle
Hold cycle
Write cycle
P37/CLK
P34/HRQ
P35/HAK
P33/WRH
P32/WRL/WR
P31/RD
P30/ALE
P27 to P20/A23 to A16
(Address)
(Address)
P17 to P10/AD15 to AD08
(Address)
P07 to P00/AD07 to AD00
(Address)
Read data
186
Write data
CHAPTER 10
I/O PORTS
This chapter explains the functions and operations of
the I/O ports.
10.1 I/O Ports
10.2 I/O Port Registers
187
CHAPTER 10 I/O PORTS
10.1
I/O Ports
Each pin of the ports can be specified as input or output using the direction register if
the corresponding peripheral does not use the pin. When a pin is specified as input, the
logic level at the pin is read. When a pin is specified as output, the data register value is
read. The above also applies to a read operation for the read-modify-write instructions.
■ I/O Ports
When a pin is used as an output of other peripheral function, the peripheral output value is read regardless
of the direction register value.
It is generally recommended that the read-modify-write instructions should not be used for setting the data
register prior to setting the port as an output. This is because the read-modify-write instruction in this case
results reading the logic level at the port rather than the register value.
Figure 10.1-1 is a block diagram of the I/O ports.
Figure 10.1-1 I/O Port Block Diagram
Internal data bus
Data register read
Data register
Data register write
Direction register
Direction register write
Direction register read
188
Pin
CHAPTER 10 I/O PORTS
10.2
I/O Port Registers
There are five types of I/O port registers:
• Port data register (PDR0 to PDRA)
• Port direction register (DDR0 to DDRA)
• Pull-up control register (PUCR0 to PUCR3)
• Analog input enable register (ADER)
• Input level select register (ILSR)
■ I/O Port Registers
Figure 10.2-1 shows the I/O port registers.
Figure 10.2-1 I/O Port Registers
7
6
5
2
1
0
Address: 000000H
Bit
P07
P06
P05
P04
4
P03
3
P02
P01
P00
Port 0 data register (PDR0)
Address: 000001H
P17
P16
P15
P14
P13
P12
P11
P10
Port 1 data register (PDR1)
Address: 000002H
P27
P26
P25
P24
P23
P22
P21
P20
Port 2 data register (PDR2)
Address: 000003H
P37
P36
P35
P34
P33
P32
P31
P30
Port 3 data register (PDR3)
Address: 000004H
P47
P46
P45
P44
P43
P42
P41
P40
Port 4 data register (PDR4)
Address: 000005H
P57
P56
P55
P54
P53
P52
P51
P50
Port 5 data register (PDR5)
Address: 000006H
P67
P66
P65
P64
P63
P62
P61
P60
Port 6 data register (PDR6)
Address: 000007H
P77
P76
P75
P74
P73
P72
P71
P70
Port 7 data register (PDR7)
Address: 000008H
P87
P86
P85
P84
P83
P82
P81
P80
Port 8 data register (PDR8)
Address: 000009H
P97
P96
P95
P94
P93
P92
P91
P90
Port 9 data register (PDR9)
Address: 00000AH
-
-
-
-
-
-
PA1
PA0
Port A data register (PDRA)
Address: 000010H
D07
D06
D05
D04
D03
D02
D01
D00
Port 0 direction register (DDR0)
Address: 000011H
D17
D16
D15
D14
D13
D12
D11
D10
Port 1 direction register (DDR1)
Address: 000012H
D27
D26
D25
D24
D23
D22
D21
D20
Port 2 direction register (DDR2)
Address: 000013H
D37
D36
D35
D34
D33
D32
D31
D30
Port 3 direction register (DDR3)
Address: 000014H
D47
D46
D45
D44
D43
D42
D41
D40
Port 4 direction register (DDR4)
Address: 000015H
D57
D56
D55
D54
D53
D52
D51
D50
Port 5 direction register (DDR5)
Address: 000016H
D67
D66
D65
D64
D63
D62
D61
D60
Port 6 direction register (DDR6)
Address: 000017H
D77
D76
D75
D74
D73
D72
D71
D70
Port 7 direction register (DDR7)
Address: 000018H
D87
D86
D85
D84
D83
D82
D81
D80
Port 8 direction register (DDR8)
Address: 000019H
D97
D96
D95
D94
D93
D92
D91
D90
Port 9 direction register (DDR9)
Address: 00001AH
SIL4
SIL3
SIL2
SIL1
SIL0
-
DA1
DA0
Port A direction register (DDRA)
Address: 00001CH
PU07
PU06
PU05
PU04
PU03
PU02
PU01
PU00
Port 0 pull-up control register (PUCR0)
Address: 00001DH
PU17
PU16
PU15
PU14
PU13
PU12
PU11
PU10
Port 1 pull-up control register (PUCR1)
Address: 00001E H
PU27
PU26
PU25
PU24
PU23
PU22
PU21
PU20
Port 2 pull-up control register (PUCR2)
Address: 00001F H
PU37
PU36
PU35
PU34
PU33
PU32
PU31
PU30
Port 3 pull-up control register (PUCR3)
13/5
12/4
11/3
9/1
8/0
Address: 00000B H
ADE15
ADE14
ADE13
ADE12
ADE11
ADE10
ADE9
ADE8
Address: 00000CH
ADE7
ADE6
ADE5
ADE4
ADE3
ADE2
ADE1
ADE0
Port 6 analog input enable register (ADER6)
Address: 00000DH
ADE23
ADE22
ADE21
ADE20
ADE19
ADE18
ADE17
ADE16
Port B analog input enable register (ADER7)
Address: 00000E H
IL7
IL6
IL5
IL4
IL3
IL2
IL1
IL0
Input level select register0 (ILSR0)
Address: 00000F H
ILT3
ILT2
ILT1
ILT0
-
ILA
IL9
IL8
Input level select register1 (ILSR1)
Bit
15/7
14/6
10/2
Port 5 analog input enable register (ADER5)
189
CHAPTER 10 I/O PORTS
10.2.1
Port Data Register
Note that R/W for I/O ports differ from R/W for memory in the following points:
• Input mode
Read: The level at the corresponding pin is read.
Write: Data is written to an output latch.
• Output mode
Read: The data register latch value is read.
Write: Data is written to an output latch and output to the corresponding pin.
■ Port Data Register
Figure 10.2-2 shows the port data registers.
Figure 10.2-2 Port Data Registers
PDR0
7
6
5
4
3
2
1
0
Address: 000000H
P07
P06
P05
P04
P03
P02
P01
P00
XXXXXXXXB
R/W
PDR1
7
P17
6
P16
5
P15
4
P14
3
P13
2
P12
1
P11
0
P10
XXXXXXXXB
R/W
Address: 000001H
PDR2
Access
7
6
5
4
3
2
1
0
Address: 000002H
P27
P26
P25
P24
P23
P22
P21
P20
XXXXXXXXB
R/W
PDR3
7
P37
6
P36
5
P35
4
P34
3
P33
2
P32
1
P31
0
P30
XXXXXXXXB
R/W
Address: 000003H
PDR4
7
6
5
4
3
2
1
0
Address: 000004H
P47
P46
P45
P44
P43
P42
P41
P40
XXXXXXXXB
R/W
PDR5
7
P57
6
P56
5
P55
4
P54
3
P53
2
P52
1
P51
0
P50
XXXXXXXXB
R/W
Address: 000005H
PDR6
7
6
5
4
3
2
1
0
Address: 000006H
P67
P66
P65
P64
P65
P62
P61
P60
XXXXXXXXB
R/W
PDR7
7
P77
6
P76
5
P75
4
P74
3
P73
2
P72
1
P71
0
P70
XXXXXXXXB
R/W
Address: 000007H
PDR8
7
6
5
4
3
2
1
0
Address: 000008H
P87
P86
P85
P84
P83
P82
P81
P80
XXXXXXXXB
R/W
PDR9
7
P97
6
P96
5
P95
4
P94
3
P93
2
P92
1
P91
0
P90
XXXXXXXXB
R/W
PDRA
7
6
5
4
3
2
1
0
Address: 00000AH
-
-
-
-
-
-
PA1
PA0
XXXXXXXXB
R/W
Address: 000009H
R/W : Readable and writable
: Undefined
190
Initial value
CHAPTER 10 I/O PORTS
● Reading the port data register
When a Port Data register is read, the value depends on the corresponding bit in the Data Direction Register
and on the current status of the resource that is connected to the same pin (if applicable).
The following cases are possible:
DDR value
Resource
Read value
0 (input)
enabled
Resource value
1 (output)
enabled
Resource value
0 (input)
disabled
Pin value
1 (output)
disabled
PDR value
191
CHAPTER 10 I/O PORTS
10.2.2
Data Direction Register
This register has following functions:
• Setting the data direction of each pin that is used as a port.
• Setting the input level of SIN -- Serial data input pin for LIN-UART.
■ Data Direction Register
Figure 10.2-3 shows the Data Direction Registers.
Figure 10.2-3 Data Direction Registers
DDR0
Address: 000010H
DDR1
Address: 000011H
DDR2
Address: 000012H
DDR3
Address: 000013H
DDR4
Address: 000014H
DDR5
Address: 000015H
DDR6
Address: 000016H
DDR7
Address: 000017H
DDR8
Address: 000018H
DDR9
Address: 000019H
DDRA
Address: 00001AH
7
6
5
4
3
2
1
0
Initial value
Access
D07
D06
D05
D04
D03
D02
D01
D00
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000000B
R/W
00000100B
bit0 to 1:R/W
bit3 to 7: W
7
6
5
4
3
2
1
0
D17
D16
D15
D14
D13
D12
D11
D10
7
6
5
4
3
2
1
0
D27
D26
D25
D24
D23
D22
D21
D20
7
6
5
4
3
2
1
0
D37
D36
D35
D34
D33
D32
D31
D30
7
6
5
4
3
2
1
0
D47
D46
D45
D44
D43
D42
D41
D40
7
6
5
4
3
2
1
0
D57
D56
D55
D54
D53
D52
D51
D50
7
6
5
4
3
2
1
0
D67
D66
D65
D64
D65
D62
D61
D60
7
6
5
4
3
2
1
0
D77
D76
D75
D74
D73
D72
D71
D70
7
6
5
4
3
2
1
0
D87
D86
D85
D84
D83
D82
D81
D80
7
6
5
4
3
2
1
0
D97
D96
D95
D94
D93
D92
D91
D90
7
6
5
4
3
2
1
0
SIL4
SIL3
SIL2
SIL1
SIL0
-
DA1
DA0
R/W : Readable and writable
W : Write Only (Read always returns "1")
- : Undefined
Bits Dxx (DDR0 to DDRA)
These bits set the data direction of ports.
When a pin is used as a port, the corresponding pin is controlled as described bellow:
192
0
Input mode
1
Output mode
CHAPTER 10 I/O PORTS
Note:
The Data Direction Register can be read independently from the status of the corresponding
resource. However, the value of the DDR influences the result of a read access on the Port Data
Register.
Bits SIL0 to SIL4 (DDRA bit3 to bit7)
These bits set the input level of the corresponding SIN (Serial Data Input for LIN-UART) signal to
CMOS forcibly. SIL0 sets the input level of SIN0(LIN-UART0), SIL4 sets the input level of
SIN4(LIN-UART4).
Setting these bits to "0" selects CMOS or Automotive or TTL input, depending of the setting of the
corresponding ILx bit and ILTx bit of ILSR.
(About ILSR, please see "10.2.5 Input Level Select Register", also.)
Setting these bits to "1" selects CMOS input level, independent of the setting of the corresponding ILx
bit and ILTx bit of ILSR. The initial value of these bits is "0".
Table 10.2-1 The Input Level Setting of SIN0/SIN1
SIL0/SIL1
IL8
0
0
Automotive level
0
1
CMOS level
1
x
CMOS level
Input level of SIN0 (P82)/SIN1 (P85)
Table 10.2-2 The Input Level Setting of SIN2
SIL2
IL5
0
0
Automotive level
0
1
CMOS level
1
x
CMOS level
Input level of SIN2 (P50)
Table 10.2-3 The Input Level Setting of SIN3/SIN4
SIL3/SIL4
ILT1
IL1
0
0
0
Automotive level
0
0
1
CMOS level
0
1
x
TTL
1
x
x
CMOS level
Input level of SIN3 (P12)/SIN4 (P15)
Note:
SIL0 to SIL4 are write-only, and "1" is always read from these bits. Therefore, instructions that
perform a read-modify-write (RMW) operation such as the INC/DEC instruction, cannot be used at
DDRA.
193
CHAPTER 10 I/O PORTS
10.2.3
Pull-up Control Register (PUCR)
Each pin of port0 to port3 has programmable pull-up resistor. Each bit of this register
controls corresponding pull-up resistor whether to be used or not.
Figure 10.2-4 shows the pull-up control register (PUCR), and Figure 10.2-5 is the block
diagram.
■ Pull-up Control Register (PUCR)
Figure 10.2-4 Pull-up Control Register
PUCR0
7
Address: 00001CH
PU07
15
PUCR1
PU17
Address: 00001DH
PUCR2
7
PU27
Address: 00001E H
15
PUCR3
Address: 00001FH
PU37
6
PU06
5
PU05
14
PU16
13
PU15
6
PU26
5
PU25
14
PU36
13
PU35
4
PU04
12
PU14
4
PU24
12
PU34
3
PU03
11
PU13
3
PU23
11
PU33
2
1
PU02
10
0
PU01
9
PU12
2
10
Access
00000000B
R/W
PU10
00000000B
R/W
00000000B
R/W
00000000B
R/W
0
PU21
9
PU32
Initial value
8
PU11
1
PU22
PU00
PU20
8
PU31
PU30
R/W : Readable and writable
■ Block Diagram of Pull-up Control Register (RDR)
Figure 10.2-5 Block Diagram of Pull-up Control Register (PUCR)
Pull-up resistor (about 50kΩ)
Data register
Port input-output
Direction register
Pull-up control
register
Internal data bus
Note:
In input mode, the pull-up resistor is controlled.
0: No pull-up resistor in input mode
1: Pull-up resistor in input mode
In output mode, this register has no meaning (no pull-up resistor).
The direction register (DDR) determines the input-output mode.
In stop mode (SPL=1), the state with no pull-up resistor is entered (high impedance).
If the port is used as an external bus, this function is disabled and data is not written to the register.
194
CHAPTER 10 I/O PORTS
10.2.4
Analog Input Enable Register
This register controls the port 5 to 7 pins as described below:
0: Port input/output mode
1: Analog input mode
If an external pin is used as an analog input for the A/D converter, the corresponding bit
should be set to "1".
■ Analog Input Enable Registers
Figure 10.2-6 shows the analog input enable register.
Figure 10.2-6 Analog Input Enable Registers (ADER7/ADER6/ADER5)
ADER7
Address: 00000DH
ADER6
Address: 00000CH
ADER5
Address: 00000B H
15
14
13
12
11
10
9
8
ADE23 ADE22 ADE21 ADE20 ADE19 ADE18 ADE17 ADE16
7
6
5
4
3
2
1
0
ADE7
ADE6
ADE5
ADE4
ADE3
ADE2
ADE1
ADE0
15
14
13
12
11
10
9
ADE15 ADE14 ADE13 ADE12 ADE11 ADE10 ADE9
Initial value
Access
11111111B
R/W
11111111B
R/W
11111111B
R/W
8
ADE8
R/W : Readable and writable
Note:
Initial value of the ADEx bits are "1". Therefore the corresponding pins can not be used as logical
input/output as initial setting. If these are used as IO ports or peripheral function IOs, then write "0" to
the ADEx bits.
195
CHAPTER 10 I/O PORTS
10.2.5
Input Level Select Register
The Input Level Select Register allows to switch from Automotive Hysteresis input
levels to CMOS Hysteresis input levels or to TTL input levels.
■ Input Level Select Register
The input level select register ILSR is located on addresses 0EH and 0FH.
Figure 10.2-7 Input Level Select Register (ILSR)
Address
ILSR1 : 00000F H
ILSR0 : 00000E H
Initial value:
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
ILT3
ILT2
ILT1
ILT0
-
ILA
IL9
IL8
IL7
IL6
IL5
IL4
IL3
IL2
IL1
IL0
R/W
R/W
R/W
0/1
0/1
0/1
R/W
-
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
0/1
0
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
R/W : Readable and writable
- : undefined
[bit15 to bit12] ILT0 to ILT3
These bits set the input level of the corresponding port to TTL or CMOS/Automotive. ILT0 sets the
input level of Port0, ILT3 sets the input level of Port3. Setting these bits to "0" selects the CMOS input
level or the Automotive input level, depending of the setting of the corresponding ILx register. Setting
these bits to "1" selects the TTL input level, independent of the setting of the corresponding ILx
register. The initial value of these bits depend on the mode pin setting:
•
For the external reset vector fetch modes, the initial value is "1" (TTL).
•
For all other modes, the initial value is "0" (Automotive/CMOS).
[bit11] undefined
Reading this bit always returns "0".
[bit10 to bit0] IL0 to ILA
These bits set the input level of the corresponding port. IL0 sets the input level of Port0, ILA sets the
input level of Port A. Setting these bits to "0" selects the Automotive input level. Setting these bits to
"1" selects the CMOS input level. The initial value of these bits depend on the mode pin setting:
196
•
For the Flash memory mode, the initial value is "1" (CMOS).
•
For all other modes, the initial value is "0" (Automotive).
CHAPTER 10 I/O PORTS
■ Initialization of ILSR
Initial value of each bit of ILSR are determined when External Reset Signal is released depending on the
value of MD2, MD1, MD0 pin input, as shown in following table.
About detail of each mode, please see "CHAPTER 9 MEMORY ACCESS MODES".
Initial value
MD2
MD1
MD0
Port Input level
Mode Name
ILTx
ILx
Port 0 to 3
Port 4 to A
0
0
0
External vector mode 0
1
0
TTL
Automotive
0
0
1
External vector mode 1
1
0
TTL
Automotive
0
1
0
0
1
1
Automotive
Automotive
1
0
0
1
0
1
1
1
0
Flash memory serial
programing
0
0
Automotive
Automotive
1
1
1
Flash memory
0
1
CMOS
CMOS
Reserved
Internal vector mode
0
0
Reserved
197
CHAPTER 10 I/O PORTS
198
CHAPTER 11
TIMEBASE TIMER
This chapter explains the functions and operations of
the timebase timer.
11.1 Outline of Timebase Timer
11.2 Timebase Timer Control Register
11.3 Operations of Timebase Timer
199
CHAPTER 11 TIMEBASE TIMER
11.1
Outline of Timebase Timer
The timebase timer consists of an 18-bit timebase counter and a control register. The
18-bit timebase counter divides the main clock. The timebase timer issues interrupts at
specified intervals based on carry signals of the timebase counter.
■ Outline of Timebase Timer
After the power on reset, the timebase timer is initialized to zero. The timebase timer is also initialized
when transition to the stop mode or transition between different clock modes, or by writing "0" to the TBR
bit of the TBTC register. The timebase timer continues counting as long as the main clock is supplied. The
timebase timer can be used to generate clock signals to the watch-dog timer or for generating the oscillation
stabilization wait time.
■ Block Diagram of Timebase Timer
Figure 11.1-1 shows a block diagram of the timebase timer.
Figure 11.1-1 Block Diagram of Timebase Timer
Watchdog timer
PPG timer
Timebase timer counter
21/HCLK
21
22
28
23
29
210
211
OF
212
213
OF
214
215
216
217
218
OF
OF
Oscillation stabilization
wait time interval
selector
Power-on reset
STOP mode
CKSCR : MCS=1
CKSCR : SCS=0
0*1
1*2
Counter clear
circuit
TBOF reset
Timebase timer control register
(TBTC)
Reserved
Interval timer
selector
TBOF set
TBIE TBOF TBR TBC1 TBC0
Timebase timer interrupt signal
OF : Overflow
HCLK : Oscillation clock
*1 : When the machine clock is switched from the main clock to PLL clock.
*2 : When the machine clock is switched from the subclock to the main clock.
200
CHAPTER 11 TIMEBASE TIMER
11.2
Timebase Timer Control Register
The timebase timer control register controls interrupts of the timebase timer and can
clear the timebase counter.
■ Timebase Timer Control Register (TBTC)
Figure 11.2-1 Configuration of the Timebase Timer Control Register (TBTC)
Address:
0000A9 H
15
14
R/W
-
13
12
11
10
9
Initial value
1XX00100B
8
- R/W R/W W R/W R/W
bit9
bit8
TBC1
TBC0
0
0
1.024 ms (at 4 MHz)
0
1
4.096 ms (at 4 MHz)
1
0
16.384 ms (at 4MHz)
1
1
131.072 ms (at 4 MHz)
Timebase Timer Interval Control
bit10
Timebase Timer Reset
TBR
Read
0
Write
clear all bits to 0
always 1
1
no effect
bit11
Timebase Timer Interrupt Request Flag
TBOF
Read
Write
0
no interrupt
clear this bit
1
interrupt request
no effect
bit12
TBIE
Timebase Timer Interrupt Enable
0
disable Interrupt
1
enable Interrupt
bit13
Undefined
bit14
Undefined
bit15
Reser ved
Reserved
R/W
W
X
-
:
:
:
:
Readable and writable
Write only (read always returns "0")
Undefined value
Undefined
:
Initial value
0
-
1
always write"1" to this bit
Table 11.2-2 shows the settings for TBC1 and TBC0:
201
CHAPTER 11 TIMEBASE TIMER
Table 11.2-1 Function Description of Each Bit of the Timebase Timer Control Register
Bit name
Function
bit15
Reserved
bit14
Undefined
bit13
Undefined
bit12
TBIE
This bit is used to enable interval interrupts based on the timebase timer. Writing "1" to this
bit enables interrupts, and writing "0" disables interrupts. This bit is initialized to "0" upon a
reset. This bit is readable and writable.
bit11
TBOF
This is an interrupt request flag for the timebase timer. While the TBIE bit is "1", an interrupt
request is issued when "1" is written to TBOF. This bit is set to "1" for each interval specified
with the TBC1 and TBC0 bits.
This bit is cleared by writing "0". This bit is also cleared when transition to the stop mode or
transition between different clock modes (from the subclock mode to the main clock mode,
from the subclock mode to the PLL clock mode and from the main clock mode to the PLL
clock mode), or by writing "0" to the TBR bit of the TBTC register and by any reset. Writing
"1" has no effect.
"1" is always read by a read-modify-write instruction.
bit10
TBR
This bit clears all bits of the timebase timer counter to "0".
Writing "0" clears the timebase counter.
Writing "1" has no effect.
"1" is always read from this bit.
TBC1/0
These bits are used to set the timebase timer interval.
Table 11.2-2 lists the specifiable intervals.
bit9/bit8
This is a reserved bit. When writing data to the TBTC register ensure that "1" is written to this
bit.
Table 11.2-2 Selecting the Timebase Timer Interval
202
TBC1
TBC0
Interval at 4 MHz source oscillation
0
0
1.024 ms
0
1
4.096 ms
1
0
16.384 ms
1
1
131.072 ms
CHAPTER 11 TIMEBASE TIMER
11.3
Operations of Timebase Timer
The timebase timer functions as a watch-dog timer clock source, timer for waiting for
the oscillation to stabilize, and interval timer for generating interrupts at specified
intervals.
■ Timebase Counter Clear
The timebase counter consists of an 18-bit counter for a clock generated by dividing the source oscillation
input by two. This clock is used to generate the machine clock. While the source oscillation is input, the
timebase counter keeps counting.
The timebase timer counter is cleared when transition to the stop mode or transition between different clock
modes (from the subclock mode to the main clock mode, from the subclock mode to PLL clock mode and
from the main clock mode to the PLL clock mode), or by writing "0" to the TBR bit of the TBTC register
and by the power on reset.
■ Interval Interrupt Function
Interrupts are generated at specified intervals according to the carry signals of the timebase counter. The
TBOF flag is set at the intervals specified with the TBC1 and TBC0 bits of the TBTC register. The flag is
set with reference to the time at which the timebase timer is cleared last time.
Upon transition from stop mode, the timebase timer is used as a timer for waiting for the oscillation to
stabilize upon recovery. Therefore, the TBOF flag is immediately cleared upon the mode transition to the
stop mode.
■ Timebase Counter Clear
The timebase timer counter is cleared when transition to the stop mode or transition between different clock
modes (from the subclock mode to the main clock mode, from the subclock mode to PLL clock mode and
from the main clock mode to the PLL clock mode), or by writing "0" to the TBR bit of the TBTC register
and by the power on reset.
203
CHAPTER 11 TIMEBASE TIMER
204
CHAPTER 12
16-BIT I/O TIMER
This chapter explains the functions and operations of
the 16-bit I/O timer.
12.1 OUTLINE OF 16-BIT I/O TIMER
12.2 16-Bit I/O Timer Registers
12.3 16-bit Free-running Timer
12.4 Output Compare
12.5 Input Capture
205
CHAPTER 12 16-BIT I/O TIMER
12.1
Outline of 16-Bit I/O Timer
The MB90860A Series contains two 16-bit free-running timer modules, four output
compare modules, and four input capture modules and supports eight input channels
and eight output channels. The following sections describe the 16-bit free-running
timer, Output Compare and Input Capture.
■ 16-bit Free-running Timer
The two 16-bit free-run timers consist of a 16-bit up counter, control register, and prescaler each. The
values output from these timer counters are used as the base time for input capture and output compare.
● Eight counter clocks are available.
Internal clock: φ, φ/2, φ/4, φ/8, φ/16, φ/32, φ/64, φ/128 (φ: machine clock)
● An interrupt can be generated upon a counter overflow or a match with compare register 0 and 4.
● The counter value can be initialized to '0000H' upon a reset, software clear, or match with compare
register 0 for timer 0, resp. compare register 4 for timer 1.
■ Output Compare (2 Channels per One Module)
The four output compare modules consist of two 16-bit compare registers, compare output latch, and
control register each.
Output Compare 0 and 1 (channels OUT0, OUT1, OUT2 and OUT3) are assigned to Free-running Timer 0
and Output Compare 2 and 3 (channels OUT4, OUT5, OUT6 and OUT7) are assigned to Free-running
Timer 1.
When a 16-bit free-running timer value matches the corresponding compare register value, the output level
is toggled and an interrupt can be issued.
● The two compare registers can be used independently for each Output Compare.
Output pins and interrupt flags corresponding to compare registers
● Output pins can be controlled based on pairs of the two compare registers.
Output pins can be toggled by using the two compare registers.
● Initial values for output pins can be set.
● Interrupts can be generated upon a compare match.
206
CHAPTER 12 16-BIT I/O TIMER
■ Input Capture (2 Channels per One Module)
The four input capture modules consist of two 16-bit capture registers and control registers each
corresponding to two independent external input pins. The 16-bit free-running timer values can be stored in
the capture register and an interrupt is issued simultaneously upon detection of an edge of a signal input
from an external input pin.
● The detection edge of an external input signal can be specified.
Rising, falling, or both edges
● Two input channels can operate independently.
● An interrupt can be issued upon a valid edge of an external input signal.
The intelligent I/O service can be activated upon an input capture interrupt.
■ Block Diagram of 16-bit I/O Timer
Figure 12.1-1 shows a block diagram of the 16-bit I/O timer.
Figure 12.1-1 Block Diagram of 16-bit I/O Timer
Control logic
To each block
Interrupt
16-bit free-run timer 0/1
16-bit timer
FRCK0
FRCK1
Bus
Clear
Output compare 0/2/4/6
Compare register 0
T Q
Output compare 1/3/5/7
Compare register 1
T Q
OUT0
OUT2
OUT4
OUT6
OUT1
OUT3
OUT5
OUT7
Input capture 0/2/4/6
Capture register 0
Input capture 1/3/5/7
Capture register 1
Edge selection
IN0
IN2
IN4
IN6
Edge selection
IN1
IN3
IN5
IN7
207
CHAPTER 12 16-BIT I/O TIMER
12.2
16-Bit I/O Timer Registers
The 16-bit I/O timer has the following three registers:
• 16-bit free-running timer register
• 16-bit output compare register
• 16-bit input capture register
■ 16-bit Free-running Timer 0 and 1
15
0
007940 H
TCDT0
Timer data register 0
007944 H
TCDT1
Timer data register 1
007942 H
007943 H
TCCSH0
TCCSL0
Timer status register 0
007946 H
007947 H
TCCSH1
TCCSL1
Timer status register 1
■ 16-bit Output Compare
15
208
0
007930 H
007932 H
OCCP0/1
Compare register 0/1
007934 H
007936 H
OCCP2/3
Compare register 2/3
007938 H
00793A H
OCCP4/5
Compare register 4/5
00793C H
00793E H
OCCP6/7
Compare register 6/7
000058 H
000059 H
OCS1
OCS0
Control status register 0/1
00005A H
00005B H
OCS3
OCS2
Control status register 2/3
00005C H
00005D H
OCS5
OCS4
Control status register 4/5
00005E H
00005F H
OCS7
OCS6
Control status register 6/7
CHAPTER 12 16-BIT I/O TIMER
■ 16-bit Input Capture
15
0
007920 H
007922 H
IPCP0/1
Capture register 0/1
007924 H
007926 H
IPCP2/3
Capture register 2/3
007928 H
00792A H
IPCP4/5
Capture register 4/5
00792C H
00792E H
IPCP6/7
Capture register 6/7
000050 H
000051 H
ICS01
000053 H
ICS23
ICS45
000057 H
ICS67
ICE67
Control register 4/5
Capture Edge register 4/5
ICE45
000056 H
Control register 2/3
Capture Edge register 2/3
ICE23
000054 H
000055 H
Capture Edge register 0/1
ICE01
000052 H
Control register 0/1
Control register 6/7
Capture Edge register 6/7
209
CHAPTER 12 16-BIT I/O TIMER
12.3
16-bit Free-running Timer
The 16-bit free-running timer consists of a 16-bit up counter and a control status
register. The count values of this timer are used as the base time for the output
compares and input captures.
• Eight counter clock frequencies are available.
• An interrupt can be generated upon a counter value overflow.
• The counter value can be initialized upon a match with compare register 0 and
compare register 4, depending on the mode.
• Two separate timers are available on MB90860A series
■ 16-bit Free-running Timer Block Diagram
Figure 12.3-1 16-bit Free-running Timer Block Diagram
φ
Interrupt request
IVF
IVFE STOP MODE CLR CLK2 CLK1 CLK0
Divider
FRCK0
Comparator 0 /1
Bus
16-bit up counter
Clock
Count value output
Note: The figure above is also valid for Timer 1
Timer 0 is connected to ICU0/1/2/3 and OCU0/1/2/3
Timer 1 is connected to ICU4/5/6/7 and OCU4/5/6/7
210
T15
to
T00
CHAPTER 12 16-BIT I/O TIMER
12.3.1
Data Register
The data register can read the count value of the 16-bit free-running timer. The counter
value is cleared to "0000" upon a reset. The timer value can be set by writing a value to
this register. However, ensure that the value is written while the operation is stopped
(STOP=1).
The data register must be accessed by the word access instructions.
■ Data Register of Free-running Timer
Figure 12.3-2 Data Register of Free-running Timer (TCDT0/TCDT1)
Address:
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
TCDT0:007940 H
007941 H
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
TCDT1:007944 H
007945 H
TCDT0/TCDT1
Initial value
0000000000000000B
bit0 to bit7
TCDT0/1
lower bits
Tn0
Timer Data Reg. 0
Tn1
Timer Data Reg. 1
Tn2
Timer Data Reg. 2
Tn3
Timer Data Reg. 3
Tn4
Timer Data Reg. 4
Tn5
Timer Data Reg. 5
Tn6
Timer Data Reg. 6
Tn7
Timer Data Reg. 7
n = 0, 1
bit8 to bit15
TCDT0/1
R/W
:
Readable and writable
upper bits
Tn8
Timer Data Reg. 8
Tn9
Timer Data Reg. 9
Tn10
Timer Data Reg. 10
Tn11
Timer Data Reg. 11
Tn12
Timer Data Reg. 12
Tn13
Timer Data Reg. 13
Tn14
Timer Data Reg. 14
Tn15
Timer Data Reg. 15
n = 0, 1
The 16-bit free-running timer is initialized upon the following factors:
•
Reset
•
Clear bit (CLR) of control status register
•
A match between compare register 0 and the timer counter value.
211
CHAPTER 12 16-BIT I/O TIMER
12.3.2
Control Status Register
The control status register sets the operation mode of the 16-bit free-running timer,
starts and stops the 16-bit free-running timer, and controls interrupts.
■ Control Status Register of Free-running Timer (Lower)
Figure 12.3-3 Control Status Register of Free-running Timer (TCCSL0/TCCSL1)
Address:
TCCSL0:007942 H
TCCSL1:007946 H
7
6
5
4
3
2
1
0
TCCSL0/TCCSL1
Initial value
0 0 0 0 0 0 0 0B
R/W R/W R/W R/W R/W R/W R/W R/W
bit 2
bit1
CLK2
CLK1
bit 0
0
0
0
φ
0
0
1
φ/2
0
1
0
φ/4
0
1
1
φ/8
1
0
0
φ / 16
1
0
1
φ / 32
1
1
0
φ / 64
1
1
1
φ / 128
CLK0
Count Clock Selection
φ = MCU clock
bit 3
CLR
0
1
Clear Timer
Read
read always "0"
Write
no effect
clear timer to "0000H"
bit 4
MODE
0
1
Set Reset condition of timer
Initialization by reset or clear bit
Init. by reset, clear bit, or compare reg. 0 and 4
bit 5
STOP
0
1
Stop the timer
Counter enabled
Counter disabled (stop)
bit 6
IVFE
Interrupt enable bit
0
Interrupt disabled
1
Interrupt enabled
bit 7
IVF
R/W
:
:
212
Interrupt request flag bit
Read
Write
Readable and writable
0
No interrupt
clear this bit
Initial value
1
Interrupt request
no effect
CHAPTER 12 16-BIT I/O TIMER
Table 12.3-1 Control Status Register of Free-running-timer (Lower)
Bit name
Function
bit7
IVF
•
•
•
•
•
This bit is the interrupt request flag bit and clear bit
Writing "0": A possible interrupt is cleared.
Writing "1": No effect.
"1" is always read during a read-modify-write cycle.
This bit is set to "1" if the free running timer overflows or if the timer value matches
with the compare register 0 and 4 when the MODE bit is set to "1".
bit6
IVFE
• This bit enables the interrupt request
• Writing "0": Interrupt disabled.
• Writing "1": Interrupt enabled.
bit5
STOP
• The STOP bit is used to stop the timer.
• Writing "0": Counter enabled (operation).
• Writing "1": Counter disabled (stop).
bit4
MODE
• "0": Initialization by reset or clear bit
• "1": Initialization by reset, clear bit, or compare register 0 and 4
bit3
CLR
• The CLR bit initializes the operating free-running timer to the value "0000"
• Writing "0": no effect.
• Writing "1": Counter is initialized.
Note:
To initialize the counter value while the timer is stopped (STOP = 1), write "0000"
to the data register (TCDT).
bit2 to
bit0
CLK2, CLK1, CLK0
These bits are used to select the count clock for the 16-bit-free-running timer. The
clock is updated immediately after a value is written to these bits. Therefore, ensure
that the input capture and output compare operations are stopped before a value is
written to these bits.
CLK2
CLK1
CLK0
Count
clock
φ = 20 MHz
φ = 16 MHz
φ = 8 MHz
φ = 4 MHz
φ = 1 MHz
0
0
0
φ
50 ns
62.5 ns
125 ns
0.25 µs
1 µs
0
0
1
φ /2
100 ns
125 ns
0.25 µs
0.5 µs
2 µs
0
1
0
φ /4
0.2 µs
0.25 µs
0.5 µs
1 µs
4 µs
0
1
1
φ /8
0.4 µs
0.5 µs
1 µs
2 µs
8 µs
1
0
0
φ / 16
0.8 µs
1 µs
2 µs
4 µs
16 µs
1
0
1
φ / 32
1.6 µs
2 µs
4 µs
8 µs
32 µs
1
1
0
φ / 64
3.2 µs
4 µs
8 µs
16 µs
64 µs
1
1
1
φ / 128
6.4 µs
8 µs
16 µs
32 µs
128 µs
213
CHAPTER 12 16-BIT I/O TIMER
■ Control Status Register of Free-running Timer (Upper)
Figure 12.3-4 Control Status Register of Free-running Timer (TCCSH0/TCCSH1)
Address:
TCCSH0:007943 H
TCCSH1:007947 H
15
14
13
12
11
10
9
8
TCCSH0/TCCSH1
Initial value
0xxxxxxx
R/W
-
-
-
-
-
-
ECKE
0
R/W
:
Readable and writable
-
:
Undefined
:
Initial value
B
-
1
External clock enable
Internal time clock
External clock from FRCK pin
Table 12.3-2 Control Status Register of Free-running-timer (Upper)
Bit name
bit15
ECKE
bit14 to
bit8
Undefined
214
Function
• This bit chose between internal time clock and external clock from FRCK
• Writing "0": Internal clock selected.
• Writing "1": External clock selected.
CHAPTER 12 16-BIT I/O TIMER
12.3.3
16-bit Free-running Timer Operation
The 16-bit free-running timer starts counting from counter value "0000" after the reset is
released. The counter value is used as the base time for the 16-bit output compare and
16-bit input capture operations.
■ 16-bit Free-running Timer Operation
The counter value is cleared in the following conditions:
•
When an overflow occurs.
•
When a match with the output compare register 0 and 4 occurs. (This depends on the mode.)
•
When "1" is written to the CLR bit of the TCCS register during operation.
•
When "0000" is written to the TCDT register during stop.
•
Reset
An interrupt can be generated when an overflow occurs or when the counter is cleared by a match with the
compare register 0 and 4. (Compare match interrupts can be used only in an appropriate mode.)
■ Clearing the Counter By an Overflow
Figure 12.3-5 Clearing the Counter By an Overflow
Counter value
FFFF H
Overflow
BFFF H
7FFF H
3FFF H
0000 H
Time
Reset
Interrupt
215
CHAPTER 12 16-BIT I/O TIMER
■ Clearing the Counter upon a Match with Output Compare Register 0
Figure 12.3-6 Clearing the Counter upon a Match with Output Compare Register 0
Counter value
FFFF H
Match
BFFF H
Match
7FFF H
3FFF H
Time
0000 H
Reset
Compare
register value
Interrupt
BFFF H
■ 16-bit Free-running Timer Timing
● 16-bit free-running timer clear timing (match with the compare register 0)
The counter can be cleared upon a reset, software clear, or a match with the compare register 0. By a reset
or software clear, the counter is immediately cleared. By a match with compare register 0, the counter is
cleared in synchronization with the count timing.
Figure 12.3-7 16-bit Free-running Timer Clear Timing (Match with the Compare Register 0)
φ
N
Compare
register value
Compare match
Counter value
216
N
0000
CHAPTER 12 16-BIT I/O TIMER
12.4
Output Compare
The output compare module consists of two 16-bit compare registers, two compare
output pins, and one control register. If the value written to the compare register of this
module matches the 16-bit free-running timer value, the output level of the pin can be
toggled and an interrupt can be issued.
■ Output Compare
•
Four separate Output Compare Modules are available on MB90860A series.
•
For each module, two compare registers exist which can be used independently. Depending on the
mode setting, the two compare registers can be used to control pin outputs.
•
The initial value for each pin output can be specified separately.
•
An interrupt can be issued upon a match as a result of comparison.
•
Each module can generate one PWM signal using two compare registers. (Except for OUT0 and OUT4
pins)
•
Two PWM signals can be generated by one output compare module using three compare registers.
(OUT2/3 and OUT6/7 pins)
• There compare registers can be used to generate one cyclic waveform signal. (OUT3 and OUT7 pins)
■ Output Compare Block Diagram
Figure 12.4-1 shows a block diagram of output compare.
Figure 12.4-1 Output Compare Block Diagram
16-bit timer counter value (T15 to T00)
T
Compare control
Q
OTE0
OUT0
CMP0EXT / CMP4EXT
Compare register 0
CMOD1
16-bit timer counter value (T15 to T00)
Bus
CMOD0
T
Compare control
Q
OTE1
OUT1
Compare register 1
ICP1
ICP0 ICE1 ICE0
Controller
Control blocks
Compare 1
interrupt
Compare 0
interrupt
Note: The figure above is also valid for Output Compare Unit 2/3, 4/5, and 6/7
The CMP0EXT / CMP4EXT signal is explained in Figure 13.4-5
217
CHAPTER 12 16-BIT I/O TIMER
12.4.1
Output Compare Register
These 16-bit compare registers are compared with the 16-bit free-running timer. Since
the initial register values are undefined, set appropriate value before enabling the
operation. These registers must be accessed by the word access instructions. When
the value of the register matches that of the 16-bit free-running timer, a compare signal
is generated and the output compare interrupt flag is set. If output is enabled, the
output level corresponding to the compare register is reversed.
If a compare match coincides with write operation to this register, resulting compare
operation is not predictable. Therefore make sure to evaluate the counter value of the
free running timer or to initialize the timer before writing to this register.
■ Output Compare Register
Figure 12.4-2 Output Compare Register (OCCP)
Address:
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
OCCP0:007930 H
OCCP0:007931 H
OCCP1:007932 H
OCCP1:007933 H R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
OCCP2:007934 H
OCCP2:007935 H
OCCP3:007936 H
OCCP3:007937 H
OCCP0
OCCP1
:
OCCP7
Initial value
XXXXXXXXXXXXXXXX
bit0 to bit7
OCCPn
OCCP4:007938 H
OCCP4:007939 H
OCCP5:00793A H
OCCP5:00793B H
OCCP6:00793C H
OCCP6:00793DH
OCCP7:00793E H
OCCP7:00793F H
lower bits
C00
Compare Data Reg. 0
C01
Compare Data Reg. 1
C02
Compare Data Reg. 2
C03
Compare Data Reg. 3
C04
Compare Data Reg. 4
C05
Compare Data Reg. 5
C06
Compare Data Reg. 6
C07
Compare Data Reg. 7
n = 0, 1, 2, 3, 4, 5, 6, 7
bit8 to bit15
OCCPn
R/W
218
:
Readable and writable
upper bits
C08
Compare Data Reg. 8
C09
Compare Data Reg. 9
C10
Compare Data Reg. 10
C11
Compare Data Reg. 11
C12
Compare Data Reg. 12
C13
Compare Data Reg. 13
C14
Compare Data Reg. 14
C15
Compare Data Reg. 15
n = 0, 1, 2, 3, 4, 5, 6, 7
B
CHAPTER 12 16-BIT I/O TIMER
12.4.2
Control Status Register of Output Compare
The control status register sets the operation mode of output compare, starts and stops
output compare, controls interrupts, and sets the external output pins.
■ Control Status Register of Output Compare (Lower Byte)
Figure 12.4-3 Control Status Register of Output Compare (OCS0/2/4/6)
Address: 7 6
5 4
3
OCS0:000058 H
OCS2:00005A H
OCS4:00005C H R/W R/W R/W R/W OCS6:00005E H
2
-
1
0
R/W R/W
OCS0
OCS4
OCS2
OCS6
Initial value
0 0 0 0 X X 0 0B
bit 0
CSTn
Comparison with timer for unit n (even)
0
Compare operation disabled for unit n
1
Compare operation enabled for unit n
bit 1
CSTm
Comparison with timer for unit m (odd)
0
Compare operation disabled for unit m
1
Compare operation enabled for unit m
bit 4
ICEn
Compare interrupt enable for unit n (even)
0
Output compare interrupt disabled for unit n
1
Output compare interrupt enabled for unit n
bit 5
ICEm
Compare interrupt enable for unit m (odd)
0
Output compare interrupt disabled for unit m
1
Output compare interrupt enabled for unit m
bit 6
ICPn
Compare match enable for unit n (even)
0
No compare match for unit n
1
Compare match for unit n
bit 7
ICPm
Compare match enable for unit m (odd)
R/W
:
Readable and writable
0
No compare match for unit m
X
:
:
Undefined value
Undefined
1
Compare match for unit m
:
Initial value
-
n = 0, 2, 4, 6 m = 1, 3, 5, 7
219
CHAPTER 12 16-BIT I/O TIMER
Table 12.4-1 Control Status Register of Output Compare (Lower)
Bit name
Function
bit7
ICPm
bit6
ICPn
• These bits are used as output compare interrupt flags. "1" is set to these bits when the
compare register value matches the 16-bit free-run timer value. While the interrupt
request bits (ICEm and ICEn) are enabled, an output compare interrupt occurs when
the ICPm and ICPn bits are set. These bits are cleared by writing "0".
• "0": No compare match.
• "1": Compare match.
• Writing "1" has no effect.
• "1" is always read by a read-modify-write instruction.
Note:
ICPn: Corresponds to output compare n (even).
ICPm: Corresponds to output compare m (odd).
bit5
ICEm
bit4
ICEn
bit3 to
bit2
Undefined
bit1
CSTm
bit0
CSTn
n = 0, 2, 4, 6
220
m = 1, 3, 5, 7
• These bits are used as output compare interrupt enable flags. While the "1" is written to
these bits, an output compare interrupt occurs when an interrupt flag (ICPm or ICPn) is
set.
• Writing "0": Output compare interrupt disabled.
• Writing "1": Output compare interrupt enabled.
Note:
ICEn: Corresponds to output compare unit n (even).
ICEm: Corresponds to output compare unit m (odd).
• These bits are used to enable the compare operation
• Writing "0": Compare operation disabled.
• Writing "1": Compare operation enabled.
Note:
Ensure that a value is written to the compare register before the compare operation is
enabled.
CSTn: Corresponds to output compare n (even).
CSTm: Corresponds to output compare m (odd).
Since output compare is synchronized with the 16-bit free-running timer clock,
stopping the 16-bit free-running timer stops compare operation.
CHAPTER 12 16-BIT I/O TIMER
■ Control Status Register of Output Compare (Upper Byte)
Figure 12.4-4 Control Status Register of Output Compare (OCS1/OCS3/OCS5/OCS7)
Address: 15 14
OCS1:000059 H
OCS3:00005B H
OCS5:00005DH R/W OCS7:00005F H
13
-
12
11
10
9
8
R/W R/W R/W R/W R/W
OCS1
OCS5
OCS3
OCS7
Initial value
0XX00000B
bit 8
OTDn
Output Pin Level Select for unit n (even)
0
Sets "0" for compare pin output for unit n
1
Sets"1" for compare pin output for unit n
bit 9
OTDm
Sets "0" for compare pin output for unit m
1
Sets"1" for compare pin output for unit m
bit 10
OTEn
:
Readable and writable
X
-
:
:
Undefined value
Undefined
:
Initial value
Output Pin Select for unit n (even)
0
General-purpose port for correspond. pin of unit n
1
Output compare pin output for unit n
bit11
OTEm
R/W
Output Pin Level Select for unit m (odd)
0
Output Pin Select for unit m (odd)
0
General-purpose port for correspond. pin of unit m
1
Output compare pin output for unit m
bit 15
bit 12
CMOD1
CMOD0
0
0
Define Comparison mode for Pin
see description for details
n = 0, 2, 4, 6 m = 1, 3, 5, 7
Table 12.4-2 Control Status Register of Output Compare (Upper) (1/2)
Bit name
bit15, bit12
CMOD0,
CMOD1
bit14, bit13
Undefined
bit11
OTEm
bit10
OTEn
Function
These bits define the operation mode for the pin output signals. Depending on the
defined mode, the level is toggled upon a match with different compare registers. See
Table 12.4-3 and Section "12.4.3 16-bit Output Compare Operation" for details.
These bits are used to enable the output compare output pins. The initial value for these
bits is "0".
• "0": General-purpose port.
• "1": Output compare pin output.
Note:
OTEn: Corresponds to OUTn (n is an even number).
OTEm: Corresponds to OUTm (m is an odd number).
When they are specified as outputs, the corresponding bits of the Port Direction
Registers should also be set to "1".
221
CHAPTER 12 16-BIT I/O TIMER
Table 12.4-2 Control Status Register of Output Compare (Upper) (2/2)
Bit name
bit9
OTDm
bit8
OTDn
n = 0, 2, 4, 6
Function
These bits are used to change the pin output level when the compare pin output is
enabled. The initial value of the compare pin output is "0". Ensure that the compare
operation is stopped before a value is written. When read, these bits indicate the output
compare pin output value.
• Writing "0": Sets "0" for compare pin output.
• Writing "1": Sets "1" for compare pin output.
Note:
OTDn: Corresponds to output compare n (even).
OTDm: Corresponds to output compare m (odd).
m = 1, 3, 5, 7
Table 12.4-3 Function of CMOD1 and 0 Bits
Pin output value toggled upon match with compare register number.
OCS1
Register OCCPx
CMOD1
CMOD0
OUT0
OUT1
x
0
0
1
x
1
0
0/1
OCS3
Register OCCPx
CMOD1
CMOD0
OUT2
OUT3
0
0
2
3
0
1
2
2/3
1
0
0/2
0/3
1
1
0/2
0/2/3
OCS5
Register OCCPx
CMOD1
CMOD0
OUT4
OUT5
x
0
4
5
x
1
4
4/5
OCS7
222
Register OCCPx
CMOD1
CMOD0
OUT6
OUT7
0
0
6
7
0
1
6
6/7
1
0
4/6
4/7
1
1
4/6
4/6/7
CHAPTER 12 16-BIT I/O TIMER
Figure 12.4-5 Block Diagram of Output Selection (OCU Module 1)
Compare
Control 2
OUT2
CMOD1
CMP0EXT
CMOD0
Compare
Control 3
OUT3
For OCU module 1, which requires a match with Output Compare Register 0 if CMOD[1:0] = "10B" the
comparison result from module 0 is carried inside by the CMP0EXT signal. Of course, this does not apply
to module 0 itself. Here, no other register can be used but OCCP0 and OCCP1.
The equivalent situation applies to OCU module 3, where the result from module 2 is needed as
CMP4EXT.
223
CHAPTER 12 16-BIT I/O TIMER
12.4.3
16-bit Output Compare Operation
In the 16-bit output compare operation, an interrupt request flag can be set and the
output level can be toggled when the specified compare register value matches the 16bit free-run timer value. The CMOD0 and CMOD1 bits can be used to define the
corresponding compare registers for each pin.
■ Sample Output Waveform when CMOD[1:0] = "00B"
When CMOD[1:0] = "00B", the output level of the pin corresponding to the compare register is reversed on
every match with the register value. Each output value is controlled by one compare register.
OUT0: The level is only reversed by a match with compare register 0.
OUT1: The level is only reversed by a match with compare register 1.
Figure 12.4-6 Sample of Output Waveform when CMOD[1:0] = "00B"
Counter value
FFFFH
BFFFH
7FFFH
3FFFH
0000H
Time
Reset
OCCP0 value
BFFFH
OCCP1 value
7FFFH
OUT0
OUT1
Compare 0
interrupt
Compare 1
interrupt
Note: In this figure, the initial value is "0" for both pins.
224
CHAPTER 12 16-BIT I/O TIMER
■ Sample Output Waveform with Two Compare Registers when CMOD[1:0] = "01B"
When CMOD[1:0] = "01B", the output level of the pin corresponding to compare register 0 (2) is reversed
upon every match with the register value. This is identical to the behavior for CMOD[1:0] = "00B".
However, the output level of the second pin is reversed upon a match with either compare register 0 or
compare register 1 (3). This allows to define a pulsed signal with one edge defined by the value in compare
register 0 and the other edge defined by compare register 1 (3) or vice versa. If both compare registers have
the same value, the operation is identical to the case for CMOD[1:0] = "00B".
A pulse width modulated signal with differing frequency can be defined by using this mode together with
the reset option by compare register match for the Free-running timer (MODE-bit in TCCSL0/TCCSL1
registers).
OUT0 (2): The level is only reversed by a match with compare register 0 (2).
OUT1 (3): The level is reversed by a match with compare register 0 (2) or with compare register 1 (3).
For OUT4, OUT5, OUT6 and OUT7, compare register 4 plays the same role as compare register 0 above.
Figure 12.4-7 Sample of a Output Waveform when CMOD[1:0] = "01B" (No Timer Reset By Match)
Counter value
FFFFH
BFFFH
7FFFH
3FFFH
0000H
Time
Reset
OCCP0 value
BFFFH
OCCP1 value
7FFFH
OUT0
OUT1
Note: In this figure, the initial value is "0" for both pins.
Figure 12.4-8 Sample of a Output Waveform when CMOD[1:0] = "01B" (with Timer Reset By Match)
Counter value
FFFFH
BFFFH
7FFFH
3FFFH
0000H
Time
Reset
OCCP0 value
BFFFH
OCCP1 value
7FFFH
OUT0
OUT1
Note: In this figure, the initial value is "0" for both pins.
225
CHAPTER 12 16-BIT I/O TIMER
■ Sample Output Waveform when CMOD[1:0] = "10B"
The operation mode defined by CMOD[1:0] = "10B" is intended for the use of three pulse width
modulated signals for each free-running timer instead of two. If this mode is set to OCU module 1, a
match of the timer value with compare register 0 reverses both OUT2 and OUT3. For the third pulsed
signal, the CMOD[1:0] bits of OCU module 0 should be set to "01B".
In register OCS1: CMOD[1:0] = "01B"
OUT0: The level is only reversed by a match with compare register 0.
OUT1: The level is reversed by a match with compare register 0 or with compare register 1.
In register OCS3: CMOD[1:0] = "10B"
OUT2: The level is reversed by a match with compare register 0 or with compare register 2.
OUT3: The level is reversed by a match with compare register 0 or with compare register 3.
For OUT4, OUT5, OUT6 and OUT7, compare register 4 plays the same role as compare register 0 above.
Figure 12.4-9 Output Waveform when OCS1.CMOD[1:0] = "01B" and OCS3.CMOD[1:0] = "10B"
Counter value
FFFFH
BFFFH
7FFFH
3FFFH
0000H
Time
Reset
OCCP0 value
BFFFH
OCCP1 value
7FFFH
OCCP2 value
3FFFH
OCCP3 value
5FFFH
OUT0
OUT1
OUT2
OUT3
Note: In this figure, the initial value is "0" for all pins. Timer reset is by match with compare register 0.
226
CHAPTER 12 16-BIT I/O TIMER
■ Sample Output Waveform when CMOD[1:0] = "11B"
When CMOD[1:0] = "11B", the output level of the OUT3 (OUT7) pin is reversed by the compare registers
0, 2 or 3 (4, 6 or 7). For the pin OUT1 (OUT5), this setting is identical to CMOD[1:0] = "01B" (see also
Table 12.4-3).
OUT0: The level is only reversed by a match with compare register 0.
OUT1: The level is reversed by a match with compare register 0 or with compare register 1.
OUT2: The level is reversed by a match with compare register 0 or with compare register 2.
OUT3: The level is reversed by a match with compare register 0, compare register 2 or with compare
register 3.
For OUT4, OUT5, OUT6 and OUT7, compare register 4 plays the same role as compare register 0 above.
Figure 12.4-10 Output Waveform when OCS1.CMOD[1:0] = "11B" and OCS3.CMOD[1:0] = "11B"
Counter value
FFFFH
BFFFH
7FFFH
3FFFH
0000H
Time
Reset
OCCP0 value
BFFFH
OCCP1 value
7FFFH
OCCP2 value
3FFFH
OCCP3 value
5FFFH
OUT0
OUT1
OUT2
OUT3
Note: In this figure, the initial value is "0" for all pins. Timer reset is by match with compare register 0.
227
CHAPTER 12 16-BIT I/O TIMER
■ Output Compare Timing
In output compare operation, a compare match signal is generated when the free-running timer value
matches the specified compare register value. The output value can be reversed and an interrupt can be
issued. The output reverse timing upon a compare match is synchronized with the counter timing.
● Compare operation upon update of compare register
When the compare register is updated, comparison with the counter value is not performed.
● Interrupt timing
Figure 12.4-11 Interrupt Timing
φ
N
Counter value
N+1
N
Compare register
value
Compare match
Interrupt
● Output pin change timing
Figure 12.4-12 Output Pin Change Timing
Counter value
Compare register
value
Compare match
signal
Pin output
228
N
N+1
N
N
N+1
CHAPTER 12 16-BIT I/O TIMER
12.5
Input Capture
Input capture detects a rising or falling edge or both edges of an external input signal
and stores a 16-bit free-running timer value at that time in a register. In addition, input
capture can generate an interrupt upon detection of an edge. One input capture module
consists of two input capture registers and one control register.
■ Input Capture
MB90860A Series has four input capture modules.
Each input capture data register has a corresponding external input pin.
● The valid edge of an external input can be selected from the following three types:
Table 12.5-1 Types of External Input Edges
Rising edge
Falling edge
Both edges
● An interrupt can be generated upon detection of a valid edge of an external input.
■ Input Capture Block Diagram
Figure 12.5-1 shows a block diagram of input capture.
Figure 12.5-1 Input Capture Block Diagram
IN0
Edge detection
Capture data register 0
Count value from Free-running Timer
EG11 EG10 EG01 EG00
IEI1
IEI0
Bus
Capture data register 1
Edge detection
ICP1
ICP0
ICE1
IN1
ICE0
Interrupt
Interrupt
Note: The figure above is also valid for Input Capture Unit 2/3, 4/5 and 6/7
229
CHAPTER 12 16-BIT I/O TIMER
12.5.1
Input Capture Register Details
Input capture module has the two data registers listed. These registers store a value
from the 16-bit free running timer when a valid edge of the corresponding external pin
input waveform is detected. (The registers must be accessed in word mode. No values
can be written to the registers.)
• Input capture data register
• Input capture control register
■ Input Capture Data Register
Figure 12.5-2 Input Capture Data Register (IPCP)
Address:
IPCP0:007920 H
.
.
.
IPCP7:00792E H
15
14
13
12
11
10
R
R
R
R
R
R
9
R
8
R
7
6
5
4
3
2
1
0
R
R
R
R
R
R
R
R
IPCP0
IPCP1
:
IPCP7
Initial value
XXXXXXXXXXXXXXXXB
IPCPn
lower bits
CP00
Input Capt. Data bit 0
CP01
Input Capt. Data bit 1
CP02
Input Capt. Data bit 2
CP03
Input Capt. Data bit 3
CP04
Input Capt. Data bit 4
CP05
Input Capt. Data bit 5
CP06
Input Capt. Data bit 6
CP07
Input Capt. Data bit 7
n = 0,1,2,3,4,5,6,7
R :
230
Read only
IPCPn
upper bits
CP08
Input Capt. Data bit 8
CP09
Input Capt. Data bit 9
CP10
Input Capt. Data bit 10
CP11
Input Capt. Data bit 11
CP12
Input Capt. Data bit 12
CP13
Input Capt. Data bit 13
CP14
Input Capt. Data bit 14
CP15
Input Capt. Data bit 15
n = 0,1,2,3,4,5,6,7
CHAPTER 12 16-BIT I/O TIMER
■ Control Status Register
Figure 12.5-3 Control Status Register (ICS01, ICS23, ICS45, ICS67)
Address: 7
6
5
4
3
2
1
0
ICS01:000050 H
ICS23:000052 H
ICS45:000054 H R/W R/W R/W R/W R/W R/W R/W R/W
ICS67:000056 H
ICS01
ICS23
ICS45
ICS67
Initial value
0 0 0 0 0 0 0 0B
bit1
bit0
EGn1
EGn0
0
0
No edge detection (stop)
0
1
Rising edge detection
1
0
Falling edge detection
1
1
Both edges detection
Edge selection bit (input capture n)
bit3
bit2
EGn+1 1
EGn+1 0
0
0
No edge detection (stop)
0
1
Rising edge detection
1
0
Falling edge detection
1
1
Both edges detection
Edge selection bit (input capture n+1)
bit4
ICEn
Interrupt Enable Bit (input capture n)
0
Disable Interrupt
1
Enable Interrupt
bit5
Interrupt Enable Bit (input capture n+1)
ICEn+1
0
Disable Interrupt
1
Enable Interrupt
bit6
ICPn
Interrupt request flag bit (input capture n)
Read
Write
0
No edge detected
Clear this bit
1
Edge detected
No effect
bit7
ICPn+1
R/W
:
Readable and writable
:
Initial value
Interrupt request flag bit (input capture n+1)
Read
Write
0
No edge detected
Clear this bit
1
Edge detected
No effect
n = 0, 2, 4, 6
m = 1, 3, 5, 7
231
CHAPTER 12 16-BIT I/O TIMER
Table 12.5-2 Input Capture Control Status Register Bits
Bit name
Function
bit7
ICPn+1:
Interrupt request flag
bit (Input capture n+1)
• This bit is used as interrupt request flag for input capture n.
• "1" is set to this bit upon detection of a valid edge of an external input pin.
• While the interrupt enable bit (ICEn+1) is set, an interrupt can be generated
upon detection of a valid edge.
• Writing "0" will clear this bit.
• Writing "1" has no effect.
• In read-modify-write operation, "1" is always read.
bit6
ICPn:
Interrupt request flag
bit (Input capture n)
• This bit is used as interrupt request flag for input capture n.
• "1" is set to this bit upon detection of a valid edge of an external input pin.
• While the interrupt enable bit (ICEn) is set, an interrupt can be generated upon
detection of a valid edge.
• Writing "0" will clear this bit.
• Writing "1" has no effect.
• In read-modify-write operation, "1" is always read.
bit5
ICEn+1:
Interrupt request
enable bit (Input
capture n+1)
• This bit is used to enable input capture interrupt request for input capture n+1.
• While "1" is written to this bit, an input capture interrupt is generated when the
interrupt flag (ICPn+1) is set.
bit4
ICEn:
Interrupt request
enable bit (Input
capture n)
• This bit is used to enable input capture interrupt request for input capture n.
• While "1" is written to this bit, an input capture interrupt is generated when the
interrupt flag (ICPn) is set.
bit3/2
EG[n+1]1, EG[n+1]0
• These bits are used to specify the valid edge polarity of an external input for
input capture n+1
• These bits are also used to enable input capture operation
bit1/0
EGn1, EGn0
• These bits are used to specify the valid edge polarity of an external input for
input capture n
• These bits are also used to enable input capture operation
n = 0, 2, 4, 6
232
CHAPTER 12 16-BIT I/O TIMER
■ Input Capture Edge Register (ICE01, ICE23, ICE45, ICE67)
Figure 12.5-4 Input Capture Edge Register (ICE01, ICE23, ICE45, ICE67)
Initial value
ICE01 : 000051 H
15
-
14
-
13
-
12
ICUS1
11
-
10
ICUS0
9
IEI1
8
IEI0
14
-
13
-
R/W
12
-
11
-
R/W
10
-
R
ICE23 : 000053 H
15
-
9
IEI3
R
8
IEI2
-
-
-
-
-
-
R
R
15
-
14
-
13
-
12
-
11
-
10
-
9
IEI5
8
IEI4
XXXXXXXX
15
-
14
-
13
-
R
R
8
IEI6
XXX000XXB
-
-
Address
ICE45 : 000055 H
ICE67 : 000057 H
R/W : Readable and writable
X : Undefined
12
11
10
ICUS7 ICUS61 ICUS60
R/W
R/W
R/W
9
IEI7
R
XXX0X0XX B
XXXXXXXX
B
B
R
Table 12.5-3 Input Capture Edge Register Bits (Upper and Lower)
Bit name
Function
bit15 to bit13
Undefined
bit12
for ICE01: ICUS1
for ICE67: ICUS7
This bit defines the input signal for Input Capture1 or 7, and is used by UART1 or 3
for LIN operation:
• Writing "0": The Input Capture source is external.
• Writing "1": The Input Capture source is UART1 or 3.
bit11,
bit10
for ICE67:
ICUS61, ICUS60
This bit defines the input signal for Input Capture6:
•I CUS61 / 60 = "00B": Pin IN6 input signal used as ICU6 input signal.
•I CUS61 / 60 = "01B": ICU6 connected to UART2.
•I CUS61 / 60 = "10B" or "11B": ICU6 connected to UART4.
bit10
for ICE01: ICUS0
This bit defines the input signal for Input Capture0:
•I CUS0 = "0B": Pin IN0 input signal used as ICU0 input signal.
•I CUS0 = "1B": ICU0 connected to UART0.
bit9
IEIm:
Valid edge
indication bit
• This bit is a valid edge indication bit for capture register IPCP1, IPCP3, IPCP5
and IPCP7 to indicate that a rising or falling edge is detected
• "0": falling edge detected.
• "1": rising edge detected.
• This bit is read only.
Note: The read value is meaningless, if EG [n+1] 1, EG [n+1] 0 = "00".
bit8
IEIn:
Valid edge
indication bit
• This bit is a valid edge indication bit for capture register IPCP0, IPCP2, IPCP4
and IPCP6 to indicate that a rising of falling edge is detected
• "0": falling edge detected.
• "1": rising edge detected.
• This bit is read only.
Note: The read value is meaningless, if EGn1, EGn0 = "00".
n = 0, 2, 4, 6
m = 1, 3, 5, 7
233
CHAPTER 12 16-BIT I/O TIMER
Figure 12.5-5 shows input signal connection of Input Captures.
Figure 12.5-5 Block Diagram of Input Capture Connection
ICUS0
IN0
UART0
Input capture 0
IN1
UART1
Input capture 1
ICUS1
IN2
Input capture 2
IN3
Input capture 3
IN4
Input capture 4
IN5
Input capture 5
ICUS60
ICUS61
IN6
UART2
Input capture 6
UART4
IN7
UART3
Input capture 7
ICUS7
234
CHAPTER 12 16-BIT I/O TIMER
12.5.2
16-bit Input Capture Operation
In 16-bit input capture operation, an interrupt can be generated upon detection of at the
specified edge, fetching the 16-bit free-run timer value and writing it to the capture data
register.
■ Sample of Input Capture Fetch Timing
•
Capture 0: Rising edge
•
Capture 1: Falling edge
•
Capture example: Both edges
Figure 12.5-6 Sample of Input Capture Fetch Timing
Counter value
FFFF H
BFFF H
7FFF H
3FFF H
0000 H
Time
Reset
IN0
IN1
IN example
Capture 0
Undefined
Capture 1
Capture
example
3FFFH
Undefined
7FFFH
Undefined
BFFFH
3FFFH
Capture 0
interrupt
Capture 1
interrupt
Capture
interrupt
■ Input Capture Input Timing
● Capture timing for input signals
Figure 12.5-7 Capture Timing for Input Signals
φ
Counter value
Input capture
input
N
N+1
Valid edge
Capture signal
Capture register
N+1
Interrupt
235
CHAPTER 12 16-BIT I/O TIMER
236
CHAPTER 13
WATCH-DOG TIMER
This chapter explains the functions and operations of
the watch-dog timer.
13.1 Outline of Watch-Dog Timer
13.2 Watch-dog Timer Operation
237
CHAPTER 13 WATCH-DOG TIMER
13.1
Outline of Watch-Dog Timer
The watch-dog timer consists of a two-bit watch-dog counter, control register, and
watch-dog reset controller. The two-bit watch-dog counter uses a carry signal of the 18bit timebase counter as a clock source.
■ Watch-dog Timer Block Diagram
Figure 13.1-1 is a diagram of the configuration of the watch-dog timer.
Figure 13.1-1 Watch-dog Timer Block Diagram
Watch-dog timer control register (WDTC)
WRST ERST SRST WTE WT1 WT0
PONR
Watch-dog timer
Watch timer control register
(WTC)
WDCS
2
Execution
Reset occurrence
Transition to sleep mode
Transition to timebase
timer mode
Transition to watch mode
Transition to stop mode
Counter clear
control circuit
Count clock
selector
2-bit counter
Watch-dog reset
generation circuit
Internal reset
generation
circuit
Clear
4
4
(Timebase timer counter)
Main clock
(HCLK divided by 2)
21
22
28
29
210
211 212
213
214
215
216
217 218
25
26
27
28
210
211 212
213
214
(Watch counter)
Subclock
(SCLK* divided by 2)
21
22
29
HCLK : Oscillation clock
SCLK : Subclock
* : SCLK is the oscillation circuit clock (X0A pin and X1A pin) divided by 2 or 4.
The division ratio is determined by SCDS bit of PLL/Subclock Control Register (PSCCR).
238
215
CHAPTER 13 WATCH-DOG TIMER
■ Watch-dog Timer Control Register (WDTC)
WDTC
Address : 0000A8H
7
6
PONR
-
R
-
5
4
WRST ERST SRST
R
2
1
0
Initial value
WTE
WT1
WT0
XXXXX111B
W
W
W
3
R
R
[bit7 to bit3] PONR, WRST, ERST, and SRST
These flags indicate the reset causes. The flags are set upon a reset as described in Table 13.1-1.
All bits are cleared to "0" after the WDTC register is read. These bits are read-only bits.
Table 13.1-1 Reset Cause Registers
Reset cause
PONR
WRST
ERST
SRST
Power-on
1
-
-
-
Watch-dog timer
*
1
*
*
External pin
*
*
1
*
RST bit
*
*
*
1
*: The previous value is maintained.
[bit2] WTE
While the watch-dog timer is stopped, writing "0" to this bit activates the watch-dog timer.
Subsequently, writing "0" clears the watch-dog timer counter. Writing "1" has no effect.
The watch-dog timer is stopped by power-on or reset by watch-dog timer. "1" is always read from this
bit.
[bit1, bit0] WT1 and WT0
These bits are used to select the watch-dog timer interval. Only the data items written during watch-dog
timer activation are valid. Data items that are written outside watch-dog timer activation are ignored.
Table 13.1-2 lists the interval settings.
These bits are write-only bits.
Table 13.1-2 Watch-dog Timer Interval Selection Bit (WTC: WDCS = 0)
Interval *
WT1
WT0
Main clock cycle count
Minimum
Maximum
0
0
approx. 3.58 ms
approx. 4.61 ms
214 plus or minus 211 cycles
0
1
approx. 14.33 ms
approx. 18.43 ms
216 plus or minus 213 cycles
1
0
approx. 57.23 ms
approx. 73.73 ms
218 plus or minus 215 cycles
1
1
approx. 458.7 ms
approx. 589.82 ms
221 plus or minus 218 cycles
*: For a source oscillation of 4 MHz.
239
CHAPTER 13 WATCH-DOG TIMER
Table 13.1-3 Watch-dog Timer Interval Selection Bit (WTC: WDCS = 1)
Interval *
WT1
WT0
Main clock cycle count
Minimum
Maximum
0
0
approx. 0.457 s
approx. 0.576 ms
212 plus or minus 29 cycles
0
1
approx. 3.584 s
approx. 4.608 ms
215 plus or minus 212 cycles
1
0
approx. 7.168 s
approx. 9.216 ms
216 plus or minus 213 cycles
1
1
approx. 14.336 s
approx. 18.432 ms
217 plus or minus 214 cycles
*: For a source oscillation of 8.192 MHz.
Note:
The interval time uses a carry signal of the time-base timer or watch timer as a count clock. If the
time-base timer or watch timer is cleared, the interval time of the watchdog timer may become
longer.
The time-base timer is also cleared by writing zero to the TBR bit in the time-base timer control
register (TBTC), transition from main clock mode to PLL clock mode, transition from sub-clock mode
to main clock mode and transition from sub-clock mode to PLL clock mode.
240
CHAPTER 13 WATCH-DOG TIMER
13.2
Watch-dog Timer Operation
The watch-dog timer function enables detection of program surge.
If the watch-dog timer is not accessed within the specified time due to, for example, a
program surge, the watch-dog timer resets the system.
■ Activation
The watch-dog timer is activated by writing "0" to the WTE bit of the WDTC register while the watch-dog
timer is stopped. At the same time, the WT1 and WT0 bits are used to set the watch-dog timer reset
interval. Only the interval setting specified during activation is valid.
■ Watch-dog Counter
Once the watch-dog timer is activated, the watch-dog timer counter must be periodically cleared within the
program. Writing "0" to the WTE bit of the WDTC register clears the watch-dog counter. The watch-dog
counter consists of a two-bit counter which uses a carry signals of the timebase counter or watch timer as a
clock source. Therefore, the watch-dog reset time may become shorter than the setting if the timebase
counter is cleared.
The watch-dog counter is cleared not only by writing to the WTE bit but also by any reset and transition to
the standby (sleep, stop, watch, timebase timer modes) or stop mode.
Figure 13.2-1 is a diagram of the watch-dog timer operation.
Figure 13.2-1 Watch-dog Timer Operation
Timebase
Watch-dog
00
01
10
00
01
10
11
00
WTE write
Watch-dog activation Watch-dog clear
Watch-dog reset
■ Watch-dog Stop
Once activated, the watch-dog timer can be stopped only by reset.
241
CHAPTER 13 WATCH-DOG TIMER
242
CHAPTER 14
16-BIT RELOAD TIMER
(WITH EVENT COUNT
FUNCTION)
This chapter explains the functions and operations of
the 16-bit reload timer (with the event count function).
14.1 Outline of 16-Bit Reload Timer (with Event Count Function)
14.2 16-Bit Reload Timer (with Event Count Function)
14.3 Internal Clock and External Clock Operations of 16-bit Reload
Timer
14.4 Underflow Operation of 16-bit Reload Timer
14.5 Output Pin Functions of 16-bit Reload Timer
14.6 Counter Operation State
243
CHAPTER 14 16-BIT RELOAD TIMER (WITH EVENT COUNT FUNCTION)
14.1
Outline of 16-Bit Reload Timer (with Event Count Function)
The 16-bit reload timer consists of a 16-bit down-counter, a 16-bit reload register, one
input pin (TIN) and one output pin (TOT), and a control register. The input clock can be
selected from one external clock and three types of internal clock.
■ Outline of 16-bit Reload Timer (with Event Count Function)
The output pin (TOT) outputs a toggle output waveform in reload mode and outputs a square waveform
indicating counting in one-shot mode. The input pin (TIN) is used for event input in event count mode, and
can be used for trigger input or gate input in internal clock mode.
The MB90860A Series has four 16-bit reload timers.
■ Intelligent I/O Service (EI2OS) Function, DMA and Interrupts
The timer includes a circuit that supports EI2OS. The timer can activate EI2OS when an underflow occurs.
EI2OS can be used with all four reload timers on this product. However, as two timers (ch0 and ch1, ch2
and ch3) are connected to the same interrupt control register (ICRx) in the interrupt controller, ch0 and ch1,
ch2 and ch3 cannot be assigned to different EI2OS services. Also, as the four timers have different interrupt
vectors, they can be assigned to four different interrupt services. However, as ch0 and ch1, ch2 and ch3
share an interrupt control register as described above, the same interrupt level applies to both pair of
channels.
■ Block Diagram of 16-bit Reload Timer
Figure 14.1-1 shows a block diagram of the 16-bit reload timer.
Figure 14.1-1 Block Diagram of 16-bit Reload Timer
16
16-bit reload register
8
F2MC-16LX BUS
Reload
RELD
UF
16-bit down-counter
OUTE
16
OUTL
2
OUT
CTL.
GATE
INTE
IRQ
UF
CSL1
Clock selector
CNTE
CSL0
Clear
EI 2OSCLR
TRG
Re-trigger
2
EXCK
φ
2
1
φ
2
3
φ
5
2
Port (TIN)
IN CTL
3
Prescaler
clear
Output enable
Port (TOT)
MOD2
MOD1
Peripheral clock
3
244
MOD0
A/DC (ch1)
CHAPTER 14 16-BIT RELOAD TIMER (WITH EVENT COUNT FUNCTION)
14.2
16-Bit Reload Timer (with Event Count Function)
The 16-bit reload timer has the following two types of registers:
• Timer control register (TMCSR)
• 16-bit timer register (TMR)/16-bit reload register (TMRLR)
■ 16-bit Reload Timer Register
Figure 14.2-1 16-bit Reload Timer Register
Address:
TMCSR0:000061 H
TMCSR1:000063 H
TMCSR2:000065 H
TMCSR3:000067 H
15
14
13
12
-
-
-
-
CSL1 CSL0 MOD2 MOD1
-
-
-
-
R/W R/W R/W R/W
Address:
TMCSR0:000060 H
TMCSR1:000062 H
TMCSR2:000064 H
TMCSR3:000066 H
7
6
5
4
11
3
MOD0 OUTE OUTL RELD I NTE
10
2
UF
R/W
:
1
8
0
CNTE TRG
TMCSR0/1/2/3 (upper)
Initial value
XXXX0000
B
TMCSR0/1/2/3 (lower)
Initial value
0 0 0 0 0 0 0 0B
R/W R/W R/W R/W R/W R/W R/W R/W
Address: 15 14 13 12 11 10
TMR0/TMRLR0:007949 H
TMR1/TMRLR1:00794B H
TMR2/TMRLR2:00794D H
TMR3/TMRLR3:00794F H R/W R/W R/W R/W R/W R/W
Address:
TMR0/TMRLR0:007948 H
TMR1/TMRLR1:00794A H
TMR2/TMRLR2:00794C H
TMR3/TMRLR3:00794E H
9
7
6
5
4
3
2
9
8
TMR/TMRLR0/1/2/3 (upper)
Initial value
XXXXXXXX
B
R/W R/W
1
0
TMR/TMRLR0/1/2/3 (lower)
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
Readable and writable
X
:
Undefined value
-
:
Undefined
245
CHAPTER 14 16-BIT RELOAD TIMER (WITH EVENT COUNT FUNCTION)
14.2.1
Timer Control Status Register (TMCSR)
Controls the operation mode and interrupts for the 16-bit timer.
■ Register Layout of Timer Control Register (TMCSR)
Figure 14.2-2 Register Layout of Timer Control Register (TMCSR)
Address:
TMCSR0:000061H
TMCSR1:000063H
TMCSR2:000065H
TMCSR3:000067H
15
14
13
12
-
-
-
-
CSL1 CSL0 MOD2 MOD1
-
-
-
-
R/W R/W R/W R/W
Address:
TMCSR0:000060H
TMCSR1:000062H
TMCSR2:000064H
TMCSR3:000066H
7
6
5
4
R/W
:
Readable and writable
X
:
Undefined value
-
:
Undefined
11
3
MOD0 OUTE OUTL RELD I NTE
10
2
UF
9
1
8
0
CNTE TRG
TMCSR0/1/2/3 (upper)
Initial value
XXXX0000
B
TMCSR0/1/2/3 (lower)
Initial value
0 0 0 0 0 0 0 0B
R/W R/W R/W R/W R/W R/W R/W R/W
■ Register Contents of Timer Control Register (TMCSR)
[bit11, bit10] CSL1, CSL0 (Clock select 1, 0)
The count clock select bits. Table 14.2-1 lists the selected clock sources.
Table 14.2-1 Clock Sources for CSL Bit Settings
CSL1
0
0
1
1
246
CSL0
0
1
0
1
Clock Source (Machine cycle φ = 24 MHz)
φ/21 (0.083 µs)
φ/23 (0.33 µs)
φ/25 (1.3 µs)
External event count mode
CHAPTER 14 16-BIT RELOAD TIMER (WITH EVENT COUNT FUNCTION)
[bit9, bit8, bit7] MOD2, MOD1, MOD0
These bits set the operation mode and I/O pin functions.
The MOD2 bit selects the I/O functions. When MOD2 = "0", the input pin functions as a trigger input.
In this case, the reload register contents is loaded to the counter when an active edge is input to the
input pin and count operation proceeds. When MOD2 = "1", the timer operates in gate counter mode
and the input pin functions as a gate input. In this mode, the counter only counts while an active level is
input to the input pin.
The MOD1 and 0 bits set the pin functions for each mode. Table 14.2-2 and Table 14.2-3 list the
MOD2, MOD1, MOD0 bit settings.
Table 14.2-2 MOD2, 1, 0 Bit Settings (1)
MOD2
MOD1
MOD0
Input Pin Function
Active Edge or Level
0
0
0
Trigger disabled
-
0
0
1
Trigger input
Rising edge
0
1
0
Falling edge
0
1
1
Both edges
1
x
0
1
x
1
Gate input
"L" level
"H" level
Internal clock mode (CSL0, 1 = "00B", "01B", or "10B")
Table 14.2-3 MOD2, 1, 0 Bit Settings (2)
MOD2
x
MOD1
MOD0
Input Pin Function
Active Edge or Level
0
0
-
-
0
1
Trigger input
Rising edge
1
0
Falling edge
1
1
Both edges
•
Event counter mode (CSL0, 1 = "11B")
•
Bits marked as x in the table can be set to any value.
247
CHAPTER 14 16-BIT RELOAD TIMER (WITH EVENT COUNT FUNCTION)
[bit6] OUTE
Output enable bit. The TOT pin functions as a general-purpose port when this bit is "0" and as the timer
output pin when this bit is "1". In reload mode, the output waveform toggles. In one-shot mode, TOT
outputs a square waveform that indicates that counting is in progress.
[bit5] OUTL
This bit sets the output level for the TOT pin.
Table 14.2-4 OUTE, RELD, and OUTL Settings
OUTE
0
1
1
1
1
RELD
OUTL
x
x
0
0
1
1
0
1
0
1
Output Waveform
General-purpose port
Output an "H" level pulse during counting.
Output an "L" level pulse during counting.
Toggle output. Starts with "L" level output.
Toggle output. Starts with "H" level output.
[bit4] RELD (Reload)
This bit enables reload operations. When RELD is "1", the timer operates in reload mode. In this mode,
the timer loads the reload register contents into the counter and continues counting whenever an
underflow occurs (when the counter value changes from 0000H to FFFFH). When RELD is "0", the
timer operates in one-shot mode. In this mode, the count operation stops when an underflow occurs due
to the counter value changing from 0000H to FFFFH.
[bit3] INTE (Interrupt enable)
Timer interrupt request enable bit. When INTE is "1", an interrupt request is generated when the UF bit
changes to "1". When INTE is "0", no interrupt request is generated, even when the UF bit changes to
"1".
[bit2] UF (Underflow)
Timer interrupt request flag. UF is set to "1" when an underflow occurs (when the counter value
changes from 0000H to FFFFH). Cleared by writing "0" or by the intelligent I/O service. Writing "1" to
this bit has no meaning. Read as "1" by read-modify-write instructions.
[bit1] CNTE (Count enable)
Timer count enable bit. Writing "1" to CNTE sets the timer to wait for a trigger. Writing "0" stops count
operation.
[bit0] TRG (Trigger)
Software trigger bit. Writing "1" to TRG applies a software trigger, causing the timer to load the reload
register contents to the counter and start counting. Writing "0" has no meaning. Reading always returns
"0". Applying a trigger using this register is only valid when CNTE = "1". Writing "1" has no effect if
CNTE = "0".
248
CHAPTER 14 16-BIT RELOAD TIMER (WITH EVENT COUNT FUNCTION)
14.2.2
Register Layout of 16-bit Timer Register (TMR)/16-bit
Reload Register (TMRLR)
• TMR contents (for reading)
Reading this register reads the count value of the 16-bit timer. The initial value is
undefined. Always read this register using the word access instructions.
• TMRLR contents (for writing)
The 16-bit reload register holds the reload value. The initial value is undefined. Always
write to this register using the word access instructions.
■ Register Layout of 16-bit Timer Register (TMR)/16-bit Reload Register (TMRLR)
Figure 14.2-3 Register Layout of 16-bit Timer Register (TMR)/16-bit Reload Register (TMRLR)
Address: 15 14 13 12 11 10
TMR0/TMRLR0:007949 H
TMR1/TMRLR1:00794BH
TMR2/TMRLR2:00794DH
TMR3/TMRLR3:00794F H R/W R/W R/W R/W R/W R/W
Address:
TMR0/TMRLR0:007948 H
TMR1/TMRLR1:00794A H
TMR2/TMRLR2:00794CH
TMR3/TMRLR3:00794E H
R/W
:
Readable and writable
X
:
Undefined value
7
6
5
4
3
2
9
8
TMR/TMRLR0/1/2/3 (upper)
Initial value
XXXXXXXX
B
R/W R/W
1
0
TMR/TMRLR0/1/2/3 (lower)
Initial value
XXXXXXXXB
R/W R/W R/W R/W R/W R/W R/W R/W
249
CHAPTER 14 16-BIT RELOAD TIMER (WITH EVENT COUNT FUNCTION)
14.3
Internal Clock and External Clock Operations of 16-bit
Reload Timer
The machine clock divided by 21, 23, or 25 can be selected as the clock sources for
operating the timer from an internal divide clock. The external input pin can be selected
as either a trigger input or gate input by a register setting.
If an external clock is selected, the TIN pin functions as an external event input pin to
count the number of valid edges set in the register.
■ Internal Clock Operation of 16-bit Reload Timer
Writing "1" to both the CNTE and TRG bits in the control register enables and starts counting at one time.
Using the TRG bit as a trigger input is always available when the timer is enabled (CNTE = "1"), regardless
of the operation mode.
Figure 14.3-1 shows counter activation and counter operation. A time period T (T: machine cycle) is
required from the counter start trigger being input until the reload register data is loaded into counter.
Figure 14.3-1 Activation and Operation of 16-bit Reload Timer Counter
Count clock
Counter
Reload data
Data load
CNTE (bit)
TRG (bit)
T
250
-1
-1
-1
CHAPTER 14 16-BIT RELOAD TIMER (WITH EVENT COUNT FUNCTION)
■ Input Pin Functions of 16-bit Reload Timer (in Internal Clock Mode)
The TIN pin can be used as either a trigger input or a gate input when an internal clock is selected as the
clock source. When used as a trigger input, input of an active edge causes the timer to load the reload
register contents to the counter and then start count operation after clearing the internal prescaler. Input a
pulse width of at least 2T (T is the machine cycle) to TIN.
Figure 14.3-2 shows the operation of trigger input.
Figure 14.3-2 Trigger Input Operation of 16-bit Reload Timer
Count clock
Rising edge detected
TIN
Prescaler clear
Counter
Reload data
0000H
-1
-1
-1
Load
2T2.5T
When used as a gate input, the counter only counts while the active level specified by the MOD0 bit of the
control register is input to the TIN pin. In this case, the count clock continues to operate unless stopped.
The software trigger can be used in gate mode, regardless of the gate level. Input a pulse width of at least
2T (T is the machine cycle) to the TIN pin. Figure 14.3-3 shows the operation of gate input.
Figure 14.3-3 Gate Input Operation of 16-bit Reload Timer
Count clock
TIN
Counter
When MOD0 = "1" (Count when "H" is input)
-1
-1
-1
■ External Event Counter
The TIN pin functions as an external event input pin when an external clock is selected. The counter counts
on the active edge specified in the register. Input a pulse width of at least 4T (T is the machine cycle) to the
TIN pin.
251
CHAPTER 14 16-BIT RELOAD TIMER (WITH EVENT COUNT FUNCTION)
14.4
Underflow Operation of 16-bit Reload Timer
An underflow is defined for this timer as the time when the counter value changes from
0000H to FFFFH. Therefore, an underflow occurs after (reload register setting + 1)
counts.
■ Underflow Operation of 16-bit Reload Timer
If the RELD bit in the control register is "1" when the underflow occurs, the contents of the reload register
is loaded into the counter and counting continues. When RELD is "0", counting stops with the counter at
FFFFH.
The UF bit in the control register is set when the underflow occurs. If the INTE bit is "1" at this time, an
interrupt request is generated.
Figure 14.4-1 shows the operation when an underflow occurs.
Figure 14.4-1 Underflow Operation of 16-bit Reload Timer
Count clock
Counter
0000H
Reload data
Data load
Underflow set
[RELD=1]
Count clock
Counter
0000H
Underflow set
[RELD=0]
252
FFFFH
-1
-1
-1
CHAPTER 14 16-BIT RELOAD TIMER (WITH EVENT COUNT FUNCTION)
14.5
Output Pin Functions of 16-bit Reload Timer
In reload mode, the TOT pin performs toggle output (inverts at each underflow). In oneshot mode, the TOT pin functions as a pulse output that shows a particular level while
the count is in progress.
■ Output Pin Functions of 16-bit Reload Timer
The OUTL bit of the control register sets the output polarity. When OUTL = "0", the initial value for toggle
output is "0" and the one-shot pulse output is "1" while the count is in progress. The output waveforms are
opposite when OUTL = "1".
Figure 14.5-1 and Figure 14.5-2 show the output pin functions.
Figure 14.5-1 Output Pin Function of 16-bit Reload Timer (1)
Count start
Underflow
Level is opposite when
OUTL = "1"
TOT
General-purpose port
CNTE
Trigger
[RELD=1, OUTL=0]
Figure 14.5-2 Output Pin Function of 16-bit Reload Timer (2)
Underflow
TOT
Level is opposite
when OUTL = "1"
General-purpose port
CNTE
Trigger
Waiting for a trigger
[RELD=0, OUTL=0]
253
CHAPTER 14 16-BIT RELOAD TIMER (WITH EVENT COUNT FUNCTION)
14.6
Counter Operation State
The counter state is determined by the CNTE bit in the control register and the internal
WAIT signal. Available states are: CNTE = "0" and WAIT = "1" (STOP state), CNTE = "1"
and WAIT = "1" (WAIT state for trigger), and CNTE = "1" and WAIT = "0" (RUN state).
■ Counter Operation State
Figure 14.6-1 shows the transitions between each state.
Figure 14.6-1 Counter State Transitions
Reset
State transitions by hardware
STOP
CNTE=0, WAIT=1
State transitions by register access
TIN pin: Input disabled
TOT pin: General-purpose port
Counter: Retains the value while
counting stopped.
Value undefined after reset.
CNTE=0
CNTE=0
CNTE=1
TRG=1
CNTE=1
TRG=0
WAIT
CNTE=1, WAIT=1
RUN
TIN pin: Only trigger input enabled
TOT pin: Initial value output
TIN pin: Functions as TIN pin
TOT pin: Functions as TOT pin
RELD ∗ UF
Counter: Retains the value while
counting stopped.
Value undefined after reset until
load.
Counter: Running
TRG=1
LOAD
TRG=1
CNTE=1, WAIT=0
Load contents of the reload
register to the counter.
254
CNTE=1, WAIT=0
RELD
UF
Load complete
CHAPTER 15
WATCH TIMER
This chapter explains the functions and operations of
the watch timer.
15.1 Outline of Watch Timer
15.2 Watch Timer Control Register (WTC)
15.3 Watch Timer Operation
255
CHAPTER 15 WATCH TIMER
15.1
Outline of Watch Timer
The watch timer consists of a 15-bit timer and a circuit that controls an interval
interrupt. The watch timer uses subclock signals regardless of the MCS bit and SCS bit
of the clock selection register (CKSCR).
■ Watch Timer Register
Figure 15.1-1 Watch Timer Control Register (WTC)
Watch timer control register
7
6
5
4
3
2
1
WDCS SCE
WTIE WTOF
Read/write
(R/W)
(R)
(R/W) (R/W) (R/W) (R/W) (R/W) (R/W)
Initial value
(1)
(X)
Address: 0000AAH
(0)
(0)
Bit No.
0
WTR WTC2 WTC1 WTC0
(1)
(0)
(0)
WTC
(0)
■ Block Diagram of Watch Timer
Figure 15.1-2 Block Diagram of Watch Timer
Watchdog timer
Watch timer counter
SCLK
x21 x2 2 x2 3 x2 4 x2 5 x2 6 x2 7 x2 8 x2 9 x210 x211 x212 x213 x214 x215
OF OF OF
OF
Power-on reset
Transition to hardware standby
Transition to stop mode
OF
Counter clear
circuit
OF
OF
OF
Subclock
oscillation stabilization wait time
Interval timer
selector
Watch timer interrupt
OF : Overflow
SCLK : Subclock
256
WDCS SCE WTIE WTOF WTR WTC2 WTC1 WTC0
Watch timer control register (WTC)
CHAPTER 15 WATCH TIMER
15.2
Watch Timer Control Register (WTC)
The watch timer control register (WTC) controls the operation of the watch timer and
the interval interrupt time.
■ Watch Timer Control Register (WTC)
Figure 15.2-1 Watch Timer Control Register (WTC)
Watch timer control register
7
6
5
4
3
2
1
0
WDCS SCE
WTIE WTOF WTR WTC2 WTC1 WTC0
Read/write
(R/W)
(R)
(R/W) (R/W) (R/W) (R/W) (R/W) (R/W)
Initial value
(1)
(X)
Address: 0000AAH
(0)
(0)
(1)
(0)
(0)
Bit No.
WTC
(0)
[bit7] WDCS
The WDCS bit is used to specify whether the clock signals from the watch timer or timebase timer is
used as the input clock of the watch-dog timer when the main clock or PLL clock is selected as the
machine clock. When WDCS=0, the clock signal from the watch timer is selected. When WDCS=1, the
clock signal from the timebase timer is selected. Write "0" to this bit when switching to the sub-clock
mode.
This bit is initialized to 1 by reset.
Note:
If WDCS is set to 1, the watch-dog timer counter may be incremented because the timebase timer
output and watch timer output are asynchronous. If WDCS is set to 1, the watch-dog timer must be
cleared before and after the WDCS bit is changed.
[bit6] SCE
The SCE bit indicates that the subclock oscillation stabilization wait time has elapsed. When this bit is
0, the oscillation stabilization is currently in progress. The oscillation stabilization time is fixed at 214
cycles (subclock). This bit is initialized to 0 by a power-on reset and stop.
[bit5] WTIE
The WTIE bit enables an interval interrupt by the watch timer. When this bit is 1, the interrupt is
enabled. When this bit is 0, the interrupt is disabled. This bit is initialized to 0 by a reset. This bit can be
read and written to.
[bit4] WTOF
The WTOF bit is the watch timer interrupt flag. When the WTIE bit is 1 and WTOF is set to 1, an
interrupt request is issued. This bit is set to 1 at each interval specified by the WTC1 and WTC0 bits.
This bit is cleared by writing 0, transition to stop mode or a reset. Writing 1 has no effect.
During read operation using a read-modify-write instruction, 1 is always read from this bit.
257
CHAPTER 15 WATCH TIMER
[bit3] WTR
The WTR bit clears all bits of the watch timer counter to 0. Writing 0 to this bit clears the timer counter.
Writing 1 has no effect. The value read from this bit is always 1.
[bit2, bit1, bit0] WTC2, WTC1, WTC0
The WTC2, WTC1, and WTC0 bits set the watch timer interval. Table 15.2-1 lists the settings for the
interval. These bits are initialized to 000 by a reset. These bits can be read and written to.
When data is written to these bits, bit4 (WTOF) should be cleared at the same time.
Table 15.2-1 Settings for the Watch Timer Interval
WTC2
WTC1
WTC0
Interval (when SCLK*=8.192kHz)
0
0
0
28 / SCLK (31.25 ms)
0
0
1
29 / SCLK (62.5 ms)
0
1
0
210 / SCLK (125 ms)
0
1
1
211 / SCLK (250 ms)
1
0
0
212 / SCLK (500 ms)
1
0
1
213 / SCLK (1.000 s)
1
1
0
214 / SCLK (2.000 s)
1
1
1
215 / SCLK (4.000 s)
*: SCLK is Sub Clock, whose frequency is the oscillation clock frequency divided by 2 or 4.
The subclock division ratio is determined by SCDS bit of PLL/Subclock Control Register (PSCCR).
258
CHAPTER 15 WATCH TIMER
15.3
Watch Timer Operation
The watch timer functions as a watch-dog counter clock source, timer for waiting for
the subclock oscillation to stabilize, and interval timer for generating interrupts at
specified intervals.
■ Watch Timer
The watch timer consists of a 15-bit counter that counts clock pulses originated from the subclock. As long
as the subclock is input, the watch timer keeps counting. The watch timer is cleared by a power-on reset,
transition to stop mode or writing 0 to the WTR bit of the watch timer control register (WTC).
Notes:
• Clearing the clock counter affects the watchdog counter and interval interrupts that use watch
timer output.
• To clear the watch timer by writing "0" to the WTR bit in the watch timer control register (WTC),
set the WTIE bit to "0" and set the watch timer to interrupt inhibited state. Before permitting an
interrupt, clear the interrupt request issued by writing "0" to the WTOF flag.
■ Interval Interrupt Function of Watch Timer
The interval interrupt function generates interrupts at specified intervals according to the carry signals of
the timer counter. The WTOF flag is set at the intervals specified by the WTC1 and WTC0 bits of the
watch timer control register (WTC). This flag is set with reference to the last time when the watch timer
was cleared.
On transition to stop, the watch timer is used as a timer for subclock oscillation to stabilize upon recovery,
and the WTOF flag is immediately cleared upon mode transition.
■ Setting Operation Clock of Watch-dog Timer
The watch-dog clock select bit (WDCS) in the watch timer control register (WTC) can be used to set the
clock input source of the watch-dog timer.
When using the subclock as the machine clock, always set the WDCS bit to "0" and select the output of the
watch timer.
259
CHAPTER 15 WATCH TIMER
260
CHAPTER 16
8/16-BIT PPG
This chapter explains the 8/16-bit PPG and explains its
functions.
16.1 Outline of 8/16-bit PPG
16.2 Block Diagram of 8/16-bit PPG
16.3 8/16-bit PPG Registers
16.4 Operations of 8/16-bit PPG
16.5 Selecting a Count Clock for 8/16-bit PPG
16.6 Controlling Pin Output of 8/16-bit PPG Pulses
16.7 8/16-bit PPG Interrupts
16.8 Initial Values of 8/16-bit PPG Hardware
261
CHAPTER 16 8/16-BIT PPG
16.1
Outline of 8/16-bit PPG
The 8/16-bit Programmable Pulse Generator (PPG) consists of two eight-bit down
counters, four eight-bit reload registers, one 16-bit control register, two external pulse
output signals, and two interrupt outputs. The following functions are implemented:
■ Function of 8/16-bit PPG
● 8-bit PPG output, 2-channel independent operation mode:
Two independent channels of PPG output operation are implemented.
● 16-bit PPG output operation mode:
One channel of 16-bit PPG output operation is implemented.
● 8+8-bit PPG output operation mode:
8-bit PPG output operation is implemented at specifies intervals, using channel 0 output as channel 1 clock
input.
● PPG output operation:
Pulse waves are output at specified intervals and duty ratio. With an external circuit, this module can be
used as a D/A converter.
The MB90860A Series contains eight PPG’s. The following sections only describe the functionality of the
PPG 0/PPG 1. The remaining PPG’s have the identical function and the register addresses should be found
in the I/O map.
Figure 16.1-1 shows the connection of internal PPG modules and external pins.
262
CHAPTER 16 8/16-BIT PPG
Figure 16.1-1 Relationship between PPG Modules and External Pins
PPG0 / PPG1
PPG2 / PPG3
Internal
Modules
PPG4 / PPG5
PPG6 / PPG7
PPG8 / PPG9
PPGA / PPGB
PPGC / PPGD
PPGE / PPGF
PPG0
PPG1
PPG2
PPG3
PPG4
PPG5
PPG6
PPG7
PPG8
PPG9
External
Pins
PPGA
PPGB
PPGC
PPGD
PPGE
PPGF
263
CHAPTER 16 8/16-BIT PPG
16.2
Block Diagram of 8/16-bit PPG
Figure 16.2-1 shows a block diagram of the 8/16-bit PPG (ch0). Figure 16.2-2 shows a
block diagram of the 8/16-bit PPG (ch1).
■ Block Diagram of 8/16-bit PPG
Figure 16.2-1 8-bit PPG ch0 Block Diagram
PPG0 output enable
PPG0
Peripheral clock 16-division
Peripheral clock 8-division
Peripheral clock 4-division
Peripheral clock 2-division
Peripheral clock
PPG0
Output latch
Invert
Clear
PEN0
In MB90340 series, this IRQ signal merged
with the Channel1 IRQ signal by OR logic.
Count clock
selection
Timebase counter output,
512-division of main clock
L/H selection
S
RQ
PCNT
(down counter)
IRQ
Reload
ch1-borrow
L/H selector
PRLL0
PRLBH0
Temporary buffer
PIE0
PRLH0
PUF0
L data bus
H data bus
PPGC0
(Operation mode control)
264
CHAPTER 16 8/16-BIT PPG
Figure 16.2-2 8-bit PPG ch1 Block Diagram
PPG1 output enable
PPG1
Peripheral clock 16-division
Peripheral clock 8-division
Peripheral clock 4-division
Peripheral clock 2-division
Peripheral clock
PPG1
Output latch
Invert
Count clock
selection
Clear
PEN1
S
RQ
PCNT
(down counter)
ch0-borrow
Timebase counter output,
512-division of main clock
L/H selection
In MB90340 series, this IRQ signal merged
with the Channel0 IRQ signal by OR logic.
IRQ
Reload
L/H selector
PRLL1
PRLBH1
Temporary buffer
PIE1
PRLH1
PUF1
L data bus
H data bus
PPGC1
(Operation mode control)
265
CHAPTER 16 8/16-BIT PPG
16.3
8/16-bit PPG Registers
The 8/16-bit PPG has the following five types of registers:
• PPGC0 (2, 4, 6, 8, A, C, E) Operation Mode Control Register
• PPGC1 (3, 5, 7, 9, B, D, F) Operation Mode Control Register
• PPG01 (23, 45, 67, 89, AB CD, EF) Clock Select Register
• Reload register H
• Reload register L
■ 8/16-bit PPG Registers
Figure 16.3-1 8/16-bit PPG Register
PPGn Operation Mode Control Register
Address: ch0 000030 H
7
6
5
4
3
2
1
0
ch2 000034 H
Reserved
ch4 000038 H
PEN0
PIE0 PUF0
PE0
ch6 00003C H
ch8 000040 H
(R/W)
(-)
(R/W) (R/W) (R/W)
(-)
(-)
(W)
chA 000044 H
(0)
(0)
(0)
(0)
(X)
(X)
(1)
(X)
chC 000048 H
chE 00004C H
PPGm Operation Mode Control Register
Address: ch1 000031 H
14
13
12
11
10
9
8
15
ch3 000035 H
ch5 000039 H
PEN1
PIE1 PUF1 MD1
MD0 Reserved
PE1
ch7 00003DH
ch9 000041 H
(R/W)
(-)
(R/W) (R/W) (R/W) (R/W) (R/W)
(W)
chB 000045 H
(0)
(X)
(0)
(0)
(0)
(0)
(0)
(1)
chD 000049 H
chF 00004D H
PPGnm Clock Select Register
Address: ch01 000032 H
ch23 000036 H
ch45 00003A H
ch67 00003E H
ch89 000042 H
chAB 000046 H
chCD 00004A H
chEF 00004E H
Reload register H
Address: ch0 007901 H
ch1 007903 H
ch2 007905 H
ch3 007907 H
ch4 007909 H
ch5 00790B H
ch6 00790D H
ch7 00790F H
ch8 007911 H
ch9 007913 H
chA 007915 H
chB 007917 H
chC 007919 H
chD 00791B H
chE 00791D H
chF 00791F H
Reload register L
Address: ch0 007900 H
ch1 007902 H
ch2 007904 H
ch3 007906 H
ch4 007908 H
ch5 00790A H
ch6 00790C H
ch7 00790E H
ch8 007910 H
ch9 007912 H
chA 007914 H
chB 007916 H
chC 007918 H
chD 00791A H
chE 00791C H
chF 00791E H
266
7
6
5
4
3
2
1
15
(R/W)
(0)
14
(R/W)
(0)
13
(R/W)
(0)
12
(R/W)
(0)
11
REV
9
10
PPGnm
(R/W)
(0)
(-)
(X)
(R/W)
(0)
PPGCm
0
PCS2 PCS1 PCS0 PCM2 PCM1 PCM0
(R/W)
(0)
PPGCn
8
PRLHn
PRLHm
(R/W)
(X)
(R/W)
(X)
7
(R/W)
(X)
6
(R/W)
(X)
5
(R/W)
(X)
4
(R/W)
(X)
3
(R/W)
(X)
2
(R/W)
(X)
1
0
PRLLn
PRLLm
(R/W)
(X)
(R/W)
(X)
(R/W)
(X)
(R/W)
(X)
(R/W)
(X)
(R/W)
(X)
(R/W)
(X)
(R/W)
(X)
n = 0, 2, 4, 6, 8, A, C, E
m = 1, 3, 5, 7, 9, B, D, F
CHAPTER 16 8/16-BIT PPG
16.3.1
PPG0 Operation Mode Control Register (PPGC0)
PPGC0 is a five-bit control register that selects the operation mode of the block,
controls pin outputs, selects count clock, and controls triggers.
■ PPG0 Operation Mode Control Register (PPGC0)
Figure 16.3-2 Configuration of the PPG0 Operation Mode Control Register
PPG0 operation mode control register
Address: ch0;000030H
7
PEN0
Read/write
Initial value
(R/W)
(0)
Bit No.
6
5
4
3
2
1
0
-
PE0
PIE0
PUF0
-
-
Reserved
(-)
(X)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(-)
(X)
(-)
(X)
PPGC0
(W)
(1)
bit 0
Other ch.:
ch2 ; 000034H
ch4 ; 000038H
ch6 ; 00003CH
ch8 ; 000040H
chA ; 000044H
chC ; 000048H
chE ; 00004CH
Reserved
1
When setting PPGC0, always set this bit to 1.
bit 3
PUF0
0
1
PPG underflow flag
PPG counter underflow is not detected.
PPG counter underflow is detected.
bit 4
PIE0
0
1
PPG interrupt enable
Interrupt disabled.
Interrupt enabled.
bit 5
PE0
0
1
bit 7
PEN0
R/W
X
-
: Readable and writable
: Undefined value
: Undefined
0
1
PPG output enable 0
Pulse output disabled (general-purpose port).
Pulse output enabled.
PPG enable
Stop ( "L" level output maintained).
PPG operation enabled.
: Initial value
267
CHAPTER 16 8/16-BIT PPG
Table 16.3-1 Bit Function Description of the PPG0 Operation Mode Control Register
Bit name
Function
bit7
PEN0:
Operation enable bit
When set to "1", this bit enables the counter operation of the PPG. When operation is
disabled but output is enabled (bit5), a low level is maintained at the output.
bit5
PE0:
PPG0 pin output
enable bit
When set to "1", this bit enables the pulse output. For MB90860A Series, the pulse signal
is output to the "PPG0" external pin. When disabled, the pin can be used as generalpurpose port.
bit4
PIE0:
PPG interrupt enable
bit
While this bit is "1", an interrupt request is issued as soon as PUF0 is set to "1". No
interrupt request is issued while this bit is set to "0".
bit3
PUF0:
PPG counter
underflow bit
In 8-bit PPG 2-channel mode or 8-bit prescaler + 8-bit PPG mode, this bit is set to "1"
when an underflow occurs as a result of the ch0 counter value becoming from 00H to FFH.
In 16-bit PPG mode, this bit is set to "1" when an underflow occurs as a result of the
Channel 0 and 1 counter value becoming from 0000H to FFFFH. To set this bit to "0",
write "0". Writing "1" to this bit has not effect. Upon a read operation during a readmodify-write instruction, "1" is read.
bit0
Reserved bit.
This is a reserved bit. When setting PPGC0, always set this bit to 1.
268
CHAPTER 16 8/16-BIT PPG
16.3.2
PPG1 Operation Mode Control Register (PPGC1)
PPGC1 is a seven-bit control register that selects the operation mode of the block,
controls pin outputs, selects count clock, and controls triggers.
■ PPG1 Operation Mode Control Register (PPGC1)
Figure 16.3-3 Configuration of the PPG1 Operation Mode Control Register
PPG1 operation mode control register
Address: ch0;000031H
15
14
13
12
11
10
9
8
-
PE1
PIE1
PUF1
MD1
MD0
Reserved
(-)
(X)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
PEN1
Read/write
Initial value
(R/W)
(0)
Bit No.
PPGC1
(W)
(1)
bit 8
Other ch.:
ch3 ; 000035H
ch5 ; 000039H
ch7 ; 00003DH
ch9 ; 000041H
chB ; 000045H
chD ; 000049H
chF ; 00004DH
Reserved
1
bit 10
MD1
0
0
1
1
When setting PPGC1, always set this bit to 1.
bit 9
MD0
0
1
0
1
PPG count mode
8-bit PPG 2ch independent mode
8-bit prescaler + 8-bit PPG 1ch mode
Reserved
16-bit PPG 1ch mode
bit 11
PUF0
0
1
PPG underflow flag
PPG counter underflow is not detected.
PPG counter underflow is detected.
bit 12
PIE1
0
1
PPG interrupt enable
Interrupt disabled.
Interrupt enabled.
bit 13
PE1
0
1
bit 15
PEN1
R/W
X
-
: Readable and writable
: Undefined value
: Undefined
0
1
PPG output enable 1
Pulse output disabled (general-purpose port).
Pulse output enabled.
PPG enable
Stop ( "L" level output maintained).
PPG operation enabled.
: Initial value
269
CHAPTER 16 8/16-BIT PPG
Table 16.3-2 Bit Function Description of the PPG1 Operation Mode Control Register
Bit name
Function
bit15
PEN1:
Operation enable bit
When set to "1", this bit enables the counter operation of the PPG. When operation
is disabled but output is enabled (bit13), a low level is maintained at the output.
bit13
PE1:
PPG1 pin output
enable bit
When set to "1", this bit enables the pulse output. For MB90860A Series, the pulse
signal is output to the "PPG1" external pin. When disabled, the pin can be used as
general-purpose port.
bit12
PIE1:
PPG interrupt enable
bit
While this bit is "1", an interrupt request is issued as soon as PUF1 is set to "1". No
interrupt request is issued while this bit is set to "0".
bit11
PUF1:
PPG counter
underflow bit
In 8-bit PPG 2-channel mode or 8-bit prescaler + 8-bit PPG mode, this bit is set to
"1" when an underflow occurs as a result of the ch1 counter value becoming from
00H to FFH. In 16-bit PPG mode, this bit is set to "1" when an underflow occurs as a
result of the Channel 0 and 1 counter value becoming from 0000H to FFFFH. To set
this bit to "0", write "0". Writing "1" to this bit has not effect. Upon a read operation
during a read-modify-write instruction, "1" is read.
bit10, bit9
MD1, MD0:
PPG count mode
These bits select the PPG timer operation mode as described in Figure 16.3-3. Do
not set "10" in these bits.
To write "01" to these bits, ensure that "01" is not written to the PEN0 bit of PPGC0
or PEN1 bit of PPGC1. Write "11" or "00" in both the PEN0 and PEN1 bits
simultaneously.
To write "11" to these bits, update PPGC0 and PPGC1 by word transfer and write
"11" or "00" to both the PEN0 and PEN1 bits simultaneously.
bit8
Reserved bit.
This is a reserved bit. When setting PPGC1, always write "1" to this bit.
270
CHAPTER 16 8/16-BIT PPG
16.3.3
PPG0/PPG1 Clock Select Register (PPG01)
The PPG0/PPG1 Clock Select Register (PPG01) is an 8-bit control register that controls
the counter clock of the 8/16-bit PPG.
■ PPG0/PPG1 Clock Select Register (PPG01)
Figure 16.3-4 Configuration of the PPG0/PPG1 Clock Select Register (PPG01)
PPG0/PPG1 Clock Select Registers
Address:
7
ch01 000032 H
6
5
4
3
2
PCS2 PCS1 PCS0 PCM2 PCM1 PCM0
Other ch.:
(R/W) (R/W) (R/W) (R/W) (R/W) (R/W)
ch23 000036 H
ch45 00003A H
ch67 00003E H
ch89 000042 H
chAB 000046 H
chCD 00004A H
chEF 00004E H
R/W
:
Readable and writable
X
:
Undefined value
-
:
Undefined
:
Initial value
PPG01
1
0
-
REV
(X)
(R/W)
Initial value
000000X0
bit 0
PPG output Ch0/Ch1 swap bit
REV
0
Default outputs pin is used
1
Output pins are swapped
bit 4
bit 3
bit 2
PCM2
PCM1
PCM0
0
0
0
Peripheral Clock
0
0
1
Peripheral Clock/2
0
1
0
Peripheral Clock/4
0
1
1
Peripheral Clock/8
1
0
0
Peripheral Clock/16
1
1
1
Clock input from timebase timer
Count clock selection bit (ch0)
bit 7
bit 6
bit 5
PCS2
PCS1
PCS0
0
0
0
Peripheral Clock
0
0
1
Peripheral Clock/2
0
1
0
Peripheral Clock/4
0
1
1
Peripheral Clock/8
1
0
0
Peripheral Clock/16
1
1
1
Clock input from timebase timer
Count clock selection bit (ch1)
271
CHAPTER 16 8/16-BIT PPG
Table 16.3-3 Bit Function Description of the Clock Select Register (PPG01)
Bit name
bit7 to bit5
bit4 to bit2
bit0
272
PCS2 to PCS0:
Count clock selection
bit
PCM2 to PCM0:
Count clock selection
bit
REV:
PPG output ch0/ch1
swap bit
Function
These bits select the operation clock for the down counter of Channel 1 as described
below.
Note:
In 8-bit prescaler + 8-bit PPG mode or in 16-bit PPG mode, ch1 PPG operates in
response to a counter clock from ch0. Therefore, the setting in these bits has no
effect.
Operation mode
PCS2
PCS1
PCS0
0
0
0
Peripheral Clock (62.5 ns machine clock, 16 MHz)
0
0
1
Peripheral Clock/2 (125 ns machine clock, 16 MHz)
0
1
0
Peripheral Clock/4 (250 ns machine clock, 16 MHz)
0
1
1
Peripheral Clock/8 (500 ns machine clock, 16 MHz)
1
0
0
Peripheral Clock/16 (1 µs machine clock, 16 MHz)
1
0
1
Clock input from the timebase timer (128 µs, 4 MHz
source oscillation)
These bits select the operation clock for the down counter of Channel 0 as described
below.
Operation mode
PCM2
PCM1
PCM0
0
0
0
Peripheral Clock (62.5 ns machine clock, 16 MHz)
0
0
1
Peripheral Clock/2 (125 ns machine clock, 16 MHz)
0
1
0
Peripheral Clock/4 (250 ns machine clock, 16 MHz)
0
1
1
Peripheral Clock/8 (500 ns machine clock, 16 MHz)
1
0
0
Peripheral Clock/16 (1 µs machine clock, 16 MHz)
1
0
1
Clock input from the timebase timer (128 µs, 4 MHz
source oscillation)
Set this bit to "1", swap PPG channel1 output pin and PPG channel0 output pin.
Set this bit to "0"(default value), both PPG channel0 and channel1 signals output
from default output pins.
CHAPTER 16 8/16-BIT PPG
16.3.4
Reload Register (PRLL/PRLH)
The reload registers (PRLL and PRLH) are 8-bit registers that store reload values for the
PCNT down counters. The PRLL and PRLH registers are readable and writable.
■ Reload Register (PRLL/PRLH)
Figure 16.3-5 Reload Register (PRLL/PRLH)
Reload register H
Address: ch0: 007901H
ch1: 007903 H
ch2: 007905 H
ch3: 007907 H
ch4: 007909 H
ch5: 00790B H
ch6: 00790D H
ch7: 00790F H
ch8: 007911 H
ch9: 007913 H
chA: 007915 H
chB: 007917 H
chC: 007919H
chD: 00791BH
chE: 00791DH
chF: 00791F H
Reload register L
Address: ch0: 007900H
ch1: 007902 H
ch2: 007904 H
ch3: 007906 H
ch4: 007908 H
ch5: 00790A H
ch6: 00790C H
ch7: 00790E H
ch8: 007910 H
ch9: 007912 H
chA: 007914 H
chB: 007916 H
chC: 007918 H
chD: 00791A H
chE: 00791CH
chF: 00791E H
15
14
13
12
11
10
9
8
PRLHn
(R/W) (R/W) (R/W) (R/W) (R/W)
(X)
(X)
(X)
(X)
(X)
7
6
5
4
3
(R/W) (R/W)
(X)
(X)
2
1
(R/W)
(X)
0
PRLLn
(R/W)
(X)
(R/W) (R/W) (R/W) (R/W)
(X)
(X)
(X)
(X)
(R/W) (R/W)
(X)
(X)
(R/W)
(X)
n = 0, 1, ... , E, F
Table 16.3-4 Register Function of the Reload Registers
Register name
Function
PRLLn
Holds the L side reload value.
PRLHn
Holds the H side reload value.
Note:
In 8-bit prescaler + 8-bit PPG mode, different values in PRLL and PRLH of Channel 0 may cause the
PPG waveform of ch1 to vary in each cycle. Write the same value to PRLL and PRLH of ch0.
273
CHAPTER 16 8/16-BIT PPG
16.4
Operations of 8/16-bit PPG
One 8/16-bit PPG consists of two channels of 8-bit PPG units. These two channels can
be used in three modes: independent two-channel mode, 8-bit prescaler + 8-bit PPG
mode, and single-channel 16-bit PPG mode.
■ Operations of 8/16-bit PPG
Each of the 8-bit PPG units has two eight-bit reload registers. One reload register is for the L pulse width
(PRLL) and the other is for the H pulse width (PRLH). The values stored in these registers are reloaded
into the 8-bit down counter (PCNT), from the PRLL and PRLH in turn. The pin output value is inverted
upon a reload caused by counter borrow. This operation results in the pulses of the specified L pulse width
and H pulse width.
Table 16.4-1 lists the relationship between the reload operation and pulse outputs.
Table 16.4-1 Reload Operation and Pulse Output
Reload operation
Pin output change
PRLH → PCNT
PPG0/PPG1
[0 → 1]
Rise
PRLL → PCNT
PPG0/PPG1
[1 → 0]
Fall
When 1 is set in bit4 (PIE0) of PPGC0 or in bit12 (PIE1) of PPGC1, an interrupt request is output upon a
borrow from 00 to FF (from 0000 to FFFF in 16-bit PPG mode) of each counter.
■ Operation Modes of 8/16-bit PPG
This block can be used in three modes: independent two-channel mode, 8-bit prescaler + 8-bit PPG mode,
and single-channel 16-bit PPG mode.
● Independent two-channel mode
The two channels of 8-bit PPG units operate independently. The PPG0 pin is connected to the ch0 PPG
output, while the PPG1 pin is connected to the ch1 PPG output.
● 8-bit prescaler + 8-bit PPG mode
ch0 is used as an 8-bit prescaler while the count in ch1 is based on borrow outputs from ch0. Thus, 8-bit
PPG waveforms can be output with arbitrary length of cycle time. The PPG0 pin is connected to the ch0
prescaler output, while the PPG1 pin is connected to the ch1 PPG output.
● 16-bit PPG 1ch mode
ch0 and ch1 are connected and used as a single 16-bit PPG. The PPG0 and PPG1 pins are connected to the
16-bit PPG output.
274
CHAPTER 16 8/16-BIT PPG
■ 8/16-bit PPG Output Operation
In this block, the ch0 PPG is activated to start counting when "1" is written to bit7 (PEN0) of the PPGC0
(PWM operation mode control) register. Similarly, the ch1 PPG is activated to start counting when "1" is
written to bit15 (PEN1) of the PPGC1 register. Once the operation has started, counting is terminated by
writing "0" to bit7 (PEN0) of PPGC0 or in bit15 (PEN1) of PPGC1. Once the counting is terminated, the
output is maintained at the L level.
In 8-bit prescaler + 8-bit PPG mode, do not set ch1 to be in operation while ch0 operation is stopped.
In 16-bit PPG mode, ensure that bit7 (PEN0) of PPGC0 register and bit15 (PEN1) of PPGC1 register are
started or stopped simultaneously. The figure below is a diagram of PPG output operation. During PPG
operation, a pulse wave is continuously output at a frequency and duty ratio (the ratio of the H-level period
of the pulse wave to the L-level period). PPG continues operation until stop is specified explicitly.
Figure 16.4-1 PPG Output Operation, Output Waveform
PEN
Starts operation based on PEN (from Lside).
Output pin
PPG
T
(L+1)
T
L : PRLL value
H : PRLH value
(H+1)
T : Input from peripheral clock ( , /4, /16)
or timer base counter (depending on the
(Start)
clock selection by PPG01)
■ Relationship between 8/16-bit PPG Reload Value and Pulse Width
The width of the output pulse is determined by adding 1 to the reload register value and multiplying it by
the count clock cycle. Note that when the reload register value is 00H during 8-bit PPG operation or 0000H
during 16-bit PPG operation, the pulse width is equivalent to one count clock cycle. In addition, note that
when the reload register value is FFH during 8-PPG operation, the pulse width is equivalent to 256 count
clock cycles. When the reload register value is FFFFH during 16-bit PPG operation, the pulse width is
equivalent to 65536 count clock cycles.
P1=T
Ph=T
(L+1)
(H+1)
L
: PRLL value
H
: PRLH value
T : Input clock cycle
Ph : High pulse width
Pl : Low pulse width
275
CHAPTER 16 8/16-BIT PPG
16.5
Selecting a Count Clock for 8/16-bit PPG
The count clock used for the operation is supplied from the peripheral clock or the
timebase timer. The count clock can be selected from six choices.
■ Selecting a Count Clock for 8/16-bit PPG
Select ch0 clock at bit4 to bit2 (PCM2 to PCM0) of the PPG01 register, and ch1 clock at bit7 to bit5 (PCS2
to PCS0) of the PPG01 register.
The clock is selected from a peripheral clock 1/16 to 1 times higher than a machine clock or an input clock
from the timebase timer.
In 8-bit prescaler + 8-bit PPG mode or 16-bit PPG mode, however, the setting in the PCS2 to PCS0 has no
effect.
When the timebase timer input is used, the first count cycle after a trigger or a stop may be shifted. The
cycle may also be shifted if the timebase counter is cleared during operation of this module.
In 8-bit prescaler + 8-bit PPG mode, if ch1 is activated while ch0 is in operation, the first count cycle may
be shifted.
276
CHAPTER 16 8/16-BIT PPG
16.6
Controlling Pin Output of 8/16-bit PPG Pulses
The pulses generated by this module can be output from external pins PPG0 and PPG1.
■ Controlling Pin Output of 8/16-bit PPG Pulses
To output the pulses from an external pin, write "1" to the bit corresponding to each pin (PPGC0: PE0,
PPGC1: PE1). When "0" is written to these bits (default), the pulses are not output from the corresponding
external pins; the pins work as general-purpose ports.
In 16-bit PPG mode, the same waveform is output from PPG0 and PPG1. Thus, the same output can be
obtained by enabling both external pin.
In 8-bit prescaler + 8-bit PPG mode, the 8-bit prescaler square waveform is output from PPG0, while the 8bit PPG waveform is output from PPG1. Figure 16.6-1 is a diagram of output waveforms in this mode.
Figure 16.6-1 8+8 PPG Output Operation Waveform
Ph0
Pl0
PPG0
PPG1
Ph1
Pl0 = T
Pl1
(L0+1)
Ph0 = T
(L0+1)
Pl1 = T
(L0+1)
(Ll+1)
Ph1 = T
(L0+1)
(Hl+1)
L0 :
ch0 PRLL value and ch0 PRLH value
L1 :
ch1 PRLL value
H1 :
ch1 PRLH value
T :
Ph0 :
Pl0 :
Input clock cycle
PPG0 high pulse widt h
PPG0 low pulse widt h
Ph1 :
Pl1 :
PPG1 high pulse widt h
PPG1 low pulse widt h
Note:
Set the same value in ch0 PRLL and ch0 PRLH.
Note:
Set the same value in ch0 PRLL and ch0 PRLH.
277
CHAPTER 16 8/16-BIT PPG
16.7
8/16-bit PPG Interrupts
For the 8/16-bit PPG, an interrupt becomes active when the reload value counts out and
a borrow occurs.
■ 8/16-bit PPG Interrupts
In 8-bit PPG 2ch mode or 8-bit prescaler + 8-bit PPG mode, an interrupt is requested by a borrow in each
counter. In 16-bit PPG mode, PUF0 and PUF1 are simultaneously set by a borrow in the 16-bit counter.
Therefore, enable only PIE0 or PIE1 to unify the interrupt causes. In addition, simultaneously clear the
interrupt flags for PUF0 and PUF1.
278
CHAPTER 16 8/16-BIT PPG
16.8
Initial Values of 8/16-bit PPG Hardware
The hardware components of this block are initialized to the following values when
reset:
■ Initial Values of 8/16-bit PPG Hardware
● Registers
•
PPGC0 → 0X000XX1B
•
PPGC1 → 0X000001B
•
PPG01 → 000000X0B
● Pulse outputs
•
PPG0 → "L"
•
PPG1 → "L"
•
PE0
→
PPG0 output disabled
•
PE1
→
PPG1 output disabled
● Interrupt requests
•
IRQ0 → "L"
•
IRQ1 → "L"
Hardware components other than the above are not initialized.
Note:
In a mode other than 16-bit PPG mode, it is recommended to use a word transfer instruction to write
data in reload registers PRLL and PRLH. If two byte transfer instructions are used to write a data
item to these registers, a pulse of unexpected cycle time may be output depending on the timing.
Figure 16.8-1 Write Timing for 8/16-bit PPG Reload Registers (PRLL and PRLH)
PPG0
B
A
B
A
C
B
C
C
D
D
279
CHAPTER 16 8/16-BIT PPG
Assume that PRLL is updated from A to C before point 1 in the time chart above, and PRLH is updated
from B to D after point 1. Since the PRL values at point 1 are PRLL=C and PRLH=B, a pulse of L side
count value C and H side count value B is output only once.
Similarly, to write data in PRL of ch0 and ch1 in 16-bit PPG mode, use a long word transfer instruction, or
use word transfer instructions in the order of ch0 and then ch1. In this mode, the data is only temporarily
written to ch0 PRL. Then, the data is actually written into ch0 PRL when the ch1 PRL is written to.
In a mode other than 16-bit PPG mode, ch0 and ch1 PRL are written independently.
Figure 16.8-2 PRL Write Operation Block Diagram
ch0 PRL write data
ch1 PRL write data
Transferred in synchronization
with ch1 write in 16-bit
Temporary latch
PPG mode
ch0 write in a mode other
than 16-bit PPG mode
ch1 write
ch0 PRL
280
ch1 PRL
CHAPTER 17
DTP/EXTERNAL
INTERRUPTS
This chapter explains the functions and operations of
the DTP/external interrupts.
17.1 Outline of DTP/External Interrupts
17.2 DTP/External Interrupt Registers
17.3 Operations of DTP/External Interrupts
17.4 Switching between External Interrupt and DTP Requests
17.5 Notes on Using DTP/External Interrupt functions
281
CHAPTER 17 DTP/EXTERNAL INTERRUPTS
17.1
Outline of DTP/External Interrupts
The data transfer peripheral (DTP) is located between an external peripheral and the
F2MC-16LX CPU. The DTP receives a DMA request or interrupt request from the external
peripheral, transfers the request to the F2MC-16LX CPU to activate the intelligent I/O
service or interrupt processing.
■ Outline of DTP/external Interrupts
For the intelligent I/O service, "H" and "L" request levels are available. For an external interrupt request,
four request levels are available: "H", "L", rising edge, and falling edge.
■ Block Diagram of DTP/external Interrupts
Figure 17.1-1 Block Diagram of DTP/external Interrupts
8
8
8
16
282
Interrupt/DTP enable register
Gate
Cause F/F
Edge detection circuit
Interrupt/DTP cause register
Request level setting register
8
Request input
CHAPTER 17 DTP/EXTERNAL INTERRUPTS
■ DTP/External Interrupts Registers
ENIR0
bit
Address : 0000C6H
ENIR1
bit
Address : 0000CAH
EIRR0
bit
Address : 0000C7H
bit
EIRR1
Address : 0000CBH
ELVR0
bit
Address : 0000C8H
ELVR0
bit
Address : 0000C9H
ELVR1
bit
Address : 0000CCH
ELVR1
bit
Address : 0000CDH
EISSR
bit
7
6
5
4
3
2
1
0
Initial Value
EN7
EN6
EN5
EN4
EN3
EN2
EN1
EN0
00000000 B
7
6
5
4
3
EN15 EN14 EN13 EN12 EN11
15
ER7
15
2
1
0
EN10
EN9
EN8
9
8
14
13
12
11
10
ER6
ER5
ER4
ER3
ER2
14
13
12
11
ER15 ER14 ER13
ER12 ER11
10
ER10
ER0
9
8
ER9
ER8
7
6
5
4
3
1
0
LB3
LA3
LB2
LA2
LB1
LA1
LB0
LA0
15
14
13
12
11
10
9
8
LB7
LA7
LB6
LA6
LB5
LA5
LB4
LA4
7
6
5
4
3
2
1
0
LB11
LA11
LB10
LA10
LB9
LA9
LB8
LA8
15
14
13
12
11
10
9
8
LB14 LA14
LB13
LA13
LB15 LA15
7
6
5
4
3
2
ER1
2
Address : 0000CEH INT15R INT14R INT13R INT12R INT11R INT10R
LB12 LA12
1
00000000 B
XXXXXXXX B
XXXXXXXX B
00000000 B
00000000 B
00000000 B
00000000 B
0
INT9R INT8R
00000000 B
283
CHAPTER 17 DTP/EXTERNAL INTERRUPTS
17.2
DTP/External Interrupt Registers
The DTP/external interrupts has the following three types of registers:
• Interrupt/DTP enable register (ENIR: External interrupt request enable register)
• Interrupt/DTP flag (EIRR: External interrupt request register)
• Request level setting register (ELVR: External level register)
• External interrupt source select register (EISSR)
■ Interrupt/DTP Enable Register (ENIR: External Interrupt Request Enable Register)
Figure 17.2-1 External Interrupt Request Enable Register (ENIR)
7
EN7
6
EN6
5
EN5
4
EN4
3
EN3
2
EN2
1
EN1
0
EN0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
7
6
EN15 EN14
5
EN13
4
EN12
3
EN11
2
EN10
R/W
R/W
R/W : Readable and writable
R/W
R/W
R/W
R/W
ENIR0
Address : 0000C6 H
ENIR1
Address : 0000CA H
1
EN9
Initial value
00000000B
0
EN8
R/W
00000000B
R/W
The ENIR register contains the interrupt enable bits of the DTP/external interrupt module. When an ENx
bit is enabled, an interrupt request is signaled if the specified interrupt event is detected at the
corresponding pin. Writing "1" to these bits enables and writing "0" disables interrupt requests.
■ Interrupt/DTP Flags (EIRR: External Interrupt Request Register)
Figure 17.2-2 External Interrupt Request Register (EIRR)
EIRR
Address : 0000C7 H
EIRR
Address : 0000CB H
15
14
13
12
11
10
ER7
ER6
ER5
ER4
ER3
ER2
ER1
ER0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
15
14
13
12
11
10
9
8
ER13
ER12
ER11
ER10
ER9
ER8
R/W
R/W
R/W
R/W
R/W
R/W
ER15 ER14
R/W
R/W
R/W : Readable and writable
X : Undefined
9
8
Initial value
XXXXXXXX B
XXXXXXXXB
The EIRR register contains the interrupt flags.
If the specified interrupt event is detected at a pin, the corresponding ERx bit is set and if the ENx bit is
"1", then an interrupt request is signaled to the interrupt controller. Writing "1" to these bits has no effect
and writing "0" clears the flags. "1" is always read from these bits by the read-modify-write instructions.
Note:
When clearing the interrupt flag, make sure to clear the flag which caused the interrupt alone but not
others.
284
CHAPTER 17 DTP/EXTERNAL INTERRUPTS
■ Request Level Setting Register (ELVR: External Interrupt Level Register)
Figure 17.2-3 External Interrupt Level Register (ELVR)
7
ELVR0
Address : 0000C8 H
Address : 0000C9 H
ELVR1
Address : 0000CC H
Address : 0000CD H
6
5
4
3
2
1
0
Initial value
LB1
LA1
LB0
LA0
00000000B
LB3
LA3
LB2
LA2
R/W
R/W
R/W
R/W
R/W
R/W
15
14
13
12
11
10
9
8
LB7
LA7
LB6
LA6
LB5
LA5
LB4
LA4
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
7
6
5
4
3
2
1
0
LB11
LA11
LB10
LA10
LB9
LA9
LB8
LA8
R/W
15
R/W
14
R/W
13
R/W
12
R/W
11
R/W
R/W
R/W
10
9
8
LB15
LA15
LB14
LA14 LB13
LA13
LB12
LA12
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
00000000
B
00000000
B
00000000
B
R/W : Readable and writable
ELVR defines the request event at the external pin. Each pin is assigned with two bits as described in Table
17.2-1. If a request is detected by the input level, the interrupt flag is set as long as the input is at the
specified level even after the flag is reset by software.
Table 17.2-1 Interrupt Request Detection Factor for External Pins
LBx
LAx
Interrupt request detection factor
0
0
L level pin input
0
1
H level pin input
1
0
Rising edge pin input
1
1
Falling edge pin input
285
CHAPTER 17 DTP/EXTERNAL INTERRUPTS
■ External Interrupt Source Select Register
Figure 17.2-4 External Interrupt Source Select Register (EISSR)
7
EISSR
6
5
4
3
2
Address : 0000CE H INT15R INT14R INT13R INT12R INT11R INT10R
R/W
R/W
R/W
R/W
R/W
1
0
Initial value
INT9R INT8R 00000000B
R/W
R/W
R/W
R/W : Readable and writable
The 8 external interrupt inputs INT8 to INT15 can be relocated to different pins. The standard location of INT8
to INT15 is Port0 (External bus). some interrupt inputs are moved to other pins to use the interrupt function even
when the external bus is used.
The source for the interrupt function will be defined by this EISSR register according to the following table.
Table 17.2-2 The Selection of the Interrupt Function
286
EISSR bit
"0"
(Initial value)
"1"
INT8R
INT8:P00
INT8R:PA0
INT9R
INT9:P01
INT9R:P42(IN6)
INT10R
INT10:P02
INT10R:P32
INT11R
INT11:P03
INT11R:P12(SIN3)
INT12R
INT12:P04
INT12R:P80(TIN0/ADTG)
INT13R
INT13:P05
INT13R:P81(TOT0/CKOT)
INT14R
INT14:P06
INT14R:P82(SIN0/TIN2)
INT15R
INT15:P07
INT15R:P84(SCK0)
CHAPTER 17 DTP/EXTERNAL INTERRUPTS
17.3
Operations of DTP/External Interrupts
When the interrupt flag is set, this block signals an interrupt to the interrupt controller.
The interrupt controller judges the priority levels of the simultaneous interrupts, and
issues an interrupt request to the F2MC-16LX CPU if the interrupt from this block has
the highest priority. The F2MC-16LX CPU compares the ILM bits of its internal CCR
register and the interrupt request. If the interrupt level of the request is higher than that
indicated by the ILM bits, the F2MC-16LX CPU activates the hardware interrupt
processing microprogram as soon as the currently executing instruction is terminated.
■ External Interrupt Operation
In the hardware interrupt processing microprogram, the CPU reads the ISE bit information from the
interrupt controller, identifies that the request is for interrupt processing based on that information, and
branches to the interrupt processing microprogram. The interrupt processing microprogram reads the
interrupt vector area and issues an interrupt acknowledgment signal for the interrupt controller. Then, the
microprogram transfers the jump destination address of the macro instruction generated from the vector to
the program counter, and executes the user interrupt processing program.
Figure 17.3-1 External Interrupt
External interrupt/DTP
Interrupt controller
F2MC-16LX CPU
ICRyy
IL
Other request
ELVR
EIRR
ENIR
Cause
CMP
ICRxx
CMP
ILM
INTA
287
CHAPTER 17 DTP/EXTERNAL INTERRUPTS
■ DTP Operation
To activate the intelligent I/O service, the user program initially sets the address of a register, assigned
between 000000H and 0000FFH, in the I/O address pointer of the intelligent I/O service descriptor. Then,
the user program sets the start address of the memory buffer in the buffer address pointer.
The DTP operation sequence is almost the same as for external interrupts. The operation is identical until
the CPU activates the hardware interrupt processing microprogram. Then, for the DTP, control is
transferred to the intelligent I/O service processing microprogram, since the ISE bit read by the CPU within
the hardware interrupt processing microprogram indicates the DTP. Once the intelligent I/O service is
activated, a read or write signal is sent to the addresses external peripheral, and data is transferred between
the peripheral and the chip. The external peripheral must cancel the interrupt request to this chip within
three machine cycles after the transfer is made. When the transfer is completed, the descriptor is updated,
and the interrupt controller generates a signal that clears the transfer cause. Upon receiving the signal to
clear the transfer cause, this resource clears the flip-flop holding the cause and prepares for the next request
from the pin. For details of the intelligent I/O service processing, refer to the MB90500 Programming
Manual.
Figure 17.3-2 Timing to Cancel the External Interrupt at the End of DTP Operation
Edge request or H level request
Internal operation
Interrupt cause
Selecting and
reading
descriptor
* When data is transferred from the I/O register to memory
in the intelligent I/O service
Read address
Address bus pin
Data bus pin
Write address
Read data
Write data
Read signal
Write signal
Cancel within three machine cycles.
Data, address
bus
Internal bus
Register
External peripheral
Figure 17.3-3 Sample Interface to the External Peripheral
INT
IRQ
DTP
Cancel within three machine
cycles after transfer.
288
MB90860A
CORE
MEMORY
CHAPTER 17 DTP/EXTERNAL INTERRUPTS
17.4
Switching between External Interrupt and DTP Requests
To switch between external interrupt and DTP requests, use the ISE bit in the ICR
register corresponding to this block, which is in the interrupt controller. Each pin is
individually assigned ICR. Thus, a pin is used for a DTP request if "1" is written to the
ISE bit of the corresponding ICR, and is used for an external interrupt request if "0" is
written to the bit.
■ Switching between External Interrupt and DTP Requests
Figure 17.4-1 Switching between External Interrupt and DTP Requests
Interrupt controller
0
ICR xx
ICR yy
1
F2MC-16LX CPU
Pin
External
interrupt/DTP
DTP
External interrupt
289
CHAPTER 17 DTP/EXTERNAL INTERRUPTS
17.5
Notes on Using DTP/External Interrupt functions
The following points must be considered to use the DTP/External function.
• Conditions on the behavior of external circuit for the DTP function
• Clearing interrupt flag
• External interrupt request level
■ Conditions on the Behavior of External Circuit for the DTP Function
• The external circuit which uses the DTP function must be able to inactivate the request signal when the
requested DTP transfer is performed.
• If the DTP request should be withdrawn, the request signal must be inactivated within 3 machine clock
cycles after the transfer is initiated (the RDX signal is activated). Otherwise it is regarded as a valid
request and the transfer will be performed.
■ Clearing Interrupt Flag
• When it is used as an external interrupt the interrupt flag must be cleared within the interrupt service
routine. Otherwise the same service is performed again after the completion of the first interrupt service.
• When level detection is specified as the event input, the interrupt flag is set again even after it is cleared
as long as the active level is kept at the input pin. In this case, the external cause of the request should be
cleared or the interrupt enable bit should be cleared.
■ External Interrupt Request Level
• When edge detection is specified as the event input, the pulse width of the input signal must be greater
than equal to 3 machine clock cycles to recognize the input edge.
• When level detection is specified as the event input, the interrupt flag keeps active status once the
specified level is input even after the input signal changes to the inactive level as shown in
Figure 17.5-1. In order to clear the request, the interrupt flag must be cleared.
Figure 17.5-1 Clearing Interrupt/DTP Cause Register upon Level Set
Level detection
Interrupt cause
Interrupt flag
(interrupt/DTP cause register)
Interrupt enable
To interrupt
controller
The cause is kept held unless cleared.
Figure 17.5-2 Interrupt Cause and Interrupt Request to the Interrupt Controller while Interrupts are
Enabled
Interrupt cause
H level
Interrupt request to
the interrupt controller
Set inactive when the cause F/F is cleared.
290
CHAPTER 18
A/D CONVERTER
This chapter explains the function and operation of the
A/D converter.
18.1 Features of A/D Converter
18.2 Block Diagram of A/D Converter
18.3 Registers for A/D Converter
18.4 Operation of A/D Converter
18.5 Conversion Using EI2OS
18.6 Convert Data Protection Function
291
CHAPTER 18 A/D CONVERTER
18.1
Features of A/D Converter
The A/D converter converts analog input voltages to digital values.
■ Features of A/D Converter
• Conversion time: 1.9 µs min. per channel (with 24-MHz machine clock)
• RC successive approximation conversion with sample and hold circuit
• Resolution: 10 bits or 8 bits
• Analog input pin selected from up to 24* channels by program
- Single-channel conversion:1 channel is selected and converted.
- Scan conversion:Sequential channels (up to 24* channels) are converted.
• Mode setting
- Single mode:
Converts the specified channels once. Up to 24* channels can be specified.
- Continuous mode:Converts the specified channels repeatedly. Up to 24* channels can be specified.
- Stop mode:
Converts one channel, then the converter stops and stands by for the next activation.
(starting of conversion can be synchronized)
• Interrupt requests
At the end of A/D conversion, the interrupt request for an A/D conversion can be signaled to the
interrupt controller. This interrupt can start EI2OS or µDMA, which can transfer A/D conversion result
data to the memory.
• Selectable activation cause
The activation can be done by software, reload timer 1, or external trigger (falling edge).
*: 24channel Analog inputs are only supported by the products with 'C'-suffix. The products without 'C'suffix have 16 channel Analog inputs.
■ Analog Input Enable Register
The A/D converter's analog input pins are assigned to ports 5 to 7.
Set pins to be used as analog input to "analog input enable (default)" by setting "1" to corresponding bit of
analog input enable register.
For details, see Section "18.3.4 Setting Register (ADSR0/ADSR1)".
292
CHAPTER 18 A/D CONVERTER
Figure 18.1-1 Analog Input Enable Registers (ADER5 to ADER7)
Analog Input Enable register for Port5
15
14
13
12
11
10
9
8
ADER5
OBH
ADE15
ADE14
ADE13
ADE12
ADE11
ADE10
ADE9
ADE8
Read/Write
Initial Value
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
Analog Input Enable register for Port6
7
ADER6
OCH
Read/Write
Initial Value
6
5
4
3
2
1
0
ADE7
ADE6
ADE5
ADE4
ADE3
ADE2
ADE1
ADE0
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
11
10
(R/W)
(1)
Analog Input Enable register for Port7
15
ADER7
ODH
Read/Write
Initial Value
14
13
12
9
8
ADE23
ADE22
ADE21
ADE20
ADE19
ADE18
ADE17
ADE16
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
(R/W)
(1)
Pins of port 5, 6 and 7 are controlled as described below.
0: Port input/output mode
1: Analog input mode
"1" is set upon a reset.
Table 18.1-1 Analog Input Pins (1/2)
Pin name
Port
Analog input
channel name
Corresponding
ADE register
Corresponding
ADE bit
LQFP
QFP
34
36
AN0
ADE0
35
37
AN1
ADE1
36
38
AN2
ADE2
37
39
AN3
Port6
ADE3
ADER6
38
40
AN4
ADE4
39
41
AN5
ADE5
40
42
AN6
ADE6
41
43
AN7
ADE7
293
CHAPTER 18 A/D CONVERTER
Table 18.1-1 Analog Input Pins (2/2)
Pin name
Port
Analog input
channel name
Corresponding
ADE register
Corresponding
ADE bit
LQFP
QFP
22
24
AN8
ADE8
23
25
AN9
ADE9
24
26
AN10
ADE10
25
27
AN11
Port5
ADE11
ADER5
26
28
AN12
ADE12
27
29
AN13
ADE13
28
30
AN14
ADE14
29
31
AN15
ADE15
43
45
AN16
ADE16
44
46
AN17
ADE17
45
47
AN18
ADE18
46
48
AN19
Port7
ADE19
ADER7
47
49
AN20
ADE20
48
50
AN21
ADE21
53
55
AN22
ADE22
54
56
AN23
ADE23
Note: Analog input channel AN16 to AN23 are only supported by products with 'C'-suffix.
294
CHAPTER 18 A/D CONVERTER
18.2
Block Diagram of A/D Converter
Figure 18.2-1 shows the block diagram of A/D converter.
■ Block Diagram of A/D Converter
Figure 18.2-1 Block Diagram of A/D Converter
Port6
AVcc
AVRH/L
AVss
D/A Converter
Sequential
comparison register
Input circuit
AN7
AN6
AN5
AN4
AN3
AN2
AN1
AN0
Input circuit
Port5
MPX
AN15
AN14
AN13
AN12
AN11
AN10
AN9
AN8
Comparator
Sample & Hold circuits
Setting register 0
Setting register 1
Hold circuit
ADSR0/1
Internal data bus
Data Register
Decoder
AN23
AN22
AN21
AN20
AN19
AN18
AN17
AN16
Input circuit
Port7
ADCR0/1
Operating clock
Prescaler
A/D control register 0
A/D control register 1
ADTG pin
16-bit reload
timer 1
External trigger starts
ADCS0/1
Timer starts
Analog input enable register 5
Analog input enable register 6
Analog input enable register 7
ADER5/6/7
295
CHAPTER 18 A/D CONVERTER
18.3
Registers for A/D Converter
The A/D converter has the following three registers:
• Control status register: ADCS0/1
• Data register: ADCR0/1
• Setting register: ADSR0/1
■ Registers for A/D Converter
Figure 18.3-1 Registers for A/D Converter
A/D control status register ( Upper)
Address: 000069H
Read/write
Initial value
Bit No.
15
14
13
12
11
10
9
8
BUSY
INT
INTE
PAUS
STS1
STS0
STRT
-
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(-)
(X)
7
6
5
2
1
0
Bit No.
MD1
MD0
S10
-
-
-
-
reserved
ADCS0
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(-)
(X)
(-)
(X)
(-)
(X)
(-)
(X)
( R/W )
(0)
15
14
13
12
11
10
9
8
B it No .
ADCR1
ADCS1
A/D control status register (Lower)
Address: 000068H
Read/write
Initial value
4
3
Data register ( Upper)
Address: 00006BH
Read/write
Initial value
-
-
-
(-)
(X)
(-)
(X)
(-)
(X)
(-)
(X)
-
-
D9
D8
(-)
(X)
(-)
(X)
(R)
(0)
(R)
(0)
Data register ( Lower)
Address: 00006AH
Read/write
Initial value
7
6
5
4
3
2
1
0
Bit No.
D7
D6
D5
D4
D3
D2
D1
D0
ADCR0
(R)
(0)
(R)
(0)
(R)
(0)
(R)
(0)
(R)
(0)
(R)
(0)
(R)
(0)
(R)
(0)
A/D setting register ( Upper)
Address: 00006DH
Read/write
Initial value
15
14
13
12
11
10
9
8
Bit No.
ST2
ST1
ST0
CT2
CT1
CT0
ANS4
ANS3
ADSR1
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
7
6
5
4
2
1
0
Bit No.
ANS2
ANS1
ANS0
ANE4
ANE3
ANE2
ANE1
ANE0
ADSR0
(R/W)
(0)
(R/W)
(0)
(R/W)
(R/W)
(R/W)
(R/W)
(R/W)
(0)
(0)
(0)
(R/W)
(0)
(0)
(0)
A/D setting register ( Lower)
Address: 00006CH
Read/write
Initial value
296
3
CHAPTER 18 A/D CONVERTER
18.3.1
Control status register (ADCS0)
The control status register (ADCS0) controls the A/D converter and indicates its status.
Do not rewrite ADCS0 during A/D conversion.
■ Control Status Register (ADCS0)
Figure 18.3-2 A/D Control Status Register (ADCS0)
A/D control status register (Lower)
Address: 000068H
Read/write
Initial value
7
6
5
4
3
2
1
0
Bit No.
MD1
MD0
S10
-
-
-
-
reserved
ADCS0
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(-)
(X)
(-)
(X)
(-)
(X)
(-)
(X)
(R/W)
(0)
[bit7, bit6] MD1 and MD0 (A/D converter mode set)
Table 18.3-1 Operation Mode Settings
MD1
MD0
Operation mode
0
0
Single mode 1 (Reactivation during A/D conversion is allowed.)
0
1
Single mode 2 (Reactivation during A/D conversion is not allowed.)
1
0
Continuous mode (Reactivation during A/D conversion is not allowed.)
1
1
Stop mode (Reactivation during A/D conversion is not allowed.)
• Single mode
A/D conversion is continuously performed from the channel specified with ANS4 to ANS0 to the
channel specified with ANE4 to ANE0. The conversion stops once it has been done for all these
channels.
• Continuous mode
A/D conversion is repeatedly performed from the channel specified with ANS4 to ANS0 to the channel
specified with ANE4 to ANE0 in a row.
• Stop mode
A/D conversion is performed from the channel specified with ANS4 to ANS0 to the channel specified
with ANE4 to ANE0, pausing for each channel. The A/D conversion is resumed upon an activation.
Notes:
• The A/D conversion in the continuous or stop mode continues until it is stopped by the BUSY bit.
• Write 0 to the BUSY bit to stop the A/D conversion.
• Reactivation disabled in single mode2, continuous mode, and stop mode. This applies to all kinds
of activation.
297
CHAPTER 18 A/D CONVERTER
[bit5] S10
This bit specifies the resolution of conversion. When "0" is written to this bit, 10-bit A/D conversion is
performed. When "1" is written to this bit, 8-bit A/D conversion is performed and the conversion result
is stored in D7 to D0.
[bit4 to bit1] Unused bits
Writing to these bits has no effect. Reading these bits always returns "1".
[bit0] reserved (reserved bit)
This bit is a reserved bit. Always write "0" to this bit.
Reading this bit always returns "0".
298
CHAPTER 18 A/D CONVERTER
18.3.2
Control status register (ADCS1)
The control status register (ADCS1) controls the A/D converter and indicates its status.
■ Control Status Register (ADCS1)
Figure 18.3-3 A/D Control Status Register (ADCS1)
A/D control status register (Upper)
Address: 000069H
Read/write
Initial value
15
14
13
12
11
10
9
8
Bit No.
BUSY
INT
INTE
PAUS
STS1
STS0
STRT
-
ADCS1
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(-)
(X)
[bit15] BUSY (busy flag and stop)
• Read operation:
- This bit indicates an operation of the A/D converter.
- The bit is set by starting of A/D conversion, and cleared by end of A/D conversion.
• Write operation:
- When "0" is written to this bit during the A/D conversion, the conversion is forced to stop.
- Writing "1" to this bit has no effect.
Notes:
• "1" is read from this bit when an read-modify-write instruction is used.
• In the single mode, this bit is cleared when A/D conversion ends.
• In the continuous or stop mode, the A/D conversion does not stop until writing "0" to this bit.
• This bit is initialized to 0 by reset.
• Do not perform the forced stop and the activation concurrently (using software (BUSY = 0, STRT =
1), external trigger, or timer).
[bit14] INT (interrupt)
This bit is set when converted data is written to ADCR. When this bit is set with bit5 (INTE) set to "1",
an interrupt request is generated. In addition, the EI2OS or µDMA is activated if it is enabled. Writing
"1" to this bit has no effect. This bit is cleared by writing "0" or by the interrupt clear signal from the
EI2OS / µDMA.
Notes:
• To clear this bit by writing "0", ensure that A/D conversion is not in progress.
• This bit is initialized to "0" at reset.
• Using an read-modify-write instruction, "1" is read from this bit.
299
CHAPTER 18 A/D CONVERTER
[bit13] INTE (Interrupt enable)
This bit enables and disables the interrupt.
• 0: Interrupt disabled
• 1: Interrupt enabled
When using EI2OS or µDMA, set this bit (EI2OS or µDMA is started by an interrupt request).
This bit is initialized to 0 at reset.
[bit12] PAUS (A/D converter pause)
This bit is set when A/D conversion pauses.
Only one register is available for storing the A/D conversion result. Therefore, unless the conversion
results are transferred by the EI2OS (or µDMA), the result data would be continuously updated and
destroyed in continuous conversion.
To prevent the above condition, the system is so designed as not to store the next converted-data when a
conversion result is not transferred yet (INT = "1"), with INTE = "1". A/D conversion pauses during
that period. When transfer by EI2OS (or µDMA) ends or when "0" is set to INT bit, A/D conversion is
resumed. Once this bit is set, it is not cleared by itself. Write "0" to clear this bit.
This bit is valid only when EI2OS (or µDMA) is used.
Notes:
• Regarding the convert data protection function, see Section "18.6
Function".
Convert Data Protection
• This bit is initialized to "0" at reset.
[bit11, bit10] STS1 and STS0 (Start source select)
These bits are initialized to "00B" by reset.
Select an A/D conversion activation cause by setting these bits.
Table 18.3-2 Function Settings
STS1
STS0
Function
0
0
Activation A/D conversion by software
0
1
Activation A/D conversion by external pin trigger and by software
1
0
Activation A/D conversion by timer and by software
1
1
Activation A/D conversion by external pin trigger, timer, and by software
In a mode allowing two or more activation causes, A/D conversion is activated by the source that occurs
first. When changing the setting of these bits during A/D conversion, the result is immediately reflected.
Therefore it is not a recommended practice.
Notes:
• An external pin trigger is detected by the falling edge.
When the external trigger input level is Low, setting external pin triggers starting may start A/D
converter.
• When the timer is selected, the 16-bit reload timer 1 is selected and the conversion is activated
when the output from the timer becomes "1".
300
CHAPTER 18 A/D CONVERTER
[bit9] STRT (Start)
A/D conversion is started by writing "1" to this bit.
To reactivate A/D conversion, write "1" to this bit again.
At reset, this bit is initialized to "0".
Reading this bit always returns "1". Using an read-modify-write instruction, "0" is read from this bit.
Reactivation during the operation is only available in the single mode 1, but not supported in the single
mode2, continuous mode and the stop mode. Check the BUSY bit before writing "1" to this bit in the
latter three modes.
Do not force to stop A/D conversion concurrently with activation of A/D conversion by software
(BUSY=0, STRT=1).
[bit8] Unused bit
Writing to this bit has no effect.
Reading this bit always returns "1".
301
CHAPTER 18 A/D CONVERTER
18.3.3
Data Register (ADCR0/ADCR1)
The data register (ADCR0/ADCR1) is used to store digital value generated as a result of
conversion. ADCR0 stores lower 8 bits; ADCR1 stores most significant 2 bits of the
conversion result. These register's values are rewritten every time conversion ends.
Normally, the last converted value is stored in these register's bits.
■ Data Register (ADCR0/ADCR1)
Figure 18.3-4 Data Register (ADCR0/ADCR1)
Data register (Upper)
Address: 00006BH
Read/write
Initial value
15
14
-
Bit No.
13
12
11
10
9
8
-
-
-
-
-
D9
D8
(-)
(X)
(-)
(X)
(-)
(X)
(-)
(X)
(-)
(X)
(-)
(X)
(R)
(0)
(R)
(0)
7
6
5
4
3
2
1
0
Bit No.
D7
D6
D5
D4
D3
D2
D1
D0
ADCR0
(R)
(0)
(R)
(0)
(R)
(0)
(R)
(0)
(R)
(0)
ADCR1
Data register (Lower)
Address: 00006AH
Read/write
Initial value
(R)
(0)
(R)
(0)
(R)
(0)
Reading bit10 to bit15 of ADCR1 always returns "1".
When S10 bit of ADCS0 is "1", the 8-bit mode is established, storing converted data in bit7 to bit0. In this
case, Reading bit9 to bit8 always returns "1".
For the use of the conversion data protection function, see Section "18.4 Operation of A/D Converter".
Do not write to this register.
302
CHAPTER 18 A/D CONVERTER
18.3.4
Setting Register (ADSR0/ADSR1)
The setting register (ADSR0/ADSR1) is used to set the A/D conversion time and the
sampling channels and to indicate the current sampling channel.
■ Setting Register (ADSR0/ADSR1)
Figure 18.3-5 Setting Register (ADSR0/ADSR)
A/D setting register (Upper)
Address: 00006DH
Read/write
Initial value
15
14
13
12
11
10
9
8
ST2
ST1
ST0
CT2
CT1
CT0
ANS4 ANS3
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
7
6
5
4
3
2
1
0
Bit No.
ADSR1
A/D setting register (Lower)
ANS2 ANS1 ANS0 ANE4 ANE3 ANE2 ANE1 ANE0
Address: 00006CH
Read/write
Initial value
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
(R/W)
(0)
Bit No.
ADSR0
(R/W)
(0)
[bit15 to bit13] ST2, ST1, ST0 (Sampling time)
Table 18.3-3 Function Settings
ST2
ST1
ST0
Function
0
0
0
4-machine cycle (8 MHz, 0.5 µs)
0
0
1
6-machine cycle (8 MHz, 0.75 µs)
0
1
0
8-machine cycle (16 MHz, 0.5 µs)
0
1
1
12-machine cycle (24 MHz, 0.5 µs)
1
0
0
24-machine cycle (8 MHz, 3 µs)
1
0
1
36-machine cycle (16 MHz, 2.25 µs)
1
1
0
48-machine cycle (16 MHz, 3.0 µs)
1
1
1
128-machine cycle (24 MHz, 5.3 µs)
These bits define the sampling time for the analog input signal. Setting for these bits must be carefully
evaluated with the following conditions. Otherwise, the result may not provide the guaranteed conversion
accuracy.
303
CHAPTER 18 A/D CONVERTER
If the driving impedance, Rext is 1.5 kΩ or less, the sampling time must be greater than equal to;
0.5µs; For 4.5V ≤ Avcc ≤ 5.5V
1.2µs; For 4.0V ≤ Avcc < 4.5V
If the driving impedance, Rext is greater than 1.5 kΩ, the sampling time must be greater than Tsamp
given by the following formula;
Tsamp = (2.25 kΩ + Rext) × 10.7pF × 7; For 4.5V ≤ Avcc ≤ 5.5V
Tsamp = (13.6 kΩ + Rext) × 10.7pF × 7; For 4.0V ≤ Avcc < 4.5V
[bit12 to bit10] CT2, CT1, CT0 (Compare time)
Table 18.3-4 Function Settings
CT2
CT1
CT0
Function
0
0
0
22-machine cycle (8 MHz, 2.8 µs)
0
0
1
33-machine cycle (16 MHz, 2.1 µs)
0
1
0
44-machine cycle (20 MHz, 2.2 µs)
0
1
1
66-machine cycle (24 MHz, 2.8 µs)
1
0
0
88-machine cycle (8 MHz, 11.0 µs)
1
0
1
132-machine cycle (16 MHz, 8.3 µs)
1
1
0
176-machine cycle (20 MHz, 8.8 µs)
1
1
1
264-machine cycle (24 MHz, 11.0 µs)
These bits define the conversion time of the successive approximation. Setting for these bits must meet
the following conditions. Otherwise, the result may not provide the guaranteed conversion accuracy.
≥ 1.0µs; For 4.5V ≤ Avcc ≤ 5.5V
≥ 2.0µs; For 4.0V ≤ Avcc < 4.5V
[bit9 to bit5] ANS4, ANS3, ANS2, ANS1, ANS0 (Analog start channel set)
These bits are used to set the starting channel for A/D conversion, and to indicate the current analog input
channel.
When the A/D converter is activated, A/D conversion is started from the channel selected by these bits.
304
CHAPTER 18 A/D CONVERTER
Table 18.3-5 Starting Channel Settings
ANS4
ANS3
ANS2
ANS1
ANS0
Starting channel
0
0
0
0
0
AN0
0
0
0
0
1
AN1
0
0
0
1
0
AN2
0
0
0
1
1
AN3
•
•
•
1
1
1
0
0
AN28
1
1
1
0
1
AN29
1
1
1
1
0
AN30
1
1
1
1
1
AN31
• Read operation
These bits indicates the current analog input channel for the conversion operation. When the conversion
operation is stopped, the last channel is indicated.
And before A/D conversion starts, the previous conversion channel will be read even if these bits have
already been set to the new value.
• At reset: These bits are initialized to "00000B".
[bit4 to bit0] ANE4, ANE3, ANE2, ANE1, ANE0 (Analog end channel set)
These bits are used to set the ending channel for A/D conversion.
Table 18.3-6 Ending Channel Settings
ANE4
ANE3
ANE2
ANE1
ANE0
Ending channel
0
0
0
0
0
AN0
0
0
0
0
1
AN1
0
0
0
1
0
AN2
0
0
0
1
1
AN3
•
•
•
1
1
1
0
0
AN28
1
1
1
0
1
AN29
1
1
1
1
0
AN30
1
1
1
1
1
AN31
• At reset, these bits are initialized to "00000B".
305
CHAPTER 18 A/D CONVERTER
Notes:
• When writing to this register, always use word access. When byte write or read-modify-write is
performed for this register, A/D conversion may be started from an unintended channel.
• When the same channel is written to the ANE4 to ANE0 bits and to the ANS4 to ANS0 bits,
conversion is performed for only 1 channel (single channel conversion).
• When conversion of the Analog end channel set by ANE4 to ANE0 is ended, with the continuous
mode or the stop mode, control returns to the Analog start channel set by the ANS4 to ANS0 bits.
• When the ANS > ANE is set for channel, conversion starts from the Analog start channel and
when conversion of AN31 ends, and then returns to the AN0 and ends in the Analog end channel.
In this case, the conversion results could be incorrect, because analog input AN16 to AN31(for
the products without 'C'-suffix) or AN24 to AN31(for the products with 'C'-suffix) do not exist. To
prevent this operation, do not set ANS larger than ANE.
• Do not set number of channel that doesn't exist on the device to ANEx bits or ANSx bits.
- The products without 'C'-suffix: 0 to 15 can be set to ANEx bits or ANSx bits
- The products with 'C'-suffix: 0 to 23 can be set to ANEx bits or ANSx bits
306
CHAPTER 18 A/D CONVERTER
18.4
Operation of A/D Converter
The A/D converter operates using the sequential-comparison converter system; and 10
bits or 8 bits can be selected for the A/D converter's resolution.
Since this A/D converter has only one register (10 bits; conversion result data register
ADCR0 and ADCR1) for storing conversion results, this register is rewritten every time
conversion is ended. So, this A/D converter alone is not suitable for continuous
conversion; and therefore conversion be performed with transferring converted data to
the memory using the extended intelligent I/O function (EI2OS) or using µDMA is
recommended.
■ Single Mode 1 / 2
In the single mode, analog inputs from the starting channel set by the ANS bits to the ending channel set by
the ANE bits are sequentially converted; and when conversion of the ending channel is ended, A/D
conversion is stopped. When the starting channel and the ending channel are the same (ANS = ANE),
conversion is performed for only the channel set by the ANS bits.
Example:
ANS = 00000B, ANE = 00011 B:
Start → AN0 → AN1 → AN2 → AN3 → End
ANS = 00010 B, ANE = 00010 B:
Start → AN2 → End
■ Continuous Mode
In the continuous mode, analog inputs from the starting channel set by the ANS bits to the ending channel
set by the ANE bits are sequentially converted; and when conversion of the ending channel is ended,
control returns to the starting channel to continue A/D conversion. When the starting channel and the
ending channel are the same (ANS = ANE), conversion is continued for only the channel set by the ANS
bits.
Example:
ANS = 00000B, ANE = 00011 B:
Start → AN0 → AN1 → AN2 → AN3 → AN0 →→→ Repetition of sequence
ANS = 00010 B, ANE = 00010 B:
Start → AN2 → AN2 → AN2 →→→ Repetition of sequence
In the continuous mode, A/D conversion is repeated until "0" is written to the BUSY bit (when "0" is
written to the BUSY bit, operation of the A/D converter stops forcibly).
Note that when operation of the A/D converter stops forcibly, A/D conversion stops halfway. In this case,
the conversion result register contains the previous data for which conversion completed.
307
CHAPTER 18 A/D CONVERTER
■ Stop Mode
In the stop mode, analog inputs from the starting channel set by the ANS bits to the ending channel set by
the ANE bits are sequentially converted, but every time one channel is converted, conversion stops.
When conversion of the ending channel is ended, control returns to the starting channel to continue A/D
conversion. When the starting channel and the ending channel are the same (ANS = ANE), conversion is
performed for only one channel.
Example:
ANS = 00000B, ANE = 00011 B:
Start → AN0 → Stop → Start → AN1 → Stop → Start → AN2 → Stop → Start → AN3 → Stop →
Start → AN0 →→→ Repetition of sequence
ANS = 00010 B, ANE = 00010 B:
Start → AN2 → Stop → Start → AN2 → Stop → Start → AN2 →→→ Repetition of sequence
In the above sequences, only A/D activation causes set using the STS1 and STS0 bits are valid.
The start of conversion can be synchronized by this mode.
308
CHAPTER 18 A/D CONVERTER
18.5
Conversion Using EI2OS
Figure 18.5-1 gives an example of flow (continuous mode) from the activation of A/D
conversion to the transfer of converted data.
■ Conversion Using EI2OS
Figure 18.5-1 Example of Flow (Continuous Mode) from activation of A/D Conversion
to Transfer of Converted Data
EI2OScontroller
A/D conveter
A/D converter activated
Sample & Hold
Data transfer
2
EI OS
request
Conversion
*
Interrupt
processing
Conversion ended
ADCS:INT=0?
N
Y
Store conversion data
to ADCR0/1
interrupt cleared
INT clear
request
*: The operation count depends
2
on the setting of the EI OS.
Interrupt
generated
309
CHAPTER 18 A/D CONVERTER
18.5.1
Example of activating of EI2OS in single mode
In the single mode, EI2OS is activated in the following procedure:
• Convert analog inputs AN1 to AN3 and then end the conversion.
• Transfer sequentially converted data to the 200H to 205H addresses.
• Activate conversion using software.
• Use the highest interrupt level.
■ Example of Starting of EI2OS in Single Mode
Table 18.5-1 Operation Description
Setting item
Sample program
MOV ICR03, #08H
Operation description
Set the highest interrupt level, start EI2OS at the interrupt, and set the
descriptor address.
MOV BAPL, #00H
MOV BAPM, #02H
Transfer destination address for converted data
MOV BAPH, #00H
Setting of
EI2OS
MOV ISCS, #18H
Transfer word data, and then increment the transfer destination address.
Transfer converted data from I/O to the memory. Don't terminate transfer
due to a request from the resource.
MOV IOAL, #6AH
Set the A/D converter result register
MOV IOAH, #00H
MOV DCTL, #03H
MOV DCTH, #00H
Setting of A/D
converter
Interrupt
sequence
Performs EI2OS transfer three times (the number of conversion times)
MOV ADCS0, #00H
Single mode1
MOVW ADSR0, #6823H
The sampling time is 0.6 µs; the comparison operation time is 2.2 µs (as
machine CLK is 20 MHz); the starting channel is AN1; the ending
channel is AN3.
MOV ADCS1, #A2H
Start A/D conversion using software.
MOV ADCS1, #80H
RETI
Return from the interrupt.
ICR03: Interrupt control register
BAPL: Buffer address pointer (lower)
BAPM: Buffer address pointer (middle)
BAPH: Buffer address pointer (upper)
ISCS: EI2OS status register
310
IOAL: I/O address counter (lower)
DCTL: Data counter (lower)
IOAH: I/O address counter (upper)
DCTH: Data counter (upper)
CHAPTER 18 A/D CONVERTER
Figure 18.5-2 Example of Starting of EI2OS in Single Mode
START
AN1
Interrupt
Transfer by EI2OS
AN2
Interrupt
Transfer by EI2OS
AN3
Interrupt
Transfer by EI2OS
END
Interrupt sequence
Parallel processing
311
CHAPTER 18 A/D CONVERTER
18.5.2
Example of activating of EI2OS in continuous mode
An example of the activating of EI2OS in the continuous mode is given below.
• Convert analog inputs AN3 to AN5 and obtain two converted data for each channel.
• Transfer sequentially converted data to the 600H to 60BH addresses.
• Start conversion using an external edge input.
• Use the highest interrupt level.
■ Example of Starting of EI2OS in Continuous Mode
Table 18.5-2 Operation Description
Setting item
Sample program
MOV ICR03, #08H
Operation description
Set the highest interrupt level, start EI2OS at the interrupt, and set the
descriptor address.
MOV BAPL, #00H
MOV BAPM, #06H
Transfer destination address for converted data
MOV BAPH, #00H
Setting of
EI2OS
MOV ISCS, #18H
MOV IOAL, #6AH
Transfer word data, and then increment the transfer destination address.
Transfer converted data from I/O to the memory. Don't terminate transfer
due to a request from the resource.
Transfer source address
MOV IOAH, #00H
MOV DCTL, #06H
MOV DCTH, #00H
Setting of A/D
converter
EI2OS end
interrupt
sequence
Transfer converted data by EI2OS six times data for '3 channels × 2'.
MOV ADCS0, #80H
Continuous mode
MOVW ADSR0, #6865H
The sampling time is 0.6 µs; the comparison operation time is 2.2 µs (with
machine CLK is 20 MHz); the starting channel is AN3; the ending channel
is AN5.
MOV ADCS1, #A4H
Start A/D conversion using external edge.
MOV ADCS1, #84H
RETI
Return from the interrupt.
ICR03: Interrupt control register
BAPL: Buffer address pointer (lower)
BAPM: Buffer address pointer (middle)
BAPH: Buffer address pointer (upper)
ISCS: EI2OS status register
312
IOAL: I/O address counter (lower)
DCTL: Data counter (lower)
IOAH: I/O address counter (upper)
DCTH: Data counter (upper)
CHAPTER 18 A/D CONVERTER
Figure 18.5-3 Example of Starting of EI2OS in Continuous Mode
START
AN3
Interrupt
EI2OS
AN4
Interrupt
EI2OS
AN5
Interrupt
EI2OS
After transfer 6 times in total:
Interrupt sequence
END
313
CHAPTER 18 A/D CONVERTER
18.5.3
Example of activating of EI2OS in stop mode
An example of the activating of EI2OS in the stop mode is given below.
• Convert the analog input AN3 12 times at regular intervals.
• Transfer sequentially converted data to the 600H to 617H addresses.
• Start conversion using an external edge input.
• Use the highest interrupt level.
■ Example of Starting of EI2OS in Stop Mode
Table 18.5-3 Operation Description
Setting item
Sample program
MOV ICR03, #08H
Operation description
Set the highest interrupt level, start EI2OS at the interrupt time, and set the
descriptor address.
MOV BAPL, #00H
MOV BAPM, #06H
Transfer destination address for converted data
MOV BAPH, #00H
Setting of
EI2OS
MOV ISCS, #18H
Transfer word data, and then increment the transfer destination address.
Transfer converted data from I/O to the memory. Don't terminate transfer
due to a request from the resource.
MOV IOAL, #6AH
Transfer source address
MOV IOAH, #00H
MOV DCTL, #0CH
MOV DCTH, #00H
Setting of A/D
converter
EI2OS end
interrupt
sequence
MOV ADCS0, #C0H
Stop mode
MOVW ADSR0, #6863H
The sampling time is 0.6 µs; the comparison operation time is 2.2 µs (with
machine CLK is 20 MHz); the starting channel is AN3; the ending
channel is AN3 (1 channel is converted).
MOV ADCS1, #A4H
Start A/D conversion using the external edge.
MOV ADCS1, #84H
RETI
Return from the interrupt.
ICR03: Interrupt control register
BAPL: Buffer address pointer (lower)
BAPM: Buffer address pointer (middle)
BAPH: Buffer address pointer (upper)
ISCS: EI2OS status register
314
Transfer converted data by EI2OS 12 times.
CHAPTER 18 A/D CONVERTER
IOAL: I/O address counter (lower)
DCTL: Data counter (lower)
IOAH: I/O address counter (upper)
DCTH: Data counter (upper)
Figure 18.5-4 Example of Starting of EI2OS in Stop Mode
START
AN3
Interrupt
Transfer by EI2OS
After transfer 12 times:
STOP
External edge start
Interrupt sequence
END
315
CHAPTER 18 A/D CONVERTER
18.6
Convert Data Protection Function
The A/D converter has the converted-data protection function, is featured by continuous
conversion and securing two or more data using EI2OS (or µDMA).
Only one conversion data register (ADCR0/ADCR1) is provided, so when A/D conversion
is continuously performed, converted data is stored every time one conversion is
ended, destroying the previous data. To prevent this, the A/D converter has a function
that conversion data is not stored in the register and the A/D conversion pauses even
when conversion is ended unless the previous data is transferred to the memory using
EI2OS (or µDMA).
■ Converted-data Protection Function
The pause operation is cancelled after converted data is transferred to the memory via EI2OS (or µDMA).
When the previous data is already transferred to the memory, A/D conversion is continuously performed
without a pause.
Note:
This function is related to the INT and INTE bits of ADCS1 register.
The data protection function operates only in the interrupt enabled state (INTE = 1).
In the interrupt disabled state (INTE = 0), this function does not operate. In this state when A/D
conversion is continuously performed, converted data is successively stored in the register,
destroying old data.
When EI2OS (or µDMA) is not used in the interrupt enabled state (INTE = 1), the INT bit is not
cleared automatically, so the data protection functions works, placing A/D conversion in a pause. In
this case, when the INT bit is cleared (by writing "0" to the bit) in an interrupt sequence, the pause is
cancelled.
When interrupts are disabled (by writing "0" to INTE bit), with EI2OS (or µDMA) operating and with
the A/D converter pausing, A/D converter resume conversion and the contents of the converted-data
register may change before it is transferred to memory.
When A/D conversion is reactivated during a pause (by writing "1" to STRT bit in the single mode1),
pending conversion result is destroyed.
When the data protection function works to cause a pause, the PAUS bit is set.
The PAUS bit is not cleared by itself. Write "0" to clear this bit.
316
CHAPTER 18 A/D CONVERTER
■ Example of Flow of Data Protection Function (when EI2OS is Used)
Figure 18.6-1 Example of Flow of Data Protection Function (when EI2OS is Used)
2
Set El OS
Start continuous A/D conversion
First conversion end
Store in data register
2
Second conversion end
Start EI OS
NO
A/D conversion pauses
2
EI OS end
YES
Stored in data register
YES
NO
2
EI OS end
Third conversion end
Continues
2
All conversions end
Start EI OS
Interrupt routine
End
A/D converter stopp
When the A/D converter is reactivated during a pause, queued, converted data is destroyed.
■ Cautions
To select the external trigger or the internal timer as the activation causes of A/D converted, the A/D
start source select bits (STS1 and STS0 bits) of ADCS1 register are used.In this case, ensure that the
input value of an external trigger or of the internal timer are "inactive". If the values are "active", A/D
conversion may start operating immediately.
When setting the STS1 bit and STS0 bit, always set the ADTG pin to "1" (input) and set the internal
timer (reload timer 1) to "0" (output).
317
CHAPTER 18 A/D CONVERTER
318
CHAPTER 19
CLOCK MONITOR FUNCTION
This chapter describes the functions and operations of
the clock monitor function.
19.1 Clock Monitor Function
19.2 Clock Output Enable Register (CLKR)
319
CHAPTER 19 CLOCK MONITOR FUNCTION
19.1
Clock Monitor Function
The clock monitor function is output a division clock (a clock for monitoring) from the
clock monitor CKOT pin.
■ Block Diagram of the Clock Monitor
Internal Data Bus
Figure 19.1-1 Block Diagram of the Clock Monitor
320
CKEN
Machine clock
FRQ2
FRQ1
FRQ0
Division
circuit
φ
P81 / CKOT
CHAPTER 19 CLOCK MONITOR FUNCTION
19.2
Clock Output Enable Register (CLKR)
The clock output enable register (CLKR) selects the CKOT output enable and the clock
output frequency.
■ Clock Output Enable Register (CLKR)
Figure 19.2-1 Clock Output Enable Register (CLKR)
Clock output enable register
6
7
5
3
4
Address: 00796CH
2
1
0
CKEN FRQ2 FRQ1 FRQ0
Read/write
Initial value
( )
( )
( )
( )
(X)
(X)
(X)
(X)
Bit No.
CLKR
(R/W) (R/W) (R/W) (R/W)
(0)
(0)
(0)
(0)
[bit7 to bit4] Undefined bit
Reading these bits always returns "1".
[bit3] CKEN
This is the CKOT output enable bit.
Table 19.2-1 CKEN Bit Function
CKEN
Function of P81/CKOT pin
0
Normal port
1
CKOT output
[bit2 to bit0] FRQ2, FRQ1, FRQ0
This bit is used to select the clock output frequency.
Table 19.2-2 FRQ2, FRQ1, FRQ0 (Clock Output Frequency Selection Bit) Function
FRQ2
FRQ1
FRQ0
Output clock
φ=24 MHz
φ=16 MHz
φ=8 MHz
0
0
0
φ/21
83 ns
125 ns
250 ns
0
0
1
φ/22
167 ns
250 ns
500 ns
0
1
0
φ/23
333 ns
500 ns
1 µs
0
1
1
φ/24
667 ns
1 µs
2 µs
1
0
0
φ/25
1.3 µs
2 µs
4 µs
1
0
1
φ/26
2.7 µs
4 µs
8 µs
1
1
0
φ/27
5.3 µs
8 µs
16 µs
1
1
1
φ/28
10.7 µs
16 µs
32 µs
321
CHAPTER 19 CLOCK MONITOR FUNCTION
322
CHAPTER 20
UART
This chapter explains the functions and operation of
UART.
20.1 Overview of UART
20.2 Configuration of UART
20.3 UART Pins
20.4 UART Registers
20.5 UART Interrupts
20.6 UART Baud Rates
20.7 Operation of UART
20.8 Notes on Using UART
323
CHAPTER 20 UART
20.1
Overview of UART
The UART with LIN (Local Interconnect Network) - Function is a general-purpose serial
data communication interface for performing synchronous or asynchronous
communication with external devices. UART provides bidirectional communication
function (normal mode), master-slave communication function (multiprocessor mode in
master/slave systems), and special features for LIN-bus systems (working both as
master or as slave device).
Please note that UART is not software compatible to the other UARTs.
The MB90860A series contain up to five UARTs.
■ UART Functions
● UART functions
UART is a general-purpose serial data communication interface for transmitting serial data to and receiving
data from another CPU and peripheral devices. It has the functions listed in Table 20.1-1.
Table 20.1-1 UART Functions (1/2)
Item
Function
Data buffer
Full-duplex
Serial Input
5 times oversampling in asynchronous mode
Transfer mode
• Clock synchronous (start-stop synchronization and start-stop-bit-option)
• Clock asynchronous (using start-, stop-bits)
Baud rate
• A dedicated baud rate generator is provided, which consists of a 15-bit-reload counter
• An external clock can be input and also be adjusted by the reload counter
Data length
• 7 bits (not in synchronous or LIN mode)
• 8 bits
Signal mode
Non-return to zero (NRZ)
Start bit timing
Clock synchronization to the falling edge of the start bit in asynchronous mode
Reception error detection
• Framing error
• Overrun error
• Parity error (Not supported in Mode 1)
Interrupt request
• Reception interrupt (reception complete, reception error detect, LIN-Synch-break
detect)
• Transmission interrupt (transmission data empty)
• Interrupt request to ICU (LIN synch field detection: LSYN)
• Both transmission and reception support for extended intelligent
I/O service (EI2OS) and DMA function.
324
CHAPTER 20 UART
Table 20.1-1 UART Functions (2/2)
Item
Function
Master-slave communication
function
(multiprocessor mode)
One-to-n communication (one master to n slaves)
(This function is supported both for master and slave system).
Synchronous mode
Function as Master- or Slave-UART
Transceiving pins
Direct access possible
LIN bus options
•
•
•
•
•
Synchronous serial clock
The synchronous serial clock can be output continuously on the SCK pin for synchronous
communication with start & stop bits
Clock delay option
Special synchronous Clock Mode for delaying clock (useful for SPI)
Operation as master device
Operation as slave device
Generation of LIN-Sync-break
Detection of LIN-Sync-break
Detection of start/stop edges in LIN-Sync-field connected to ICU 0, 1, 6 and 7
■ UART Operation Modes
The UART operates in four different modes, which are determined by the MD0- and the MD1-bit of the
Serial mode register (SMR). Mode 0 and 2 are used for bidirectional serial communication, mode 1 for
master/slave communication and mode 3 for LIN master/slave communication.
Table 20.1-2 UART Operation Modes
Data length
Operation mode
Parity disabled
0
Normal mode
1
Multiprocessor
2
Normal mode
3
LIN mode
Parity enabled
7 or 8
7 or 8 + 1 *2
8
8
-
Synchronization of
mode
Length of
stop bit
Data bit
direction *1
Asynchronous
1 or 2
L/M
Asynchronous
1 or 2
L/M
Synchronous
0, 1 or 2
L/M
Asynchronous
1
L
*1: means the data bit transfer format: LSB or MSB first.
*2: "+1" means the indicator bit of the address/data selection in the multiprocessor mode, instead of parity.
Note:
Mode 1 operation is supported both for master or slave operation of UART in a master-slave
connection system. In Mode 3 the UART function is locked to 8N1-Format, LSB first.
If the mode is changed, UART cuts off all possible transmission or reception and awaits then new action.
The MD1 and MD0 bit of the Serial Mode Register (SMR) determine the operation mode of UART as
shown in the following table:
325
CHAPTER 20 UART
Table 20.1-3 Mode Bit Setting
MD1
MD0
Mode
Description
0
0
0
Asynchronous (normal mode)
0
1
1
Asynchronous (multiprocessor mode)
1
0
2
Synchronous (normal mode)
1
1
3
Asynchronous (LIN mode)
■ UART Interrupt and EI2OS
Table 20.1-4 UART Interrupt and EI2OS
Interrupt control register
Interrupt cause
Interrupt
number
Vector table address
Register
name
Address
Lower
Upper
Bank
2
EI OS
DMA
channel
number
UART0
reception
interrupt
#35(23H)
ICR12
0000BCH
FFFF70H
FFFF71H
FFFF72H
*1
DRQ10
UART0
transmission
interrupt
#36(24H)
ICR12
0000BCH
FFFF6CH
FFFF6DH
FFFF6EH
*2
DRQ11
UART1/UART3
reception
interrupt
#37(25H)
ICR13
0000BDH
FFFF68H
FFFF69H
FFFF6AH
*1
DRQ12
UART1/UART3
transmission
interrupt
#38(26H)
ICR13
0000BDH
FFFF64H
FFFF65H
FFFF66H
*2
DRQ13
UART2/UART4
reception
interrupt
#39(27H)
ICR14
0000BEH
FFFF60H
FFFF61H
FFFF62H
*1
DRQ14
UART2/UART4
transmission
interrupt
#40(28H)
ICR14
0000BEH
FFFF5CH
FFFF5DH
FFFF5EH
*2
DRQ15
*1: EI2OS service is usable if the other interrupt (s) which shares the same interrupt vector is (are) not enabled. Detection of
receive errors is possible and stop request for EI2OS service is supported.
*2: EI2OS service is usable if the other interrupt (s) which shares the same interrupt vector is (are) not enabled.
326
CHAPTER 20 UART
20.2
Configuration of UART
This section provides a short overview on the building blocks of UART.
■ Block Diagram of UART
UART consists of the following blocks:
• Reload Counter
• Reception Control Circuit
• Reception Shift Register
• Reception Data Register (RDR)
• Transmission Control Circuit
• Transmission Shift Register
• Transmission Data Register (TDR)
• Error Detection Circuit
• Oversampling Unit
• Interrupt Generation Circuit
• LIN Synch Break/Synch Field Detection
• Bus Idle Detection Circuit
• LIN-UART Serial Mode Register (SMR)
• Serial Control Register (SCR)
• Serial Status Register (SSR)
• Extended Com. Contr. Reg. (ECCR)
• Extended Status/Contr. Reg. (ESCR)
327
CHAPTER 20 UART
Figure 20.2-1 Block Diagram of UART
(OTO,
EXT,
REST)
Machine clock
PE
ORE
FRE
TIE
RIE
LBIE
LBD
transmission clock
Reload
Counter
SCKn
TRANSMISSION
CONTROL
CIRCUIT
RECEPTION
CONTROL
CIRCUIT
Pin
RBI
TBI
Start bit
Detection
circuit
Transmission
Start circuit
Received
Bit counter
Transmission
Bit counter
Received
Parity counter
Transmission
Parity counter
Restart Reception
Reload Counter
SINn
Interrupt
Generation
circuit
reception clock
Pin
reception
IRQ
transm.
IRQ
TDRE
SOTn
Oversampling
Unit
Pin
RDRF
reception
complete
SOTn
SINn
Signal
to ICU
LIN break
and Synch
Field
Detection
circuit
SINn
Reception
shift register
Transmission
shift register
LIN
break
generation
circuit
transmission
start
Bus idle
Detection
circuit
Error
Detection
RDRn
To DMA/
EI 2OS
PE
ORE
FRE
LBR
LBL1
LBL0
TDRn
RBI
LBD
TBI
Internal data bus
PE
ORE
FRE
RDRF
TDRE
BDS
RIE
TIE
SSRn
register
MD1
MD0
OTO
EXT
REST
UPCL
SCKE
SOE
SMRn
register
PEN
P
SBL
CL
A/D
CRE
RXE
TXE
SCRn
register
LBIE
LBD
LBL1
LBL0
SOPE
SIOP
CCO
SCES
LBR
MS
ESCRn SCDE
register
SSM
ECCRn
register
RBI
TBI
■ Explanation of the Different Blocks
● Reload Counter
The reload counter functions as the dedicated baud rate generator. It can select external input clock or
internal clock for the transmitting and receiving clocks. The reload counter has a 15 bit register for the
reload value. The actual count of the transmission reload counter can be read via the BGRn0/n1.
● Reception Control Circuit
The reception control circuit consists of a received bit counter, start bit detection circuit, and received
parity counter. The received bit counter counts reception data bits. When reception of one data item for the
specified data length is complete, the received bit counter sets the Reception data register full flag. The start
bit detection circuit detects start bits from the serial input signal and sends a signal to the reload counter to
synchronize it to the falling edge of these start bits. The reception parity counter calculates the parity of the
reception data.
328
CHAPTER 20 UART
● Reception Shift Register
The reception shift register fetches reception data input from the SINn pin, shifting the data bit by bit.
When reception is complete, the reception shift register transfers receive data to the RDR register.
● Reception Data Register
This register retains reception data. Serial input data is converted and stored in this register.
● Transmission Control Circuit
The transmission control circuit consists of a transmission bit counter, transmission start circuit, and
transmission parity counter. The transmission bit counter counts transmission data bits. When the
transmission of one data item of the specified data length is complete, the transmission bit counter sets the
Transmission data register full flag. The transmission start circuit starts transmission when data is written to
TDR. The transmission parity counter generates a parity bit for data to be transmitted if parity is enabled.
● Transmission Shift Register
The transmission shift register transfers data written to the TDR register to itself and outputs the data to the
SOTn pin, shifting the data bit by bit.
● Transmission Data Register (TDR)
This register sets transmission data. Data written to this register is converted to serial data and output.
● Error Detection Circuit
The error detection circuit checks if there was any error during the last reception. If an error has occurred it
sets the corresponding error flags.
● Oversampling Unit
The oversampling unit oversamples the incoming data at the SINn pin for five times. It is switched off in
synchronous operation mode.
● Interrupt Generation Circuit
The interrupt generation circuit administers all cases of generating a reception or transmission interrupt. If a
corresponding enable flag is set and an interrupt case occurs the interrupt will be generated immediately.
● LIN synch Break and Synchronization Field Detection Circuit
The LIN break and LIN synchronization field detection circuit detects a LIN break, if a LIN master node is
sending a message header. If a LIN break is detected a special flag bit is generated. The first and the fifth
falling edge of the synchronization field is recognized by this circuit by generating an internal signal for the
Input Capture Unit to measure the actual serial clock time of the transmitting master node.
● LIN Synch Break Generation Circuit
The LIN break generation circuit generates a LIN break of a determined length.
329
CHAPTER 20 UART
● Bus Idle Detection circuit
The bus idle detection circuit recognizes if neither reception nor transmission is going on. In this case, the
circuit generates the special flag bits TBI and RBI.
● LIN-UART Serial Mode Register (SMR)
This register performs the following operations:
• Selecting the LIN-UART operation mode
• Selecting a clock input source
• Selecting if an external clock is connected "one-to-one" or connected to the reload counter
• Resetting dedicated reload timer
• Resetting the LIN-UART (preserving the settings of the registers)
• Specifying whether to enable serial data output to the corresponding pin
• Specifying whether to enable clock output to the corresponding pin
● Serial Control Register (SCR)
This register performs the following operations:
• Specifying whether to provide parity bits
• Selecting parity bits
• Specifying a stop bit length
• Specifying a data length
• Selecting a frame data format in mode 1
• Clearing the error flags
• Specifying whether to enable transmission
• Specifying whether to enable reception
● Serial Status Register (SSR)
This register performs the following functions
• Indicating status of receive/transmit operations and errors
• Specifying LSB first or MSB first
• Receive interrupt enable/disable
• Transmit interrupt enable/disable
● Extended Status/Control Register (ESCR)
This register performs the following functions
• LIN synch break interrupt enable/disable
• Indicating LIN synch break detection
• Specifying LIN synch break length
• Directly accessing SINn and SOTn pins
• Specifying continuous clock output operation
• Specifying sampling clock edge
330
CHAPTER 20 UART
● Extended Communication Control Register (ECCR)
This register performs the following functions
• Indicating bus idle state
• Specifying synchronous clock
• Specifying LIN synch break generation
331
CHAPTER 20 UART
20.3
UART Pins
This section describes the UART pins and provides a pin block diagram.
■ UART Pins
The UART pins also serve as general ports. Table 20.3-1 lists the pin functions, I/O formats, and settings
required to use UART.
Table 20.3-1 UART Pins
Pin name
Pin function
I/O format
P82/SIN0
P85/SIN1
P50/SIN2
P12/SIN3
P15/SIN4
Port I/O or serial
data input
P83/SOT0
P86/SOT1
P51/SOT2
P13/SOT3
P16/SOT4
Port I/O or serial
data output
P84/SCK0
P87/SCK1
P52/SCK2
P14/SCK3
P17/SCK4
Port I/O or serial
clock input/output
CMOS output
and CMOS
Automotive
input
Pull-up
P12 to P17 have
programmable pullup register.
Pins other than
above do not have
pull-up register.
Standby
control
Provided
Setting required to use pin
Set as an input port
(DDR: corresponding bit = 0)
Set to output enable mode
(SMRn: SOE = 1)
Set as an input port when a
clock is input
(DDR: corresponding bit = 0)
Set to output enable mode
when a clock is output
(SMRn: SCKE = 1)
Figure 20.3-1 Block Diagram of UART Pins
Resource input (*)
Port data register (PDR)
Resource output
Internal data bus
Resource output enable
PDR read
Output latch
Pch
PDR write
Pin
Port direction register (DDR)
Direction latch
Nch
DDR write
Standby control (SPL=1)
DDR read
Standby control: Stop mode, watch mode, timebase timer mode, and SPL=1
*: Resources are input or output to or from pins having peripheral functions.
332
general purpose I/O /SIN
general purpose I/O /SCK
general purpose I/O /SOT
CHAPTER 20 UART
20.4
UART Registers
The following figure shows the UART registers.
■ UART Registers
Figure 20.4-1 UART Registers
- UART0 registers
Address:
000021H, 000020H
bit 15
bit 8
bit 7
bit 0
SCR0 (Serial Control Register)
SMR0 (Serial Mode Register)
000023H, 000022H
SSR0 (Serial Status Register)
RDR0/TDR0 (Rx, Tx Data Register)
000025H, 000024H
ESCR0 (Extended Status/Control Reg.)
ECCR0 (Extended Comm. Contr. Reg.)
000027H, 000026H
BGR01 (Baud Rate Generator Reg. 01)
BGR00 (Baud Rate Generator Reg. 00)
- UART1 registers
Address:
000029H, 000028H
bit 15
bit 8
bit 7
bit 0
SCR1 (Serial Control Register)
SMR1 (Serial Mode Register)
00002BH, 00002AH
SSR1 (Serial Status Register)
RDR1/TDR1 (Rx, Tx Data Register)
00002DH, 00002CH
ESCR1 (Extended Status/Control Reg.)
ECCR1 (Extended Comm. Contr. Reg.)
00002FH, 00002EH
BGR11 (Baud Rate Generator Reg. 11)
BGR10 (Baud Rate Generator Reg. 10)
- UART2 registers
Address:
0000D9H, 0000D8H
bit 15
bit 8
bit 7
bit 0
SCR2 (Serial Control Register)
SMR2 (Serial Mode Register)
0000DBH, 0000DAH
SSR2 (Serial Status Register)
RDR2/TDR2 (Rx, Tx Data Register)
0000DDH, 0000DCH
ESCR2 (Extended Status/Control Reg.)
ECCR2 (Extended Comm. Contr. Reg.)
0000DFH, 0000DEH
BGR21 (Baud Rate Generator Reg. 21)
BGR20 (Baud Rate Generator Reg. 20)
- UART3 registers
Address:
007951H, 007950H
bit 15
bit 8
bit 7
bit 0
SCR3 (Serial Control Register)
SMR3 (Serial Mode Register)
007953H, 007952H
SSR3 (Serial Status Register)
RDR3/TDR3 (Rx, Tx Data Register)
007955H, 007954H
ESCR3 (Extended Status/Control Reg.)
ECCR3 (Extended Comm. Contr. Reg.)
007957H, 007956H
BGR31 (Baud Rate Generator Reg. 31)
BGR30 (Baud Rate Generator Reg. 30)
- UART4 registers
Address:
007959H, 007958H
bit 15
bit 8
bit 7
bit 0
SCR4 (Serial Control Register)
SMR4 (Serial Mode Register)
00795BH, 00795AH
SSR4 (Serial Status Register)
RDR4/TDR4 (Rx, Tx Data Register)
00795DH, 00795CH
ESCR4 (Extended Status/Control Reg.)
ECCR4 (Extended Comm. Contr. Reg.)
00795FH, 00795EH
BGR41 (Baud Rate Generator Reg. 41)
BGR40 (Baud Rate Generator Reg. 40)
333
CHAPTER 20 UART
20.4.1
Serial Control Register (SCR)
This register specifies parity bits, selects the stop bit and data lengths, selects a frame
data format in mode 1, clears the reception error flag, and specifies whether to enable
transmission and reception.
■ Serial Control Register (SCR)
Figure 20.4-2 Configuration of the Serial Control Register (SCR)
Address:
SCR0: 000021H
SCR1: 000029H
SCR2: 0000D9H
SCR3: 007951H
SCR4: 007959H
15
PEN
14
P
13
SBL
12
11
10
9
CL
AD
CRE RXE
8
Initial value
00000000B
TXE
R/W R/W R/W R/W R/W W R/W R/W
bit8
TXE
Transmission enable
0
Disable Transmission
1
Enable Transmission
bit9
RXE
Reception enable
0
Disable Reception
1
Enable Reception
bit10
Clear Reception errors
CRE
write
read
0
ignored
1
Clear all reception
errors (PE, FRE, ORE)
read always returns "0"
bit11
AD
Address / Data bit
0
Data bit
1
Address bit
bit12
CL
Character (Data frame) Length
0
7 bits
1
8 bits
bit13
SBL
Stop bit length
0
1 stop bit
1
2 stop bits
bit14
P
Parity setting
0
Even Parity enabled
1
Odd Parity enabled
bit15
PEN
334
Parity Enable
R/W
:
Readable and writable
0
Parity disabled
W
:
Write only
1
Parity enabled
:
Initial value
CHAPTER 20 UART
Table 20.4-1 Functions of Each Bit of Control Register (SCR)
Bit name
Function
bit15
PEN:
Parity enable bit
This bit selects whether to add a parity bit during transmission or detect it during
reception.
Parity is only provided in mode 0 and in mode 2 if SSM of the ECCR is selected. This bit
is fixed to 0 (no parity) in mode 3 (LIN).
bit14
P:
Parity selection bit
When parity is provided and enabled this bit selects even (0) or odd (1) parity
bit13
SBL:
Stop bit length
selection bit
This bit selects the length of the stop bit of an asynchronous data frame or a synchronous
frame if SSM of the ECCR is selected. This bit is fixed to 0 (1 stop bit) in mode 3 (LIN).
bit12
CL:
Data length selection
bit
This bit specifies the length of transmission or reception data. This bit is fixed to 1 (8
bits) in mode 2 and 3.
bit11
AD:
Address/Data
selection bit
This bit specifies the data format in multiprocessor mode 1. Writing to this bit is
provided for a master CPU, reading from it for slave CPU. A 1 indicates an address
frame, a 0 indicates a usual data frame.
Note:
Please read the hints about using this bit in Section "20.8 Notes on Using UART".
bit10
CRE:
Clear reception error
flags bit
This bit clears the FRE, ORE, and PE flag of the Serial Status Register (SSR).
Writing a 1 to it clears the error flag.
Writing a 0 has no effect.
Reading from it always returns 0.
Note:
Clear reception error flags after the receive operation.
bit9
RXE:
Reception enable bit
This bit enables/disables LIN-UART reception.
If this bit is set to 0, UART disables the reception of data frames.
If this bit is set to 1, UART enables the reception of data frames.
The LIN synch break detection in mode 3 remains unaffected.
Note:
If reception is disabled (RXE=0) during receiving, it is stopped immediately. In this
case, data is not guaranteed.
bit8
TXE:
Transmission enable
bit
This bit enables/disables LIN-UART transmission.
If this bit is set to 0, UART disables the transmission of data frames.
If this bit is set to 1, UART enables the transmission of data frames.
Note:
If transmission is disabled (RXE=0) during transmitting, it is stopped immediately. In
this case, data is not guaranteed.
335
CHAPTER 20 UART
20.4.2
Serial Mode Register (SMR)
This register selects an operation mode and baud rate clock and specifies whether to
enable output of serial data and clocks to the corresponding pin.
■ Serial Mode Register (SMR)
Figure 20.4-3 Configuration of the Serial Mode Register (SMR)
Address:
SMR0: 000020H
SMR1: 000028H
SMR2: 0000D8H
SMR3: 007950H
SMR4: 007958H
7
6
5
4
3
2
1
0
MD1 MD0 OTO EXT REST UPCL SCKE SOE
R/W R/W R/W R/W W
W R/W R/W
Initial value
00000000B
bit0
SOE
Serial data output enable bit of LIN-UART
0
General purpose I/O port
1
LIN-UART serial data output pin
bit1
SCKE
Serial clock output enable bit of LIN-UART
0
General purpose I/O port or LIN-UART clock input pin
1
Serial clock output pin of LIN-UART
bit2
UPCL
LIN-UART programmable clear (Software Reset)
write
read
0
ignored
1
Reset UART
always "0"
bit3
Restart dedicated Reload Counter
REST
write
read
0
ignored
1
Restart Counter
always "0"
bit4
EXT
External Serial Clock Source enable
0
Use internal Baud Rate Generator (Reload Counter)
1
Use external Serial Clock Source
bit5
OTO
One-to-one external clock Input enable
0
Use ext. Clock with Baud Rate Generator (Reload C.)
1
Use external Clock as is
bit7
336
bit6
MD1
MD0
Operation Mode Setting
R/W
:
Readable and writable
0
0
Mode 0: Asynchronous normal
W
:
Write only
0
1
Mode 1: Asynchronous Multiprocessor
:
Initial value
1
0
Mode 2: Synchronous
1
1
Mode 3: Asynchronous LIN
CHAPTER 20 UART
Table 20.4-2 Bit Function of the Serial Mode Register (SMR)
Bit name
Function
bit7
bit6
MD1 and MD0:
Operation mode
selection bits
These two bits sets the UART operation mode.
bit5
OTO:
One-to-one external
clock selection bit
This bit sets an external clock directly to the LIN-UART’s serial clock. This function is
used for operating mode 2 (synchronous) slave mode operation.
bit4
EXT:
External clock
selection bit
This bit executes internal or external clock source for the reload counter
bit3
REST:
Restart of
transmission reload
counter bit
If a 1 is written to this bit the reload counter is restarted. Writing 0 to it has no effect.
Reading from this bit always returns 0.
bit2
UPCL:
UART
programmable clear
bit
Writing a 1 to this bit resets LIN-UART immediately. The register settings are
preserved. Possible reception or transmission will cut off.
All flags (TDRE, RDRF, LBD, PE, ORE, FRE) are cleared and the Reception Data
Register (RDR) contains 00H. Writing 0 to this bit has no effect. Reading from it always
returns 0.
LIN-UART reset should performed after disabling the interrupt enable bits.
bit1
SCKE:
Serial clock output
enable
• This bit controls the serial clock I/O ports.
• When this bit is 0, SCKn pin operate as general purpose I/O port or serial clock input
pin. When this bit is 1, the pin operates as serial clock output pin and outputs clock in
operating mode 2 (synchronous).
Note:
When using SCKn pin as serial clock input (SCKE=0) pin, set the corresponding bit
of DDR as input port. Also, select external clock (EXT = 1) using the external clock
selection bit.
Reference:
When the SCKn pin is assigned to serial clock output (SCKE=1), it functions as the
serial clock output pin regardless of the status of the general purpose I/O ports.
bit0
SOE:
Serial data output
enable bit
• This bit enables or disables the output of serial data.
• When this bit is 0, SOTn pin operates as general purpose I/O pin. When this bit is 1,
SOTn pin operates as serial data output pins (SOT).
Reference:
When the output of serial data is enabled (SOE=1), SOTn pin functions as serial data
output pin (SOT) regardless of the status of general input-output ports.
337
CHAPTER 20 UART
20.4.3
Serial Status Register (SSR)
This register checks the transmission and reception status and error status, and
enables and disables the transmission and reception interrupts.
■ Serial Status Register (SSR)
Figure 20.4-4 Configuration of the Serial Status Register (SSR)
Address:
SSR0: 000023H
SSR1: 00002BH
SSR2: 0000DBH
SSR3: 007953H
SSR4: 00795BH
15
PE
R
14
13
12
11
10
9
ORE FRE RDRF TDRE BDS RIE
R
R
R
Initial value
00001000B
8
TIE
R R/W R/W R/W
bit8
TIE
Transmission Interrupt enable
0
Disables Transmission Interrupt
1
Enables Transmission Interrupt
bit9
RIE
Reception Interrupt enable
0
Disables Reception Interrupt
1
Enables Reception Interrupt
bit10
BDS
Bit direction setting
0
send / receive LSB first
1
send / receive MSB first
bit11
TDRE
Transmission data register empty
0
Transmission data register is full
1
Transmission data register is empty
bit12
RDRF
Reception data register full
0
Reception data register is empty
1
Reception data register is full
bit13
FRE
Framing error
0
No framing error occurred
1
A framing error occurred during reception
bit14
ORE
Overrun error
0
No overrun error occurred
1
An overrun error occurred during reception
bit15
PE
338
Parity error
R/W
:
Readable and writable
0
No parity error occurred
R
:
Flag is read only, write to it has
no effect
1
A parity error occurred during reception
:
Initial value
CHAPTER 20 UART
Table 20.4-3 Functions of Each Bit of Status Register (SSR)
Bit name
Function
bit15
PE:
Parity error flag bit
• This bit is set to 1 when a parity error occurs during reception at PE=1 and is cleared
when 1 is written to the CRE bit of the serial mode register (SMR).
• A reception interrupt request is output when this bit and the RIE bit are 1.
• Data in the reception data register (RDR) is invalid when this flag is set.
bit14
ORE:
Overrun error flag bit
• This bit is set to 1 when an overrun error occurs during reception and is cleared when
0 is written to the CRE bit of the serial mode register (SMR).
• A reception interrupt request is output when this bit and the RIE bit are 1.
• Data in the reception data register (RDR) is invalid when this flag is set.
bit13
FRE:
Framing error flag bit
• This bit is set to 1 when a framing error occurs during reception and is cleared when
0 is written to the CRE bit of the serial mode register 1 (SMR).
• A reception interrupt request is output when this bit and the RIE bit are 1.
• Data in the reception data register (RDR) is invalid when this flag is set.
bit12
RDRF:
Receive data full flag
bit
• This flag indicates the status of the reception data register (RDR).
• This bit is set to 1 when reception data is loaded into RDR and can only be cleared to
0 when the reception data register (RDR) is read.
• A reception interrupt request is output when this bit and the RIE bit are 1.
bit11
TDRE:
Transmission data
empty flag bit
• This flag indicates the status of the transmission data register (TDR).
• This bit is cleared to 0 when transmission data is written to TDR and is set to 1 when
data is loaded into the transmission shift register and transmission starts.
• A transmission interrupt request is generated if both this bit and the TIE bit are 1.
• If the LBR bit in the ECCR register is set to "1" while the TDRE bit is "1", then this
bit once changes to "0". After the completion of LIN synch break generator, the
TDRE bit charges back to "1".
Note:
This bit is set to 1 (TDR empty) as its initial value.
bit10
BDS:
Transfer direction
selection bit
• This bit selects whether to transfer serial data from the least significant bit (LSB
first, BDS=0) or the most significant bit (MSB first, BDS=1).
Note:
The high-order and low-order sides of serial data are interchanged with each other
during reading from or writing to the serial data register. If this bit is set to another
value after the data is written to the RDR register, the data becomes invalid.
This bit is fixed to 0 in mode 3 (LIN)
bit9
RIE:
Reception interrupt
request enable bit
• This bit enables/disables the reception interrupt. If any of the RDRF, PE, ORE and
FRE bits is set and this bit is "1", then a reception interrupt is signaled to the
interrupt controller.
bit8
TIE:
Transmission
interrupt request
enable bit
• This bit enables or disables the transmission interrupt.
• A transmission interrupt request is output when this bit and the TDRE bit are 1.
339
CHAPTER 20 UART
20.4.4
Reception and Transmission Data Register (RDR/TDR)
The reception data register (RDR) holds the received data. The transmission data
register (TDR) holds the transmission data. Both RDR and TDR registers are located at
the same address.
■ Reception and Transmission Data Registers (RDR/TDR)
Figure 20.4-5 Transmission and Reception Data Registers (RDR/TDR)
Address:
RDR0/TDR0: 000022H
RDR1/TDR1: 00002AH
RDR2/TDR2: 0000DAH
RDR3/TDR3: 007952H
RDR4/TDR4: 00795AH
7
6
5
4
3
2
1
0
Initial value
00000000B
R/W R/W R/W R/W R/W R/W R/W R/W
bit 7 to bit 0
R/W
Data Registers
Read
Read from Reception Data Register
Write
Write to Transmission Data Register
R/W: Readable and writable
● Reception:
RDR is the register that contains reception data. The serial data signal transmitted to the SINn pin is
converted in the shift register and stored there. When the data length is 7 bits, the uppermost bit (D7)
contains 0. When reception is complete the data is stored in this register and the reception data full flag bit
(SSR: RDRF) is set to 1. If a reception interrupt request is enabled at this point, a reception interrupt
occurs.
Read RDR when the RDRF bit of the status register (SSR) is 1. The RDRF bit is cleared automatically to 0
when RDR is read. Also the reception interrupt is cleared if it is enabled and no error has occurred.
Data in RDR is invalid when a reception error occurs (SSR: PE, ORE, or FRE = 1).
340
CHAPTER 20 UART
● Transmission:
When data to be transmitted is written to the transmission data register in transmission enable state, it is
transferred to the transmission shift register, then converted to serial data, and transmitted from the serial
data output terminal (SOTn pin). If the data length is 7 bits, the uppermost bit (D7) is not sent.
When transmission data is written to this register, the transmission data empty flag bit (SSR: TDRE) is
cleared to 0. When transfer to the transmission shift register is complete and starts, the bit is set to 1. When
the TDRE bit is 1, the next part of transmission data can be written. If output transmission interrupt
requests have been enabled, a transmission interrupt is generated. Write the next part of transmission data
when a transmission interrupt is generated or the TDRE bit is 1.
Note:
TDR is a write-only register and RDR is a read-only register. These registers are located in the same
address, so the read value is different from the write value. Therefore, instructions that perform a
read-modify-write (RMW) operation, such as the INC/DEC instruction, cannot be used.
341
CHAPTER 20 UART
20.4.5
Extended Status/Control Register (ESCR)
This register provides several LIN functions, direct access to the SINn and SOTn pin
and setting for UART synchronous clock mode.
■ Extended Status/Control Register (ESCR)
Figure 20.4-6 Configuration of the Extended Status/Control Register (ESCR)
9
8
Address: 15 14 13 12 11 10
ESCR0: 000025H
LBIE LBD LBL1 LBL0 SOPE SIOP CCO SCES
ESCR1: 00002DH
ESCR2: 0000DDH
R/W R/W R/W R/W R/W R/W R/W R/W
ESCR3: 007955H
ESCR4: 00795DH
Initial value
0 0 0 0 0 1 0 0B
bit8
SCES
Sampling Clock Edge Selection (Mode 2)
0
Sampling on rising clock edge (normal)
1
Sampling on falling clock edge (inverted clock)
bit9
CCO
Continuous Clock Output (Mode 2)
0
Continuous Clock Output disabled
1
Continuous Clock Output enabled
bit10
Serial Input / Output Pin Access
SIOP
write (if SOPE = "1")
read
0
SOT is forced to "0"
1
SOT is forced to "1"
reading the actual value of
SIN
bit11
SOPE
Enable Serial Output pin direct Access
0
Serial Output pin direct access disable
1
Serial Output pin direct access enable
bit12
bit 13
LBL0
LBL1
0
0
LIN break length 13 bit times
LIN synch break length select
1
0
LIN break length 14 bit times
0
1
LIN break length 15 bit times
1
1
LIN break length 16 bit times
bit14
LIN synch break detected flag
LBD
write
read (*1)
0
Clear LIN synch break
detected flag
No LIN synch break detected
1
Ignored
LIN synch break detected
bit15
LBIE
R/W
X
342
:
:
:
Readable and writable
Indeterninate
Initial value
LIN synch break detection Interrupt enable
0
LIN synch break interrupt disable
1
LIN synch break interrupt enable
CHAPTER 20 UART
Table 20.4-4 Function of Each Bit of the Extended Status/Control Register (ESCR)
Bit name
Function
bit15
LBIE:
LIN synch break
detection interrupt
enable bit
This bit enables/disables LIN synch break interrupt
LIN synch break interrupt is connected to the reception interrupt. When the LBD bit is
set and this bit is "1", a reception interrupt is signaled to the interrupt controller. This bit
is fixed to "0" in operation mode 1 and 2.
bit14
LBD:
LIN synch break
detected flag
This bit goes 1 if a LIN synch break was detected in operating mode 3. Writing a 0 to it
clears this bit and the corresponding interrupt, if it is enabled.
It is recommended to write "0" to the RXE bit in the SCR register before using this bit.
Read-modify-write instructions always return 1. Note that this dose not indicate a LIN
synch break.
bit13
bit12
LBL1/0:
LIN synch break
length selection
These two bits determine how many serial bit times the LIN synch break is generated by
UART. Receiving a LIN synch break is always fixed to 11 bit times.
bit11
SOPE:
Serial Output pin
direct access enable*
Setting this bit to 1 enables the direct write to the SOTn pin, if SOE = 1 (SMR). *
bit10
SIOP:
Serial Input/Output
Pin direct access *
Normal read instructions always return the actual value of the SINn pin. Writing to it
sets the bit value to the SOTn pin, if SOPE = 1. During a Read-Modify-Write
instruction the bit returns the SOTn value in the read cycle. *
bit9
CCO:
Continuos Clock
Output enable bit
This bit enables a continuos serial clock at the SCKn pin if UART operates in master
mode 2 (synchronous) and the SCKn pin is configured as a clock output.
Note: When CCO bit is "1", use SSM bit of ECCR as setting to "1".
bit8
SCES:
Serial clock edge
selection bit
This bit inverts the serial clock signal in operation mode 2 (synchronous
communication). Receiving data is sampled at the falling edge of the internal clock. If
the MS bit of the ECCR register is "0" (master mode) and the SCKE bit of the SMR
register is "1" (clock output enabled), the output clock signal is also inverted.
During operation mode 0, 1, 3, please set this bit to 0.
*: See Table 20.4-5.
Table 20.4-5 Description of the Interaction of SOPE and SIOP
SOPE
SIOP
Writing to SIOP
Reading from SIOP
0
R/W
has no effect on SOTn, but holds the written value
returns current value of SINn
1
R/W
write "0" or "1" to SOTn
returns current value of SINn
1
RMW
reads current value of SOTn and write it back
343
CHAPTER 20 UART
20.4.6
Extended Communication Control Register (ECCR)
The extended communication control register provides bus idle recognition interrupt
settings, synchronous clock settings, and the LIN break generation.
■ Extended Communication Control Register (ECCR)
Figure 20.4-7 Configuration of the Extended Communication Control Register (ECCR)
Address:
ECCR0: 000024H
ECCR1: 00002CH
ECCR2: 0000DCH
ECCR3: 007954H
ECCR4: 00795CH
7
6
LBR
-
5
4
3
2
MS SCDE SSM
W R/W R/W R/W
-
1
0
RBI
TBI
R
R
Initial value
0 0 0 0 0 0 X XB
bit0
Transmission bus idle
TBI *
0
Transmission is ongoing
1
no transmission activity
bit1
Reception bus idle
RBI *
0
Reception is ongoing
1
no reception activity
bit2
Unued bit
BIE *
Reading value is undefined. Always write "0".
bit3
SSM
Synchronous start/stop bits in mode 2
0
No start/stop bits in synchronous mode 2
1
Enable start/stop bits in synchronous mode 2
bit4
SCDE
Serial Clock Delay enable in mode 2
0
disable clock delay
1
enable clock delay
bit5
MS
Master / Slave function in mode 2
0
Master mode (generating serial clock)
1
Slave mode (receiving external serial clock)
bit6
Generating LIN break
LBR
write
0
ignored
1
Generate LIN break
read
always read "0"
bit7
0
R/W
:
Readable and writable
R
:
Read only
W
:
Write only
X
:
Indeterminate
:
Undefined
:
Initial value
-
344
Read value is undefined / always write "0"
* : Not used in mode2 when SSM = 0
CHAPTER 20 UART
Table 20.4-6 Function of Each Bit of the Extended Communication Control Register (ECCR)
Bit name
Function
bit7
-
This bit is undefined. Always write "0".
bit6
LBR: Generating
LIN synch break bit
Writing a 1 to this bit generates a LIN synch break of the length selected by the LBL0/
LBL1 bits of the ESCR, if operation mode 3 is selected. Setting to "0" in operation
mode 0.
bit5
MS:
Master/Slave mode
selection bit
This bit selects master or slave mode of UART in synchronous mode 2. If master is
selected UART generates the synchronous clock by itself. If slave mode is selected,
UART receives external serial clock.
This bit is fixed to "0" in operation mode 0, 1 and 3.
Note:
If slave mode is selected, the clock source must be external and set to "One-to-One"
(SMR: SCKE = 0, EXT = 1, OTO = 1).
bit4
SCDE:
Serial clock delay
enable bit
If this bit is set the serial output clock is delayed as shown in Figure 20.7-4 if UART
operates in master mode 2.
bit3
SSM:
Start/Stop bit mode
enable
This bit adds start and stop bits to the synchronous data format in operation mode 2. It is
ignored in mode 0, 1, and 3.
bit2
Unused bit
Unused bit. Reading value is undefined. Always write to "φ"
bit1
RBI:
Reception bus idle
flag bit
This bit is "1" if there is no reception activity on the SINn pin and it is kept at "1".
Do not use this bit in mode 2 when SSM=0.
bit0
TBI:
Transmission bus
idle flag bit
This bit is "1" if there is no transmission activity on the SOTn pin.
Do not use this bit in mode 2 when SSM=0.
345
CHAPTER 20 UART
20.4.7
Baud Rate/Reload Counter Register 0 and 1 (BGRn0/
BGRn1)
The baud rate/reload counter registers set the division ratio for the serial clock. Also the
actual count of the transmission reload counter can be read.
■ Baud Rate Generator Register (BGRn0/BGRn1)
Figure 20.4-8 Baud Rate Generator Register (BGRn0/BGRn1)
Address:
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Initial value
00000000B
BGR00: 000026H
00000000B
BGR01: 000027H
BGR10: 00002EH R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
BGR11: 00002FH
BGR20: 0000DEH
BGR21: 0000DFH
BGR30: 007956H
bit 7 to bit 0
BGR31: 007957H
Baud rate Generator Register n0
BGR40: 00795EH
BGR7 to BGR0
write
Write bit 7 to 0 of reload value to counter
BGR41: 00795FH
read
Read bit 7 to 0 of transmittion reload counter
bit 14 to bit 8
Baud rate Generator Register n1
BGR14 to BGR8
write
Write bit 14 to 8 of reload value to counter
read
Read bit 14 to 8 of transmittion reload counter
bit 15
Undefined bit
R/W
:
returns "0"
Readable and writable
n = 0, 1, 2, 3, 4
■ Baud Rate/Reload Counter Register
The baud rate/reload counter registers determine the division ratio for the serial clock.
Both registers can be read or written via byte or word access.
346
CHAPTER 20 UART
20.5
UART Interrupts
UART uses both reception and transmission interrupts. An interrupt request can be
generated for either of the following causes:
• Receive data is set in the Reception Data Register (RDR), or a reception error occurs
• Transmission data is transferred from the Transmission Data Register (TDR) to the
transmission shift register and started
• A LIN break is detected
The extended intelligent I-O service (EI2OS) and DMA is available for these interrupts.
■ LIN-UART Interrupts
Table 20.5-1 Interrupt Control Bits and Interrupt Causes of LIN-UART
Reception/
transmissio
n/ICU
Interrupt
request
flag bit
Flag
Register
Operation
mode
0
Reception
1
2
Interrupt cause
How to clear the
Interrupt Request
3
RDRF
SSR
❍ ❍ ❍ ❍
ORE
SSR
❍ ❍ ❍ ❍ Overrun error
FRE
SSR
❍ ❍ *
❍ Framing error
PE
SSR
❍ x
*
x
Parity error
LBD
ESCR
x
x
❍
LIN synch break
detected
Transmission
TDRE
SSR
❍ ❍ ❍ ❍ TDR empty
Input Capture
Unit
ICP0/ICP1/
ICP6/ICP7
ICS01/
ICS67
x
x
x
ICP0/ICP1/
ICP6/ICP7
ICS01/
ICS67
x
x
x
x
Interrupt
cause
enable bit
Receive data is
written to RDR
SSR: RIE
Receive data is
read
"1" is written to
clear rec. error bit
(SCR: CRE)
ESCR: LBIE
"0" is written to
ESCR: LBD
SSR: TIE
Write data to TDR
1st falling edge of
❍ LIN synch field
ICS01/ICS45:
ICE0/ICE1/
ICE6/ICE7
Disable ICP0/
ICP1/ICP6/ICP7
temporary
5th falling edge of
❍ LIN synch field
ICS01/ICS45:
ICE0/ICE1/
ICE6/ICE7
Disable ICP0/
ICP1/ICP6/ICP7
❍: Used
x: Unused
*: Only available if ECCR/SSM = 1
347
CHAPTER 20 UART
● Reception Interrupt
If one of the following events occurs in reception mode, the corresponding flag bit of the Serial Status
Register (SSR) is set to "1":
• Data reception is complete, i. e. the received data was transferred from the serial input shift register to
the Reception Data Register (RDR) and data can be read: RDRF
• Overrun error, i. e. RDRF = 1 and RDR was not read by the CPU and received next serial data: ORE
• Framing error, i. e. a stop bit was expected, but a "0"-bit was received: FRE
• Parity error, i. e. a wrong parity bit was detected: PE
If at least one of these flag bits above go "1" and the reception interrupt is enabled (SSR: RIE = 1), a
reception interrupt request is generated.
If the Reception Data Register (RDR) is read, the RDRF flag is automatically cleared to "0". Note that this
is the only way to reset the RDRF flag. The error flags are cleared to "0", if a "1" is written to the Clear
Reception Error (CRE) flag bit of the Serial Control Register (SCR). The RDR contains only valid data if
the RDRF flag is "1" and no error bits are set.
Note, that the CRE flag is "write only" and by writing a "1" to it, it is internally held to "1" for one machine
clock cycle.
● Transmission Interrupt
If transmission data is transferred from the Transmission Data Register (TDR) to the transfer shift register
and transfer is started, the Transmission Data Register Empty flag bit (TDRE) of the Serial Status Register
(SSR) is set to "1". In this case an interrupt request is generated, if the Transmission Interrupt Enable (TIE)
bit of the SSR was set to "1" before.
Note, that the initial value of TDRE (after hardware or software reset) is "1". So an interrupt is generated
immediately then, if the TIE flag is set to "1". Also note, that the only way to reset the TDRE flag is writing
data to the Transmission Data Register (TDR).
● LIN Synchronization Break Interrupt
This paragraph is only relevant, if UART operates in mode 3 as a LIN slave.
If the bus (serial input) goes "0" (dominant) for more than 11 bit times, the LIN Break Detected (LBD) flag
bit of the Extended Status/Control Register (ESCR) is set to "1". Note, that in this case after 9 bit times the
reception error flags are set to "1", therefore the RXE flag has to set to "0", if only a LIN synch break detect
is desired.
The interrupt and the LBD flag are cleared after writing a "1" to the LBD flag. This has to be performed
before input capture interrupt for LIN sync field.
● LIN Synchronization Field Edge Detection Interrupts
This paragraph is only relevant, if UART operates in mode 3 as a LIN slave. After a LIN break detection
the next falling edge of the reception bus is indicated by UART. Simultaneously an internal signal
connected to the ICU1/ICU5 is set to "1". This signal is reset to "0" after the fifth falling edge of the LIN
Synchronization Field. In both cases the ICU1/5 generates an interrupt, if "both edge detection" and the
ICU1/ICU5 interrupt are enabled. The difference of the ICU1/5 counter values is the serial clock multiplied
by 8. Dividing it by 8 results in the new detected and calculated baud rate for the dedicated reload counter.
This value - 1 has then to be written to the Baud Rate Generator Registers (BGR1/BGR0).There is no need
to restart the reload counter, because it is automatically reset if a falling edge of a start bit is detected.
348
CHAPTER 20 UART
■ LIN-UART Interrupts and EI2OS
Table 20.5-2 UART Interrupt and EI2OS
Interrupt cause
Interrupt
number
Interrupt control
register
Vector table address
Register
name
Address
Lower
Upper
Bank
2
EI OS
DMA
channel
number
UART0 reception
interrupt
#35(23H)
ICR12
0000BCH
FFFF70H
FFFF71H
FFFF72H
*1
DRQ10
UART0 transmission
interrupt
#36(24H)
ICR12
0000BCH
FFFF6CH
FFFF6DH
FFFF6EH
*2
DRQ11
UART1/UART3
reception interrupt
#37(25H)
ICR13
0000BDH
FFFF68H
FFFF69H
FFFF6AH
*1
DRQ12
UART1/UART3
transmission interrupt
#38(26H)
ICR13
0000BDH
FFFF64H
FFFF65H
FFFF66H
*2
DRQ13
UART2/UART4
reception interrupt
#39(27H)
ICR14
0000BEH
FFFF60H
FFFF61H
FFFF62H
*1
DRQ14
UART2/UART4
transmission interrupt
#40(28H)
ICR14
0000BEH
FFFF5CH
FFFF5DH
FFFF5EH
*2
DRQ15
*1: Provided with a function that detects a UART reception error and stops EI2OS.
*2: Usable when ICR12, ICR13 and ICR14 or interrupt causes that share an interrupt vector are not used.
■ UART EI2OS Functions
UART has a circuit for operating EI2OS, which can be started up for either reception or transmission
interrupts.
● For Reception
EI2OS can be used regardless of the status of other resources.
● For Transmission
UART shares the interrupt registers with the UART reception interrupts. Therefore, EI2OS can be started
up only when no UART reception interrupts are used.
349
CHAPTER 20 UART
20.5.1
Reception Interrupt Generation and Flag Set Timing
The following are the reception interrupt causes: completion of reception (SSR: RDRF)
and occurrence of a reception error (SSR: PE, ORE, or FRE).
■ Reception Interrupt Generation and Flag Set Timing
Generally a reception interrupt is generated, if the received data is complete (RDRF = 1) and the Reception
Interrupt Enable (RIE) flag bit of the Serial Status Register (SSR) was set to "1". This interrupt is generated
if the first stop bit is detected in mode 0, 1, 2 (if SSM = 1), 3, or the last data bit was read in mode 2 (if
SSM = 0).
Note:
If a reception error has occurred, the Reception Data Register (RDR) contains invalid data in each
mode.
Figure 20.5-1 Reception Operation and Flag Set Timing
Receive data
(mode 0/3)
ST
Receive data
(mode 1)
ST
Receive data
(mode 2)
PE
(*1)
D0
D0
D0
D1
D2
....
D5
D6
D7/P
SP
ST
D1
D2
....
D6
D7
A/D
SP
ST
D2
....
D5
D6
D7
D0
D1
D4
, FRE
RDRF
ORE (*2)
(if RDRF = "1")
reception interrupt occurs
*1: The PE flag will always remain "0" in mode 1 or 3.
*2: ORE only occurs, if the reception data is not read by the CPU (RDRF = 1) and
another data frame is read.
ST: Start Bit
SP: Stop Bit
A/D: Mode 1 (multi processor) address/data selection bit
Note:
The example in Figure 20.5-1 does not show all possible reception options for mode 0 and 3. Here it
is: "7p1" and "8N1" (p = E [even] or O [odd]).
350
CHAPTER 20 UART
Figure 20.5-2 ORE Set Timing
Receive
data
RDRF
ORE
351
CHAPTER 20 UART
20.5.2
Transmission Interrupt Generation and Flag Set Timing
A transmission interrupt is generated when the transmission data is transferred from
transmission data register (TDR) to transmission shift register and started.
■ Transmission Interrupt Generation and Flag Set Timing
A transmission interrupt is generated, when the next data to be sent is ready to be written to the
Transmission Data Register (TDR), i. e. the TDR is empty, and the transmission interrupt is enabled by
setting the Transmission Interrupt Enable (TIE) bit of the Serial Status Register (SSR) to "1".
The Transmission Data Register Empty (TDRE) flag bit of the SSR indicates an empty TDR. Because the
TDRE bit is "read only", it only can be cleared by writing data into TDR.
The following figure demonstrates the transmission operation and flag set timing for the four modes of
UART.
Figure 20.5-3 Transmission Operation and Flag Set Timing
transmission interrupt occurs
transmission interrupt occurs
Mode 0, 1 or 3:
write to TDR
TDRE
serial output
ST D0 D1 D2 D3 D4 D5 D6 D7
transmission interrupt occurs
P SP ST D0 D1 D2 D3 D4 D5 D6 D7 P SP
AD
AD
transmission interrupt occurs
Mode 2 (SSM = 0):
write to TDR
TDRE
serial output
ST: Start bit
D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4
D0 to D7: data bits
P: Parity
SP: Stop bit
AD: Address/data selection bit (mode1)
Note:
The example in Figure 20.5-3 does not show all possible transmission options for mode 0. Here it is:
"8p1" (p = E [even] or O [odd]). Parity is not provided in mode 3 or 2, if SSM = 0.
352
CHAPTER 20 UART
■ Transmission Interrupt Request Generation Timing
If the TDRE flag is set to "1" when a transmission interrupt is enabled (SSR: TIE=1), transmission interrupt
request is generated.
Note:
A transmission completion interrupt is generated immediately after the transmission interrupt is
enabled (TIE=1) because the TDRE bit is set to 1 as its initial value. TDRE is a read-only bit that can
be cleared only by writing new data to the output data register (TDR). Carefully specify the
transmission interrupt enable timing.
353
CHAPTER 20 UART
20.6
UART Baud Rates
One of the following can be selected for the UART serial clock source:
• Dedicated baud rate generator (Reload Counter)
• External clock as it is (clock input to the SCKn pin)
• External clock connected to the baud rate generator (Reload Counter)
■ UART Baud Rate Selection
The baud rate selection circuit is designed as shown below. One of the following three types of baud rates
can be selected:
● Baud rates determined using the dedicated baud rate generator (reload counter)
UART has two independent internal reload counters for transmission and reception serial clock. The baud
rate can be selected via the 15-bit reload value determined by the Baud Rate Generator Register 0 and 1
(BGRn0/BGRn1).
The reload counter divides the machine clock by the value set in the Baud Rate Generator Register 0 and 1.
● Baud rates determined using external clock (one-to-one mode)
The clock input from UART clock pulse input pins (SCK) is used as it is (synchronous). Any baud rate less
than the machine clock divided by 4 and is divisible can be set externally.
● Baud rates determined using the dedicated baud rate generator with external clock
An external clock source can also be connected internally to the reload counter. In this mode it is used
instead of the internal machine clock. This was designed to use quartz oscillators with special frequencies
and having the possibility to divide them.
354
CHAPTER 20 UART
Figure 20.6-1 Baud Rate Selection Circuit (Reload Counter)
REST
Start bit falling
edge detected
Reload Value: v
Rxc = 0?
Reception
15-bit Reload Counter
set
FF
Reload
Rxc = v/2?
0
Reception
Clock
reset
1
Reload Value: v
Machine clock
0
SCKn
(external
clock
input)
EXT
Txc = 0?
Transmission
15-bit Reload Counter
1
Count Value: Txc
set
Txc = v/2?
OTO
FF
Reload
0
reset
1
Transmission
Clock
Internal data bus
EXT
REST
OTO
SMRn
register
BGR14
BGR13
BGR12
BGR11
BGR10
BGR9
BGR8
BGRn1
register
BGR7
BGR6
BGR5
BGR4
BGR3
BGR2
BGR1
BGR0
BGRn0
register
n = 0, 1, 2, 3, 4
355
CHAPTER 20 UART
20.6.1
Setting the Baud Rate
This section describes how the baud rates are set and the resulting serial clock
frequency is calculated.
■ Calculating the Baud Rate
The both 15-bit reload counters are programmed by the baud rate generator registers 1, 0 (BGR). The
following calculation formula should be used to set the desired baud rate:
Reload Value:
v = [φ / b] - 1,
where φ is the machine clock, b the baud rate and [] gaussian brackets (mathematical rounding function).
● Example of calculation
If the CPU clock is 16 MHz and the desired baud rate is 19200 bps baud then the reload value v is:
v = [16 × 106 / 19200] - 1 = 832
The exact baud rate can then be recalculated: bexact = φ / (v + 1), here it is: 16 × 106 / 833 = 19207.6831
Note:
Setting the reload value to 0 stops the reload counter. For this reason the minimum division ratio is
2. For asynchronous communication, the reload value must be greater than equal to 4 because 5
times over-sampling is performed internally.
356
CHAPTER 20 UART
■ Suggested Division Ratios for Different Machine Speeds and Baud Rates
The following settings are suggested for different MCU clock speeds and baud rates:
Table 20.6-1 Suggested Baud Rates and Reload Values at Different Machine Speeds.
Baud
rate
(bps)
8 MHz
10 MHz
16 MHz
20 MHz
24 MHz
value
dev.
value
dev.
value
dev.
value
dev.
value
dev.
4M
-
-
-
-
-
-
4
0
5
0
2M
-
-
4
0
7
0
9
0
11
0
1M
7
0
9
0
15
0
19
0
23
0
500000
15
0
19
0
31
0
39
0
47
0
460800
-
-
-
-
-
-
-
-
51
-0.16
250000
31
0
39
0
63
0
79
0
95
0
230400
-
-
-
-
-
-
-
-
103
-0.16
153600
51
-0.16
64
-0.16
103
-0.16
129
-0.16
155
-0.16
125000
63
0
79
0
127
0
159
0
191
0
115200
68
-0.64
86
0.22
138
0.08
173
0.22
207
-0.16
76800
103
-0.16
129
-0.16
207
-0.16
259
-0.16
311
-0.16
57600
138
0.08
173
0.22
277
0.08
346
-0.06
416
0.08
38400
207
-0.16
259
-0.16
416
0.08
520
0.03
624
0
28800
277
0.08
346
<0.01
554
-0.01
693
-0.06
832
-0.03
19200
416
0.08
520
0.03
832
-0.03
1041
0.03
1249
0
10417
767
<0.01
959
<0.01
1535
<0.01
1919
<0.01
2303
<0.01
9600
832
0.04
1041
0.03
1666
0.02
2083
0.03
2499
0
7200
1110
<0.01
1388
<0.01
2221
<0.01
2777
<0.01
3332
<0.01
4800
1666
0.02
2082
-0.02
3332
<0.01
4166
<0.01
4999
0
2400
3332
<0.01
4166
<0.01
6666
<0.01
8332
<0.01
9999
0
1200
6666
<0.01
8334
0.02
13332
<0.01
16666
<0.01
19999
0
600
13332
<0.01
16666
<0.01
26666
<0.01
-
-
-
-
300
26666
<0.01
-
-
-
-
-
-
-
-
Notes:
1) Deviations are given in%.
2) Maximum Synchronous Baud Rate: MCU-Clock div. by 5.
357
CHAPTER 20 UART
■ Using External Clock
If the EXT bit of the SMR is set, an external clock is selected, which has to be connected to the SCKn pin.
The external clock is used in the same way as the machine clock to the baud rate reload counter.
If One-to-one External Clock Input Mode (SMR: OTO) is selected the SCKn signal is directly connected to
the UART serial clock inputs. This is needed for the UART synchronous mode 2 operating as slave device.
Note, that in any case the resulting clock signal is synchronized to the machine clock in the UART module.
This means that indivisible clock rates will result in phase unstable signals.
■ Counting Example
Assume the reload value is 832. The Figure 20.6-2 demonstrates the behavior of both Reload Counters:
Figure 20.6-2 Counting Example of the Reload Counters
Transmission/
Reception Clock
Reload
Count
001
000
832
831
830
829
828
827
413
412
411
410
reload count value
Transmission/
Reception Clock
Reload
Count
417
416
415
414
Note:
The falling edge of the Serial Clock Signal always occurs after | (v + 1) / 2 |.
358
CHAPTER 20 UART
20.6.2
Restarting the Reload Counter
The Reload Counters can be restarted of the following reasons:
Transmission and reception reload counter:
• Global MCU reset
• UART programmable clear (SMR:UPCL bit)
• User programmable restart (SMR: REST bit)
Reception reload counter:
• Start bit falling edge detection in asynchronous mode
■ Programmable Restart
If the REST bit of the Serial Mode Register (SMR) is set by the user, both Reload Counters are restarted at
the next clock cycle. This feature is intended to use the Transmission Reload Counter as a small timer.
The following figure illustrates a possible usage of this feature (assume that the reload value is 100.)
Figure 20.6-3 Reload Counter Restart Example
MCU
Clock
Reload
Counter
Clock
Outputs
REST
Reload
Value
37
36
35
100
99
98
97
96
95
94
93
92
91
90
89
88
87
Read
BGR0/1
Data
Bus
90
: don’t care
In this example the number of MCU clock cycles (cyc) after REST is then:
cyc = v - c + 1 = 100 - 90 + 1 = 11,
where v is the reload value and c is the read counter value.
Note:
If UART is reset by setting SMR:UPCL, the Reload Counters will restart too.
359
CHAPTER 20 UART
• Automatic restart
In asynchronous UART mode if a falling edge of a start bit is detected the Reception Reload Counter is
restarted. This is intended to synchronize the serial input shifter to the incoming serial data stream.
● Clearing reload counters
The baud rate reload/counter register (BGRn1 and BGRn0) and the baud rate reload counters are cleared to
"0" by the MCU global reset and the counters stops. The reload counters are cleared to "0" by writing "1" to
the UPCL bit in the SMR register. However the value stored in the reload register is kept unchanged and
the counters start from reload value immediately. Writing "0" to the REST bit does not clear the counters
and they restart from reload value immediately.
360
CHAPTER 20 UART
20.7
Operation of UART
UART operates in operation mode 0 for normal bidirectional serial communication, in
mode 2 and 3 in bidirectional communication as master or slave, and in mode 1 as
master or slave in multiprocessor communication.
■ Operation of UART
● Operation modes
There are four UART operation modes: modes 0 to 3. As listed in Table 20.7-1, an operation mode can be
selected according to the communication method.
Table 20.7-1 UART Operation Mode
Data length
Operation mode
0
Normal mode
1
Multiprocessor
2
Normal mode
3
LIN mode
Parity
disabled
Parity
enabled
7 or 8
-
7 or 8 + 1*2
8
8
-
Synchronization
of mode
Length
of stop
bit
Data bit
direction
Asynchronous
1 or 2
L/M
Asynchronous
1 or 2
L/M
Synchronous
0, 1 or 2
L/M
Asynchronous
1
L
*1
*1: means the data bit transfer format: LSB or MSB first
*2: "+1" means the indicator bit of the address/data selection in the multiprocessor mode, instead of
parity.
Note:
Mode 1 operation is supported both for master or slave operation of UART in a master-slave
connection system. In Mode 3 the UART function is locked to 8N1-Format, LSB first.
If the mode is changed, UART cuts off all possible transmission or reception and awaits then new
action.
361
CHAPTER 20 UART
■ Inter-CPU Connection Method
External Clock One-to-one connection (normal mode) and master-slave connection (multiprocessor mode)
can be selected. For either connection method, the data length, whether to enable parity, and the
synchronization method must be common to all CPUs. Select an operation mode as follows:
• In the one-to-one connection method, operation mode 0 or 2 must be used in the two CPUs. Select
operation mode 0 for asynchronous transfer mode and operation mode 2 for synchronous transfer mode.
Note, that one CPU has to set to the master and the other to the slave in synchronous mode 2.
• Select operation mode 1 for the master-slave connection method and use it either for the master or slave
system.
■ Synchronization Methods
In asynchronous operation UART reception clock is automatically synchronized to the falling edge of a
received start bit.
In synchronous mode the synchronization is performed either by the clock signal of the master device or by
UART itself if operating as master.
■ Signal Mode
UART can treat data only in non-return to zero (NRZ) format.
■ Operation Enable Bit
UART controls both transmission and reception using the operation enable bit for transmission (SCR:
TXE) and reception (SCR: RXE).
• If reception operation is disabled during reception (data is input to the reception shift register), finish
frame reception and read the received data of the reception data register (RDR). Then stop the reception
operation.
• If the transmission operation is disabled during transmission (data is output from the transmission shift
register), wait until there is no data in the transmission data register (TDR) before stopping the
transmission operation.
362
CHAPTER 20 UART
20.7.1
Operation in Asynchronous Mode
(Operation Modes 0 and 1)
When UART is used in operation mode 0 (normal mode) or operation mode 1
(multiprocessor mode), the asynchronous transfer mode is selected.
■ Operation in Asynchronous Mode
● Transfer data format
Generally each data transfer in the asynchronous mode operation begins with the start bit (low-level on
bus) and ends with at least one stop bit (high-level). The direction of the bit stream (LSB first or MSB first)
is determined by the BDS bit of the Serial Status Register (SSR). The parity bit (if enabled) is always
placed between the last data bit and the (first) stop bit.
In operation mode 0 the length of the data frame can be 7 bits or 8 bits, with or without parity, and 1 or 2
stop bits.
In operation mode 1 the length of the data frame can be 7 bits or 8 bits with a following address-/dataselection bit instead of a parity bit. 1 or 2 stop bits can be selected.
The calculation formula for the bit length of a transfer frame is:
Length = 1 + d + p + s
(d = number of data bits [7 or 8], p = parity [0 or 1], s = number of stop bits [1 or 2]
Figure 20.7-1 Transfer Data Format (Operation Modes 0 and 1))
*1
*2
Operation mode 0
ST
D0
D1
D2
D3
D4
D5
D6
D7/P
SP SP
Operation mode 1
ST
D0
D1
D2
D3
D4
D5
D6
D7 A/D
SP
*1 D7 (bit 7) if parity is not provided and data length is 8 bits
P (parity) if parity is provided and data length is 7 bits
*2 only if SBL bit of SCR is set to 1
ST: Start Bit
SP: Stop Bit
A/D: Address/data selection bit in mode 1 (multiprocessor mode)
Note:
If BDS bit of the Serial Status Register (SSR) is set to "1" (MSB first), the bit stream processes as:
D7, D6, ..., D1, D0, (P).
During Reception both stop bits are detected, if selected. But the Reception data register full (RDRF) flag
will go "1" at the first stop bit. The bus idle flag (RBI of ECCR) goes "1" after the second stop bit if no
further start bit is detected. (The second stop bit belongs to "bus activity", although it is just mark level.)
363
CHAPTER 20 UART
● Transmission operation
If the Transmission Data Register Empty (TDRE) flag bit of the Serial Status Register (SSR) is "1",
transmission data is allowed to be written to the Transmission Data Register (TDR). When data is written,
the TDRE flag goes "0". If the transmission operation is enabled by the TXE-Bit ("1") of the Serial Control
Register (SCR), the data is written next to the transmission shift register and the transmission starts at the
next clock cycle of the serial clock, beginning with the start bit. Thereby the TDRE flag goes "1", so that
new data can be written to the TDR.
If transmission interrupt is enabled (TIE = 1), the interrupt is generated by the TDRE flag. Note, that the
initial value of the TDRE flag is "1", so that in this case if TIE is set to "1" an interrupt will occur
immediately.
When the character length is set to 7 bits (CL=0), the unused bit of the TDR is always the MSB,
independently from the bit direction setting in the BDS bit (LSB first or MSB first).
● Reception operation
Reception operation is performed when it is enabled by the Reception Enable (RXE) flag bit of the SCR. If
a start bit is detected, a data frame is received according to the format specified by the SCR. In case of
errors, the corresponding error flags are set (PE, ORE, FRE). After the reception of the data frame the data
is transferred from the serial shift register to the Reception Data Register (RDR) and the Receive Data
Register Full (RDRF) flag bit of the SSR is set. The data then has to be read by the CPU. By doing so, the
RDRF flag is cleared. If reception interrupt is enabled (RIE = 1), the interrupt is simply generated by the
RDRF.
When the character length is set to 7 bits (CL=0), the unused bit of the RDR is always the MSB,
independently from the bit direction setting in the BDS bit (LSB first or MSB first).
Note:
Only when the RDRF flag bit is set and no errors have occurred the Reception Data Register (RDR)
contains valid data.
● Used clock
Use the internal clock or external clock. Select the baudrate generator (SMR: EXT = 0 or 1, OTO = 0) for
desired baudrate.
● Stop bit, error detection, and parity:
Number of stop bit, 1 or 2 can be specified by the SBL bit of the SCR register. When receiving and 2-bit is
specified as the stop bit, the second stop bit is checked in addition to the first stop bit. The RBI (bus idle)
flag is set after the second stop bit. However the RDRF flag is set when the first stop bit is received. In
mode 0, parity error, overrun error and framing error are checked. In mode 1, parity check is not supported
and overrun error and framing error are checked. The PEN bit of the SCR register enables/disables the
parity bit and the P bit specifies even or odd parity in mode 0.
364
CHAPTER 20 UART
20.7.2
Operation in Synchronous Mode (Operation Mode 2)
The clock synchronous transfer method is used for UART operation mode 2 (normal
mode).
■ Operation in Synchronous Mode (Operation Mode 2)
● Transfer data format
In the synchronous mode, 8-bit data is transferred without start or stop bits if the SSM bit of the Extended
Communication Control Register (ECCR) is 0. The figure below illustrates the data format during a
transmission in the synchronous operation mode.
Figure 20.7-2 Transfer Data Format (Operation Mode 2)
Reception or transfer data
(ECCR:SSM=0, SCR:PEN=0)
D0
D1
D2
D3
D4
D5
D6
D7
Reception or transfer data
(ECCR:SSM=1, SCR:PEN=0)
ST
D0
D1
D2
D3
D4
D5
D6
D7
SP SP
Reception or transfer data
(ECCR:SSM=1, SCR:PEN=1)
ST
D0
D1
D2
D3
D4
D5
D6
D7
P
*
*
SP SP
* only if SBL bit of SCR is set to
ST: Start Bit
SP: Stop Bit
P : Parity Bit
● Clock inversion and start/stop bits in mode 2
If the SCES bit of the Extended Status/Control Register (ESCR) is set the serial clock is inverted. Therefore
in slave mode UART samples the data bits at the falling edge of the received serial clock. Note, that in
master mode if SCES is set the clock signal’s mark level is "0". If the SSM bit of the Extended
Communication Control Register (ECCR) is set the data format gets additional start and stop bits like in
asynchronous mode.
Figure 20.7-3 Transfer Data Format with Clock Inversion
mark level
reception or transmission clock
(SCES = 0, CCO = 0):
reception or transmission clock
(SCES = 1, CCO = 0):
data stream (SSM = 1)
(here: no parity, 1 stop bit)
mark level
ST
SP
data frame
365
CHAPTER 20 UART
● Clock supply:
In operation mode 2, the number of clock cycles for the clock signal must be the same as the number of bits
for the data including start and stop bits. If the MS bit of the ECCR register is "0" (master mode) and the
SCKE bit of the SMR register is "1" (clock output enabled), the consistent clock cycles are generated
automatically. IF the MS bit of the ECCR register is "1" (slave mode), make sure that correct clock cycles
are generated by the other communication device. While there is no communication, the clock signal must
be kept at "1" as the mark level
If the SCDE bit of the ECCR register is "1", the clock output signal is delayed by the half of the serial clock
cycle as shown in Figure 20.7-4. The operation is prepared for communication devices which use the
falling edge of the serial clock signal for the data sampling.
Figure 20.7-4 Delayed Transmitting Clock Signal(SCDE=1)
Transmission data
writing
Reception data sample edge (SCES = 0)
Transmitting or
receiving clock
(normal)
Mark level
Mark level
Transmitting
clock (SCDE = 1)
Transmission and
reception data
Mark level
0
1
LSB
1
0
1
0
0
1
MSB
Data
If the SCES bit of the ESCR register is "1", the serial clock signal is inverted. Receiving data is sampled at
the falling edge of the serial clock.
If the MS bit of the ECCR register is "0" (master mode) and the SCKE bit of the SMR register is "1" (clock
output enabled), the output clock signal is also inverted.
While there is no communication, the clock signal must be kept at "0" as the mark level.
If the CCO bit of the ESCR register is "1", the serial clock is signaled even while there is no data
communication. Therefore it is recommended to specify the start/stop bits as shown in Figure 20.7-5.
Figure 20.7-5 Continuous Clock Output in Mode 2
reception or transmission clock
(SCES = 0, CCO = 1):
reception or transmission clock
(SCES = 1, CCO = 1):
data stream (SSM = 1)
(here: no parity, 1 stop bit)
ST
SP
data frame
● Error detection:
If no start/stop bits are selected (ECCR: SSM = 0) only overrun errors are detected.
366
CHAPTER 20 UART
● Communication:
For initialization of the synchronous mode, following settings have to be done:
Baud rate generator registers (BGR0/BGR1):
Set the desired reload value for the dedicated baud rate reload counter.
Serial mode control register (SMR):
MD1, MD0: "10B" (Mode 2)
SCKE: "1" for the dedicated Baud Rate Reload Counter
"0" for external clock input
SOE: "1" for transmission and reception
"0" for reception only
Serial control register (SCR):
RXE, TXE: set one or both of these flags to "1"
A/D: no Address/Data selection - don’t care
CL: automatically fixed to 8-bit data - don’t care
CRE: "1" to clear receive error flags.
- when SSM=0 (default):
PEN, P, SBL: don’t care
- when SSM=1:
PEN: "1" if parity bit is added/detected, "0" if not
P: "0" for even parity, "1" odd parity
SBL: "1" for 2 stop bits, "0" for 1 stop bit.
Serial status register (SSR):
BDS: "0" for LSB first, "1" for MSB first
RIE: "1" if interrupts are used; "0" reception interrupts are disabled.
TIE: "1" if interrupts are used; "0" transmission interrupts are disabled.
Extended communication control register (ECCR):
SSM: "0" if no start/stop bits are desired (normal); "1" for adding start/stop bits (special)
MS: "0" for master mode (UART generates the serial clock); "1" for slave mode (UART receives serial
clock from the master device)
367
CHAPTER 20 UART
20.7.3
Operation with LIN Function (Operation Mode 3)
UART can be used either as LIN-Master or LIN-Slave. For this LIN function a special
mode is provided. Setting the UART to mode 3 configures the data format to 8N1-LSBfirst format.
■ Operation in Asynchronous LIN Mode (Operation Mode 3)
● UART as LIN master
In LIN master mode the master determines the baud rate of the whole sub bus, therefore slaves devices
have to synchronize to the master. Therefore the desired baud rate remains fixed in master operation after
initialization.
Writing a "1" into the LBR bit of the Extended Communication Control Register (ECCR) generates a 13 16 bit time low-level on the SOT pin, which is the LIN synchronization break and the start of a LIN
message. Thereby the TDRE flag of the Serial Status Register (SSR) goes "0" and is reset to "1" after the
break, and generates a transmission interrupt for the CPU (if TIE of SSR is "1").
The length of the Synchronization break to be sent can be determined by the LBL1/0 bits of the ESCR as
follows:
Table 20.7-2 LIN Break Length
LBL1
LBL0
Length of Break
0
0
13 Bit times
1
0
14 Bit times
0
1
15 Bit times
1
1
16 Bit times
The Synch Field is sent as byte data of 0x55 after the LIN break. To prevent a transmission interrupt, the
0x55 can be written to the TDR just after writing the "1" to the LBR bit, although the TDRE flag is "0".
The internal transmission shifter waits until the LIN break has finished and shifts the TDR value out
afterwards. In this case no interrupt is generated after the LIN break and before the start bit.
● UART as LIN slave
In LIN slave mode UART has to synchronize to the master’s baud rate. If Reception is disabled (RXE = 0)
but LIN break Interrupt is enabled (LBIE = 1) UART will generate a reception interrupt, if a
synchronization break from the LIN master is detected, and indicates it with the LBD flag of the ESCR.
Writing "0" to this bit clears the reception interrupt request. The LIN slave may need to calculate the baud
rate from the synch field. In this case, the time between the first falling edge to the fifth falling edge of the
synch field is measured by the input capture module. For this purpose, the input capture module is
connected to the LIN-UART with an internal signal. This internal signal changes from "0" to "1" at the first
falling edge then "1" to "0" at the fifth falling edge. Therefore the input capture module should be set to
detect both rising and falling edge. Also the input signal from the LIN-UART should be selected. The time
368
CHAPTER 20 UART
measured by the input capture module represents 8 times of the baud rate clock cycle.
Therefore, baud rate setting value is summarized as follows:
without timer overflow : BGR value = (b-a)/8
with timer overflow
: BGR value = (MAX + b-a)/8
where MAX is the timer maximum value at the overflow occurs.
where a is the value of the ICU counter register after the first Interrupt
where b is the value of the ICU counter register after the second Interrupt
For the correspondence between other UARTs and ICUs, see "12.3 16-bit Free-running Timer".
● LIN Synch Break Detection Interrupt and Flags
If a LIN Synch synchronization break is detected in the slave mode, the LIN Break Detected (LBD) Flag of
the ESCR is set to "1". This causes an interrupt, if the LIN Break Interrupt Enable (LBIE) bit is set
Figure 20.7-6 LIN Synch Break Detection and Flag Set Timing.
Serial clock
0
cycle#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Serial
clock
Serial
Input
(LIN bus)
FRE
(RXE=1)
LBD
(RXE=0)
Reception interrupt occurs, if RXE=1
Reception interrupt occurs, if RXE=0
The figure above demonstrates the LIN synch break detection and flag set timing.
Note, that if reception is enabled (RXE = 1) and reception interrupt is enabled (RIE = 1) the Reception Data
Framing Error (FRE) flag bit of the SSR will cause a reception interrupt 2 bit times ("8N1") earlier than the
LIN break interrupt, so it is recommended to turn off RXE, if a LIN break is expected.
LBD is only supported in operation mode 3.
Figure 20.7-7 shows a typical start of a LIN message frame and the behavior of the UART.
Figure 20.7-7 UART Behavior as Slave in LIN Mode
Serial
clock
Serial
Input
(LIN bus)
LBR cleared
by CPU
LBD
Internal
ICU
Signal
Synch break (e. g. 14 Tbit)
Synch field
369
CHAPTER 20 UART
● LIN bus timing
Figure 20.7-8 LIN Bus Timing and UART Signals
old serial clock
no clock used
(calibration frame)
new (calibrated) serial clock
ICU count
LIN
bus
(SIN)
RXE
LBD
(IRQ0)
LBIE
Internal
Signal
to ICU
IRQ from
ICU
RDRF
(IRQ0)
RIE
Read
RDR
by CPU
Reception Interrupt
enable
LIN break begins
LIN break detected and Interrupt
IRQ cleared by CPU (LBD -> 0)
IRQ from ICU
IRQ cleared: Begin of Input Capture
IRQ from ICU
IRQ cleared: Calculate & set new baud rate
LBIE disable
Reception enable
Edge of Start bit of Identifier byte
Byte read in RDR
RDR read by CPU
370
CHAPTER 20 UART
20.7.4
Direct Access to Serial Pins
UART allows the user to directly access to the transmission pin (SOTn) or the reception
pin (SINn).
■ UART Direct Pin access
The UART provides the ability for the software to access directly to serial input or output pin. The software
can always monitor the incoming serial data by reading the SIOP bit of the ESCR. If setting the Serial
Output Pin direct access Enable (SOPE) bit of the ESCR the software can force the SOTn pin to a desired
value. Note, that this access is only possible, if the transmission shift register is empty (i. e. no transmission
activity).
In LIN mode this function can be used for reading back the own transmission and is used for error handling
if something is physically wrong with the single-wire LIN-bus.
Notes:
• Write the desired value to the SIOP pin before enabling the output pin access to prevent
undesired output level because SIOP holds the last written value.
• During a Read-Modify-Write operation the SIOP bit returns the actual value of the SOTn pin in the
read cycle instead of the value of SINn during a normal read instruction.
371
CHAPTER 20 UART
20.7.5
Bidirectional Communication Function (Normal Mode)
In operation mode 0 or 2, normal serial bidirectional communication is available. Select
operation mode 0 for asynchronous communication and operation mode 2 for
synchronous communication.
■ Bidirectional Communication Function
The settings shown in Figure 20.7-9 are required to operate UART in normal mode (operation mode 0 or
2).
Figure 20.7-9 Settings for UART Operation Mode 0 and 2
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
SCRn, SMRn
PEN P SBL CL AD CRE RXE TXE MD1MD0 OTO EXTREST UPCL SCKESOE
Mode 0
Mode 2
SSRn, TDRn/RDRn
+
X
X
0
1
0
0
PE ORE FRE RDRFTDRE BDS RIE TIE
0
0
0
0
0
0
0
0
1
Set conversion data (during writing)
Retain reception data (during reading)
Mode 0
Mode 2
ESCRn, ECCRn
Mode 0
Mode 2
LBIE LBD LBL1 LBL0 SOPE SIOP CCO SCES
X
X
X
X
X
X
X
X
0
0
RBI TBI
LBR MS SCDE SSM
0
X
X
X
X
0
0
: Bit used
X : Bit not used
1 : Set 1
0 : Set 0
: Bit used if SSM =1 (Synchronous start-/stop-bit mode)
+ : Bit automatically set to correct value
372
n = 0, 1, 2, 3, 4
CHAPTER 20 UART
● Inter-CPU connection
As shown in Figure 20.7-10, interconnect two CPUs in UART mode 2
Figure 20.7-10 Connection Example of UART Mode 2 Bidirectional Communication
SOT
SOT
SIN
SIN
SCK
Input
Output
CPU-1 (Master)
SCK
CPU-2 (Slave)
Figure 20.7-11 Example of Master-slave Communication Flowchart
(Transmission side)
(Reception side)
Start
Start
Operating mode setting
(either 0 or 2)
Operating mode setting
(match the transmission side)
Set 1-byte data to TDR
and communicate
With reception data
NO
YES
With reception data
Read reception data
and process
NO
YES
Read reception data
and process
1-byte data transmission
(ANS)
373
CHAPTER 20 UART
20.7.6
Master-Slave Communication Function (Multiprocessor
Mode)
UART communication with multiple CPUs connected in master-slave mode is available
for both master or slave systems.
■ Master-slave Communication Function
The settings shown in Figure 20.7-12 are required to operate UART in multiprocessor mode (operation
mode 1).
Figure 20.7-12 Settings for UART Operation Mode 1
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
SCRn, SMRn
PEN P SBL CL AD CRE RXE TXE MD1MD0 OTO EXTREST UPCL SCKESOE
+
Mode 1
0
0
X
SSRn, TDRn/RDRn PE ORE FRE RDRFTDRE BDS RIE TIE
Mode 1
1
0
0
0
0
1
Set conversion data (during writing)
Retain reception data (during reading)
X
ESCRn, ECCRn
LBIE LBD LBL1 LBL0 SOPE SIOP CCO SCES
X
Mode 1
X
X
X
0
0
RBI TBI
LBR MS SCDE SSM
X
X
X
X
0
: Bit used
X : Bit not used
1 : Set 1
0 : Set 0
+ : Bit automatically set to correct value
n = 0, 1, 2, 3, 4
● Inter-CPU connection
As shown in Figure 20.7-13, a communication system consists of one master CPU and multiple slave CPUs
connected to two communication lines. UART can be used for the master or slave CPU.
Figure 20.7-13 Connection Example of UART Master-slave Communication
SOT1
SIN1
Master CPU
SOT
SIN
Slave CPU #0
374
SOT
SIN
Slave CPU #1
CHAPTER 20 UART
● Function selection
Select the operation mode and data transfer mode for master-slave communication as shown in Table 20.73.
Table 20.7-3 Selection of the Master-slave Communication Function
Operation mode
Data
Master CPU
Address
transmission
and
reception
Data
transmission
and
reception
Mode 1
(transmit/
receive AD-bit)
Parity
Synchronization
method
None
Asynchronous
Slave CPU
Mode 1
(transmit/
receive AD-bit)
Stop
bit
Bit
direction
1 bit or
2 bits
LSB first
or MSB
first
AD=1
+ 7-bit or
8-bit address
AD=0
+ 7-bit or
8-bit data
Communication procedure
When the master CPU transmits address data, communication starts. The A/D bit in the address data is
set to 1, and the communication destination slave CPU is selected. Each slave CPU checks the address
data using a program. When the address data indicates the address assigned to a slave CPU, the slave
CPU communicates with the master CPU.
Figure 20.7-14 shows a flowchart of master-slave communication (multiprocessor mode).
375
CHAPTER 20 UART
Figure 20.7-14 Master-slave Communication Flowchart
(Master CPU)
(Slave CPU)
Start
Start
Set operation mode 1.
Set operation mode 1.
Set SIN pin as the
serial data input pin.
Set SOT pin as the
serial data output pin.
Set SIN pin as the
serial data input pin.
Set SOT pin as the
serial data output pin.
Set 7 or 8 data bits.
Set 1 or 2 stop bits.
Set 7 or 8 data bits.
Set 1 or 2 stop bits.
Set “1” in AD bit.
Set TXE = RXE = 1.
Set TXE = RXE = 1.
Receive Byte.
Send Slave Address.
Is
AD bit = 1 ?
NO
YES
Does
Slave Address
match?
Set “0” in AD bit.
NO
YES
Communicate with
slave CPU.
Is
communication
complete?
Communicate with
master CPU.
NO
YES
Communicate
with another
slave CPU?
YES
NO
YES
Set TXE = RXE = 0.
End
376
Is
communication
complete?
NO
CHAPTER 20 UART
20.7.7
LIN Communication Function
UART communication with LIN devices is available for both LIN master or LIN slave
systems.
■ LIN-master-slave Communication Function
The settings shown in the figure below are required to operate UART in LIN communication mode
(operation mode 3).
Figure 20.7-15 Settings for UART in Operation Mode 3 (LIN)
SCRn, SMRn
Mode 3
PEN P SBL CL AD CRE RXE TXE MD1MD0 OTO EXTREST UPCL SCKESOE
+
X
+
+
X
1
0
ESCRn, ECCRn
X
0
0
0
0
1
Set conversion data (during writing)
Retain reception data (during reading)
SSRn, TDRn/RDRn PE ORE FRE RDRFTDRE BDS RIE TIE
Mode 3
1
+
LBIE LBD LBL1 LBL0 SOPE SIOP CCO SCES
0
Mode 3
0
RBI TBI
LBR MS SCDE SSM
X
X
X
0
: Bit used
X : Bit not used
1 : Set 1
0 : Set 0
+ : Bit automatically set to correct value
n = 0, 1, 2, 3, 4
● LIN device connection
As shown in the Figure below, a communication system of one LIN-Master device and a LIN-Slave device.
UART can operate both as LIN-Master or LIN-Slave.
Figure 20.7-16 Connection Example of a Small LIN-Bus System
SOT
SOT
LIN bus
SIN
LIN-Master
SIN
Single-WireTransceiver
Single-WireTransceiver
LIN-Slave
377
CHAPTER 20 UART
20.7.8
Sample Flowcharts for UART in LIN communication
(Operation Mode 3)
This section contains sample flowcharts for UART in LIN communication.
■ UART as Master Device
Figure 20.7-17 UART LIN Master Flow Chart
START
Initial setting :
Set operation mode 3
Serial data output enabled
Baudrate setting
Synch break length setting
TXE=1, TIE=0
RXE=0, RIE=1
No
Send Message?
No (transmission)
Yes (reception)
Yes
Wake up?
RDRF=1
No
Data field reception?
(0x80 reception)
Reception interrupt
Yes
(*1)
Data 1 reception
Transmission data 1 set :
TDR=Data 1
Transmission interrupt
enabled
RDRF=1
RXE=0
TDRE=1
Reception interrupt
Synch break interrupt enabled
Synch break transmission :
(*1)
Data N reception
Transmission interrupt
ECCR : LBR=1
Transmission data N set :
TDR=Data N
Transmission interrupt
disabled
Synch field transmission :
TDR=0x55
LBD=1
RDRF=1
Synch break interrupt
Reception interrupt
Reception enabled
LBD=0
Synch break interrupt disabled
(*1)
Data 1 reception
Data 1 reading
RDRF=1
RDRF=1
Reception interrupt
Reception interrupt
(*1)
(*1)
Synch field reception
Data 1 reception
Data 1 reading
Identify field set : TDR=ID
RDRF=1
Reception interrupt
(*1)
(*2)
ID field reception
No
Without error
Yes
378
Error processing
CHAPTER 20 UART
■ UART as Slave Device
Figure 20.7-18 UART LIN Slave Flow Chart
START
Initial setting :
Set operation mode 3
Serial data output enabled
Baudrate setting
Synch break length setting
TXE=1, TIE=0
RXE=0, RIE=1
Connection with UART and ICU
Reception prohibited
ICU interrupt enabled
Synch break interrupt enabled
Yes (reception)
LBD=1
RDRF=1
Synch break interrupt
No (transmission)
Data field
reception?
Reception interrupt
(*1)
Synch break detection clear
ECCR : LBD=0
Synch break interrupt prohibited
Transmission data 1 set
TDR=Data 1
Transmission interrupt
enabled
Data 1 reception
RDRF=1
ICU interrupt
Reception interrupt
TDRE=1
(*1)
Data N reception
ICU data read
ICU interrupt flag clear
Transmission interrupt
Transmission data N set
TDR=Data N
Transmission interrupt
prohibited
ICU interrupt
Reception prohibited
RDRF=1
ICU data read
Baud rate regulation
Reception enabled
ICU interrupt flag clear
ICU interrupt prohibited
Reception interrupt
(*1)
Data 1 reception
Data 1 read
RDRF=1
LBD=1
Reception interrupt
Synch break interrupt
(*1)
(*1)
Data N reception
Data N read
Reception prohibited
Identify field reception
Sleep mode?
No
(*2)
Yes
No
Without error
Error processing
Yes
Wake up reception?
No
Yes
Wake up
transmission?
No
Yes
Wake up code transmission
379
CHAPTER 20 UART
20.8
Notes on Using UART
Notes on using UART are given below.
■ Notes on Using UART
● Enabling operations
In UART, the control register (SCR) has TXE (transmission) and RXE (reception) operation enable bits.
Both, transmission and reception operations, must be enabled before the communication starts because they
have been disabled as the default value (initial value). The operation can also be canceled by disabling
these bits.
● Communication mode setting
Set the communication mode while the system is not operating. If the mode is changed during transmission
or reception, the transmission or reception is stopped and possible data will be lost.
● Transmission interrupt enabling timing
The default (initial value) of the transmission data empty flag bit (SSR: TDRE) is "1" (no transmission data
and transmission data write enable state). A transmission interrupt request is generated as soon as the
transmission interrupt request is enabled (SSR: TIE=1). Be sure to set the TIE flag to "1" after setting the
transmission data to avoid an immediate interrupt.
● Using LIN operation mode 3
The LIN features are available in mode 3 (transmitting, receiving synch break), but using mode 3 sets the
UART data format automatically to LIN format (8N1, LSB first). Note, that the length of the synch break
for transmission is variable but for reception it is fixed 11-bit time.
Note:
During LIN operation, please set SCES bit of ESCR register to 0.
● Changing operation settings
It is strongly recommended to reset UART after changing operation settings. Particularly if (for example)
start-/stop-bits added to or removed from the data format.
Note:
If settings in the Serial Mode Register (SMR) are desired, it is not useful to set the UPCL bit at the
same time to reset UART. The correct operation settings are not guaranteed in this case. Thus it is
recommended to set the bits of the SMR and then to set them again plus the UPCL bit.
380
CHAPTER 20 UART
● LIN slave settings
Set the baud rate before receiving the first LIN synch break for the slave operation. Otherwise, duration of
the synch break can not be correctly checked against the minimum requirement of the LIN specification (13
master bit time and 11 slave bit time).
● Software compatibility
Although this UART is similar to other UART in other microcontrollers it is not software compatible to
them. The programming models may be the same, but the structure of the registers differ. Furthermore the
setting of the baud rate is now determined by a reload value instead of selecting a predefined value.
● Bus idle function
The Bus Idle Function cannot be used in synchronous mode 2.
● AD bit (serial control register (SCR): address/data type select bit)
Special care has to be taken when using the AD bit (Address-Data-Bit for multiprocessor mode 1) of the
Serial Control Register. This bit is both a control and a flag bit, because writing to it sets the AD bit for
transmission, whereas reading from it returns the last received AD bit. Internally, the received and the
transmitted value are stored in different registers, but in Read-Modify-Write instructions, the received value
is read, modified and then written back for transmission. This can lead to a wrong value in the AD bit,
when one of the other bits in the same register is accessed by an instruction of this kind.
Therefore, this bit should be written by the last register access before transmission. Alternatively, using
byte wise access and writing the correct values for all bits at once avoids this problem.
Furthermore, the AD bit is not buffered like the transmission data register.
Changing the bit when transmission will alter the AD bit of the currently transmitted data.
● Software reset of UART
Perform the software reset (SMR: UPCL=1), when the TXE bit of the SCR register is "1".
● LIN Synch field wait state
In mode 3 (LIN operation), the LBD bit in the ESCR register is set to "1" if the input signal is kept at "0"
for more than equal to 11-bit time. Then the UART waits for the following synch field to be received. If the
UART is set into this state for other reasons than the synch break, it should be initialized by the software
reset (SMR: UPCL=1).
381
CHAPTER 20 UART
382
CHAPTER 21
400 kHz I2C INTERFACE
This section describes the functions and operation of
the fast I2C interface.
21.1 I2C Interface Overview
21.2 I2C Interface Registers
21.3 I2C Interface Operation
21.4 Programming Flow Charts
383
CHAPTER 21 400 kHz I2C INTERFACE
21.1
I2C Interface Overview
The I2C interface is a serial I/O port supporting the Inter IC bus, operating as a master/
slave device on the I2C bus.
The MB90860A Series contain two I2C Interface modules (only devices with suffix-"c".)
■ Features
• Master/slave transmitting and receiving functions
• Arbitration function
• Clock synchronization function
• General call addressing support
• Transfer direction detection function
• Repeated start condition generation and detection function
• Bus error detection function
• 7 bit addressing as master and slave
• 10 bit addressing as master and slave
• Possibility to give the interface a seven and a ten bit slave address
• Acknowledging upon slave address reception can be disabled (Master-only operation)
• Address masking to give interface several slave addresses (in 7 and 10 bit mode)
• Up to 400 kbps transfer rate
• Possibility to use built-in noise filters for SDA and SCL
• Can receive data at 400 kbps if machine clock is higher than 6 MHz regardless of prescaler setting
• Can generate MCU interrupts on transmission and bus error events
• Supports being slowed down by a slave on bit and byte level
The I2C interface does not support SCL clock stretching on bit level since it can receive the full 400 kbps
data rate if the machine clock is higher than 6 MHz regardless of the prescaler setting. However, clock
stretching on byte level is performed since SCL is pulled low during an interrupt (INT="1" in IBCR
register).
384
CHAPTER 21 400 kHz I2C INTERFACE
Figure 21.1-1 Block Diagram
ICCR
I2C enable
EN
ICCR
Clock Divider 1
2 3 4 5 ... 32
CS4
CS3
5
CS2
5
Clock Selector
Sync
CS1
CS0
Clock Divider 2 (by 12)
SCL Duty Cycle Generator
Shift Clock Generator
IBSR
BB
Bus busy
RSC
Repeated start
LRB
Last Bit
TRX
Send/receive
Bus Observer
Bus Error
ADT
Address Data
AL
Arbitration Loss Detector
ICCR
NSF
Internal data-bus
IBCR
enable
BER
BEIE
MCU
IRQ
Interrupt Request
INTE
INT
Noise
Filter
SCL
SDA
SCL
SDA
IBCR
SCC
MSS
ACK
GCAA
Start
Start-Stop Condition
Generator
Master
ACK enable
ACK Generator
GC-ACK enable
8
IDAR
IBSR
AAS
GCA
ISMK
ENSB
ITMK
ENTB
RAL
8
Slave
General call
enable 7 bit mode
Slave Address
Comparator
enable 10 bit mode
received ad. length
7
10
10
ITBA
ITMK
7
ISBA
ISMK
10
10
7
7
385
CHAPTER 21 400 kHz I2C INTERFACE
21.2
I2C Interface Registers
This section describes the function of the I2C interface registers in detail.
■ I2C Interface Registers
Figure 21.2-1 I2C Interface Registers (1/2)
I2C Bus Control Register (IBCR0/IBCR1)
Address:
IBCR0: 007971H
IBCR1: 007981H
15
14
13
12
11
10
9
BER BEIE SCC MSS ACK GCAA INTE
8
IBCR0/IBCR1
INT
Initial value
00000000B
R/W R/W W R/W R/W R/W R/W R/W
I2C Bus Status Register (IBSR0/IBSR1)
Address:
IBSR0: 007970H
IBSR1: 007980H
I2C
7
6
BB
R
5
4
3
RSC AL
LRB
TRX AAS GCA ADT
R
R
R
R
2
1
R
0
R
R
9
8
IBSR0/IBSR1
Initial value
0 0 0 0 0 0 0 0B
Ten Bit slave Address register (ITBA0/ITBA1)
Address:
15
14
13
12
11
10
ITBAH0: 007973H
ITBAH1: 007983H
-
-
-
-
-
-
-
-
-
-
-
- R/W R/W
7
6
5
4
3
2
Address:
ITBAL0: 007972H
ITBAL1: 007982H
TA9 TA8
1
ITBAH0/ITBAH1 (upper)
Initial value
00000000
B
0
ITBAL0/ITBAL1 (lower)
TA7 TA6 TA5 TA4 TA3 TA2 TA1 TA0
Initial value
0 0 0 0 0 0 0 0B
R/W R/W R/W R/W R/W R/W R/W R/W
I2C Ten bit slave address MasK register (ITMK0/ITMK1)
13
12
11
ITMKH0: 007975H ENTB RAL ITMKH1: 007985H
R/W R/W -
-
-
- TM9 TM8
-
-
- R/W R/W
4
3
2
Address:
Address:
ITMKL0: 007974H
ITMKL1: 007984H
15
7
14
6
5
10
9
1
8
ITMKH0/ITMKH1 (upper)
Initial value
00111111B
0
ITMKL0/ITMKL1 (lower)
TM7 TM6 TM5 TM4 TM3 TM2 TM1 TM0
Initial value
1 1 1 1 1 1 1 1B
R/W R/W R/W R/W R/W R/W R/W R/W
I2C Seven Bit slave Address register (ISBA0/ISBA1)
R/W
R
W
-
386
:
:
:
:
Address:
7
ISBA0: 007976H
ISBA1: 007986H
-
SA6 SA5 SA4 SA3 SA2 SA1 SA0
-
R/W R/W R/W R/W R/W R/W R/W
Readable and writable
Read only
Write only
Undefined
6
5
4
3
2
1
0
ISBA0/ISBA1
Initial value
0 0 0 0 0 0 0 0B
CHAPTER 21 400 kHz I2C INTERFACE
Figure 21.2-1 I2C Interface registers (2/2)
I2C Seven bit slave address MasK register (ISMK0/ISMK1)
Address:
ISMK0: 007977H
ISMK1: 007987H
15
14
13
12
11
10
9
8
ENSB SM6 SM5 SM4 SM3 SM2 SM1 SM0
ISMK0/ISMK1
Initial value
0 1 1 1 1 1 1 1B
R/W R/W R/W R/W R/W R/W R/W R/W
I2C Data Register (IDAR0/IDAR1)
Address:
IDAR0: 007978H
IDAR1: 007988H
7
6
5
4
3
2
D7 D6 D5 D4 D3 D2
1
0
D1 D0
R/W R/W R/W R/W R/W R/W R/W R/W
IDAR0/IDAR1
Initial value
00000000
B
I2C Clock control register (ICCR0/ICCR1)
Address:
ICCR0: 00797BH
ICCR1: 00798BH
R/W
:
Readable and writable
-
:
Undefined
15
14
13
12
11
10
9
8
-
NSF EN CS4 CS3 CS2 CS1 CS0
-
R/W R/W R/W R/W R/W R/W R/W
ICCR0/ICCR1
Initial value
0 0 0 1 1 1 1 1B
387
CHAPTER 21 400 kHz I2C INTERFACE
I2C Bus Status Register (IBSR)
21.2.1
The I2C bus status register (IBSR) has the following functions:
• Bus busy detection
• Repeated start condition detection
• Arbitration loss detection
• Acknowledge detection
• Data transfer direction indication
• Addressing detection as slave
• General call address detection
• Address/data detection
■ I2C Bus Status Register (IBSR)
This register is read-only, all bits are controlled by the hardware. All bits are cleared if the interface is not
enabled (EN = "0" in ICCR).
Figure 21.2-2 Configuration of the I2C Bus Status Register (IBSR0/IBSR1)
Address:
IBSR0: 007970H
IBSR1: 007980H
7
6
5
4
3
2
1
0
BB
RSC
AL
LRB
TRX
AAS
GCA
ADT
R
R
R
R
R
R
R
R
IBSR0/IBSR1
Initial value
0 0 0 0 0 0 0 0B
bit 0
ADT
Address data transfer bit
0
Incoming data is not address (or bus not in use)
1
Incoming data is address
bit 1
GCA
General Call Address bit
0
Generall call address not received as slave
1
General call address received as slave
bit 2
AAS
Addressed as slave bit
0
not addressed as slave
1
Addressed as slave
bit 3
TRX
Transferring data bit
0
Not transmitting data
1
Transmitting data
bit 4
LRB
Last received bit
0
Receiver did acknowledge
1
Receiver did not acknowledge
bit 5
AL
Arbitration loss bit
0
No arbitration loss detected
1
Arbitration loss detected
bit 6
RSC
Repeated start condition bit
0
Repeated start condition not detected
1
Bus in use, repeated start condition detected
bit 7
BB
R
388
Bus busy bit
:
Read only
0
Stop condition detected (bus idle)
:
Initial value
1
Start condition detected (bus in use)
CHAPTER 21 400 kHz I2C INTERFACE
■ I2C Bus Status Register (IBSR) Contents
Table 21.2-1 Function of Each Bit of the I2C Bus Status Register (IBSR0/IBSR1) (1/2)
Bit name
Function
bit7
BB:
Bus busy bit
This bit indicates the status of the I2C bus.
"0": Stop condition detected (bus idle)
"1": Start condition detected (bus in use)
This bit is set to "1" if a start condition is detected. It is reset upon a stop condition.
bit6
RSC:
Repeated start
condition bit
This bit indicates detection of a repeated start condition.
"0": Repeated start condition not detected.
"1": Repeated start condition detected (bus in use).
This bit is cleared at the end of an address data transfer (ADT="0") or detection of a stop
condition.
bit5
AL:
Arbitration loss
bit
This bit indicates an arbitration loss.
"0": No arbitration loss detected.
"1": Arbitration loss occurred during master sending.
This bit is cleared by writing "0" to the INT bit or by writing "1" to the MSS bit in the IBCR
register.
An arbitration loss occurs if:
- the data sent does not match the data read on the SDA line at the rising SCL edge
- a repeated start condition is generated by another master in the first bit of a data byte
- The interface could not generate a start or stop condition because signal transition caused
from "1" to "0" by a certain external condition observed at the SCL line.
bit4
LRB:
Last received bit
This bit is used to indicate the acknowledge from the receiving device.
"0": Receiver acknowledged.
"1": Receiver did not acknowledge.
It is changed by the hardware upon reception of bit9 (acknowledge bit) and is also cleared by
a start or stop condition.
bit3
TRX:
Transferring data
bit
This bit indicates data transmission operation.
"0": Not transmitting data.
"1": Transmitting data.
It is set to "1":
- if a start condition was generated in master mode
- if addressed as slave in read access.
It is set to "0" if:
- the bus is idle (BB="0")
- an arbitration loss occurred
- "1" is written to the SCC bit during master interrupt (MSS="1" and INT="1")
- the MSS bit being cleared during master interrupt (MSS="1" and INT="1")
- the interface is in slave mode and the last transferred byte was not acknowledged
- the interface is in slave mode and it is receiving data
- the interface is in master mode and is reading data from a slave
bit2
AAS:
Addressed as
slave bit
This bit indicates detection of a slave addressing.
"0": Not addressed as slave.
"1": Addressed as slave.
This bit is cleared by a (repeated-) start or stop condition. It is set if the interface detects its
seven and/or ten bit slave address.
389
CHAPTER 21 400 kHz I2C INTERFACE
Table 21.2-1 Function of Each Bit of the I2C Bus Status Register (IBSR0/IBSR1) (2/2)
Bit name
Function
bit1
GCA:
General call
address bit
This bit indicates detection of a general call address (0x00).
"0": General call address not received as slave.
"1": General call address received as slave.
This bit is cleared by a (repeated-) start or stop condition.
bit0
ADT:
Address data
transfer bit
This bit indicates the detection of an address data transfer.
"0": Incoming data is not address data (or bus is not in use).
"1": Incoming data is address data.
This bit is set to "1" by a start condition. It is cleared after the second byte if a ten bit slave
address header with write access is detected, else it is cleared after the first byte.
This bit is also cleared when:
-"0" is written to the MSS bit during a master interrupt (MSS="1" and INT="1" in IBCR)
-"1" is written to the SCC bit during a master interrupt (MSS="1" and INT="1" in IBCR)
- the INT bit is being cleared
- the beginning of every byte transfer if the interface is not involved in the current transfer as
master or slave
390
CHAPTER 21 400 kHz I2C INTERFACE
21.2.2
I2C Bus Control Register (IBCR)
The I2C bus control register (IBCR) has the following functions:
• Interrupt enabling flags
• Interrupt generation flag
• Bus error detection flag
• Repeated start condition generation
• Master / slave mode selection
• General call acknowledge generation enabling
• Data byte acknowledge generation enabling
■ I2C Bus Control Register (IBCR)
Write access to this register should only occur while the INT="1" or if a transfer is to be started. The user
should not write to this register during an ongoing transfer since changes to the ACK or GCAA bits could
result in bus errors. All bits in this register except the BER and the BEIE bit are cleared if the interface is
not enabled (EN="0" in ICCR).
Figure 21.2-3 Configuration of the I2C Bus Control Register (IBCR0/IBCR1)
15
Address:
IBCR0: 007971H
IBCR1: 007981H
14
13
12
BER BEIE SCC MSS
11
10
9
ACK GCAA INTE
8
IBCR0/IBCR1
INT
Initial value
00000000B
R/W R/W W R/W R/W R/W R/W R/W
bit 8
INT
0
1
Interrupt bit
see table on next page for details
bit 9
INTE
Interrupt enable bit
0
Interrupt disabled
1
Interrupt enabled
bit 10
GCCA
Generall call address acknowledge bit
0
No acknowledge on general call address
1
Acknowledge on general call address
bit 11
ACK
Acknowledge bit
0
No Acknowledge on data byte reception
1
Acknowledge on data byte reception
bit 12
MSS
Master slave select bit
0
Go to slave mode
1
Go to master mode (s. table below for details)
bit 13
SCC
Start condition continue bit
0
Write: No effect:
1
Write: Generate repeated start condition
bit 14
BEIE
W
:
Write only
R/W
:
Readable and writable
:
Initial value
Bus error interrupt enable bit
0
Bus error interrupt disabled
1
Bus error interrupt enabled
bit 15
Bus error bit
BER
write
read
0
Clear bus error int.
No error detected
1
No effect
Error detected
391
CHAPTER 21 400 kHz I2C INTERFACE
■ I2C Bus Control Register (IBCR) Contents
Table 21.2-2 Function of Each Bit of the I2C Bus Control Register (IBCR0/IBCR1) (1/2)
Bit name
Function
bit15
BER:
Bus error bit
This bit is the bus error interrupt flag. It is set by the hardware and cleared by the user.
It always reads "1" in a Read-Modify-Write access.
Write access:
"0": Clear bus error interrupt flag
"1": No effect
Read access:
"0": No bus error detected
"1": One of the error conditions described below detected
When this bit is set, the EN bit in the ICCR register is cleared, the I2C interface goes to
pause status, data transfer is interrupted and all bits in the IBSR and the IBCR registers
except BER and BEIE are cleared. The BER bit must be cleared before the interface may be
reenabled.
This bit is set to "1" if:
- start or stop conditions are detected at wrong places: during an address data transfer or
during the transfer of the bits two to nine (acknowledge bit)
- a ten bit address header with read access is received before a ten bit write access
bit14
BEIE:
Bus error
interrupt enable
bit
This bit enables the bus error interrupt. It only can be changed by the user.
"0": Bus error interrupt disabled
"1": Bus error interrupt enabled
Setting this bit to "1" enables MCU interrupt generation when the BER bit is set to "1".
bit13
SCC
Start condition
continue bit
This bit is used to generate a repeated start condition. It is write only - it always reads "0".
"0": No effect
"1": Generate repeated start condition during master transfer
A repeated start condition is generated if a "1" is written to this bit while an interrupt in
master mode (MSS="1" and INT="1") and the INT bit is cleared automatically.
bit12
MSS:
Master slave
select bit
This is the master/slave mode selection bit. It can only be set by the user, but it can be
cleared by the user and the hardware.
"0": Go to slave mode
"1": Go to master mode, generate start condition and send address data byte in IDAR
register. It is cleared if an arbitration loss event occurs during master sending.
If a "0" is written to it during a master interrupt (MSS="1" and INT="1"), the INT bit is
cleared automatically, a stop condition will be generated and the data transfer ends. Note
that the MSS bit is reset immediately, the generation of the stop condition can be checked
by polling the BB bit in the IBSR register.
If a "1" is written to it while the bus is idle (MSS="0" and BB="0"), a start condition is
generated and the contents of the IDAR register (which should be address data) is sent.
If a "1" is written to the MSS bit while the bus is in use (BB="1" and TRX="0" in IBSR;
MSS="0" in IBCR), the interface waits until the bus is free and then starts sending.
If the interface is addressed as slave with write access (data reception) in the meantime, it
will start sending after the transfer ended and the bus is free again. If the interface is sending
data as slave in the meantime (AAS="1" and TRX="1" in IBSR), it will not start sending
data if the bus is free again. It is important to check whether the interface was addressed as
slave (AAS="1" in IBSR), sent the data byte successfully (MSS="1" in IBCR) or failed to
send the data byte (AL="1" in IBSR) at the next interrupt!
392
CHAPTER 21 400 kHz I2C INTERFACE
Table 21.2-2 Function of Each Bit of the I2C Bus Control Register (IBCR0/IBCR1) (2/2)
Bit name
Function
bit11
ACK:
Acknowledge bit
This bit enables the acknowledge generation on data byte reception. It only can be changed
by the user.
"0": The interface will not acknowledge on data byte reception
"1": The interface will acknowledge on data byte reception
This bit is not valid when receiving address bytes in slave mode - if the interface detects its
7 or 10 bit slave address, it will acknowledge if the corresponding enable bit (ENTB in
ITMK or ENSB in ISMK) is set.
Write access to this bit should occur during an interrupt (INT="1") or if the bus is idle
(BB="0" in the IBSR register) only.
bit10
GCAA:
General call
address
acknowledge bit
This bit enables acknowledge generation when a general call address is received. It only can
be changed by the user.
"0": The interface will not acknowledge on general call address byte reception.
"1": The interface will acknowledge on general call address byte reception.
Write access to this bit should occur during an interrupt (INT="1") or if the bus is idle
(BB="0" in IBSR register) or the interface is disabled (EN="0" in ICCR register) only.
bit9
INTE:
Interrupt enable
bit
This bit enables the MCU interrupt generation. It only can be changed by the user.
"0": Interrupt disabled
"1": Interrupt enabled
Setting this bit to "1" enables MCU interrupt generation when the INT bit is set to "1" (by
the hardware).
bit8
INT:
Interrupt flag bit
This bit is the transfer end interrupt request flag. It is changed by the hardware and can be
cleared by the user. It always reads "1" in a Read-Modify-Write access.
Write access:
"0": Clear transfer end interrupt request flag
"1": No effect
Read access:
"0": Transfer not ended or not involved in current transfer or bus is idle
"1": Set at the end of a 1-byte data transfer or reception including the acknowledge bit under
the following conditions:
Device is bus master.
Device is addressed as slave.
General call address received.
Arbitration loss occurred.
Set at the end of an address data reception (after first byte if seven bit address received,
after second byte if ten bit address received) including the acknowledge bit if the device
is addressed as slave.
While this bit is "1" the SCL line will hold an "L" level signal. Writing "0" to this bit clears
the setting, releases the SCL line, and executes transfer of the next byte or a repeated start or
stop condition is generated. Additionally, this bit is cleared if a "1" is written to the SCC bit
or the MSS bit is being cleared.
393
CHAPTER 21 400 kHz I2C INTERFACE
■ SCC, MSS and INT Bit Competition
Simultaneously writing to the SCC, MSS and INT bits causes a competition to transfer the next byte, to
generate a repeated start condition or to generate a stop condition. In these cases the order of priority is as
follows:
• Next byte transfer and stop condition generation.
When "0" is written to the INT bit and "0" is written to the MSS bit, the MSS bit takes priority and a
stop condition is generated.
• Next byte transfer and start condition generation.
When "0" is written to the INT bit and "1" is written to the SCC bit, the SCC bit takes priority. A
repeated start condition is generated and the contents of the IDAR register is sent.
• Repeated start condition generation and stop condition generation.
When a "1" is written to the SCC bit and "0" to the MSS bit, the MSS bit clearing takes priority. A stop
condition is generated and the interface enters slave mode.
Notes:
If specific conditions are met, the AL (arbitration lost) bit does not set the INT (interrupt) bit. Those
conditions are presented in Figure 21.2-4 and Figure 21.2-5.
● Case 1: When SCL and SDA signals are kept at "L";
The AL bit is set immediately after the MSS bit set to "1" while the BB bit is indicating "0" (no start
condition is detected). However the AL bit will not set the INT bit under this circumstances.
Figure 21.2-4 Diagram of Timing at which an Interrupt upon Detection of " AL Bit = 1 " does not Occur
SCL pin
SCL pin or SDA pin is Low level.
SDA pin
"L"
"L"
I2C operation enable state (EN bit =1)
Master mode setting (MSS bit = 1)
1
Arbitration lost detection (AL bit = 1)
394
Bus busy (BB bit)
0
Interruption (INT bit)
0
CHAPTER 21 400 kHz I2C INTERFACE
● Case 2: When I2C interface is enabled while there is ongoing communication with another bus master;
The interface participates in the I2C bus while the bus is occupied with ongoing communication if the
EN bit is set from "0" to "1". In this case the BB bit stays "0" (no start condition is detected) and
setting the MSS bit to "1" results in the AL bit indicating "1". However the AL bit will not set the INT
bit under this circumstances.
Figure 21.2-5 Diagram of Timing at which an Interrupt upon Detection of "AL Bit = 1" does not Occur
Start Condition
INT bit interruption is not generated
in 9th clock.
Stop Condition
SCL pin
SDA pin
SLAVE ADDRESS
ACK
DAT
ACK
EN bit
MSS bit
AL bit
BB bit
INT bit
0
0
If a symptom as described above can occur, follow the procedure below for software processing.
1. Execute the instruction that generates a start condition (set the MSS bit to 1).
2. Use, for example, the timer function to wait for the time for three - bit data transmission at the I2C
transfer frequency set in the ICCR register.*
Example: Time for three-bit data transmission at an I2C transfer frequency of
100 kHz = (1/100 × 103) × 3 = 30
3. Check the AL and BB bits in the IBSR register and, if the AL and BB bits are 1 and 0,
respectively, set the EN bit in the ICCR register to 0 to initialize I2C. When the AL and BB bits are
not so, perform normal processing.
395
CHAPTER 21 400 kHz I2C INTERFACE
A sample flow is given below.
Master mode setting
Setting "1" to MSS bit in I2C bus control register (IBCR)
Wait for the time for three-bit data transmission at the I2C transfer
frequency set in the I2C clock control register (ICCR).*
NO
BB bit =0 and AL bit = 1
YES
Setting EN bit to "0" and initializing of I2C
To normal process
*: Arbitration lost is detected within 3-bit time after setting the MSS bit to "1".
● Example of occurrence of an interrupt (INT bit = 1) upon detection of "AL bit = 1"
When an instruction which generates a start condition is executed (setting the MSS bit to 1) with
"bus busy" detected (BB bit = 1) and arbitration is lost, the INT bit interrupt occurs upon detection of
"AL bit = 1".
Figure 21.2-6 Diagram of Timing at which an Interrupt upon Detection of "AL Bit = 1" Occurs
Start Condition
Interrupt at 9th clock.
SCL pin
SDA pin
SLAVE ADDRESS
ACK
DAT
EN bit
MSS bit
AL bit clear on soft
AL bit
BB bit
INT bit
396
INT bit clear on soft
and open SCL
CHAPTER 21 400 kHz I2C INTERFACE
I2C Ten Bit Slave Address Register (ITBAH/ITBAL)
21.2.3
This register (ITBAH / ITBAL) designates the ten bit slave address.
■ I2C Ten Bit Slave address Register (ITBA)
Write access to this register is only possible if the interface is disabled (EN="0" in ICCR).
Figure 21.2-7 Configuration of the I2C Ten Bit Slave address Register (ITBA0/ITBA1)
Address:
ITBAH0: 007973H
ITBAH1: 007983H
Address:
ITBAL0: 007972H
ITBAL1: 007982H
15
14
13
12
11
10
9
-
-
-
-
-
-
TA9 TA8
-
-
-
-
-
-
R/W R/W
7
6
5
4
3
2
1
8
0
TA7 TA6 TA5 TA4 TA3 TA2 TA1 TA0
ITBAH0/ITBAH1 (upper)
Initial value
0 0 0 0 0 0 0 0B
ITBAL0/ITBAL1 (lower)
Initial value
0 0 0 0 0 0 0 0B
R/W R/W R/W R/W R/W R/W R/W R/W
R/W
:
Readable and writable
-
:
Undefined
■ I2C Ten Bit Slave address Register (ITBA) Contents
Table 21.2-3 Function of Each Bit of the I2C Ten Bit Slave address Register (ITBA0/ITBA1)
Bit name
Function
bit15 to
bit10
Undefined
These bits always return "0".
bit9 to bit0
TBA9 to TBA0:
Ten bit slave
address
When address data is received in slave mode, it is compared to the ITBA register if
the ten bit address is enabled (ENTB="1" in the ITMK register). An acknowledge is
sent to the master after reception of a ten bit address header with write access1. Then,
the second incoming byte is compared to the TBAL register. If a match is detected,
an acknowledge signal is sent to the master device and the AAS bit is set.
Additionally, the interface acknowledges upon the reception of a ten bit header with
read access2 after a repeated start condition.
All bits of the slave address may be masked using the ITMK register. The received
ten bit slave address is written back to the ITBA register, it is only valid while the
AAS bit in the IBSR register is "1".
Notes:
• A ten bit header (write access) consists of the following bit sequence: "11110", TA9, TA8, "0".
• A ten bit header (read access) consists of the following bit sequence: "11110", TA9, TA8, "1".
397
CHAPTER 21 400 kHz I2C INTERFACE
I2C Ten Bit Address Mask Register (ITMKH/ITMKL)
21.2.4
This register contains the ten bit slave address mask and the ten bit slave address
enable bit.
■ I2C Ten Bit address Mask Register (ITMK)
Figure 21.2-8 Configuration of the I2C Ten Bit address Mask Register (ITMK0/ITMK1)
Address:
ITMKH0: 007975H
ITMKH1: 007985H
Address:
ITMKL0: 007974H
ITMKL1: 007984H
15
14
13
12
11
10
ENTB
RAL
-
-
-
-
TM9 TM8
R/W R/W -
-
-
-
R/W R/W
4
3
2
7
6
5
9
1
8
0
TM7 TM6 TM5 TM4 TM3 TM2 TM1 TM0
ITMKH0/ITMKH1 (upper)
Initial value
00111111B
ITMKL0/ITMKL1 (lower)
Initial value
1 1 1 1 1 1 1 1B
R/W R/W R/W R/W R/W R/W R/W R/W
R/W
:
Readable and writable
-
:
Undefined
■ I2C Ten Bit address Mask Register (ITMK) Contents
Table 21.2-4 Function of Each Bit of the I2C Ten Bit address Mask Register (ITMK0/ITMK1)
Bit name
Function
bit15
ENTB:
Enable ten bit
slave address
bit
This bit enables the ten bit slave address (and the acknowledging upon its reception). Write
access to this bit is only possible if the interface is disabled (EN="0" in ICCR).
"0": Ten bit address disabled
"1": Ten bit address enabled
bit14
RAL:
Received
slave address
length bit
This bit indicates whether the interface was addressed as a seven or ten bit slave. It is read-only.
"0": Addressed as seven bit slave
"1": Addressed as ten bit slave
This bit can be used to determine whether the interface was addressed as a seven or ten bit slave
if both slave addresses are enabled (ENTB="1" and ENSB="1"). Its contents is only valid if the
AAS bit in the IBSR register is "1". This bit is also reset if the interface is disabled (EN="0" in
ICCR).
bit13 to
bit10
Undefined
These bits always return "1" during reading.
bit9 to
bit0
TMK:
Ten bit slave
address mask
bits
This register is used to mask the ten bit slave address of the interface. Write access to these bits
is only possible if the interface is disabled (EN="0" in ICCR).
"0": Bit is not used in slave address comparison
"1": Bit is used in slave address comparison
This can be used to make the interface acknowledge on multiple ten bit slave addresses. Only
the bits set to "1" in this register are used in the ten bit slave address comparison. The received
slave address is written back to the ITBA register and thus may be determined by reading the
ITBA register if the AAS bit in the IBSR register is "1".
Note:
If the address mask is changed after the interface had been enabled, the slave address should
also be set again since it could have been overwritten by a previously received slave
address.
398
CHAPTER 21 400 kHz I2C INTERFACE
I2C Seven Bit Slave Address Register (ISBA)
21.2.5
This register designates the seven bit slave address.
■ I2C Seven Bit Slave address Register
Write access to this register is only possible if the interface is disabled (EN="0" in ICCR).
Figure 21.2-9 Configuration of the I2C Seven Bit Slave address Register (ISBA0/ISBA1)
Address:
7
ISBA0: 007976H
ISBA1: 007986H
-
SA6 SA5 SA4 SA3 SA2 SA1 SA0
-
R/W R/W R/W R/W R/W R/W R/W
R/W
:
Readable and writable
-
:
Undefined
6
5
4
3
2
1
0
ISBA0/ISBA1
Initial value
0 0 0 0 0 0 0 0B
■ I2C Seven Bit Slave address Register Contents
Table 21.2-5 Function of Each Bit of the I2C Seven Bit Slave address Register (ISBA0/ISBA1)
Bit name
Function
bit7
Undefined
This bit always returns "0" during reading.
bit6 to
bit0
SA6 to SA0:
Seven bit slave
address bits
When address data is received in slave mode, it is compared to the ISBA register if the
seven bit address is enabled (ENSB="1" in the ISMK register). If a match is detected, an
acknowledge signal is sent to the master device and the AAS bit is set.
All bits of the slave address may be masked using the ISMK register. The received
seven bit slave address is written back to the ISBA register, it is only valid while the
AAS bit in the IBSR register is "1".
The interface does not compare the contents of this register to the incoming data if a ten
bit header or a general call is received.
■ I2C Seven Bit Slave address Mask Register (ISMK)
This register contains the seven bit slave address mask and the seven bit mode enable bit. Write access to
this register is only possible if the interface is disabled (EN="0" in ICCR).
Figure 21.2-10 Configuration of the I2C Seven Bit Slave address Mask Register (ISMK0/ISMK1)
Address:
15
14
13
12
11
10
9
8
ISMK0: 007977H ENSB SM6 SM5 SM4 SM3 SM2 SM1SM0
ISMK1: 007987H
ISMK0/ISMK1
Initial value
0 1 1 1 1 1 1 1B
R/W R/W R/W R/W R/W R/W R/W R/W
R/W
:
Readable and writable
399
CHAPTER 21 400 kHz I2C INTERFACE
■ I2C Seven Bit Slave address Mask Register Contents
Table 21.2-6 Function of Each Bit of the I2C Seven Bit Slave address Mask Register (ISMK0/ISMK1)
Bit name
Function
bit15
ENSB:
Enable seven bit
slave address bit
This bit enables the seven bit slave address (and the acknowledging upon its reception).
"0": Seven bit slave address disabled
"1": Seven bit slave address enabled
bit14
to bit8
SMK:
Seven bit slave
address mask bits
This register is used to mask the seven bit slave address of the interface.
"0": Bit is not used in slave address comparison.
"1": Bit is used in slave address comparison.
This can be used to make the interface acknowledge on multiple seven bit slave
addresses. Only the bits set to "1" in this register are used in the seven bit slave address
comparison. The received slave address is written back to the ISBA register and may
thus may be determined by reading the ISBA register if the AAS bit in the IBSR register
is "1".
Note:
If the address mask is changed after the interface had been enabled, the slave address
should also be set again since it could have been overwritten by a previously
received slave address.
400
CHAPTER 21 400 kHz I2C INTERFACE
I2C Data Register (IDAR)
21.2.6
I2C Data Register for the 400 kHz I2C Interface.
■ I2C Data Register (IDAR)
Figure 21.2-11 Configuration of the I2C Data Register (IDAR0/IDAR1)
Address:
IDAR0: 007978H
IDAR1: 007988H
7
6
5
4
3
2
1
0
D7
D6
D5
D4
D3
D2
D1 D0
IDAR0/IDAR1
Initial value
00000000
R/W R/W R/W R/W R/W R/W R/W R/W
R/W
:
B
Readable and writable
■ I2C Data Register Contents
Table 21.2-7 Function of Each Bit of the I2C Data Register (IDAR0/IDAR1)
Bit name
bit7 to bit0
D7 to D0:
Data bits
Function
The I2C data register is used in serial data transfer, and transfers data MSB-first. This
register is double buffered on the write side, so that when the bus is in use (BB="1"),
write data can be loaded to the register for serial transfer. The data byte is loaded into
the internal transfer register if the INT bit in the IBCR register is being cleared or the
bus is idle (BB="0" in IBSR). In a read access, the internal register is read directly,
therefore received data values in this register are only valid if INT="1" in the IBCR
register.
401
CHAPTER 21 400 kHz I2C INTERFACE
I2C Clock Control Register (ICCR)
21.2.7
The I2C clock control register (ICCR) has the following functions:
• Enable test mode
• Enable I/O pad noise filters
• Enable I2C interface operation
• Setting the serial clock frequency
■ I2C Clock Control Register (ICCR)
Figure 21.2-12 Configuration of the I2C Clock Control Register (ICCR0/ICCR1)
Address:
ICCR0: 00797BH
ICCR1: 00798BH
402
R/W
:
Readable and writable
-
:
Undefined
15
14
13
12
11
10
9
8
-
NSF EN CS4 CS3 CS2 CS1 CS0
-
R/W R/W R/W R/W R/W R/W R/W
ICCR0/ICCR1
Initial value
0 0 0 1 1 1 1 1B
CHAPTER 21 400 kHz I2C INTERFACE
■ I2C Clock Control Register (ICCR) Contents
Table 21.2-8 Function of Each Bit of the I2C Clock Control Register (ICCR0/ICCR1)
Bit name
Function
bit15
Undefined
This bit always returns "0" during reading.
bit14
NSF:
IO pad noise filter
enable bit
This bit enables the noise filters built into the SDA and SCL IO pads.
0: Noise filter disabled
1: Noise filter enabled
The noise filter will suppress single spikes with a pulse width of 0 ns (minimum) and
between 1 and 1.5 cycles of the machine clock. The maximum depends on the phase
relationship between I2C signals (SDA, ACL) and machine clock.
It should be set to "1" if the interface is transmitting or receiving at data rates above
100kbps.
bit13
EN:
Enable bit
This bit enables the I2C interface operation. It can only be set by the user but may be
cleared by the user and the hardware.
"0": Interface disabled
"1": Interface enabled
When this bit is set to "0" all bits in the IBSR register and IBCR register (except the
BER and BEIE bits) are cleared and the module is disabled and the I2C lines are left
open. It is cleared by the hardware if a bus error occurs (BER="1" in IBCR).
Note:
The interface immediately stops transmitting or receiving if is it is being disabled.
This might leave the I2C bus in an undesired state.
bit12 to
bit8
CS4 to CS0:
Clock prescaler
bits
These bits select the serial bit rate. They can only be changed if the interface is disabled
(EN="0") or the EN bit is being cleared in the same write access.
n
CS4
CS3
CS2
CS1
CS0
1
0
0
0
0
1
Bitrate: φ / 28(+1)
2
0
0
0
1
0
Bitrate: φ / 40(+1)
3
0
0
0
1
1
Bitrate: φ / 52(+1)
4
0
0
1
0
0
Bitrate: φ / 64(+1)
1
1
1
Bitrate: φ / 400(+1)
...
31
1
1
(+1) means: Add 1 to divisor, if noise filter is enabled
403
CHAPTER 21 400 kHz I2C INTERFACE
■ Clock Prescaler Settings
The calculation formula for CS0 to CS4 is determined as follows:
Bitrate =
φ
n*12 + 16
n>0 φ : machine clock, Noise filter disabled
Bitrate =
φ
n*12 + 17
n>0 φ : machine clock, Noise filter enabled
Table 21.2-9 Prescaler Settings:
n
CS4
CS3
CS2
CS1
CS0
1
0
0
0
0
1
2
0
0
0
1
0
3
0
0
0
1
1
1
1
1
...
31
1
1
Note:
Do not use n=0 prescaler setting, it violates SDA/SCL timings.
■ Common Machine Clock Frequencies
The most common machine clock frequencies with their prescaler settings and the resulting sending bit
rate:
Table 21.2-10 Common Machine Clock Frequencies
Machine Clock
MHz
404
100 Kbit (Noise filter disabled)
400 Kbit (Noise filter enabled)
n
Bit rate kbps
n
Bit rate kbps
24
19
98
4
369
20
16
96
3
377
16
12
100
2
390
40/3 = 13.3
10
98
2
325
12
9
96
2
292
64/6 = 10.6
8
94
1
367
10
7
100
1
344
8
6
90
1
275
CHAPTER 21 400 kHz I2C INTERFACE
21.3
I2C Interface Operation
The I2C bus executes communication using two bi-directional bus lines, the serial data
line (SDA) and serial clock line (SCL). The I2C interface has two open-drain I/O pins
(SDA/SCL) corresponding to these lines, enabling wired logic applications.
■ Start Conditions
When the bus is free (BB="0" in IBSR, MSS="0" in IBCR), writing "1" to the MSS bit places the I2C
interface in master mode and generates a start condition.
If a "1" is written to it while the bus is idle (MSS="0" and BB="0"), a start condition is generated and the
contents of the IDAR register (which should be address data) is sent.
Repeated start conditions can be generated by writing "1" to the SCC bit when in bus master mode and
interrupt status (MSS="1" and INT="1" in IBCR).
If a "1" is written to the MSS bit while the bus is in use (BB="1" and TRX="0" in IBSR; MSS="0"and
INT="0"in IBCR), the interface waits until the bus is free and then starts sending.
If the interface is addressed as slave with write access (data reception) in the meantime, it will start sending
after the transfer ended and the bus is free again. If the interface is sending data as slave in the meantime, it
will not start sending data if the bus is free again. It is important to check whether the interface was
addressed as slave (MSS="0" in IBCR and AAS="1" in IBSR), sent the data byte successfully (MSS="1" in
IBCR) or failed to send the data byte (AL="1" in IBSR) at the next interrupt.
Writing "1" to the MSS bit or SCC bit in any other situation has no significance.
■ Stop Conditions
Writing "0" to the MSS bit in master mode (MSS="1" and INT="1" in IBCR) generates a stop condition
and places the device in slave mode. Writing "0" to the MSS bit in any other situation has no significance.
After clearing the MSS bit, the interface tries to generate a stop condition which might fail if a certain
external condition causes signal transition caused from "1" to "0" at the SCL line before the generation of
this stop condition. In this case, the AL bit is set to "1" and interrupt is signaled at the end of the next byte.
■ Slave address Detection
In slave mode, after a start condition is generated the BB is set to "1" and data sent from the master device
is received into the IDAR register.
After the reception of eight bits, the contents of the IDAR register is compared to the ISBA register using
the bit mask stored in ISMK if the ENSB bit in the ISMK register is "1". If a match results, the AAS bit is
set to "1" and an acknowledge signal is sent to the master. Then bit0 of the received data (bit0 of the IDAR
register) is inverted and stored in the TRX bit.
If the ENTB bit in the ITMK register is "1" and a ten bit address header (11110, TA1, TA0, write access) is
detected, the interface sends an acknowledge signal to the master and stores the inverted last data bit in the
TRX register. No interrupt is generated. Then, the next transferred byte is compared (using the bit mask
stored in ITMK) to the lower byte of the ITBA register. If a match is found, an acknowledge signal is sent
to the master, the AAS bit is set and an interrupt is generated.
If the interface was addressed as slave and detects a repeated start condition, the AAS bit is set after
reception of the ten bit address header (11110, TA1, TA0, read access) and an interrupt is generated.
405
CHAPTER 21 400 kHz I2C INTERFACE
Since there are separate registers for the ten and seven bit address and their bit masks, it is possible to make
the interface acknowledge on both addresses by setting the ENSB (in ISMK) and ENTB (in ITMK) bits.
The received slave address length (seven or ten bit) may be determined by reading the RAL bit in the
ITMK register (this bit is valid if the AAS bit is set only).
It is also possible to give the interface no slave address by setting both bits to "0" if it is only used as a
master.
All slave address bits may be masked with their corresponding mask register (ITMK or ISMK).
■ Slave address Masking
Only the bits set to "1" in the mask registers (ITMK / ISMK) are used for address comparison, all other bits
are ignored. The received slave address can be read from the ITBA (if ten bit address received, RAL="1")
or ISBA (if seven bit address received, RAL="0") register if the AAS bit in the IBSR register is "1".
If the bit masks are cleared, the interface can be used as a bus monitor since it will always be addressed as
slave. Note that this is not a real bus monitor because it acknowledges upon any slave address reception,
even if there is no other slave listening.
■ Addressing Slaves
In master mode, after a start condition is generated the BB and TRX bits are set to "1" and the contents of
the IDAR register is sent in MSB first order. After address data is sent and an acknowledge signal was
received from the slave device, bit0 of the sent data (bit0 of the IDAR register after sending) is inverted and
stored in the TRX bit. Acknowledgement by the slave may be checked using the LRB bit in the IBSR
register. This procedure also applies to a repeated start condition.
In order to address a ten bit slave for write access, two bytes have to be sent. The first one is the ten bit
address header which consists of the bit sequence "1 1 1 1 0 A9 A8 0B", it is followed by the second byte
containing the lower eight bits of the ten bit slave address (A7 to A0).
A ten bit slave is accessed for reading by sending the above byte sequence and generating a repeated start
condition (SCC bit in IBCR) followed by a ten bit address header with read access (1 1 1 1 0 A9 A8 1B).
Summary of the address data bytes:
7 bit slave, write access: Start condition - A6 A5 A4 A3 A2 A1 A0 0.
7 bit slave, read access: Start condition - A6 A5 A4 A3 A2 A1 A0 1.
10 bit slave, write access: Start condition - 1 1 1 1 0 A9 A8 0 - A7 A6 A5 A4 A3 A2 A1 A0.
10 bit slave, read access: Start condition - 1 1 1 1 0 A9 A8 1 - A7 A6 A5 A4 A3 A2 A1 A0.
repeated start - 1 1 1 1 0 A9 A8 1.
■ Arbitration
During sending in master mode, if another master device is sending data at the same time, arbitration is
performed. If a device is sending the data value "1" and the data on the SDA line has an "L" level value, the
device is considered to have lost arbitration, and the AL bit is set to "1." Also, the AL bit is set to "1" if a
start condition is detected at the first bit of a data byte but the interface did not want to generate one or the
generation of a start or stop condition failed by some reason.
Arbitration loss detection clears both the MSS and TRX bit and immediately places the device in slave
mode so it is able to acknowledge if its own slave address is being sent.
406
CHAPTER 21 400 kHz I2C INTERFACE
■ Acknowledgement
Acknowledge bits are sent from the receiver to the transmitter. The ACK bit in the IBCR register can be
used to select whether to send an acknowledgment when data bytes are received.
When data is send in slave mode (read access from another master), if no acknowledgement is received
from the master, the TRX bit is set to "0" and the device goes to receiving mode. This enables the master to
generate a stop condition as soon as the slave has released the SCL line.
In master mode, acknowledgement by the slave can be checked by reading the LRB bit in the IBSR
register.
407
CHAPTER 21 400 kHz I2C INTERFACE
21.4
Programming Flow Charts
Each programming flow charts for the 400 kHz I2C interface is shown below.
■ Programming Flow Charts
Figure 21.4-1 Example of Slave Addressing and Sending Data
Addressing a 7 bit slave
Sending data
Start
Start
Address slave for write
Clear BER bit (if set);
Enable Interface EN:=1;
IDAR := Data Byte;
INT := 0
IDAR := sl.address<<1+RW;
MSS := 1; INT := 0
N
INT=1?
N
INT=1?
Y
Y
Y
BER=1?
Y
Bus error
BER=1?
N
N
AL=1?
Restart
transfer
Check
if AAS
Y
AL=1?
Restart
transfer
Check
if AAS
Y
N
N
ACK?
ACK?
(LRB=0?)
N
(LRB=0?)
N
Y
Y
Ready to send data
Last byte
transferred?
Y
N
Slave did not ACK
Generate
repeated start
or stop condition
Transfer End
Generate
repeated start or
stop condition
408
CHAPTER 21 400 kHz I2C INTERFACE
Figure 21.4-2 Example of Receiving Data
Start
Address slave for read
Clear ACK bit in IBCR if it’s the
last byte to read from slave;
INT := 0
N
INT=1?
Y
BER=1?
Y
Bus error
reenable IF
N
N
Last byte
transferred?
Y
Transfer End
Generate
repeated start or
stop condition
409
CHAPTER 21 400 kHz I2C INTERFACE
410
CHAPTER 22
ADDRESS MATCH
DETECTION FUNCTION
This chapter explains the address match detection
function and operation.
22.1 Outline of the Address Match Detection Function
22.2 Registers of the Address Match Detection Function
22.3 Operation of the Address Match Detection Function
22.4 Example of the Address Match Detection Function
411
CHAPTER 22 ADDRESS MATCH DETECTION FUNCTION
22.1
Outline of the Address Match Detection Function
When an address matches the value set in the address detection register, the
instruction code to be read by the CPU is replaced with the INT9 instruction code (01H).
Consequently, the CPU executes the INT9 instruction when executing a specified
instruction. The address match detection function can be achieved using the INT9
interrupt routine for processing.
There are 6 address detection registers, each with an interrupt permission bit. When an
address matches the value set in the address detection register and the interrupt
permission bit is 1, the instruction code to be read by the CPU is replaced with the INT9
instruction code.
■ Block Diagram of the address Match Detection Function
Internal data bus
Address latch
Address detection
register
Permission bit
F2MC-16LX bus
412
Comparison
Figure 22.1-1 Block Diagram of the address Match Detection Function
INT9
instruction
F2MC-16LX
CPU core
CHAPTER 22 ADDRESS MATCH DETECTION FUNCTION
22.2
Registers of the Address Match Detection Function
The two types of registers for the address match detection function are as follows:
• Program address detection registers (PADR0 to PADR5)
• Program address detection control status register (PACSR0 and PACSR1)
■ Program address Detection Registers (PADR0 to PADR5)
The program address detection registers 0 to 5 (PADR0 to PADR5) compare the address with the value
written in each register. If they match when the interrupt permission bit corresponding to ADCSR is 1, the
CPU is requested to issue the INT9 instruction.
When the corresponding interrupt bit is 0, nothing occurs.
Figure 22.2-1 Program address Detection Registers (PADR0 to PADR5)
Program address detection registers
PADR0
PADR1
PADR2
PADR3
PADR4
PADR5
byte
79E2H/79E1H/79E0H
79E5H/79E4H/79E3H
79E8H/79E7H/79E6H
79F2H/79F1H/79F0H
79F5H/79F4H/79F3H
79F8H/79F7H/79F6H
byte
byte
Access
Initial value
R/W
R/W
R/W
R/W
R/W
R/W
Not defined
Not defined
Not defined
Not defined
Not defined
Not defined
Table 22.2-1 lists the correspondence between the program address detection registers (PADR0 to PADR5)
and PACSR.
Table 22.2-1 Correspondence between PADR0 to PADR5 Registers and PACSR0 and
PACSR1 Registers
Address detection register
Interrupt permission bit
PADR0
AD0E (bit1)
PADR1
AD1E (bit3)
PADR2
AD2E (bit5)
PADR3
AD3E (bit1)
PADR4
AD4E (bit3)
PADR5
AD5E (bit5)
413
CHAPTER 22 ADDRESS MATCH DETECTION FUNCTION
■ Program address Detection Control Status Register (PACSR)
The program address detection control status register (PACSR) controls the operation of the address
detection function.
Figure 22.2-2 Program address Detection Control Status Registers (PACSR0/PACSR1)
Address:
00009E H
7
6
5
4
3
2
1
0
Reserved Reserved AD2E Reserved AD1E Reserved AD0E Reserved
R/W R/W R/W R/W R/W R/W R/W R/W
Address:
15
00003B H
Reserved Reserved AD5E Reserved AD4E Reserved AD3E Reserved
14
13
12
11
10
9
8
R/W R/W R/W R/W R/W R/W R/W R/W
R/W
PACSR0
Initial value
00000000
B
PACSR1
Initial value
0 0 0 0 0 0 0 0B
: Readable and writable
Table 22.2-2 Function of Each Bit of PACSR1 and PACSR0
Name
Function
bit15 to
bit14
Reserved bits
Bit15 to bit14 are reserved. Set these bits to 0 before setting PACSR1.
bit13
AD5E:
Address detect
register 1 enable
The AD5E bit is the operation permission bit of ASIE ADR5.
When this bit is 1, the address is compared with the PADR5 register. If they match,
the INT9 instruction is issued.
bit12
Reserved bit
Bit12 is reserved. Set this bit to 0 before setting PACSR1.
bit11
AD4E:
Address detect
register 1 enable
The AD4E bit is the operation permission bit of ASIE ADR4.
When this bit is 1, the address is compared with the PADR4 register. If they match,
the INT9 instruction is issued.
bit10
Reserved bit
Bit10 is reserved. Set this bit to 0 before setting PACSR1.
bit9
AD3E:
Address detect
register 1 enable
The AD3E bit is the operation permission bit of ASIE ADR3.
When this bit is 1, the address is compared with the PADR3 register. If they match,
the INT9 instruction is issued.
bit8
Reserved bit
Bit8 is reserved. Set this bit to 0 before setting PACSR1.
bit7 to bit6
Reserved bits
Bit7 to bit6 are reserved. Set these bits to 0 before setting PACSR0.
bit5
AD2E:
Address detect
register 1 enable
The AD2E bit is the operation permission bit of ASIE ADR2.
When this bit is 1, the address is compared with the PADR2 register. If they match,
the INT9 instruction is issued.
bit4
Reserved bits
Bit4 is reserved. Set these bits to 0 before setting PACSR0.
bit3
AD1E:
Address detect
register 1 enable
The AD1E bit is the operation permission bit of ASIE ADR1.
When this bit is 1, the address is compared with the PADR1 register. If they match,
the INT9 instruction is issued.
bit2
Reserved bit
Bit2 is reserved. Set this bit to 0 before setting PACSR0.
bit1
AD0E:
Address detect
register 0 enable
The AD0E bit is the operation permission bit of ADR0.
When this bit is 1, the address is compared with the PADR0 register. If they match,
the INT9 instruction is issued.
bit0
Reserved bit
Bit0 is reserved. Set this bit to 0 before setting PACSR0.
414
CHAPTER 22 ADDRESS MATCH DETECTION FUNCTION
22.3
Operation of the Address Match Detection Function
If the program counter specifies the same address as the address match detection
register, the INT9 instruction is executed. The address match detection function can be
achieved by processing the INT9 instruction routine.
■ Operation of the address Match Detection Function
There are 6 address detection registers with a compare enable bit. When the value set in the address
detection register and the value of the program counter match and the compare enable bit is set to 1, the
CPU executes the INT9 instruction.
Note:
If the value of the address detection register and the value of the program counter match, the
contents of internal data bus is changed to 01H. Consequently, the INT9 instruction is executed.
Before changing the contents of the address detection register, always set the compare enable bit to
0. While the compare enable bit is set to 1, changing the contents of the address detection register
may result in a malfunction.
415
CHAPTER 22 ADDRESS MATCH DETECTION FUNCTION
22.4
Example of the Address Match Detection Function
Figure 22.4-1 shows a system configuration example of the address match detection
function. Table 22.4-1 lists the EEPROM memory map.
■ System Configuration Example of the address Match Detection Function
Figure 22.4-1 System Configuration Example of the address Match Detection Function
EEPROM
MCU
F2MC16LX
SIN
Pull-up resistor
Connector (UART)
Table 22.4-1 EEPROM Memory Map
Address
Description
0000H
Number of bytes of patch program No.0 (If 0, no program
error exists.)
0001H
Program address No.0 bit7 to bit0
0002H
Program address No.0 bit15 to bit8
0003H
Program address No.0 bit24 to bit16
0004H
Number of bytes of patch program No.1 (If 0, no program
error exists.)
0005H
Program address No.1 bit7 to bit0
0006H
Program address No.1 bit15 to bit8
0007H
Program address No.1 bit24 to bit16
0010H or higher
Main body of patch program No. 0
● Initial status
EEPROM is set to all 0s.
416
CHAPTER 22 ADDRESS MATCH DETECTION FUNCTION
● When a program error occurs:
The main body of the patch program and program address are transferred to the MCU through the
connector (UART). The MCU writes the information to EEPROM.
● Reset sequence
The MCU reads the value of EEPROM after reset. If the number of bytes of the patch program is not 0, the
main body of the patch program is read from EEPROM and written to RAM. The MCU then uses either
PADR0 or PADR1 to set the patch address and sets the compare enable bit. If the relocatable patch
program is required, the first address of the patched program can be written to the RAM area. In this case,
the INT9 routine accesses this user-defined RAM area and jumps to the patched program.
● INT9 interrupt
The interrupt routine can know the address where the interrupt occurs by checking the value of the stack
program counter. The information that has been placed on the stack during the interrupt is discarded.
■ Example of Program Patch Processing
Figure 22.4-2 Example of Program Patch Processing
FFFFFFH
Abnormal program
PC = address in error
ROM
External EEPROM
Register set for
program patch
Number of program bytes
Address where the interrupt occurs
Corrected program
Data transfer using UART
Corrected program
RAM
000000H
417
CHAPTER 22 ADDRESS MATCH DETECTION FUNCTION
Figure 22.4-3 Flow of Program Patch Processing
Reset
Reads "00H" of EEPROM
INT9
YES
0000H (EEPROM)=0
To patch program
JMP 000400H
NO
Read address
"0001H" to "0003H" (EEPROM)
MOV
PADR0 (MCU)
Execute patch program
"000400H" to "000480H"
Read patch program
"0010H" to "0090H" (EEPROM)
MOV
"000400H" to "000480H" (MCU)
Terminate patch program
JMP FF0050H
Enable compare
MOV PACSR, #02H
Execute normal program
NO
PC=PADR0
YES
INT9
FFFFFFH
FF0050H
ROM
EEPROM
Abnormal program
FF0000H
FFFFH
FE0000H
0090H
Patch program
0010H
001100H
Stack area
0003H
0002H
0001H
0000H
418
Program address
low-order:
Program address
middle-order:
Program address
high-order:
Number of bytes of
the patch program:
RAM area
00
00
000480H
Patch program
RAM
000400H
RAM and register area
FF
000100H
I/O area
80
000000H
CHAPTER 23
ROM MIRRORING MODULE
This chapter explains the ROM mirroring module.
23.1 Outline of ROM Mirroring Module
23.2 ROM Mirroring Register (ROMM)
419
CHAPTER 23 ROM MIRRORING MODULE
23.1
Outline of ROM Mirroring Module
The ROM Mirroring module switches whether to mirror the image of the FF bank of the
ROM to the 00 bank.
■ Block Diagram of ROM Mirroring Module
Figure 23.1-1 Block Diagram of ROM Mirroring Module
F2MC-16LX BUS
Internal data bus
ROM Mirrroring Register
Address Area
address
data
420
FF bank
00 bank
ROM
CHAPTER 23 ROM MIRRORING MODULE
23.2
ROM Mirroring Register (ROMM)
Do not access the ROM mirroring register (ROMM) when addresses "008000H" to
"00FFFFH" are being accessed.
■ ROM Mirroring Register (ROMM)
Address:
00006FH
15
14
13
12
11
10
9
8
-
-
-
-
-
-
-
MI
-
-
-
-
-
-
-
W
W
:
Write only
X
-
:
:
Undefined value
Undefined
ROMM
Initial value
X X X X X X X1B
Table 23.2-1 Function of Each Bit of ROM Mirroring Register
Bit Name
bit15 to bit9
Undefined
bit8
MI:
Mirror bit
Function
The image of the ROM data in the FF bank can also be found in the 00
bank when "1" is written to this bit. However, this memory mapping will
not be done when this bit is written to "0". This bit is write only.
Note:
Only "FF8000H" to "FFFFFFH" is mirrored to "008000H" to "00FFFFH" when the ROM mirroring
function is activated. Therefore, addresses "FF0000H" to "FF7FFFH" will not be mirrored to 00 bank.
421
CHAPTER 23 ROM MIRRORING MODULE
422
CHAPTER 24
1M-BIT
FLASH MEMORY
This chapter explains the functions and operation of the
1M-bit flash memory. The following three methods are
available for writing data to and erasing data from the
flash memory:
• Parallel programmer
• Serial programmer
• Executing programs to write/erase data
This chapter explains "Executing programs to write/
erase data".
24.1 Overview of 1M-bit Flash Memory
24.2 Block Diagram of the Entire Flash Memory and Sector
Configuration of the Flash Memory
24.3 Write/Erase Modes
24.4 Flash Memory Control Status Register (FMCS)
24.5 Starting the Flash Memory Automatic Algorithm
24.6 Confirming the Automatic Algorithm Execution State
24.7 Detailed Explanation of Writing to and Erasing Flash Memory
24.8 Notes on using 1M-bit Flash Memory
24.9 Flash Security Feature
24.10 Example of Programming 1M-bit Flash Memory
423
CHAPTER 24 1M-BIT FLASH MEMORY
24.1
Overview of 1M-bit Flash Memory
The 1M-bit flash memory is mapped to the "FFH" to "FEH" bank in the CPU memory
map. The functions of the flash memory interface circuit enable read-access and
program-access from the CPU in the same way as mask ROM. Instructions from the
CPU can be used via the flash memory interface circuit to write data to and erase data
from the flash memory. Internal CPU control therefore enables rewriting of the flash
memory while it is mounted. As a result, improvements in programs and data can be
performed efficiently.
■ 1M-bit Flash Memory Features
•
Use of automatic program algorithm (Embedded Algorithm: Equivalent to MBM29LV200)
•
Erase pause/restart functions provided
•
Detection of completion of writing/erasing using data polling or toggle bit functions
•
Detection of completion of writing/erasing using CPU interrupts
•
Sector erase function (any combination of sectors)
•
Minimum of 10,000 write/erase operations
• Flash reading cycle time: Minimum of 2 machine cycles
Embedded Algorithm is a trademark of Advanced Micro Devices, Inc.
Note:
The manufacturer code and device code do not have the reading function. These codes cannot be
accessed by the command.
■ Writing to/Erasing Flash Memory
The flash memory cannot be written to and read at the same time. That is, when data is written to or erased
data from the flash memory, the program in the flash memory must first be copied to RAM. The entire
process is then executed in RAM so that data is simply written to the flash memory. This eliminates the
need for the program to access the flash memory from the flash memory itself.
■ Flash Memory Control Status Register (FMCS)
FMCS
Address: 0000AEH
424
7
6
5
4
3
2
1
0
INTE
RDYINT
WE
RDY
Reserved
Reserved
Reserved
Reserved
(R/W)
(R/W)
(R/W)
(R)
-
-
-
-
Initial value
000X0000B
CHAPTER 24 1M-BIT FLASH MEMORY
24.2
Block Diagram of the Entire Flash Memory and Sector
Configuration of the Flash Memory
Figure 24.2-1 shows a block diagram of the entire flash memory with the flash memory
interface circuit included. Figure 24.2-2 shows the sector configuration of the flash
memory.
■ Block Diagram of the Entire Flash Memory
Figure 24.2-1 Block Diagram of the Entire Flash Memory
Flash memory
interface circuit
Port 0
Port 1
Port 2
Port 3
Port 4
Port 5
F2MC-16LX
bus
1M/2M/3M-bit
Flash memory
BYTE
INT
BYTE
CE
CE
OE
OE
WE
WE
AQ0 to AQ18
AQ0 to AQ17
AQ-1
DQ0 to DQ15
DQ0 to DQ15
RY/BY
RY/BY
RESET
Write enable interrupt signal
(to CPU)
External reset signal
RY/BY write
enable signal
■ Sector Configuration of the 1M-bit Flash Memory
Figure 24.2-2 shows the sector configuration of the 1M-bit flash memory. The addresses in the figure
indicate the high-order and low-order addresses of each sector.
425
CHAPTER 24 1M-BIT FLASH MEMORY
Figure 24.2-2 Sector Configuration of the 1M-bit Flash Memory
Programmer
address*
CPU
address
SA4 (16 K Byes)
7FFFFH
FFFFFFH
SA3 (8 K Bytes)
7BFFFH
FFBFFFH
SA2 (8 K Byes)
79FFFH
FF9FFFH
SA1 (32 K Bytes)
77FFFH
FF7FFFH
6FFFFH
FEFFFFH
60000 H
FE0000 H
MB90F867A(S)
SA0 (64 K Byes)
* The programmer address is equivalent to the CPU address when data is written to the
flash memory using a parallel programmer. When a general programmer is used for
writing/erasing, this address is used for writing/erasing.
426
CHAPTER 24 1M-BIT FLASH MEMORY
24.3
Write/Erase Modes
The flash memory can be accessed in two different ways: Flash memory mode and
alternative mode. Flash memory mode enables data to be directly written to or erased
from the external pins. Alternative mode enables data to be written to or erased from
the CPU via the internal bus. Use the mode external pins to select the mode.
■ Flash Memory Mode
The CPU stops when the mode pins are set to "111B" while the reset signal is asserted. The flash memory
interface circuit is connected directly to ports 0, 1, 2, 3, 4 and 5, enabling direct control from the external
pins. This mode makes the MCU seem like a standard flash memory to the external pins, and write/erase
can be performed using a flash memory programmer.
In flash memory mode, all operations supported by the flash memory automatic algorithm can be used.
■ Alternative Mode
The flash memory is located in the "FEH" to "FFH" banks in the CPU memory space, and like ordinary
mask ROM, can be read-accessed and program-accessed from the CPU via the flash memory interface
circuit.
Since writing/erasing the flash memory is performed by instructions from the CPU via the flash memory
interface circuit, this mode allows rewriting even when the MCU is soldered on the target board.
Sector protect operations cannot be performed in these modes.
■ Flash Memory Control Signals
Table 24.3-1 lists the flash memory control signals in flash memory mode.
There is almost a one-to-one correspondence between the flash memory control signals and the external
pins of the MBM29LV200. The VID (12 V) pins required by the sector protect operations are MD0, MD1,
and MD2 instead of A9, RESET, and OE for the MBM29LV200.
In flash memory mode, the external data bus signal width is limited to 8 bits, enabling only one-byte
access. The DQ15 to DQ8 pins are not supported. The BYTE pin should always be set to 0.
427
CHAPTER 24 1M-BIT FLASH MEMORY
Table 24.3-1 Flash Memory Control Signals
MB90F867A(S)
Pin number
428
MBM29LV200
Normal function
Flash memory mode
LQFP
QFP
3
5
P30
AQ16
A15
4
6
P31
CE
CE
5
7
P32
OE
OE
6
8
P33
WE
WE
9
11
P36
BYTE
BYTE
10
12
P37
RY/BY
RY/BY
16, 19
18 to 21
P42 to P45
AQ8 to AQ11
A7 to A10
20, 21
22, 23
P46, P47
AQ12, AQ13
A11, A12
22, 23
24, 25
P50, P51
AQ14, AQ15
A13, A14
51
53
MD0
MDO
A9 (VID)
50
52
MD1
MD1
RESET (VID)
49
51
MD2
MD2
OE (VID)
75 to 82
77 to 84
P00 to P07
DQ0 to DQ7
DQ0 to DQ7
83 to 86
85 to 88
P10 to P13
DQ8 to DQ11
DQ8 to DQ11
52
54
RST
RESET
RESET
87, 92 to 94
89, 94 to 96
P14 to P17
DQ12 to DQ15
DQ12 to DQ15
99, 100, 1, 2,
95 to 98
1 to 4, 97 to 100
P20 to P27
AQ0 to AQ7
A-1, A0 to A6
CHAPTER 24 1M-BIT FLASH MEMORY
24.4
Flash Memory Control Status Register (FMCS)
The flash memory control status register (FMCS), together with the flash memory
interface circuit, is used to write data to and erase data from the flash memory.
■ Flash Memory Control Status Register (FMCS)
Figure 24.4-1 Flash Memory Control Status Register (FMCS)
7
6
5
4
3
2
1
0
INTE
RDYINT
WE
RDY
Reserved
Reserved
Reserved
Reserved
(R/W)
(R/W)
(R/W)
(R)
-
-
-
-
FMCS
Address: 0000AEH
Initial value
000X0000B
● Explanation of bits
[bit7] INTE (interrupt enable)
This bit generates an interrupt to the CPU when flash memory write/erase terminates.
An interrupt to the CPU is generated when the INTE and RDYINT bits are 1. No interrupt is generated
when the INTE bit is 0.
•
0: Disables interrupts when write/erase terminates.
•
1: Enables interrupts when write/erase terminates.
[bit6] RDYINT (ready interrupt)
This bit indicates the operating state of the flash memory.
This bit is set to 1 when flash memory write/erase terminates. Data cannot be written to or erased from
the flash memory while this bit is 0 after a flash memory write/erase. Flash memory write/erase is
enabled when write/erase terminates and this bit is set to 1.
Writing 0 clears this bit to 0. Writing 1 is ignored. This bit is set to 1 at the termination timing of the
flash memory automatic algorithm (see Section "24.5 Starting the Flash Memory Automatic
Algorithm"). When the read-modify-write (RMW) instruction is used, 1 is always read.
•
0: Write/erase is being executed.
•
1: Write/erase has terminated (interrupt request generated).
[bit5] WE (write enable)
This bit enables writing to the flash memory area.
When this bit is 1, writing after the command sequence (see Section "24.5 Starting the Flash Memory
Automatic Algorithm") is issued to the FC (F9) to FF bank writes to the flash memory area. When this
bit is 0, the write/erase signal is not generated. This bit is used when the flash memory Write/Erase
command is started.
If write/erase is not performed, it is recommended that this bit be set to 0 to prevent data from being
mistakenly written to the flash memory.
•
0: Disables flash memory write/erase.
•
1: Enables flash memory write/erase.
429
CHAPTER 24 1M-BIT FLASH MEMORY
[bit4] RDY (ready)
This bit enables flash memory write/erase.
Flash memory write/erase is disabled while this bit is 0. However, Suspend commands, such as the
Read/Reset command and Sector Erase Suspend command, can be accepted even if this bit is 0.
•
0: Write/erase is being executed.
•
1: Write/erase has terminated (next data write/erase enabled).
[bit3 to bit0] Reserved bits
These bits are reserved for testing. During regular use, they should always be set to 0.
Notes:
• This register can be accessed only in byte-access mode.
• The RDYINT and RDY bits cannot be changed at the same time. Create a program so that
decisions are made using one or the other of these bits.
Figure 24.4-2 Transitions of the RDYINT and RDY Bits
Automatic algorithm
Termination timing
RDYINT bit
RDY bit
1 machine cycle
430
CHAPTER 24 1M-BIT FLASH MEMORY
24.5
Starting the Flash Memory Automatic Algorithm
Four types of commands are available for starting the flash memory automatic
algorithm: Read/Reset, Write, and Chip Erase. Control of suspend and restart is enabled
for sector erase.
■ Command Sequence Table
Table 24.5-1 lists the commands used for flash memory write/erase. All of the data written to the command
register is in bytes, but use word access to write. The data of the high-order bytes at this time is ignored.
Table 24.5-1 Command Sequence Table
Command
sequence
1st bus write
cycle
Bus
write
access
2nd bus write cycle
3rd bus write cycle
4th bus write cycle
5th bus write cycle
6th bus write cycle
Address
Data
Address
Data
Address
Data
Address
Data
Address
Data
Address
Data
Read/Reset *
1
FxXXXX
XXF0
-
-
-
-
-
-
-
-
-
-
Read/Reset *
4
FxAAAA
XXAA
Fx5554
XX55
FxAAAA
XXF0
RA
RD
-
-
-
-
Write program
4
FxAAAA
XXAA
Fx5554
XX55
FxAAAA
XXA0
PA
(even)
PD
(word)
-
-
-
-
Chip Erase
6
FxAAAA
XXAA
Fx5554
XX55
FxAAAA
XX80
FxAAAA
XXAA
Fx5554
XX55
FxAAAA
XX10
Sector Erase
6
FxAAAA
XXAA
Fx5554
XX55
FxAAAA
XX80
FxAAAA
XXAA
Fx5554
XX55
SA
(even)
XX30
-
-
Sector Erase Suspend
Entering address FxXXXX data (xxB0H) suspends erasing during sector erase.
Sector Erase Restart
Entering address FxXXXX data (xx30H) restarts erasing after erasing is suspended during sector erase.
Auto-select
3
FxAAA
XXAA
Fx5554
XX55
FxAAAA
XX90
-
-
-
-
*: Both of the two types of Read/Reset commands can reset the flash memory to read mode.
Notes:
• The addresses Fx in the table mean "FF", "FE", "FD", "FC", "FB", "FA" and "F9" for1M-bit Flash
Memory. Use these addresses as the access target bank values for operations.
• The addresses in the table are the values in the CPU memory map. All addresses and data are
represented using hexadecimal notation. However, the letter X is an optional value.
• RA: Read address
• PA: Write address. Only even addresses can be specified.
• SA: Sector address. See Section "24.2 Block Diagram of the Entire Flash Memory and Sector
Configuration of the Flash Memory".
• RD: Read data
• PD: Write data. Only word data can be specified.
431
CHAPTER 24 1M-BIT FLASH MEMORY
The Auto-select command shown in Table 24.5-2 is used to know the state of sector protection. When
using the Auto-select command, set the address as follows.
Table 24.5-2 Address Setting at Auto-select Command Sequence Table
Sector protection
AQ13 to AQ17 (,AQ18)
AQ7
AQ2
AQ1
AQ0
DQ7 to DQ0
Sector Address
L
H
L
L
CODE*
*: When the sector address is protected, the output is "01H".
When the sector address is not protected, the output is "00H".
432
CHAPTER 24 1M-BIT FLASH MEMORY
24.6
Confirming the Automatic Algorithm Execution State
Because the write/erase flow of the flash memory is controlled using the automatic
algorithm, the flash memory has hardware for posting its internal operating state and
completion of operation. This automatic algorithm enables confirmation of the
operating state of the built-in flash memory using the following hardware sequences.
■ Hardware Sequence Flags
The hardware sequence flags are configured from the five-bit output of DQ7, DQ6, DQ5, DQ3 and DQ2.
The functions of these bits are those of the data polling flag (DQ7), toggle bit flag (DQ6), timing limit
exceeded flag (DQ5), sector erase timer flag (DQ3) and toggle bit-2 flag (DQ2). The hardware sequence
flags can therefore be used to confirm that writing or chip sector erase has been completed or that erase
code write is valid.
The hardware sequence flags can be accessed by read-accessing the addresses of the target sectors in the
flash memory after setting of the command sequence (see Table 24.5-1 in Section "24.5 Starting the Flash
Memory Automatic Algorithm". Table 24.6-1 lists the bit assignments of the hardware sequence flags.
Table 24.6-1 Bit Assignments of Hardware Sequence Flags
Bit No.
7
6
5
4
3
2
1
0
Hardware sequence flag
DQ7
DQ6
DQ5
-
DQ3
DQ2
-
-
To determine whether automatic writing or chip sector erase is being executed, the hardware sequence flags
can be checked or the status can be determined from the RDY bit of the flash memory control register
(FMCS) that indicates whether writing has been completed. After writing/erasing has terminated, the state
returns to the read/reset state. When creating a program, use one of the flags to confirm that automatic
writing/erasing has terminated. Then, perform the next processing operation, such as data read. In addition,
the hardware sequence flags can be used to confirm whether the second or subsequent sector erase code
write is valid. The following sections describe each hardware sequence flag separately. Table 24.6-2 lists
the functions of the hardware sequence flags.
433
CHAPTER 24 1M-BIT FLASH MEMORY
Table 24.6-2 Hardware Sequence Flag Functions
State
State
change for
normal
operation
Write → Write completed (write
address specified)
Chip/sector erase → Erase completed
Sector erase wait → Erase started
Abnormal
operation
DQ7
DQ7 →
DATA:7
DQ6
Toggle →
DATA:6
DQ5
0→
DATA:5
DQ3
0→
DATA:3
1→
DATA:2
0→1
Toggle →
Stop
0→1
1
Toggle →
Stop
0
Toggle
0
0→1
Toggle
Erase → Sector erase suspended (sector
being erased)
0→1
Toggle →
1
0
1→0
Toggle
Sector erase suspend → Erase restarted
(sector being erased)
1→0
1→
Toggle
0
0→1
Toggle
Sector erase suspended (sector not being
erased)
DATA:7
DATA:6
DATA:5
DATA:3
DATA:2
DQ7
Toggle
1
0
1
0
Toggle
1
1
*
Write
Chip/sector erase
*: If the DQ5 outputs "1" (exceed the timing limit), successive reads from a writing or erasing sector cause DQ2 to
toggle. DQ2 does not toggle when the successive reads are executed from other sectors.
434
DQ2
CHAPTER 24 1M-BIT FLASH MEMORY
24.6.1
Data Polling Flag (DQ7)
The data polling flag (DQ7) uses the data polling function to post that the automatic
algorithm is being executed or has terminated
■ Data Polling Flag (DQ7)
Table 24.6-3 and Table 24.6-4 list the state transitions of the data polling flag.
Table 24.6-3 Data Polling Flag State Transitions (State Change for Normal Operation)
Operating
state
DQ7
Write →
Completed
DQ7 →
Chip/sector
erase →
Completed
0→1
Sector
erase wait
→
Started
Sector erase →
Erase suspend
(sector being
erased)
0→1
0
Sector erase
suspend →
Restarted
(sector being
erased)
1→0
Sector erase
suspended
(sector not
being erased)
DATA:7
Table 24.6-4 Data Polling Flag State Transitions (State Change for Abnormal Operation)
Operating state
DQ7
Write
DQ7
Chip/sector erase
0
● Write
Read-access during execution of the automatic write algorithm causes the flash memory to output the
opposite data of bit7 last written, regardless of the value at the address specified by the address signal.
Read-access at the end of the automatic write algorithm causes the flash memory to output bit7 of the read
value of the address specified by the address signal.
● Chip/sector erase
For a sector erase, read-access during execution of the chip erase/sector erase algorithm causes the flash
memory to output 0 from the sector currently being erased. For a chip erase, read-access causes the flash
memory to output 0 regardless of the value at the address specified by the address signal. Read-access at
the end of the automatic write algorithm causes the flash memory to output 1 in the same way.
● Sector erase suspend
Read-access during a sector erase suspend causes the flash memory to output 1 if the address specified by
the address signal belongs to the sector being erased. The flash memory outputs bit7 (DATA: 7) of the read
value at the address specified by the address signal if the address specified by the address signal does not
belong to the sector being erased. Referencing this flag together with the toggle bit flag (DQ6) enables a
decision to be made on whether the flash memory is in the erase suspended state and which sector is being
erased.
435
CHAPTER 24 1M-BIT FLASH MEMORY
Note:
When the automatic algorithm is being started, read-access to the specified address is ignored.
Since termination of the data polling flag (DQ7) can be accepted for a data read and other bits
output, data read after the automatic algorithm has terminated should be performed after readaccess has confirmed that data polling has terminated.
436
CHAPTER 24 1M-BIT FLASH MEMORY
24.6.2
Toggle Bit Flag (DQ6)
Like the data polling flag, the toggle bit flag (DQ6) uses the toggle bit function to post
that the automatic algorithm is being executed or has terminated.
■ Toggle Bit Flag (DQ6)
Table 24.6-5 and Table 24.6-6 list the state transitions of the toggle bit flag.
Table 24.6-5 Toggle Bit Flag State Transitions (State Change for Normal Operation)
Operating
state
DQ6
Write →
Completed
Chip/sector
erase →
Completed
Toggle →
DATA:6
Toggle →
Stop
Sector
erase wait
→ Started
Toggle
Sector erase
→ Erase
suspend
(sector being
erased)
Toggle → 1
Sector erase
suspend →
Restarted
(sector being
erased)
1 → Toggle
Sector erase
suspended
(sector not
being erased)
DATA:6
Table 24.6-6 Toggle Bit Flag State Transitions (State Change for Abnormal Operation)
Operating state
DQ6
Write
Toggle
Chip/sector erase
Toggle
● Write/chip sector erase
Continuous read-access during execution of the automatic write algorithm and chip/sector erase algorithm
causes the flash memory to toggle the 1 or 0 state for every read cycle, regardless of the value at the
address specified by the address signal. Continuous read-access at the end of the automatic write algorithm
and chip/sector erase algorithm causes the flash memory to stop toggling bit6 and output bit6 (DATA: 6) of
the read value of the address specified by the address signal.
● Sector erase suspend
Read-access during a sector erase suspend causes the flash memory to output 1 if the address specified by
the address signal belongs to the sector being erased. The flash memory outputs bit6 (DATA: 6) of the read
value at the address specified by the address signal if the address specified by the address signal does not
belong to the sector being erased.
Note:
For a write, if the sector where data is to be written is rewrite-protected, the toggle bit terminates the
toggle operation after approximately 2µs without any data being rewritten. For an erase, if all of the
selected sectors are write-protected, the toggle bit performs toggling for approximately 100µs and
then returns to the read/reset state without any data being rewritten.
437
CHAPTER 24 1M-BIT FLASH MEMORY
24.6.3
Timing Limit Exceeded Flag (DQ5)
The timing limit exceeded flag (DQ5) is used to post that execution of the automatic
algorithm has exceeded the time (internal pulse count) prescribed in the flash memory.
■ Timing Limit Exceeded Flag (DQ5)
Table 24.6-7 and Table 24.6-8 list the state transitions of the timing limit exceeded flag.
Table 24.6-7 Timing Limit Exceeded Flag State Transitions (State Change for Normal Operation)
Operating
state
DQ5
Write →
Completed
Chip/sector
erase →
Completed
0→
DATA:5
0→1
Sector
erase wait
→ Started
0
Sector erase
suspend →
Restarted
(sector being
erased)
Sector erase
→ Erase
suspend
(sector being
erased)
0
0
Sector erase
suspended
(sector not
being erased)
DATA:5
Table 24.6-8 Timing Limit Exceeded Bit Flag State Transitions (State Change for Abnormal
Operation)
Operating state
DQ5
Write
1
Chip/sector erase
1
● Write/chip sector erase
Read-access after write or chip/sector erase automatic algorithm activation causes the flash memory to
output 0 if the time is within the prescribed time (time required for write/erase) or to output 1 if the
prescribed time has been exceeded. Because this is done regardless of whether the automatic algorithm is
being executed or has terminated, it is possible to determine whether write/erase was successful or
unsuccessful. That is, when this flag outputs 1, writing can be determined to have been unsuccessful if the
automatic algorithm is still being executed by the data polling function or toggle bit function.
For example, writing 1 to a flash memory address where 0 has been written will cause the fail state to
occur. In this case, the flash memory will lock and execution of the automatic algorithm will not terminate.
As a result, valid data will not be output from the data polling flag (DQ7). In addition, the toggle bit flag
(DQ6) will exceed the time limit without stopping the toggle operation and the timing limit exceeded flag
(DQ5) will output 1. Note that this state indicates that the flash memory is not faulty, but has been used
correctly. When this state occurs, execute the Reset command.
438
CHAPTER 24 1M-BIT FLASH MEMORY
24.6.4
Sector Erase Timer Flag (DQ3)
The sector erase timer flag (DQ3) is used to post whether the automatic algorithm is
being executed during the sector erase wait period after the Sector Erase command has
been started.
■ Sector Erase Timer Flag (DQ3)
Table 24.6-9 and Table 24.6-10 list the state transitions of the sector erase timer flag.
Table 24.6-9 Sector Erase Timer Flag State Transitions (State Change for Normal Operation)
Operating
state
DQ3
Write →
Completed
Chip/sector
erase →
Completed
0→
DATA:3
1
Sector
erase wait
→ Started
0→1
Sector erase →
Erase suspend
(sector being
erased)
1→0
Sector erase
suspend →
Restarted
(sector being
erased)
0→1
Sector erase
suspended
(sector not
being erased)
DATA:3
Table 24.6-10 Sector Erase Timer Flag State Transitions (State Change for Abnormal
Operation)
Operating state
DQ3
Write
0
Chip/sector erase
1
● Sector erase
Read-access after the Sector Erase command has been started causes the flash memory to output 0 if the
automatic algorithm is being executed during the sector erase wait period, regardless of the value at the
address specified by the address signal of the sector that issued the command. The flash memory outputs 1
if the sector erase wait period has been exceeded.
If the data polling function or toggle bit function indicates that the erase algorithm is being executed,
internally controlled erase has already started if this flag is 1. Continuous write of the sector erase codes or
commands other than the Sector Erase Suspend command will be ignored until erase is terminated.
If this flag is 0, the flash memory will accept write of additional sector erase codes. To confirm this, it is
recommended that the state of this flag be checked before continuing to write sector erase codes. If this flag
is 1 after the second state check, it is possible that additional sector erase codes may not be accepted.
● Read access during sector erase
Read-access during execution of sector erase suspend causes the flash memory to output 1 if the address
specified by the address signal belongs to the sector being erased. If this address does not belong to the
sector being erased, the flash memory outputs bit3 (DATA:3) of the corresponding memory value.
439
CHAPTER 24 1M-BIT FLASH MEMORY
24.6.5
Toggle Bit-2 Flag (DQ2)
The toggle bit-2 flag (DQ2) is a flag that uses the toggle bit function to indicate that the
sector is in the erase-suspended state.
■ Toggle Bit-2 Flag (DQ2)
Table 24.6-11 and Table 24.6-12 list the state transitions of the toggle bit flag.
Table 24.6-11 Toggle Bit-2 Flag State Transitions (State Change for Normal Operation)
Operating
state
DQ2
Write →
Completed
Chip/sector
erase →
Completed
1 → DATA:2
Toggle →Stop
Sector
erase wait
→ Started
Toggle
Sector erase
→ Erase
suspend
(sector being
erased)
Toggle
Sector erase
suspend →
Restarted
(sector being
erased)
Toggle
Sector erase
suspended
(sector not
being erased)
DATA:2
Table 24.6-12 Toggle Bit-2 Flag State Transitions (State Change for Abnormal Operation)
Operating state
DQ2
Write
1
Chip/sector erase
*
*: If the DQ5 outputs "1" (exceed the timing limit), successive reads from a writing or erasing sector cause DQ2 to
toggle.
DQ2 does not toggle when the successive reads are executed from other sectors.
● During a sector erase operation
If successive reads are executed during the execution of the chip sector erase algorithm, a flash memory
toggles to output "1" and "0" to addresses alternately at every read access regardless of the location
indicated by the addresses. If successive reads are executed after the chip sector erase algorithm is
completed, the flash memory stops the toggle operation of the bit2 and outputs the read value of the bit2
(DATA: 2) to the location indicated by the address.
● While a sector erase operation is suspended
If successive reads are executed while a sector erase operation is suspended, and if the address indicates the
sector to be erased, the flash memory toggles to alternately output "1" and "0". If the address indicates the
sector is not to be erased, the flash memory outputs the read value of the bit2 (DATA: 2) to the location
indicated by the address.
In the erase-suspend-program mode, successive reads from the non-erase suspended sector causes the flash
memory to output "1".
Both DQ2 and DQ6 are used for detecting an erase-suspended sector (DQ2 toggles, but DQ6 does not).
DQ2 is also used for detecting an erasing sector. While erasing a sector, if a read access is executed from
the erasing sector, DQ2 toggles.
440
CHAPTER 24 1M-BIT FLASH MEMORY
Reference:
If all sectors selected for erasing are write-protected, the toggle bit-2 toggles for about 100ms, and
then returns to the read/reset mode without writing the data.
441
CHAPTER 24 1M-BIT FLASH MEMORY
24.7
Detailed Explanation of Writing to and Erasing Flash
Memory
This section describes each operation procedure of flash memory Read/Reset, Write,
Chip Erase, Sector Erase, Sector Erase Suspend, and Sector Erase Restart when a
command that starts the automatic algorithm is issued.
■ Detailed Explanation of Flash Memory Write/Erase
The flash memory executes the automatic algorithm by issuing a command sequence (see Table 24.5-1 in
Section "24.5 Starting the Flash Memory Automatic Algorithm") for a write cycle to the bus to perform
Read/Reset, Write, Chip Erase, Sector Erase, Sector Erase Suspend, or Sector Erase Restart operations.
Each bus write cycle must be performed continuously. In addition, whether the automatic algorithm has
terminated can be determined using the data polling or other function. At normal termination, the flash
memory is returned to the read/reset state.
Each operation of the flash memory is described in the following order:
442
•
Setting the read/reset state
•
Writing data
•
Erasing all data (erasing chips)
•
Erasing optional data (erasing sectors)
•
Suspending sector erase
•
Restarting sector erase
CHAPTER 24 1M-BIT FLASH MEMORY
24.7.1
Setting The Read/Reset State
This section describes the procedure for issuing the Read/Reset command to set the
flash memory to the read/reset state.
■ Setting the Flash Memory to the Read/Reset State
The flash memory can be set to the read/reset state by sending the Read/Reset command in the command
sequence table (see Table 24.5-1 in Section "24.5 Starting the Flash Memory Automatic Algorithm")
continuously to the target sector in the flash memory.
The Read/Reset command has two types of command sequences that execute the first and third bus
operations. However, there are no essential differences between these command sequences.
The read/reset state is the initial state of the flash memory. When the power is turned on and when a
command terminates normally, the flash memory is set to the read/reset state. In the read/reset state, other
commands wait for input.
In the read/reset state, data is read by regular read-access. As with the mask ROM, program access from the
CPU is enabled. The Read/Reset command is not required to read data by a regular read. The Read/Reset
command is mainly used to initialize the automatic algorithm in such cases as when a command does not
terminate normally.
443
CHAPTER 24 1M-BIT FLASH MEMORY
24.7.2
Writing Data
This section describes the procedure for issuing the Write command to write data to the
flash memory.
■ Writing Data to the Flash Memory
The data write automatic algorithm of the flash memory can be started by sending the Write command in
the command sequence table (see Table 24.5-1 in Section "24.5 Starting the Flash Memory Automatic
Algorithm") continuously to the target sector in the flash memory. When data write to the target address is
completed in the fourth cycle, the automatic algorithm and automatic write are started.
● Specifying addresses
Only even addresses can be specified as the write addresses specified in a write data cycle. Odd addresses
cannot be written correctly. That is, writing to even addresses must be done in units of word data.
Writing can be done in any order of addresses or even if the sector boundary is exceeded. However, the
Write command writes only data of one word for each execution.
● Notes on writing data
Writing cannot return data 0 to data 1. When data 1 is written to data 0, the data polling algorithm (DQ7) or
toggle operation (DQ6) does not terminate and the flash memory elements are determined to be faulty. If
the time prescribed for writing is thus exceeded, the timing limit exceeded flag (DQ5) is determined to be
an error. Otherwise, the data is viewed as if dummy data 1 had been written. However, when data is read in
the read/reset state, the data remains 0. Data 0 can be set to data 1 only by erase operations.
All commands are ignored during execution of the automatic write algorithm. If a hardware reset is started
during writing, the data of the written addresses will be unpredictable.
■ Writing to the Flash Memory
Figure 24.7-1 is an example of the procedure for writing to the flash memory. The hardware sequence flags
(see Section "24.6 Confirming the Automatic Algorithm Execution State") can be used to determine the
state of the automatic algorithm in the flash memory. Here, the data polling flag (DQ7) is used to confirm
that writing has terminated.
The data read to check the flag is read from the address written to last.
The data polling flag (DQ7) changes at the same time that the timing limit exceeded flag (DQ5) changes.
For example, even if the timing limit exceeded flag (DQ5) is 1, the data polling flag bit (DQ7) must be
rechecked.
Also for the toggle bit flag (DQ6), the toggle operation stops at the same time that the timing limit
exceeded flag bit (DQ5) changes to 1. The toggle bit flag (DQ6) must therefore be rechecked.
444
CHAPTER 24 1M-BIT FLASH MEMORY
Figure 24.7-1 Example of the Flash Memory Write Procedure
Start writing
FMCS: WE (bit 5)
Enable flash memory write
Write command sequence
(1) FxAAAA <-- XXAA
(2) Fx5554 <-- XX55
(3) FxAAAA <-- XXA0
(4) Write address <-- Write data
Read internal address
Data polling (DQ7)
Next address
Data
Data
0
Timing limit (DQ5)
1
Read internal address
Data
Data polling (DQ7)
Data
Write error
Final address
FMCS: WE (bit 5)
Disable flash memory write
Complete writing
:Confirm with the hardware
sequence flags.
445
CHAPTER 24 1M-BIT FLASH MEMORY
24.7.3
Erasing All Data (Erasing Chips)
This section describes the procedure for issuing the Chip Erase command to erase all
data in the flash memory.
■ Erasing All Data in the Flash Memory (Erasing Chips)
All data can be erased from the flash memory by sending the Chip Erase command in the command
sequence table (see Table 24.5-1 in Section "24.5 Starting the Flash Memory Automatic Algorithm")
continuously to the target sector in the flash memory.
The Chip Erase command is executed in six bus operations. When writing of the sixth cycle is completed,
the chip erase operation is started. For chip erase, the user need not write to the flash memory before
erasing. During execution of the automatic erase algorithm, the flash memory writes 0 for verification
before all of the cells are erased automatically.
446
CHAPTER 24 1M-BIT FLASH MEMORY
24.7.4
Erasing Optional Data (Erasing Sectors)
This section describes the procedure for issuing the Sector Erase command to erase
optional data (erase sector) in the flash memory. Individual sectors can be erased.
Multiple sectors can also be specified at one time.
■ Erasing Optional Data (Erasing Sectors) in the Flash Memory
Optional sectors in the flash memory can be erased by sending the Sector Erase command in the command
sequence table (see Table 24.5-1 in Section "24.5 Starting the Flash Memory Automatic Algorithm")
continuously to the target sector in the flash memory.
● Specifying sectors
The Sector Erase command is executed in six bus operations. Sector erase wait of 50µs is started by writing
the sector erase code (30H) to an accessible even-numbered address in the target sector in the sixth cycle.
To erase multiple sectors, write the erase code (30H) to the addresses in the target sectors after the above
processing operation.
● Notes on specifying multiple sectors
Erase is started when the sector erase wait period of 50µs terminates after the final sector erase code has
been written. That is, to erase multiple sectors at one time, an erase code (sixth cycle of the command
sequence) must be written within 50µs of writing of the address of a sector and the address of the next
sector must be written within 50µs of writing of the previous erase code. Otherwise, the address and erase
code may not be accepted. The sector erase timer (hardware sequence flag DQ3) can be used to check
whether writing of the subsequent sector erase code is valid.
At this time, specify so that the address used for reading the sector erase timer indicates the sector to be
erased.
■ Erasing Sectors in the Flash Memory
The hardware sequence flags (see Section "24.6 Confirming the Automatic Algorithm Execution State")
can be used to determine the state of the automatic algorithm in the flash memory. Figure 24.7-2 is an
example of the procedure for erasing sectors in the flash memory. Here, the toggle bit flag (DQ6) is used to
confirm that erasing has terminated.
The data that is read to check the flag is read from the sector to be erased.
The toggle bit flag (DQ6) stops the toggle operation at the same time that the timing limit exceeded flag
(DQ5) is changed to 1. For example, even if the timing limit exceeded flag (DQ5) is 1, the toggle bit flag
(DQ6) must be rechecked.
The data polling flag (DQ7) also changes at the same time that the timing limit exceeded flag bit (DQ5)
changes. As a result, the data polling flag (DQ7) must be rechecked.
447
CHAPTER 24 1M-BIT FLASH MEMORY
Figure 24.7-2 Example of the Flash Memory Sector Erase Procedure
Start erasing
FMCS: WE (bit 5)
Enable flash memory erase
Erase command sequence
(1) FxAAAA <-- XXAA
(2) Fx5554 <-- XX55
(3) FxAAAA <-- XX80
(4) FxAAAA <-- XXAA
(5) Fx5554 <-- XX55
(6) Enter code to erase sector
(30H)
Y
Another erase sector
N
Read internal address 1
Read internal address 2
N
Y
Next sector
Toggle bit (DQ6)
data 1(DQ6) = data 2(DQ6)
Sector erase completed
Y
N
0
Timing limit (DQ5)
1
Read internal address 1
Read internal address 2
N
Toggle bit (DQ6)
data 1(DQ6) = data 2(DQ6)
Y
Erase error
Final sector
N
Y
FMCS: WE (bit 5)
Disable flash memory erase
: Confirm with the hardware
sequence flags.
Complete erasing
448
CHAPTER 24 1M-BIT FLASH MEMORY
24.7.5
Suspending Sector Erase
This section describes the procedure for issuing the Sector Erase Suspend command
to suspend erasing of flash memory sectors. Data can be read from sectors that are not
being erased.
■ Suspending Erasing of Flash Memory Sectors
Erasing of flash memory sectors can be suspended by sending the Sector Erase Suspend command in the
command sequence table (see Table 24.5-1 in Section "24.5 Starting the Flash Memory Automatic
Algorithm") continuously to the target sector in the flash memory.
The Sector Erase Suspend command suspends the sector erase operation being executed and enables data to
be read from sectors that are not being erased. In this state, only reading is enabled; data cannot be written.
This command is valid only during sector erase operations that include the erase wait time. The command
will be ignored during chip erase or write operations.
This command is implemented by writing the erase suspend code (B0h). At this time, specify an optional
address in the flash memory for the address. An Erase Suspend command issued again during erasing of
sectors will be ignored.
Entering the Sector Erase Suspend command during the sector erase wait period will immediately terminate
sector erase wait, cancel the erase operation, and set the erase stop state. Entering the Erase Suspend
command during the erase operation after the sector erase wait period has terminated will set the erase
suspend state after a maximum period of 15µs has elapsed.
449
CHAPTER 24 1M-BIT FLASH MEMORY
24.7.6
Restarting Sector Erase
This section describes the procedure for issuing the Sector Erase Restart command to
restart suspended erasing of flash memory sectors.
■ Restarting Erasing of Flash Memory Sectors
Suspended erasing of flash memory sectors can be restarted by sending the Sector Erase Restart command
in the command sequence table (see Table 24.5-1 in Section "24.5 Starting the Flash Memory Automatic
Algorithm") continuously to the target sector in the flash memory.
The Sector Erase Restart command is used to restart erasing of sectors from the sector erase suspend state
set using the Sector Erase Suspend command. The Sector Erase Restart command is implemented by
writing the erase restart code (30h). At this time, specify an optional address in the flash memory area for
the address.
If a Sector Erase Restart command is issued during sector erase, the command will be ignored.
450
CHAPTER 24 1M-BIT FLASH MEMORY
24.8
Notes on using 1M-bit Flash Memory
This section contains notes on using 1M-bit flash memory.
■ Notes on Using Flash Memory
● Input of a hardware reset (RST)
To input a hardware reset when the automatic algorithm has not been started and reading is in progress, a
minimum low-level width of 500 ns must be maintained. In this case, a maximum of 500 ns is required
until data can be read from the flash memory after a hardware reset has been activated.
Similarly, to input a hardware reset when the automatic algorithm has been activated and writing or erasing
is in progress, a minimum low-level width of 50 ns must be maintained. In this case, 20 µs are required
until data can be read after the operation for initializing the flash memory has terminated.
A hardware reset during writing the data being written to be undefined. A hardware reset during erasing
may make the sector being erased unusable.
● Canceling of a software reset and watchdog timer reset
When the flash memory is being written to or erased with CPU access and if reset conditions occur while
the automatic algorithm is active, the CPU may run out of control. This occurs because these reset
conditions cause the automatic algorithm to continue without initializing the flash memory unit, possibly
preventing the flash memory unit from entering the read state when the CPU starts the sequence after the
reset has been deasserted. These reset conditions must be disabled during writing to or erasing of the flash
memory.
● Program access to flash memory
When the automatic algorithm is operating, read access to the flash memory is disabled. With the memory
access mode of the CPU set to internal ROM mode, writing or erasing must be started after the program
area is switched to another area such as RAM. In this case, when sectors (SA11) containing interrupt
vectors are erased, writing or erasing interrupt processing cannot be executed. For the same reason, all
interrupt sources other than the flash memory are disabled while the automatic algorithm is operating.
Also, while the automatic algorithm is being executed, all interrupt sources except flash memory are
disabled.
● Hold function
When the CPU accepts a hold request, the Write signal WE of the flash memory unit may be skewed,
causing erroneous writing or erasing due to an erroneous write. When the acceptance of a hold request is
enabled (HDE bit of EPCR set to 1), ensure that the WE bit of the control status register (FMCS) is 0.
● Extended intelligent I/O service (EI2OS)
Because write and erase interrupts issued to the CPU from the flash memory interface circuit cannot be
accepted by the EI2OS, they should not be used.
451
CHAPTER 24 1M-BIT FLASH MEMORY
● Applying VID
Applying VID required for the sector protect operation should always be started and terminated when the
supply voltage is on.
452
CHAPTER 24 1M-BIT FLASH MEMORY
24.9
Flash Security Feature
Flash Security Feature provides possibilities to protect the content of the flash memory
from being read from external pins.
■ Abstract
By writing the protection code of "01H" to one predefined address of the flash memory (1M-bit flash
memory:FE0001H), access to the flash memory is restricted. Once the flash memory is protected,
performing the chip erase operation only can unlock the function. Otherwise read/write access to the flash
memory from the external pins is not possible.
This function is suitable for applications requiring security of self-containing and data stored in the flash
memory.
■ How to Enable the Flash Security Feature
After writing the code "01H" to the predefined address of each flash memory(1M-bit flash
memory:FE0001H), the following external reset or power-on enables the Flash Security Feature.
■ How to Disable the Flash Security Feature
Performing the chip erase operation.
■ Behavior Under the Flash Security Feature
Read operation: invalid data read
Write operation: ignored
■ Others
(1) About configuration of the standard parallel programmer, please follow to the specification of parallel
programmer.
(2) Writing the protection code at the last of flash memory programming is recommended, in order to
prevent the device from enabling the Flash Security Feature accidentally.
453
CHAPTER 24 1M-BIT FLASH MEMORY
24.10
Example of Programming 1M-bit Flash Memory
This section presents a programming example of 1M-bit flash memory.
■ Programming Example of 1M-bit Flash Memory
Flash Memory Sample Program
NAME
FLASHWE
TITLE FLASHWE
;------------------------------------------------------------------------------;1M-bit-FLASH test program
;
;1: Transmits the program (address: FFA000H, sector: SA3) from FLASH to RAM
;
(address: 001500H).
;2: Executes the program on RAM.
;3: Writes the PDR1 value to FLASH (address: FF0000H, sector: SA1).
;4: Reads the written value (address: FF0000H, sector: SA1) and outputs it to PDR2.
;5: Erases the written sector (SA1).
;6: Checks and outputs erase data.
;Conditions
; - Number of bytes transmitted to RAM: 100H (256B)
; - Write/erase termination judgment
;
Judgment according to DQ5 (timing limit excess flag)
;
Judgment according to DQ6 (toggle bit flag)
;
Judgment according to RDY (FMCS)
; - Error handling
;
"H" output to P00 to P07
;
Reset command issuance
;------------------------------------------------------------------;
RESOUS IOSEG
ABS=00
;"RESOUS" I/O segment definition
ORG
0000H
PDR0
RB
1
PDR1
RB
1
PDR2
RB
1
PDR3
RB
1
ORG
0010H
DDR0
RB
1
DDR1
RB
1
DDR2
RB
1
DDR3
RB
1
ORG
00A1H
CKSCR
RB
1
ORG
00AEH
FMCS
RB
1
ORG
006FH
ROMM
RB
1
RESOUS ENDS
;
SSTA
SSEG
RW
0127H
STA_T
RW
1
SSTA
ENDS
;
DATA
DSEG
ABS=0FFH
;Flash command address
ORG
5554H
COMADR2 RW
1
ORG
0AAAAH
COMADR1 RW
1
DATA
ENDS
454
CHAPTER 24 1M-BIT FLASH MEMORY
;/////////////////////////////////////////////////////////////
;Main program (FFA000H)
;/////////////////////////////////////////////////////////////
CODE
CSEG
START:
;
/////////////////////////////////////////////////////
;
Initialization
;
/////////////////////////////////////////////////////
MOV
CKSCR,#0BAH
;3-multiple setting
MOV
RP,#0
MOV
A,#!STA_T
MOV
SSB,A
MOVW
A,#STA_T
MOVW
SP,A
MOV
ROMM,#00H
;Mirror OFF
MOV
PDR0,#00H
;For error check
MOV
DDR0,#0FFH
MOV
PDR1,#00H
;Port for data input
MOV
DDR1,#00H
MOV
PDR2,#00H
;Port for data output
MOV
DDR2,#0FFH
;
//////////////////////////////////////////////////////////////
;
Transfer of "Flash write erase program (FFA000H)" to RAM (1500H address)
;
//////////////////////////////////////////////////////////////
MOVW
A,#1500H
;Transfer destination RAM area
MOVW
A,#0A000H
;Transfer source address (program position)
MOVW
RW0,#100H
;Number of bytes to be transferred
MOVS
ADB,PCB
;Transfer of 100H from FFA000H to 001500H
CALLP
001500H
;Jump to the address containing the transferred
;
program
;
/////////////////////////////////////////////////////
;
Data output
;
/////////////////////////////////////////////////////
OUT
MOV
A,#0FFH
MOV
ADB,A
MOVW
RW2,#0000H
MOVW
A,@RW2+00
MOV
PDR2,A
END
JMP
*
CODE
ENDS
;////////////////////////////////////////////////////////////
;Flash write erase program (SA3)
;////////////////////////////////////////////////////////////
RAMPRG CSEG
ABS=0FFH
ORG
0BC00H
;
////////////////////////////////////////////
Initialization
;
////////////////////////////////////////////
MOVW
RW0,#0500H
;RW0:RAM space for input data acquisition
From 00:0500
MOVW
RW2,#0000H
;RW2:Flash memory write address
From FF:0000
MOV
A,#00H
;DTB modification
MOV
DTB,A
;Bank specification for @RW0
MOV
A,#0FFH
;ADB modification 1
MOV
ADB,A
;Bank specification for write mode specification
;
address
MOV
PDR3,#00H
;Switch initialization
MOV
DDR3,#00H
;
WAIT1
BBC
PDR3:0,WAIT1
;PDR3: 0(write start at high level)
;
455
CHAPTER 24 1M-BIT FLASH MEMORY
;////////////////////////////////////////////////
;Write (SA1)
;////////////////////////////////////////////////
MOV
A,PDR1
MOVW
@RW0+00,A
;PDR1 data allocation to RAM
MOV
FMCS,#20H
;Write mode setting
MOVW
ADB:COMADR1,#00AAH
;Flash write command 1
MOVW
ADB:COMADR2,#0055H
;Flash write command 2
MOVW
ADB:COMADR1,#00A0H
;Flash write command 3
;
MOVW
A,@RW0+00
;Input data (RW0) write to flash memory (RW2)
MOVW
@RW2+00,A
WRITE
;Wait time check
;
///////////////////////////////////////////////////////////////////
;
ERROR when the time limit excess check flag is set and toggle operation is
;
in progress
;
///////////////////////////////////////////////////////////////////
MOV
A,@RW2+00
AND
A,#20H
;DQ5 time limit check
BZ
NTOW
;Time limit over
MOVW
A,@RW2+00
;AH
MOVW
A,@RW2+00
;AL
XORW
A
;XOR of AH and AL (1 when the values differ)
AND
A,#40H
;Is the DQ6 toggle bit different?
BNZ
ERROR
;To ERROR when the DQ6 toggle bit is different
;
///////////////////////////////////////
;
Write termination check (FMCS-RDY)
;
///////////////////////////////////////
;
///////////////////////////////////////
NTOW
MOV
A,FMCS
AND
A,#10H
;Extraction of FMCS RDY bit (bit 4)
BZ
WRITE
;End of write?
MOV
FMCS,#00H
;Write mode release
;
/////////////////////////////////////////////////////
;
Write data output
;
/////////////////////////////////////////////////////
MOVW
RW2,#0000H
;Write data output
MOVW
A,@RW2+00
MOV
PDR2,A
;
WAIT2
BBC
PDR3:1,WAIT2
;PDR3: 1(sector erase start at high level)
;
;/////////////////////////////////////////////
;Sector erase (SA1)
;/////////////////////////////////////////////
MOV
@RW2+00,#0000H
;Address initialization
MOV
FMCS,#20H
;Erase mode setting
MOVW
ADB:COMADR1,#00AAH
;Flash erase command 1
MOVW
ADB:COMADR2,#0055H
;Flash erase command 2
MOVW
ADB:COMADR1,#0080H
;Flash erase command 3
MOVW
ADB:COMADR1,#00AAH
;Flash erase command 4
MOVW
ADB:COMADR2,#0055H
;Flash erase command 5
MOV
@RW2+00,#0030H
;Issuance of erase command 6 to the sector
to be erased
ELS
;Wait time check
;
///////////////////////////////////////////////////////////////////
;
ERROR when the time limit excess check flag is set and toggle operation is
;
in progress
;
///////////////////////////////////////////////////////////////////
MOVW
A,@RW2+00
AND
A,#20H
;DQ5 time limit check
BZ
NTOE
;Time limit over
MOVW
A,@RW2+00
;AH High and Low are alternately output from
MOVW
A,@RW2+00
;AL DQ6 per read during write operation.
XORW
A
;XOR of AH and AL (If the DQ6 value differs,
;
write operation is in progress (1)).
AND
A,#40H
;Is the DQ6 toggle bit High?
BNZ
ERROR
;ERROR when the DQ6 toggle bit is High
456
CHAPTER 24 1M-BIT FLASH MEMORY
;
;
;
NTOE
///////////////////////////////////////
Erase termination check (FMCS-RDY)
///////////////////////////////////////
MOV
A,FMCS
;
AND
A,#10H
;Extraction of FMCS RDY bit (bit 4)
BZ
ELS
;End of sector erase?
MOV
FMCS,#00H
;Flash erase mode release
RETP
;Return to the main program
;//////////////////////////////////////////////
;Error
;//////////////////////////////////////////////
ERROR
MOV
FMCS,#00H
;Flash mode release
MOV
PDR0,#0FFH
;Error handling check
MOV
ADB:COMADR1,#0F0H
;Reset command (read is enabled)
RETP
;Return to the main program
RAMPRG ENDS
;/////////////////////////////////////////////
VECT
CSEG
ABS=0FFH
ORG
0FFDCH
DSL
START
DB
00H
VECT
ENDS
;
457
CHAPTER 24 1M-BIT FLASH MEMORY
458
CHAPTER 25
EXAMPLES OF MB90F867A(S)
SERIAL PROGRAMMING
CONNECTION
This chapter provides examples of F2MC-16LX
MB90F867A(S) serial programming connection.
25.1 Basic Configuration of MB90F867A(S) Serial Programming
Connection
25.2 Example of Serial Programming Connection (User Power Supply
Used)
25.3 Example of Serial Programming Connection (Power Supplied from
the Programmer)
25.4 Example of Minimum Connection to the Flash Microcomputer
Programmer (User Power Supply Used)
25.5 Example of Minimum Connection to the Flash Microcomputer
Programmer (Power Supplied from the Programmer)
459
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
25.1
Basic Configuration of MB90F867A(S) Serial Programming
Connection
The MB90F867A(S) supports flash ROM serial onboard programming (Fujitsu standard).
This section describes the specifications.
■ Basic Configuration of MB90F867A(S) Serial Programming Connection
The AF220/AF210/AF120/AF110 flash microcomputer programmer from Yokogawa Digital Computer
Corporation is used for Fujitsu standard serial onboard programming.
Figure 25.1-1 Fujitsu Standard Serial Onboard Programming of MB90F867A(S)
Host interface cable (AZ201)
AF220/AF210/
AF120/AF110
flash
microcomputer
programmer
+
memory card
General-purpose
common cable (AZ210)
CLK synchronous serial
MB90F867A(S)
User system
Stand-alone operation enabled
Note:
Ask the company representative from Yokogawa Digital Computer Corporation for details about the
functions and operations of the AF220/AF210/AF120/AF110 flash microcomputer programmer,
general-purpose common cable for connection (AZ210), and connectors.
460
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
Table 25.1-1 Pins Used for Fujitsu Standard Serial Onboard Programming
Pin
Function
Additional information
MD2, MD1
MD0
Mode pins
Controls programming mode from the flash microcomputer
programmer.
X0, X1
Oscillation pins
In programming mode, the CPU internal operation clock signal is
one multiple of the PLL clock signal frequency. Therefore, because
the oscillation clock frequency becomes the internal operation clock
signal, the oscillator used for serial reprogramming is 3 MHz to 16
MHz.
P00, P01
Programming activation pins
Set P00 to an input of "L" level and P01 to an input of "H" level.
RST
Reset pin
SIN0
Serial data input pin
SOT0
Serial data output pin
SCK0
Serial clock signal input pin
C
C pin
This external capacitor pin is used to stabilize the power supply.
Connect a ceramic capacitor of approximately 0.1 µF to the outside.
VCC
Power voltage supply pin
If the programming voltage (5 V 10%) is supplied from the user
system, the flash microcomputer programmer need not be
connected. Connect so that the power supply of the user side is not
short-circuited.
VSS
GND pin
Common to the ground of the flash microcomputer programmer.
-
Serial input-output is used.
Even if the P00, P01, SIN0, SOT0, and SCK0 pins are used for the user system, the control circuit shown in
the figure below is required. The /TICS signal of the flash microcomputer programmer can be used to
disconnect the user circuit during serial programming.
Sections "25.2 Example of Serial Programming Connection (User Power Supply Used)" to "25.5 Example
of Minimum Connection to the Flash Microcomputer Programmer (Power Supplied from the Programmer)"
present examples the following four types of serial programming connection. See each Section as required.
•
Serial programming connection (user power supply used)
•
Serial programming connection (power supplied from the programmer)
•
Minimum connection to the flash microcomputer programmer (user power supply used)
•
Minimum connection to the flash microcomputer programmer (power supplied from the programmer)
461
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
Figure 25.1-2 Connecting User Circuitry for Serial Programming
AF220/AF210/
AF120/AF110
write control pin
MB90F867A(S)
write control pin
10 k
AF220/AF210/
AF120/AF110
/TICS pin
User circuit
Table 25.1-2 System Configuration of Flash Microcomputer Programmers (Manufactured
By Yokogawa Digital Computer Corporation)
Model
Main unit
Function
AF220/AC4P
Ethernet interface built-in model and 100 to 220 V AC power adapter
AF210/AC4P
Standard model and 100 to 220 V AC power adapter
AF120/AC4P
Single-key Ethernet interface built-in model and 100 to 220 V AC power
adapter
AF110/AC4P
Single-key model and 100 to 220 V AC power adapter
AZ221
PC/AT RS232C cable for programmer
AZ210
Standard target probe (a) with a 1 m cable
FF201
Fujitsu F2MC-16LX flash microcomputer control module
AZ290
Remote controller
/P2
2M bytes PC card (optional) for flash memory sizes up to 128K bytes
/P4
4M bytes PC card (optional) for flash memory sizes up to 512K bytes
Inquiries:
Yokogawa Digital Computer Corporation
Telephone number: (81)-42-333-6222
Note:
Although the AF200 flash microcomputer programmer is no longer manufactured, the programmer
still can be used in combination with the FF201 control module.
Examples of serial programming connection are given in Sections "25.2 Example of Serial
Programming Connection (User Power Supply Used)" and "25.3 Example of Serial Programming
Connection (Power Supplied from the Programmer)".
462
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
■ Oscillating Clock Frequency and Serial Clock Input Frequency
The equation listed below can be used to calculate the serial clock frequencies that can be used for the
MB90F867A(S). Set an appropriate serial clock input frequency in the flash microcomputer programmer
according to the oscillating clock frequency in use.
fSC = 0.125 × fOSC,
where fSC is the serial clock frequency and fOSC is the oscillating clock frequency.
Table 25.1-3 Examples of Serial Clock Frequencies that can be Used
Oscillating clock
frequency
Maximum serial clock
frequency that can be
used for microcomputers
Maximum serial clock
frequency that can be
used for the AF220,
AF210, AF120, and
AF110
Maximum serial clock
frequency that can be
used for the AF200
4 MHz
500 kHz
500 kHz
500 kHz
8 MHz *
1 MHz
850 kHz
500 kHz
16 MHz *
2 MHz
1.25 MHz
500 kHz
*: External clock only.
463
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
25.2
Example of Serial Programming Connection (User Power
Supply Used)
Figure 25.2-1 is an example of a serial programming connection for internal vector
modes (single-chip mode) when the user power supply is used.
The value 1 and 0 are input to mode pins MD2 and MD0 from TAUX3 and TMODE of the
AF220/AF210/AF120/AF110 programmer.
Serial reprogramming mode: MD2, MD1, MD0 = 110B.
■ Example of Serial Programming Connection (User Power Supply Used)
Figure 25.2-1 Example of Serial Programming Connection for MB90F867A(S) Internal Vector Modes
(User Power Supply Used)
AF220/AF210/AF120/AF110
flash microcomputer
programmer
TAUX3
User system
MB90F867A(S)
Connector
DX10-28S or DX20-28S
MD2
(19)
10 kΩ
10 kΩ
MD1
10 kΩ
TMODE
(12)
4MHz to
16 MHz
TAUX
MD0
X0
X1
P00
(23)
10kΩ
/TICS
(10)
User
10kΩ
/TRES
10 kΩ
RST
(5)
10 kΩ
User
0.1 or more µF
TTXD
TRXD
TCK
TVcc
GND
(13)
(27)
(6)
SIN0
SOT0
SCK0
(2)
(7, 8,
14,15,
21, 22
1, 28)
P01
C
Vcc
User power
supply
Vss
Pin 14
Pins 3, 4, 9, 11, 16, 17, 18, 20,
24, 25, and 26 are open.
DX10-28S: Right-angle type
DX20-28S: Straight type
464
Pin 1
DX10-28S
DX20-28S
Pin 28
Pin 15
Connector (Hirose Electronics Ltd.)
pin arrangement
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
•
Even if the SIN0, SOT0, and SCK0 pins are used for the user system, the control circuit shown in the
figure below is required in the same way that it is for P00. The /TICS signal of the flash microcomputer
programmer can be used to disconnect the user circuit during serial programming.
•
Connect the AF220/AF210/AF120/AF110 while the user power is off.
Figure 25.2-2 Connecting User Circuitry (detail)
AF220/AF210/
AF120/AF110
write control pin
MB90F867A(S)
write control pin
10 k
AF220/AF210/
AF120/AF110
/TICS pin
User circuit
465
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
25.3
Example of Serial Programming Connection (Power
Supplied from the Programmer)
Figure 25.3-1 is an example of a serial programming connection for internal vector
modes (single-chip mode) when power is supplied from the programmer.
The value 1 and 0 are input to mode pins MD2 and MD0 from TAUX3 and TMODE of the
AF220/AF210/AF120/AF110 programmer.
Serial reprogramming mode: MD2, MD1, MD0 = 110B.
■ Example of Serial Programming Connection (Power Supplied from the Programmer)
Figure 25.3-1 Example of Serial Programming Connection for MB90F867A(S) Internal Vector Modes
(Power Supplied from the Programmer)
AF220/AF210/AF120/AF110
flash microcomputer
programmer
TAUX3
User system
MB90F867A(S)
Connector
DX10-28S or DX20-28S
MD2
(19)
10 kΩ
10 kΩ
MD1
10 kΩ
TMODE
MD0
X0
(12)
4MHz to
16 MHz
TAUX
X1
P00
(23)
10 kΩ
/TICS
(10)
User
10 kΩ
/TRES
10 kΩ
RST
(5)
10 kΩ
User
0.1 or more µF
TTXD
TRXD
TCK
TVcc
GND
(13)
(27)
(6)
SIN0
SOT0
SCK0
(2)
(7, 8,
14,15,
21, 22
1, 28)
P01
C
User power
supply
Vcc
Vss
Pin 14
Pins 3, 4, 9, 11, 16, 17, 18, 20,
24, 25, and 26 are open.
DX10-28S: Right-angle type
DX20-28S: Straight type
466
Pin 1
DX10-28S
DX20-28S
Pin 28
Pin 15
Connector (Hirose Electronics Ltd.)
pin arrangement
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
•
Even if the SIN0, SOT0, and SCK0 pins are used for the user system, the control circuit shown in the
figure below is required in the same way that it is for P00. The /TICS signal of the flash microcomputer
programmer can be used to disconnect the user circuit during serial programming.
•
Connect the AF220/AF210/AF120/AF110 while the user power is off.
•
When the programming power is supplied from the AF220/AF210/AF120/AF110, be careful not to
short-circuit the user power supply.
Figure 25.3-2 Connecting User Circuitry (detail)
AF220/AF210/
AF120/AF110
write control pin
MB90F867A(S)
write control pin
10 k
AF220/AF210/
AF120/AF110
/TICS pin
User circuit
467
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
25.4
Example of Minimum Connection to the Flash
Microcomputer Programmer (User Power Supply Used)
Figure 25.4-1 is an example of the minimum connection to the flash microcomputer
programmer when the user power supply is used.
Serial reprogramming mode: MD2, MD1, MD0 = 110B.
■ Example of Minimum Connection to the Flash Microcomputer Programmer (User
Power Supply Used)
For a flash memory write, the MD2, MD1, MD0, and P00 pins and flash microcomputer programmer need
not be connected if the pins are set as described below.
Figure 25.4-1 Example of Minimum Connection to the Flash Microcomputer Programmer (User Power Supply Used)
MB90F867A(S)
AF220/AF210/AF120/AF110 User system
flash microcomputer
programmer
1 for serial
reprogramming
10 k Ω
MD2
10 k Ω
10 k Ω
1 for serial
reprogramming
MD1
10 k Ω
10 k Ω
MD0
0 for serial
reprogramming
10 k Ω
X0
4MHz to
16 MHz
10k Ω
0 for serial
reprogramming
X1
P00
10 k Ω
User circuit
P01
1 for serial reprogramming
User
circuit
Connector
DX10-28S or
DX20-28S
/TRES
TTXD
TRXD
TCK
TVcc
(5)
(13)
(27)
(6)
(2)
GND
(7, 8,
14,15,
21, 22,
1, 28)
0.1 or more µF
10 k Ω
468
RST
SIN0
SOT0
SCK0
Vcc
User power supply
Pins 3, 4, 9, 10, 11, 12, 16, 17, 18, 19,
20, 23, 24, 25, and 26 are open.
DX10-28S: Right-angle type
DX20-28S: Straight type
C
Vss
Pin 14
Pin 1
Pin 28
Pin 15
DX10-28S
DX20-28S
Connector (Hirose Electronics Ltd.)
pin arrangement
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
•
Even if the SIN0, SOT0, and SCK0 pins are used for the user system, the control circuit shown in the
figure below is required. The /TICS signal of the flash microcomputer programmer can be used to
disconnect the user circuit during serial programming.
•
Connect the AF220/AF210/AF120/AF110 while the user power is off.
Figure 25.4-2 Connecting User Circuitry (detail)
AF220/AF210/
AF120/AF110
write control pin
MB90F867A(S)
write control pin
10 k
AF220/AF210/
AF120/AF110
/TICS pin
User circuit
469
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
25.5
Example of Minimum Connection to the Flash
Microcomputer Programmer (Power Supplied from the
Programmer)
Figure 25.5-1 is an example of the minimum connection to the flash microcomputer
programmer when power is supplied from the Programmer.
Serial reprogramming mode: MD2, MD1, MD0 = 110B.
■ Example of Minimum Connection to the Flash Microcomputer Programmer (Power
Supplied from the Programmer)
For a flash memory write, the MD2, MD1, MD0, and P00 pins and flash microcomputer programmer need
not be connected if the pins are set as described below.
Figure 25.5-1 Example of Minimum Connection to the Flash Microcomputer Programmer
(Power Supplied from the Programmer)
MB90F867A(S)
AF220/AF210/AF120/AF110 User system
flash microcomputer
programmer
1 for serial
reprogramming
10 kΩ
MD2
1 for serial
reprogramming
10 k Ω
10 k Ω
10k Ω
10k Ω
MD1
MD0
0 for serial
reprogramming
10 k Ω
4MHz to
16 MHz
10k Ω
0 for serial
reprogramming
X0
X1
P00
10 k Ω
User circuit
P01
1 for serial reprogramming
User
circuit
Connector
DX10-28S or
DX20-28S
/TRES
TTXD
TRXD
TCK
(5)
(13)
(27)
(6)
(2)
(3)
(16)
0.1 or more µF
10 k Ω
RST
SIN0
SOT0
SCK0
Vcc
TVcc
GND
(7,8,
14,15,
21, 22,
1, 28)
Pins 4, 9, 10, 11, 12, 17, 18, 19,
20, 23, 24, 25, and 26 are open.
DX10-28S: Right-angle type
DX20-28S: Straight type
C
Vss
Pin 14
Pin 1
Pin 28
Pin 15
DX10-28S
DX20-28S
Connector (Hirose Electronics Ltd.)
pin arrangement
470
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
•
Even if the SIN0, SOT0, and SCK0 pins are used for the user system, the control circuit shown in the
figure below is required. The /TICS signal of the flash microcomputer programmer can be used to
disconnect the user circuit during serial programming.
•
Connect the AF220/AF210/AF120/AF110 while the user power is off.
•
When the programming power is supplied from the AF220/AF210/AF120/AF110, be careful not to
short-circuit the user power supply.
Figure 25.5-2 Connecting User Circuitry (detail)
AF220/AF210/
AF120/AF110
write control pin
MB90F867A(S)
write control pin
10 k
AF220/AF210/
AF120/AF110
/TICS pin
User circuit
471
CHAPTER 25 EXAMPLES OF MB90F867A(S) SERIAL PROGRAMMING CONNECTION
472
CHAPTER 26
ROM SECURITY FUNCTION
This chapter explains ROM security function.
26.1 Overview of ROM security function
473
CHAPTER 26 ROM SECURITY FUNCTION
26.1
Overview of ROM security function
The content of ROM can be protected by ROM security function.
■ Overview of ROM Security Function
ROM security function is a function to prevent reading from the third party of ROM data by limiting the
access to ROM.
Please inquire of our company about details of this function.
474
APPENDIX
The appendixes provide I/O maps, instructions, and
other information.
APPENDIX A I/O Maps
APPENDIX B Instructions
APPENDIX C Timing Diagrams in Flash Memory Mode
APPENDIX D MB90860A Series List of Interrupt Vectors
475
APPENDIX
APPENDIX A I/O Maps
Table A-1 lists addresses to be assigned to the registers in the peripheral blocks.
■ I/O Maps (00H to FFH Addresses)
Table A-1 I/O Map (1/8)
Address
476
Register
Abbreviation
Access
Peripheral
Initial value
00H
Port 0 data register
PDR0
R/W
Port 0
XXXXXXXXB
01H
Port 1 data register
PDR1
R/W
Port 1
XXXXXXXXB
02H
Port 2 data register
PDR2
R/W
Port 2
XXXXXXXXB
03H
Port 3 data register
PDR3
R/W
Port 3
XXXXXXXXB
04H
Port 4 data register
PDR4
R/W
Port 4
XXXXXXXXB
05H
Port 5 data register
PDR5
R/W
Port 5
XXXXXXXXB
06H
Port 6 data register
PDR6
R/W
Port 6
XXXXXXXXB
07H
Port 7 data register
PDR7
R/W
Port 7
XXXXXXXXB
08H
Port 8 data register
PDR8
R/W
Port 8
XXXXXXXXB
09H
Port 9 data register
PDR9
R/W
Port 9
XXXXXXXXB
0AH
Port A data register
PDRA
R/W
Port A
XXXXXXXXB
0BH
Analog Input Enable Port 5
ADER5
R/W
Port 5, A/D
11111111B
0CH
Analog Input Enable Port 6
ADER6
R/W
Port 6, A/D
11111111B
0DH
Analog Input Enable Port 7
ADER7
R/W
Port 7, A/D
11111111B
0EH
Input level select register0
ILSR0
R/W
Ports
XXXXXXXXB
0FH
Input level select register1
ILSR1
R/W
Ports
XXXXXXXXB
10H
Port 0 direction register
DDR0
R/W
Port 0
00000000B
11H
Port 1 direction register
DDR1
R/W
Port 1
00000000B
12H
Port 2 direction register
DDR2
R/W
Port 2
00000000B
13H
Port 3 direction register
DDR3
R/W
Port 3
00000000B
14H
Port 4 direction register
DDR4
R/W
Port 4
00000000B
15H
Port 5 direction register
DDR5
R/W
Port 5
00000000B
APPENDIX
Table A-1 I/O Map (2/8)
Address
Register
Abbreviation
Access
Peripheral
Initial value
16H
Port 6 direction register
DDR6
R/W
Port 6
00000000B
17H
Port 7 direction register
DDR7
R/W
Port 7
00000000B
18H
Port 8 direction register
DDR8
R/W
Port 8
00000000B
19H
Port 9 direction register
DDR9
R/W
Port 9
00000000B
1AH
Port A direction register
DDRA
R/W
Port A
00000100B
16H
Port 6 direction register
DDR6
R/W
Port 6
00000000B
1BH
Reserved
1CH
Port 0 Pull-up control register
PUCR0
R/W
Port 0
00000000B
1DH
Port 1 Pull-up control register
PUCR1
R/W
Port 1
00000000B
1EH
Port 2 Pull-up control register
PUCR2
R/W
Port 2
00000000B
1FH
Port 3 Pull-up control register
PUCR3
W, R/W
Port 3
00000000B
20H
Serial Mode Register
SMR0
W, R/W
00000000B
21H
Serial Control Register
SCR0
W, R/W
00000000B
22H
Reception/Transmission Data
Register
RDR0/TDR0
R/W
00000000B
23H
Serial Status Register
SSR0
R, R/W
00001000B
UART0
24H
Extended Communication
Control Reg.
ECCR0
R, W,
R/W
000000XXB
25H
Extended Status/Control Register
ESCR0
R/W
00000100B
26H
Baud Rate Register 0
BGR00
R/W
00000000B
27H
Baud Rate Register 1
BGR01
R/W
00000000B
28H
Serial Mode Register
SMR1
W, R/W
00000000B
29H
Serial Control Register
SCR1
W, R/W
00000000B
2AH
Reception/Transmission Data
Register
RDR1/TDR1
R/W
00000000B
2BH
Serial Status Register
SSR1
R, R/W
2CH
Extended Communication
Control Reg.
ECCR1
R, W,
R/W
000000XXB
2DH
Extended Status/Control Register
ESCR1
R/W
00000100B
2EH
Baud Rate Register 0
BGR10
R/W
00000000B
UART1
00001000B
477
APPENDIX
Table A-1 I/O Map (3/8)
Address
Register
Abbreviation
Access
Peripheral
Initial value
UART1
00000000B
2FH
Baud Rate Register 1
BGR11
R/W
30H
PPG0 operation mode control
register
PPGC0
W, R/W
31H
PPG1 operation mode control
register
PPGC1
W, R/W
32H
PPG0 and PPG1 clock select
register
PPG01
R/W
33H
PPG2 operation mode control
register
PPGC2
W, R/W
35H
PPG3 operation mode control
register
PPGC3
W, R/W
36H
PPG2 and PPG3 clock select
register
PPG23
R/W
37H
0X000001B
000000X0B
0X000XX1B
16-bit Programable
Pulse
Generator 2/3
0X000001B
000000X0B
Reserved
38H
PPG4 operation mode control
register
PPGC4
W, R/W
39H
PPG5 operation mode control
register
PPGC5
W, R/W
3AH
PPG4 and PPG5 clock select
register
PPG45
R/W
3BH
ROM Correction Control Status 1
PACSR1
R/W
3CH
PPG6 operation mode control
register
PPGC6
W, R/W
3DH
PPG7 operation mode control
register
PPGC7
W, R/W
3EH
PPG6 and PPG7 clock select
register
PPG67
R/W
3FH
478
16-bit Programable
Pulse
Generator 0/1
Reserved
34H
0X000XX1B
16-bit Programable
Pulse
Generator 4/5
0X000001B
000000X0B
ROM Correction 1
00000000B
0X000XX1B
16-bit Programable
Pulse
Generator 6/7
0X000001B
000000X0B
Reserved
40H
PPG8 operation mode control
register
PPGC8
W, R/W
41H
PPG9 operation mode control
register
PPGC9
W, R/W
42H
PPG8 and PPG9 clock select
register
PPG89
R/W
43H
0X000XX1B
Reserved
0X000XX1B
16-bit Programable
Pulse
Generator 8/9
0X000001B
000000X0B
APPENDIX
Table A-1 I/O Map (4/8)
Address
Register
Abbreviation
Access
44H
PPGA operation mode control
register
PPGCA
W, R/W
45H
PPGB operation mode control
register
PPGCB
W, R/W
46H
PPGA and PPGB clock select
register
PPGAB
R/W
47H
Initial value
0X000XX1B
16-bit Programable
Pulse
Generator A/B
0X000001B
000000X0B
Reserved
48H
PPGC operation mode control
register
PPGCC
W, R/W
49H
PPGD operation mode control
register
PPGCD
W, R/W
4AH
PPGC and PPGD clock select
register
PPGCD
R/W
4BH
0X000XX1B
16-bit Programable
Pulse
Generator C/D
0X000001B
000000X0B
Reserved
4CH
PPGE operation mode control
register
PPGCE
W, R/W
4DH
PPGF operation mode control
register
PPGCF
W, R/W
4EH
PPGE and PPGF clock select
register
PPGEF
R/W
4FH
50H
Peripheral
0X000XX1B
16-bit Programable
Pulse
Generator E/F
0X000001B
000000X0B
Reserved
Input Capture Control Status 0/1
ICS01
00000000B
R/W
Input Capture 0/1
51H
Input Capture Edge 0/1
ICE01
R/W
52H
Input Capture Control Status 2/3
ICS23
R/W
XXX0X0XXB
00000000B
Input Capture 2/3
53H
Input Capture Edge 2/3
ICE23
R/W
54H
Input Capture Control Status 4/5
ICS45
R/W
XXXXXXXXB
00000000B
Input Capture 4/5
55H
Input Capture Edge 4/5
ICE45
R/W
56H
Input Capture Control Status 6/7
ICS67
R/W
XXXXXXXXB
00000000B
Input Capture 6/7
57H
Input Capture Edge 6/7
ICE67
R/W
58H
Output Compare Control Status 0
OCS0
R/W
XXX000XXB
0000XX00B
Output Compare 0/1
59H
Output Compare Control Status 1
OCS1
R/W
5AH
Output Compare Control Status 2
OCS2
R/W
0XX00000B
0000XX00B
Output Compare 2/3
5BH
Output Compare Control Status 3
OCS3
R/W
0XX00000B
479
APPENDIX
Table A-1 I/O Map (5/8)
Address
Register
Abbreviation
Access
5CH
Output Compare Control Status 4
OCS4
R/W
Peripheral
Initial value
0000XX00B
Output Compare 4/5
5DH
Output Compare Control Status 5
OCS5
R/W
5EH
Output Compare Control Status 6
OCS6
R/W
0XX00000B
0000XX00B
Output Compare 6/7
5FH
Output Compare Control Status 7
60H
Timer Control Status 0
OCS7
R/W
TMCSR0
R/W
0XX00000B
00000000B
16-bit Reload Timer 0
61H
Timer Control Status 0
TMCSR0
R/W
62H
Timer Control Status 1
TMCSR1
R/W
XXXX0000B
00000000B
16-bit Reload Timer 1
63H
Timer Control Status 1
TMCSR1
R/W
64H
Timer Control Status 2
TMCSR2
R/W
XXXX0000B
00000000B
16-bit Reload Timer 2
65H
Timer Control Status 2
TMCSR2
R/W
66H
Timer Control Status 3
TMCSR3
R/W
XXXX0000B
00000000B
16-bit Reload Timer 3
TMCSR3
R/W
XXXX0000B
A/D Control Status 0
ADCS0
R/W
000XXXX0B
69H
A/D Control Status 1
ADCS1
R/W
0000000XB
6AH
A/D Data 0
ADCR0
R
67H
Timer Control Status 3
68H
00000000B
A/D Converter
6BH
A/D Data 1
ADCR1
R
XXXXXX00B
6CH
ADC Setting 0
ADSR0
R/W
00000000B
6D
ADC Setting 1
ADSR1
R/W
00000000B
6EH
6FH
Reserved
ROM Mirror
ROMM
W
70 to 8FH
Reserved
90 to 9AH
Reserved
480
ROM Mirror
XXXXXXX1B
9BH
DMA Descriptor Channel Select
DCSR
R/W
9CH
DMA Status L
DSRL
R/W
9DH
DMA Status H
DSRH
R/W
9EH
ROM Correction Control Status 0
PACSR0
R/W
ROM Correction 0
00000000B
9FH
Delayed Interrupt/release
DIRR
R/W
Delayed Interrupt
XXXXXXX0B
A0H
Low-power Mode Control
LPMCR
W, R/W
Low Power
Controller
00011000B
00000000B
DMA
00000000B
00000000B
APPENDIX
Table A-1 I/O Map (6/8)
Address
A1H
Register
Clock Selection
Abbreviation
Access
Peripheral
Initial value
CKSCR
R, R/W
Low Power
Controller
11111100B
DMA
00000000B
A2H, A3H
Reserved
A4H
DMA Stop Status
DSSR
R/W
A5H
Automatic ready function select
reg.
ARSR
W
A6H
External address output control
reg.
HACR
W
A7H
Bus control signal selection
register
ECSR
W
A8H
Watchdog Control
WDTC
R, W
Watchdog Timer
XXXXX111B
A9H
Time Base Timer Control
TBTC
W, R/W
Time Base Timer
1XX00100B
AAH
Watch Timer Control register
WTC
R, R/W
Watch Timer
1X001000B
ABH
ACH
0011XX00B
External Memory
Access
00000000B
0000000XB
Reserved
DMA Enable L
DERL
00000000B
R/W
DMA
ADH
DMA Enable H
DERH
R/W
AEH
Flash Control Status
(Flash device only. Otherwise
reserved)
FMCS
R, R/W
AFH
00000000B
Flash Memory
000X0000B
Reserved
B0H
Interrupt control register 00
ICR00
W, R/W
00000111B
B1H
Interrupt control register 01
ICR01
W, R/W
00000111B
B2H
Interrupt control register 02
ICR02
W, R/W
00000111B
B3H
Interrupt control register 03
ICR03
W, R/W
00000111B
B4H
Interrupt control register 04
ICR04
W, R/W
B5H
Interrupt control register 05
ICR05
W, R/W
00000111B
B6H
Interrupt control register 06
ICR06
W, R/W
00000111B
B7H
Interrupt control register 07
ICR07
W, R/W
00000111B
B8H
Interrupt control register 08
ICR08
W, R/W
00000111B
Interrupt controller
00000111B
481
APPENDIX
Table A-1 I/O Map (7/8)
Address
Register
Abbreviation
Access
Peripheral
Initial value
B9H
Interrupt control register 09
ICR09
W, R/W
00000111B
BAH
Interrupt control register 10
ICR10
W, R/W
00000111B
BBH
Interrupt control register 11
ICR11
W, R/W
00000111B
BCH
Interrupt control register 12
ICR12
W, R/W
BDH
Interrupt control register 13
ICR13
W, R/W
00000111B
BEH
Interrupt control register 14
ICR14
W, R/W
00000111B
BFH
Interrupt control register 15
ICR15
W, R/W
00000111B
C0H
D/A Converter data 0
DAT0
R/W
XXXXXXXXB
C1H
D/A Converter data 1
DAT1
R/W
Interrupt controller
00000111B
XXXXXXXXB
D/A Converter
C2H
D/A Control 0
DACR0
R/W
XXXXXXX0B
C3H
D/A Control 1
DACR1
R/W
XXXXXXX0B
C4H, C5H
Reserved
C6H
DTP/External Interrupt Enable 0
ENIR0
R/W
C7H
DTP/External Interrupt Request 0
EIRR0
R/W
00000000B
XXXXXXXXB
External Interrupt 0
482
C8H
External Interrupt Level 0
ELVR0
R/W
00000000B
C9H
External Interrupt Level 0
ELVR0
R/W
00000000B
CAH
DTP/External Interrupt Enable 1
ENIR1
R/W
00000000B
CBH
DTP/External Interrupt Request 1
EIRR1
R/W
XXXXXXXXB
CCH
External Interrupt Level 1
ELVR1
R/W
CDH
External Interrupt Level 1
ELVR1
R/W
00000000B
CEH
External Interrupt 1 Source
Select
EISSR
R/W
00000000B
CFH
PLL/Subclock Control register
PSCCR
W
D0H
DMA Buffer Address Pointer L
BAPL
R/W
XXXXXXXXB
D1H
DMA Buffer Address Pointer M
BAPM
R/W
XXXXXXXXB
D2H
DMA Buffer Address Pointer H
BAPH
R/W
D3H
DMA Control
DMACS
R/W
XXXXXXXXB
D4H
I/O Register Address Pointer L
IOAL
R/W
XXXXXXXXB
D5H
I/O Register Address Pointer H
IOAH
R/W
XXXXXXXXB
External Interrupt 1
PLL
DMA
00000000B
XXXX0000B
XXXXXXXXB
APPENDIX
Table A-1 I/O Map (8/8)
Address
D6H
Register
Data Counter L
Abbreviation
Access
DCTL
R/W
Peripheral
Initial value
XXXXXXXXB
DMA
D7H
Data Counter H
DCTH
R/W
XXXXXXXXB
D8H
Serial Mode Register
SMR2
W, R/W
00000000B
D9H
Serial Control Register
SCR2
W, R/W
00000000B
DAH
Reception/Transmission Data
Register
RDR2/TDR2
R/W
00000000B
DBH
Serial Status Register
SSR2
R, R/W
00001000B
UART2
DCH
Extended Communication
Control Reg.
ECCR2
R, W,
R/W
000000XXB
DDH
Extended Status/Control Register
ESCR2
R/W
00000100B
DEH
Baud Rate Register 0
BGR20
R/W
00000000B
DFH
Baud Rate Register 1
BGR21
R/W
00000000B
E0H to EFH
Reserved
F0H to FFH
External
483
APPENDIX
■ I/O Map (79XX - 7FXX Addresses)
Table A-2 I/O Map (79XX - 7FXX Addresses) (1/6)
Address
484
Register
Abbreviation
Access
Peripheral
Initial value
XXXXXXXXB
7900H
Reload L0
PRLL0
R/W
7901H
Reload H0
PRLH0
R/W
7902H
Reload L1
PRLL1
R/W
7903H
Reload H1
PRLH1
R/W
XXXXXXXXB
7904H
Reload L2
PRLL2
R/W
XXXXXXXXB
7905H
Reload H2
PRLH2
R/W
7906H
Reload L3
PRLL3
R/W
7907H
Reload H3
PRLH3
R/W
XXXXXXXXB
7908H
Reload L4
PRLL4
R/W
XXXXXXXXB
7909H
Reload H4
PRLH4
R/W
790AH
Reload L5
PRLL5
R/W
790BH
Reload H5
PRLH5
R/W
XXXXXXXXB
790CH
Reload L6
PRLL6
R/W
XXXXXXXXB
790DH
Reload H6
PRLH6
R/W
790EH
Reload L7
PRLL7
R/W
790FH
Reload H7
PRLH7
R/W
XXXXXXXXB
7910H
Reload L8
PRLL8
R/W
XXXXXXXXB
7911H
Reload H8
PRLH8
R/W
7912H
Reload L9
PRLL9
R/W
7913H
Reload H9
PRLH9
R/W
XXXXXXXXB
7914H
Reload LA
PRLLA
R/W
XXXXXXXXB
7915H
Reload HA
PRLHA
R/W
7916H
Reload LB
PRLLB
R/W
7917H
Reload HB
PRLHB
R/W
7918H
Reload LC
PRLLC
R/W
7919H
Reload HC
PRLHC
R/W
16-bit Programable
Pulse
Generator 0/1
16-bit Programable
Pulse
Generator 2/3
16-bit Programable
Pulse
Generator 4/5
16-bit Programable
Pulse
Generator 6/7
16-bit Programable
Pulse
Generator 8/9
16-bit Programable
Pulse
Generator A/B
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
16-bit Programable
Pulse
Generator C/D
XXXXXXXXB
XXXXXXXXB
APPENDIX
Table A-2 I/O Map (79XX - 7FXX Addresses) (2/6)
Address
Register
Abbreviation
Access
Peripheral
Initial value
16-bit Programable
Pulse
Generator C/D
XXXXXXXXB
791AH
Reload LD
PRLLD
R/W
791BH
Reload HD
PRLHD
R/W
791CH
Reload LE
PRLLE
R/W
791DH
Reload HE
PRLHE
R/W
791EH
Reload LF
PRLLF
R/W
791FH
Reload HF
PRLHF
R/W
XXXXXXXXB
7920H
Input Capture 0
IPCP0
R
XXXXXXXXB
7921H
Input Capture 0
IPCP0
R
XXXXXXXXB
XXXXXXXXB
16-bit Programable
Pulse
Generator E/F
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
Input Capture 0/1
7922H
Input Capture 1
IPCP1
R
XXXXXXXXB
7923H
Input Capture 1
IPCP1
R
XXXXXXXXB
7924H
Input Capture 2
IPCP2
R
XXXXXXXXB
7925H
Input Capture 2
IPCP2
R
XXXXXXXXB
Input Capture 2/3
7926H
Input Capture 3
IPCP3
R
XXXXXXXXB
7927H
Input Capture 3
IPCP3
R
XXXXXXXXB
7928H
Input Capture 4
IPCP4
R
XXXXXXXXB
7929H
Input Capture 4
IPCP4
R
XXXXXXXXB
Input Capture 4/5
792AH
Input Capture 5
IPCP5
R
XXXXXXXXB
792BH
Input Capture 5
IPCP5
R
XXXXXXXXB
792CH
Input Capture 6
IPCP6
R
XXXXXXXXB
792DH
Input Capture 6
IPCP6
R
XXXXXXXXB
Input Capture 6/7
792EH
Input Capture 7
IPCP7
R
XXXXXXXXB
792FH
Input Capture 7
IPCP7
R
XXXXXXXXB
7930H
Output Compare 0
OCCP0
R/W
XXXXXXXXB
7931H
Output Compare 0
OCCP0
R/W
XXXXXXXXB
Output Compare 0/1
7932H
Output Compare 1
OCCP1
R/W
XXXXXXXXB
7933H
Output Compare 1
OCCP1
R/W
XXXXXXXXB
7934H
Output Compare 2
OCCP2
R/W
XXXXXXXXB
7935H
Output Compare 2
OCCP2
R/W
XXXXXXXXB
Output Compare 2/3
7936H
Output Compare 3
OCCP3
R/W
XXXXXXXXB
7937H
Output Compare 3
OCCP3
R/W
XXXXXXXXB
485
APPENDIX
Table A-2 I/O Map (79XX - 7FXX Addresses) (3/6)
Address
Register
Abbreviation
Access
7938H
Output Compare 4
OCCP4
R/W
7939H
Output Compare 4
OCCP4
R/W
Peripheral
Initial value
XXXXXXXXB
XXXXXXXXB
Output Compare 4/5
793AH
Output Compare 5
OCCP5
R/W
XXXXXXXXB
793BH
Output Compare 5
OCCP5
R/W
XXXXXXXXB
793CH
Output Compare 6
OCCP6
R/W
XXXXXXXXB
793DH
Output Compare 6
OCCP6
R/W
XXXXXXXXB
Output Compare 6/7
793EH
Output Compare 7
OCCP7
R/W
XXXXXXXXB
793FH
Output Compare 7
OCCP7
R/W
XXXXXXXXB
7940H
Timer Data 0
TCDT0
R/W
00000000B
7941H
Timer Data 0
TCDT0
R/W
00000000B
I/O Timer 0
7942H
Timer Control 0
TCCSL0
R/W
00000000B
7943H
Timer Control 0
TCCSH0
R/W
0XXXXXXXB
7944H
Timer Data 1
TCDT1
R/W
00000000B
7945H
Timer Data 1
TCDT1
R/W
00000000B
I/O Timer 1
7946H
Timer Control 1
TCCSL1
R/W
00000000B
7947H
Timer Control 1
TCCSH1
R/W
0XXXXXXXB
TMR0/
TMRLR0
R/W
Timer 0/Reload 0
7948H
7949H
794AH
Timer 1/Reload 1
794BH
794CH
Timer 2/Reload 2
794DH
794EH
Timer 3/Reload 3
794FH
486
TMR1/
TMRLR1
TMR2/
TMRLR2
TMR3/
TMRLR3
R/W
R/W
R/W
R/W
R/W
R/W
R/W
16-bit Reload
Timer 0
16-bit Reload
Timer 1
16-bit Reload
Timer 2
16-bit Reload
Timer 3
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
XXXXXXXXB
APPENDIX
Table A-2 I/O Map (79XX - 7FXX Addresses) (4/6)
Address
Register
Abbreviation
Access
Peripheral
Initial value
7950H
Serial Mode Register 3
SMR3
W, R/W
00000000B
7951H
Serial Control Register 3
SCR3
W, R/W
00000000B
7952H
Reception/Transmission Data
Register 3
RDR3/TDR3
R/W
00000000B
7953H
Serial Status Register 3
SSR3
R, R/W
00001000B
7954H
Extended Communication
Control Reg. 3
ECCR3
R, W, R/W
000000XXB
7955H
Extended Status/Control
Register 3
ESCR3
R/W
00000100B
7956H
Baud Rate Register 30
BGR30
R/W
00000000B
7957H
Baud Rate Register 31
BGR31
R/W
00000000B
7958H
Serial Mode Register 4
SMR4
W, R/W
00000000B
7959H
Serial Control Register 4
SCR4
W, R/W
00000000B
795AH
Reception/Transmission Data
Register 4
RDR4/TDR4
R/W
00000000B
795BH
Serial Status Register 4
SSR4
R, R/W
00001000B
795CH
Extended Communication
Control Reg. 4
ECCR4
R, W, R/W
000000XXB
795DH
Extended Status/Control
Register 4
ESCR4
R/W
00000100B
795EH
Baud Rate Register 40
BGR40
R/W
00000000B
795FH
Baud Rate Register 41
BGR41
R/W
00000000B
UART3
UART4
7960 to
796BH
796CH
796DH to
796FH
Reserved
Clock output enable register
CLKR
R/W
Clock Monitor
XXXX0000B
Reserved
487
APPENDIX
Table A-2 I/O Map (79XX - 7FXX Addresses) (5/6)
Address
Register
Abbreviation
Access
Initial value
7970H
I2C bus status register 0
IBSR0
R
00000000B
7971H
I2C bus control register 0
IBCR0
W, R/W
00000000B
7972H
I2C ten bit slave address
register 0
ITBAL0
R/W
00000000B
ITBAH0
R/W
00000000B
ITMKL0
R/W
7973H
7974H
7975H
I2C ten bit address mask
register 0
11111111B
2
ITMKH0
R/W
I C Interface 0
00111111B
7976H
I2C seven bit slave address
register 0
ISBA0
R/W
00000000B
7977H
I2C seven bit address mask
register 0
ISMK0
R/W
01111111B
7978H
I2C data register 0
IDAR0
R/W
00000000B
7979H to
797AH
797BH
Reserved
I2C clock control register 0
ICCR0
797C to
797FH
R/W
I2C Interface 0
00011111B
Reserved
7980H
I2C bus status register 1
IBSR1
R
00000000B
7981H
I2C bus control register 1
IBCR1
W, R/W
00000000B
7982H
I2C ten bit slave address
register 1
ITBAL1
R/W
00000000B
ITBAH1
R/W
00000000B
ITMKL1
R/W
7983H
7984H
7985H
I2C ten bit address mask
register 1
ITMKH1
R/W
11111111B
I2C
Interface 1
00111111B
7986H
I2C seven bit slave address
register 1
ISBA1
R/W
00000000B
7987H
I2C seven bit address mask
register 1
ISMK1
R/W
01111111B
7988H
I2C data register 1
IDAR1
R/W
00000000B
7989H to
798AH
798BH
798C to
79C1H
488
Peripheral
Reserved
I2C clock control register 1
ICCR1
R/W
Reserved
I2C Interface 1
00011111B
APPENDIX
Table A-2 I/O Map (79XX - 7FXX Addresses) (6/6)
Address
79C2H
Register
Clock Modulator Control
Register
Abbreviation
Access
Peripheral
Initial value
CMCR
R, R/W
Clock Modulator
0001X000B
79C3 to
79DFH
Reserved
79E0H
ROM Correction Address 0
PADR0
R/W
XXXXXXXXB
79E1H
ROM Correction Address 0
PADR0
R/W
XXXXXXXXB
79E2H
ROM Correction Address 0
PADR0
R/W
XXXXXXXXB
79E3H
ROM Correction Address 1
PADR1
R/W
XXXXXXXXB
79E4H
ROM Correction Address 1
PADR1
R/W
79E5H
ROM Correction Address 1
PADR1
R/W
XXXXXXXXB
79E6H
ROM Correction Address 2
PADR2
R/W
XXXXXXXXB
79E7H
ROM Correction Address 2
PADR2
R/W
XXXXXXXXB
79E8H
ROM Correction Address 2
PADR2
R/W
XXXXXXXXB
79E9 to
79EFH
ROM Correction 0
XXXXXXXXB
Reserved
79F0H
ROM Correction Address 3
PADR3
R/W
XXXXXXXXB
79F1H
ROM Correction Address 3
PADR3
R/W
XXXXXXXXB
79F2H
ROM Correction Address 3
PADR3
R/W
XXXXXXXXB
79F3H
ROM Correction Address 4
PADR4
R/W
XXXXXXXXB
79F4H
ROM Correction Address 4
PADR4
R/W
79F5H
ROM Correction Address 4
PADR4
R/W
XXXXXXXXB
79F6H
ROM Correction Address 5
PADR5
R/W
XXXXXXXXB
79F7H
ROM Correction Address 5
PADR5
R/W
XXXXXXXXB
79F8H
ROM Correction Address 5
PADR5
R/W
XXXXXXXXB
79F9 to
7FFFH
ROM Correction 1
XXXXXXXXB
Reserved
Note:
Any write access to reserved addresses in I/O map should not be performed.
A read access to reserved address results in reading "X".
489
APPENDIX
● Explanation of write and read
R/W: Both read and write enabled
R: Only read enabled
W: Only write enabled
● Explanation of initial values
0: The initial value of this bit is "0".
1: The initial value of this bit is "1".
X: The initial value of this bit is undefined.
490
APPENDIX
APPENDIX B Instructions
APPENDIX B describes the instructions used by the F2MC-16LX.
B.1 Instruction Types
B.2 Addressing
B.3 Direct Addressing
B.4 Indirect Addressing
B.5 Execution Cycle Count
B.6 Effective address field
B.7 How to Read the Instruction List
B.8 F2MC-16LX Instruction List
B.9 Instruction Map
491
APPENDIX
B.1
Instruction Types
The F2MC-16LX supports 351 types of instructions. Addressing is enabled by using an
effective address field of each instruction or using the instruction code itself.
■ Instruction Types
The F2MC-16LX supports the following 351 types of instructions:
492
•
41 transfer instructions (byte)
•
38 transfer instructions (word or long word)
•
42 addition/subtraction instructions (byte, word, or long word)
•
12 increment/decrement instructions (byte, word, or long word)
•
11 comparison instructions (byte, word, or long word)
•
11 unsigned multiplication/division instructions (word or long word)
•
11 signed multiplication/division instructions (word or long word)
•
39 logic instructions (byte or word)
•
6 logic instructions (long word)
•
6 sign inversion instructions (byte or word)
•
1 normalization instruction (long word)
•
18 shift instructions (byte, word, or long word)
•
50 branch instructions
•
6 accumulator operation instructions (byte or word)
•
28 other control instructions (byte, word, or long word)
•
21 bit operation instructions
•
10 string instructions
APPENDIX
B.2
Addressing
With the F2MC-16LX, the address format is determined by the instruction effective
address field or the instruction code itself (implied). When the address format is
determined by the instruction code itself, specify an address in accordance with the
instruction code used. Some instructions permit the user to select several types of
addressing.
■ Addressing
The F2MC-16LX supports the following 23 types of addressing:
•
Immediate (#imm)
•
Register direct
•
Direct branch address (addr16)
•
Physical direct branch address (addr24)
•
I/O direct (io)
•
Abbreviated direct address (dir)
•
Direct address (addr16)
•
I/O direct bit address (io:bp)
•
Abbreviated direct bit address (dir:bp)
•
Direct bit address (addr16:bp)
•
Vector address (#vct)
•
Register indirect (@RWj j = 0 to 3)
•
Register indirect with post increment (@RWj+ j = 0 to 3)
•
Register indirect with displacement (@RWi + disp8 i = 0 to 7, @RWj + disp16 j = 0 to 3)
•
Long register indirect with displacement (@RLi + disp8 i = 0 to 3)
•
Program counter indirect with displacement (@PC + disp16)
•
Register indirect with base index (@RW0 + RW7, @RW1 + RW7)
•
Program counter relative branch address (rel)
•
Register list (rlst)
•
Accumulator indirect (@A)
•
Accumulator indirect branch address (@A)
•
Indirectly-specified branch address (@ear)
•
Indirectly-specified branch address (@eam)
493
APPENDIX
■ Effective Address Field
Table B.2-1 lists the address formats specified by the effective address field.
Table B.2-1 Effective Address Field
Code
Representation
00
R0
RW0
RL0
01
R1
RW1
(RL0)
02
R2
RW2
RL1
03
R3
RW3
(RL1)
04
R4
RW4
RL2
05
R5
RW5
(RL2)
06
R6
RW6
RL3
07
R7
RW7
(RL3)
08
@RW0
09
@RW1
Address format
Register direct: Individual parts correspond to
the byte, word, and long word types in order
from the left.
Default bank
None
DTB
DTB
Register indirect
0A
@RW2
ADB
0B
@RW3
SPB
0C
@RW0+
DTB
0D
@RW1+
DTB
Register indirect with post increment
0E
@RW2+
ADB
0F
@RW3+
SPB
10
@RW0+disp8
DTB
11
@RW1+disp8
DTB
Register indirect with 8-bit displacement
12
@RW2+disp8
ADB
13
@RW3+disp8
SPB
14
@RW4+disp8
DTB
15
@RW5+disp8
DTB
Register indirect with 8-bit displacement
16
@RW6+disp8
ADB
17
@RW7+disp8
SPB
18
@RW0+disp16
DTB
19
@RW1+disp16
DTB
Register indirect with 16-bit displacement
494
1A
@RW2+disp16
ADB
1B
@RW3+disp16
SPB
1C
@RW0+RW7
Register indirect with index
DTB
1D
@RW1+RW7
Register indirect with index
DTB
1E
@PC+disp16
PC indirect with 16-bit displacement
PCB
1F
addr16
Direct address
DTB
APPENDIX
B.3
Direct Addressing
An operand value, register, or address is specified explicitly in direct addressing mode.
■ Direct Addressing
● Immediate addressing (#imm)
Specify an operand value explicitly (#imm4/ #imm8/ #imm16/ #imm32).
Figure B.3-1 Example of Immediate Addressing (#imm)
MOVW A, #01212H (This instruction stores the operand value in A.)
Before execution
A 2233
4455
After execution
A 4455
1 2 1 2 (Some instructions transfer AL to AH.)
● Register direct addressing
Specify a register explicitly as an operand. Table B.3-1 lists the registers that can be specified. Figure B.3-2
shows an example of register direct addressing.
Table B.3-1 Direct Addressing Registers
General-purpose register
Special-purpose register
Byte
R0, R1, R2, R3, R4, R5, R6, R7
Word
RW0, RW1, RW2, RW3, RW4, R5W, RW6,
RW7
Long word
RL0, RL1, RL2, RL3
Accumulator
A, AL
Pointer
SP *
Bank
PCB, DTB, USB, SSB, ADB
Page
DPR
Control
PS, CCR, RP, ILM
*: One of the user stack pointer (USP) and system stack pointer (SSP) is selected and used depending on
the value of the S flag bit in the condition code register (CCR). For branch instructions, the program
counter (PC) is not specified in an instruction operand but is specified implicitly.
495
APPENDIX
Figure B.3-2 Example of Register Direct Addressing
MOV R0, A (This instruction transfers the eight low-order bits of A to the generalpurpose register R0.)
Before execution
A 0716
2534
Memory space
R0
After execution
A 0716
2564
??
Memory space
R0
34
● Direct branch addressing (addr16)
Specify an offset explicitly for the branch destination address. The size of the offset is 16 bits, which
indicates the branch destination in the logical address space. Direct branch addressing is used for an
unconditional branch, subroutine call, or software interrupt instruction. Bit23 to bit16 of the address are
specified by the program bank register (PCB).
Figure B.3-3 Example of Direct Branch Addressing (addr16)
JMP 3B20H (This instruction causes an unconditional branch by direct branch
addressing in a bank.)
Before execution
After execution
496
PC 3 C 2 0
PC 3 B 2 0
PCB 4 F
PCB 4 F
Memory space
4F3B20H
Next instruction
4F3C20H
62
4F3C21H
20
4F3C22H
3B
JMP 3B20H
APPENDIX
● Physical direct branch addressing (addr24)
Specify an offset explicitly for the branch destination address. The size of the offset is 24 bits. Physical
direct branch addressing is used for unconditional branch, subroutine call, or software interrupt instruction.
Figure B.3-4 Example of Direct Branch Addressing (addr24)
JMPP 333B20H (This instruction causes an unconditional branch by direct branch 24-bit
addressing.)
Before execution
After execution
PC 3 C 2 0
PC 3 B 2 0
PCB 4 F
PCB 3 3
Memory space
333B20H
Next instruction
4F3C20H
63
4F3C21H
20
4F3C22H
3B
4F3C23H
33
JMPP 333B20H
● I/O direct addressing (io)
Specify an 8-bit offset explicitly for the memory address in an operand. The I/O address space in the
physical address space from 000000H to 0000FFH is accessed regardless of the data bank register (DTB)
and direct page register (DPR). A bank select prefix for bank addressing is invalid if specified before an
instruction using I/O direct addressing.
Figure B.3-5 Example of I/O Direct Addressing (io)
MOVW A, i : 0C0H (This instruction reads data by I/O direct addressing and stores it
in A.)
Before execution
After execution
A 0716
2534
Memory space
0000C0H
EE
0000C1H
FF
A 2534 FFEE
497
APPENDIX
● Abbreviated direct addressing (dir)
Specify the eight low-order bits of a memory address explicitly in an operand. Address bits 8 to 15 are
specified by the direct page register (DPR). Address bits 16 to 23 are specified by the data bank register
(DTB).
Figure B.3-6 Example of Abbreviated Direct Addressing (dir)
MOV S : 20H, A (This instruction writes the contents of the eight low-order bits of A in
abbreviated direct addressing mode.)
Before execution
A 4455
DPR 6 6
After execution
DTB 7 7
A 4455
DPR 6 6
1212
Memory space
776620H
1212
DTB 7 7
??
Memory space
776620H
12
● Direct addressing (addr16)
Specify the 16 low-order bits of a memory address explicitly in an operand. Address bits 16 to 23 are
specified by the data bank register (DTB). A prefix instruction for access space addressing is invalid for
this mode of addressing.
Figure B.3-7 Example of Direct Addressing (addr16)
MOVW A, 3B20H (This instruction reads data by direct addressing and stores it in A.)
Before execution
After execution
498
A 2020
A AABB
AABB
0123
DTB 5 5
DTB 5 5
Memory space
553B21H
01
553B20H
23
APPENDIX
● I/O direct bit addressing (io:bp)
Specify bits in physical addresses 000000H to 0000FFH explicitly. Bit positions are indicated by ":bp",
where the larger number indicates the most significant bit (MSB) and the lower number indicates the least
significant bit (LSB).
Figure B.3-8 Example of I/O Direct Bit Addressing (io:bp)
SETB i : 0C1H : 0 (This instruction sets bits by I/O direct bit addressing.)
Memory space
Before execution
0000C1H
00
Memory space
After execution
0000C1H
01
● Abbreviated direct bit addressing (dir:bp)
Specify the eight low-order bits of a memory address explicitly in an operand. Address bits 8 to 15 are
specified by the direct page register (DPR). Address bits 16 to 23 are specified by the data bank register
(DTB). Bit positions are indicated by ":bp", where the larger number indicates the most significant bit
(MSB) and the lower number indicates the least significant bit (LSB).
Figure B.3-9 Example of Abbreviated Direct Bit Addressing (dir:bp)
SETB S : 10H : 0 (This instruction sets bits by abbreviated direct bit addressing.)
Memory space
Before execution
DTB 5 5
DPR 6 6
556610H
00
Memory space
After execution
DTB 5 5
DPR 6 6
556610H
01
● Direct bit addressing (addr16:bp)
Specify arbitrary bits in 64 kilobytes explicitly. Address bits 16 to 23 are specified by the data bank register
(DTB). Bit positions are indicated by ":bp", where the larger number indicates the most significant bit
(MSB) and the lower number indicates the least significant bit (LSB).
Figure B.3-10 Example of Direct Bit Addressing (addr16:bp)
SETB 2222H : 0 (This instruction sets bits by direct bit addressing.)
Memory space
Before execution
DTB 5 5
552222H
00
Memory space
After execution
DTB 5 5
552222H
01
499
APPENDIX
● Vector Addressing (#vct)
Specify vector data in an operand to indicate the branch destination address. There are two sizes for vector
numbers: 4 bits and 8 bits. Vector addressing is used for a subroutine call or software interrupt instruction.
Figure B.3-11 Example of Vector Addressing (#vct)
CALLV #15 (This instruction causes a branch to the address indicated by the interrupt
vector specified in an operand.)
Before execution
PC 0 0 0 0
Memory space
PCB F F
After execution
FFC000H
EF
FFFFE0H
00
FFFFE1H
D0
CALLV #15
PC D 0 0 0
PCB F F
Table B.3-2 CALLV Vector List
Instruction
Vector address L
Vector address H
CALLV #0
XXFFFEH
XXFFFFH
CALLV #1
XXFFFCH
XXFFFDH
CALLV #2
XXFFFAH
XXFFFBH
CALLV #3
XXFFF8H
XXFFF9H
CALLV #4
XXFFF6H
XXFFF7H
CALLV #5
XXFFF4H
XXFFF5H
CALLV #6
XXFFF2H
XXFFF3H
CALLV #7
XXFFF0H
XXFFF1H
CALLV #8
XXFFEEH
XXFFEFH
CALLV #9
XXFFECH
XXFFEDH
CALLV #10
XXFFEAH
XXFFEBH
CALLV #11
XXFFE8H
XXFFE9H
CALLV #12
XXFFE6H
XXFFE7H
CALLV #13
XXFFE4H
XXFFE5H
CALLV #14
XXFFE2H
XXFFE3H
CALLV #15
XXFFE0H
XXFFE1H
Note: A PCB register value is set in XX.
Note:
When the program bank register (PCB) is FFH, the vector area overlaps the vector area of INT #vct8
(#0 to #7). Use vector addressing carefully (see Table B.3-2).
500
APPENDIX
B.4
Indirect Addressing
In indirect addressing mode, an address is specified indirectly by the address data of
an operand.
■ Indirect Addressing
● Register indirect addressing (@RWj j = 0 to 3)
Memory is accessed using the contents of general-purpose register RWj as an address. Address bits 16 to
23 are indicated by the data bank register (DTB) when RW0 or RW1 is used, system stack bank register
(SSB) or user stack bank register (USB) when RW3 is used, or additional data bank register (ADB) when
RW2 is used.
Figure B.4-1 Example of Register Indirect Addressing (@RWj j = 0 to 3)
MOVW A, @RW1 (This instruction reads data by register indirect addressing and stores
it in A.)
Before execution
A 0716
2534
Memory space
RW1 D 3 0 F
After execution
DTB 7 8
78D30FH
EE
78D310H
FF
A 2534 FFEE
RW1 D 3 0 F
DTB 7 8
● Register indirect addressing with post increment (@RWj+ j = 0 to 3)
Memory is accessed using the contents of general-purpose register RWj as an address. After operand
operation, RWj is incremented by the operand size (1 for a byte, 2 for a word, or 4 for a long word).
Address bits 16 to 23 are indicated by the data bank register (DTB) when RW0 or RW1 is used, system
stack bank register (SSB) or user stack bank register (USB) when RW3 is used, or additional data bank
register (ADB) when RW2 is used.
If the post increment results in the address of the register that specifies the increment, the incremented
value is referenced after that. In this case, if the next instruction is a write instruction, priority is given to
writing by an instruction and, therefore, the register that would be incremented becomes write data.
501
APPENDIX
Figure B.4-2 Example of Register Indirect Addressing with Post Increment (@RWj+ j = 0 to 3)
MOVW A, @RW1+ (This instruction reads data by register indirect addressing with post
increment and stores it in A.)
Before execution
A 0716
2534
Memory space
RW1 D 3 0 F
After execution
DTB 7 8
78D30FH
EE
78D310H
FF
A 2534 FFEE
RW1 D 3 1 1
DTB 7 8
● Register indirect addressing with offset (@RWi + disp8 i = 0 to 7, @RWj + disp16 j = 0 to 3)
Memory is accessed using the address obtained by adding an offset to the contents of general-purpose
register RWj. Two types of offset, byte and word offsets, are used. They are added as signed numeric
values. Address bits 16 to 23 are indicated by the data bank register (DTB) when RW0, RW1, RW4, or
RW5 is used, system stack bank register (SSB) or user stack bank register (USB) when RW3 or RW7 is
used, or additional data bank register (ADB) when RW2 or RW6 is used.
Figure B.4-3 Example of Register Indirect Addressing with Offset
(@RWi + disp8 i = 0 to 7, @RWj + disp16 j = 0 to 3)
MOVW A, @RW1+10H (This instruction reads data by register indirect addressing with
an offset and stores it in A.)
Before execution
A 0716
2534
(+10H)
RW1 D 3 0 F
After execution
A 2534 FFEE
RW1 D 3 0 F
502
DTB 7 8
DTB 7 8
Memory space
78D31FH
EE
78D320H
FF
APPENDIX
● Long register indirect addressing with offset (@RLi + disp8 i = 0 to 3)
Memory is accessed using the address that is the 24 low-order bits obtained by adding an offset to the
contents of general-purpose register RLi. The offset is 8-bits long and is added as a signed numeric value.
Figure B.4-4 Example of Long Register Indirect Addressing with Offset (@RLi + disp8 i = 0 to 3)
MOVW A, @RL2+25H (This instruction reads data by long register indirect addressing with
an offset and stores it in A.)
Before execution
A 0716
2534
(+25H)
RL2 F 3 8 2
After execution
4B02
Memory space
824B27H
EE
824B28H
FF
A 2534 FFEE
RL2 F 3 8 2
4B02
● Program counter indirect addressing with offset (@PC + disp16)
Memory is accessed using the address indicated by (instruction address + 4 + disp16). The offset is one
word long. Address bits 16 to 23 are specified by the program bank register (PCB). Note that the operand
address of each of the following instructions is not deemed to be (next instruction address + disp16):
•
DBNZ eam, rel
•
DWBNZ eam, rel
•
CBNE eam, #imm8, rel
•
CWBNE eam, #imm16, rel
•
MOV eam, #imm8
•
MOVW eam, #imm16
Figure B.4-5 Example of Program Counter Indirect Addressing with Offset (@PC + disp16)
MOVW A, @PC+20H (This instruction reads data by program counter indirect addressing
with an offset and stores it in A.)
Before execution
A 0716
2534
Memory space
PCB C 5 PC 4 5 5 6
After execution
A 2534
FFEE
PCB C 5 PC 4 5 5 A
+4
C54556H
73
C54557H
9E
C54558H
20
C54559H
00
MOVW
A, @PC+20H
C5455AH
.
.
.
+20H
C5457AH
EE
C5457BH
FF
503
APPENDIX
● Register indirect addressing with base index (@RW0 + RW7, @RW1 + RW7)
Memory is accessed using the address determined by adding RW0 or RW1 to the contents of generalpurpose register RW7. Address bits 16 to 23 are indicated by the data bank register (DTB).
Figure B.4-6 Example of Register Indirect Addressing with Base Index (@RW0 + RW7, @RW1 + RW7)
MOVW A, @RW1+RW7 (This instruction reads data by register indirect addressing with
a base index and stores it in A.)
Before execution
A 0716
RW1 D 3 0 F
WR7 0 1 0 1
After execution
A 2534
RW1 D 3 0 F
WR7 0 1 0 1
504
2534
+
DTB 7 8
FFEE
DTB 7 8
Memory space
78D410H
EE
78D411H
FF
APPENDIX
● Program counter relative branch addressing (rel)
The address of the branch destination is a value determined by adding an 8-bit offset to the program
counter (PC) value. If the result of addition exceeds 16 bits, bank register incrementing or decrementing is
not performed and the excess part is ignored, and therefore the address is contained within a 64-kilobyte
bank. This addressing is used for both conditional and unconditional branch instructions. Address bits 16 to
23 are indicated by the program bank register (PCB).
Figure B.4-7 Example of Program Counter Relative Branch Addressing (rel)
BRA 10H (This instruction causes an unconditional relative branch.)
Before execution
After execution
PC 3 C 2 0
PC 3 C 3 2
PCB 4 F
PCB 4 F
Memory space
4F3C32H
Next instruction
4F3C21H
10
4F3C20H
60
BRA 10H
● Register list (rlst)
Specify a register to be pushed onto or popped from a stack.
Figure B.4-8 Configuration of the Register List
MSB
LSB
RW7 RW6 RW5 RW4 RW3 RW2 RW1 RW0
A register is selected when the corresponding bit is 1 and deselected when the bit is 0.
505
APPENDIX
Figure B.4-9 Example of Register List (rlist)
POPW, RW0, RW4 (This instruction transfers memory data indicated by the SP to
multiple word registers indicated by the register list.)
SP
34FA
SP
34FE
RW0
×× ××
RW0
02 01
RW1
×× ××
RW1
×× ××
RW2
×× ××
RW2
×× ××
RW3
×× ××
RW3
×× ××
RW4
×× ××
RW4
04 03
RW5
×× ××
RW5
×× ××
RW6
×× ××
RW6
×× ××
RW7
×× ××
RW7
×× ××
Memory space
SP
Memory space
01
34FAH
01
34FAH
02
34FBH
02
34FBH
03
34FCH
03
34FCH
04
34FDH
04
34FDH
34FEH
SP
Before execution
34FEH
After execution
● Accumulator indirect addressing (@A)
Memory is accessed using the address indicated by the contents of the low-order bytes (16 bits) of the
accumulator (AL). Address bits 16 to 23 are specified by a mnemonic in the data bank register (DTB).
Figure B.4-10 Example of Accumulator Indirect Addressing (@A)
MOVW A, @A (This instruction reads data by accumulator indirect addressing and stores it in A.)
Before execution
A
0716
2534
DTB B B
After execution
A
0716
DTB B B
506
FFEE
Memory space
BB2534H
EE
BB2535H
FF
APPENDIX
● Accumulator indirect branch addressing (@A)
The address of the branch destination is the content (16 bits) of the low-order bytes (AL) of the
accumulator. It indicates the branch destination in the bank address space. Address bits 16 to 23 are
specified by the program bank register (PCB). For the Jump Context (JCTX) instruction, however, address
bits 16 to 23 are specified by the data bank register (DTB). This addressing is used for unconditional
branch instructions.
Figure B.4-11 Example of Accumulator Indirect Branch Addressing (@A)
JMP @A (This instruction causes an unconditional branch by accumulator indirect
branch addressing.)
Before execution
PC 3 C 2 0
A 6677
After execution
PC 3 B 2 0
A 6677
PCB 4 F
3B20
Memory space
4F3B20H
Next instruction
4F3C20H
61
JMP @A
PCB 4 F
3B20
● Indirect specification branch addressing (@ear)
The address of the branch destination is the word data at the address indicated by ear.
Figure B.4-12 Example of Indirect Specification Branch Addressing (@ear)
JMP @@RW0 (This instruction causes an unconditional branch by register indirect
addressing.)
Before execution
After execution
PC 3 C 2 0
PCB 4 F
RW0 7 F 4 8
DTB 2 1
PC 3 B 2 0
PCB 4 F
RW0 7 F 4 8
DTB 2 1
Memory space
217F48H
20
217F49H
3B
4F3B20H
Next instruction
4F3C20H
73
4F3C21H
08
JMP @@RW0
507
APPENDIX
● Indirect specification branch addressing (@eam)
The address of the branch destination is the word data at the address indicated by eam.
Figure B.4-13 Example of Indirect Specification Branch Addressing (@eam)
JMP @RW0 (This instruction causes an unconditional branch by register indirect
addressing.)
Before execution
PC 3 C 2 0
PCB 4 F
RW0 3 B 2 0
After execution
PC 3 B 2 0
RW0 3 B 2 0
508
PCB 4 F
Memory space
4F3B20H
Next instruction
4F3C20H
73
4F3C21H
00
JMP @RW0
APPENDIX
B.5
Execution Cycle Count
The number of cycles required for instruction execution (execution cycle count) is
obtained by adding the number of cycles required for each instruction, "correction
value" determined by the condition, and the number of cycles for instruction fetch.
■ Execution Cycle Count
The number of cycles required for instruction execution (execution cycle count) is obtained by adding the
number of cycles required for each instruction, "correction value" determined by the condition, and the
number of cycles for instruction fetch. In the mode of fetching an instruction from memory such as internal
ROM connected to a 16-bit bus, the program fetches the instruction being executed in word increments.
Therefore, intervening in data access increases the execution cycle count.
Similarly, in the mode of fetching an instruction from memory connected to an 8-bit external bus, the
program fetches every byte of an instruction being executed. Therefore, intervening in data access increases
the execution cycle count. In CPU intermittent operation mode, access to a general-purpose register,
internal ROM, internal RAM, internal I/O, or external data bus causes the clock to the CPU to halt for the
cycle count specified by the CG0 and CG1 bits of the low power consumption mode control register.
Therefore, for the cycle count required for instruction execution in CPU intermittent operation mode, add
the "access count x cycle count for the halt" as a correction value to the normal execution count.
509
APPENDIX
■ Calculating the Execution Cycle Count
Table B.5-1 lists execution cycle counts and Table B.5-2 and Table B.5-3 summarize correction value data.
Table B.5-1 Execution Cycle Counts in Each Addressing Mode
(a) *
Code
Operand
00
|
07
Ri
Rwi
RLi
08
|
0B
Execution cycle count in
each addressing mode
Register access count in
each addressing mode
See the instruction list.
See the instruction list.
@RWj
2
1
0C
|
0F
@RWj+
4
2
10
|
17
@RWi+disp8
2
1
18
|
1B
@RWi+disp16
2
1
1C
1D
1E
1F
@RW0+RW7
@RW1+RW7
@PC+disp16
addr16
4
4
2
1
2
2
0
0
*: (a) is used for ~ (cycle count) and B (correction value) in "B.8 F2MC-16LX Instruction List".
510
APPENDIX
Table B.5-2 Cycle Count Correction Values for Counting Execution Cycles
(b) byte *
Operand
(c) word *
(d) long *
Cycle
count
Access
count
Cycle
count
Access
count
Cycle
count
Access
count
Internal register
+0
1
+0
1
+0
2
Internal memory
Even address
+0
1
+0
1
+0
2
Internal memory
Odd address
+0
1
+2
2
+4
4
External data bus
16-bit even address
+1
1
+1
1
+2
2
External data bus
16-bit odd address
+1
1
+4
2
+8
4
External data bus
8-bits
+1
1
+4
2
+8
4
*: (b), (c), and (d) are used for ~ (cycle count) and B (correction value) in "B.8 F2MC-16LX Instruction
List".
Note:
When an external data bus is used, the cycle counts during which an instruction is made to wait by
ready input or automatic ready must also be added.
Table B.5-3 Cycle Count Correction Values for Counting Instruction Fetch Cycles
Instruction
Byte boundary
Word boundary
Internal memory
-
+2
External data bus 16-bits
-
+3
External data bus 8-bits
+3
-
Note:
• When an external data bus is used, the cycle counts during which an instruction is made to wait
by ready input or automatic ready must also be added.
• Actually, instruction execution is not delayed by every instruction fetch. Therefore, use the
correction values to calculate the worst case.
511
APPENDIX
B.6
Effective address field
Table B.6-1 shows the effective address field.
■ Effective Address Field
Table B.6-1 Effective Address Field
Code
00
01
02
03
04
05
06
07
08
09
0A
Representation
R0
R1
R2
R3
R4
R5
R6
R7
@RW0
@RW1
@RW2
RW0
RW1
RW2
RW3
RW4
RW5
RW6
RW7
RL0
(RL0)
RL1
(RL1)
RL2
(RL2)
RL3
(RL3)
Address format
Byte count of
extended
address part *
Register direct: Individual parts correspond to
the byte, word, and long word types in order
from the left.
-
Register indirect
0
0B
@RW3
0C
@RW0+
0D
@RW1+
Register indirect with post increment
0
0E
@RW2+
0F
@RW3+
10
@RW0+disp8
11
@RW1+disp8
12
@RW2+disp8
13
@RW3+disp8
Register indirect with 8-bit displacement
1
14
@RW4+disp8
15
@RW5+disp8
16
@RW6+disp8
17
@RW7+disp8
18
@RW0+disp16
19
@RW1+disp16
Register indirect with 16-bit displacement
2
1A
@RW2+disp16
1B
@RW3+disp16
1C
@RW0+RW7
Register indirect with index
0
1D
@RW1+RW7
Register indirect with index
0
1E
@PC+disp16
PC indirect with 16-bit displacement
2
1F
addr16
Direct address
2
*1: Each byte count of the extended address part applies to + in the # (byte count) column in "B.8 F2MC-16LX
Instruction List".
512
APPENDIX
B.7
How to Read the Instruction List
Table B.7-1 describes the items used in the F2MC-16LX Instruction List, and Table B.7-2
describes the symbols used in the same list.
■ Description of Instruction Presentation Items and Symbols
Table B.7-1 Description of Items in the Instruction List (1/2)
Item
Mnemonic
Description
Uppercase, symbol: Represented as is in the assembler.
Lowercase: Rewritten in the assembler.
Number of following lowercase: Indicates bit length in the instruction.
#
Indicates the number of bytes.
~
Indicates the number of cycles.
See Table B.2-1 for the alphabetical letters in items.
RG
B
Operation
Indicates the number of times a register access is performed during instruction
execution.
The number is used to calculate the correction value for CPU intermittent
operation.
Indicates the correction value used to calculate the actual number of cycles during
instruction execution.
The actual number of cycles during instruction execution can be determined by
adding the value in the ~ column to this value.
Indicates the instruction operation.
LH
Indicates the special operation for bit15 to bit08 of the accumulator.
Z: Transfers 0.
X: Transfers after sign extension.
-: No transfer
AH
Indicates the special operation for the 16 high-order bits of the accumulator.
*: Transfers from AL to AH.
-: No transfer
Z: Transfers 00 to AH.
X: Transfers 00H or FFH to AH after AL sign extension.
513
APPENDIX
Table B.7-1 Description of Items in the Instruction List (2/2)
Item
Description
I
Each indicates the state of each flag: I (interrupt enable), S (stack), T (sticky bit), N
(negative), Z (zero), V (overflow), C (carry).
*: Changes upon instruction execution.
-: No change
Z: Set upon instruction execution.
X: Reset upon instruction execution.
S
T
N
Z
V
C
RMW
Indicates whether the instruction is a Read Modify Write instruction (reading data
from memory by the I instruction and writing the result to memory).
*: Read Modify Write instruction
-: Not Read Modify Write instruction
Note:
Cannot be used for an address that has different meanings between read and
write operations.
Table B.7-2 Explanation on Symbols in the Instruction List (1/2)
Symbol
A
514
Explanation
The bit length used varies depending on the 32-bit accumulator instruction.
Byte: Low-order 8 bits of byte AL
Word: 16 bits of word AL
Long word: 32 bits of AL and AH
AH
16 high-order bits of A
AL
16 low-order bits of A
SP
Stack pointer (USP or SSP)
PC
Program counter
PCB
Program bank register
DTB
Data bank register
ADB
Additional data bank register
SSB
System stack bank register
USB
User stack bank register
SPB
Current stack bank register (SSB or USB)
DPR
Direct page register
brg1
DTB, ADB, SSB, USB, DPR, PCB, SPB
brg2
DTB, ADB, SSB, USB, DPR, SPB
APPENDIX
Table B.7-2 Explanation on Symbols in the Instruction List (2/2)
Symbol
Ri
Explanation
R0, R1, R2, R3, R4, R5, R6, R7
RWi
RW0, RW1, RW2, RW3, RW4, RW5, RW6, RW7
RWj
RW0, RW1, RW2, RW3
RLi
RL0, RL1, RL2, RL3
dir
Abbreviated direct addressing
addr16
Direct addressing
addr24
Physical direct addressing
ad24 0-15
Bit0 to bit15 of addr24
ad24 16-23
Bit16 to bit23 of addr24
io
I/O area (000000H to 0000FFH)
#imm4
4-bit immediate data
#imm8
8-bit immediate data
#imm16
16-bit immediate data
#imm32
32-bit immediate data
ext (imm8)
16-bit data obtained by sign extension of 8-bit immediate data
disp8
8-bit displacement
disp16
16-bit displacement
bp
Bit offset
vct4
Vector number (0 to 15)
vct8
Vector number (0 to 255)
( )b
Bit address
rel
PC relative branch
ear
Effective addressing (code 00 to 07)
eam
Effective addressing (code 08 to 1F)
rlst
Register list
515
APPENDIX
B.8
F2MC-16LX Instruction List
Table B.8-1 to Table B.8-18 list the instructions used by the F2MC-16LX.
■ F2MC-16LX Instruction List
Table B.8-1 41 Transfer Instructions (Byte)
Mnemonic
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOVN
MOVX
MOVX
MOVX
MOVX
MOVX
MOVX
MOVX
MOVX
MOVX
MOVX
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
XCH
XCH
XCH
XCH
A,dir
A,addr16
A,Ri
A,ear
A,eam
A,io
A,#imm8
A,@A
A,@RLi+disp8
A,#imm4
A,dir
A,addr16
A,Ri
A,ear
A,eam
A,io
A,#imm8
A,@A
A,@RWi+disp8
A,@RLi+disp8
dir,A
addr16,A
Ri,A
ear,A
eam,A
io,A
@RLi+disp8,A
Ri,ear
Ri,eam
ear,Ri
eam,Ri
Ri,#imm8
io,#imm8
dir,#imm8
ear,#imm8
eam,#imm8
@AL,AH / @A,T
A,ear
A,eam
Ri,ear
Ri,eam
#
~
RG
B
2
3
1
2
2+
2
2
2
3
1
2
3
2
2
2+
2
2
2
2
3
2
3
1
2
2+
2
3
2
2+
2
2+
2
3
3
3
3+
2
2
2+
2
2+
3
4
2
2
3 + (a)
3
2
3
10
1
3
4
2
2
3 + (a)
3
2
3
5
10
3
4
2
2
3 + (a)
3
10
3
4 + (a)
4
5 + (a)
2
5
5
2
4 + (a)
3
4
5 + (a)
7
9 + (a)
0
0
1
1
0
0
0
0
2
0
0
0
1
1
0
0
0
0
1
2
0
0
1
1
0
0
2
2
1
2
1
1
0
0
1
0
0
2
0
4
2
(b)
(b)
0
0
(b)
(b)
0
(b)
(b)
0
(b)
(b)
0
0
(b)
(b)
0
(b)
(b)
(b)
(b)
(b)
0
0
(b)
(b)
(b)
0
(b)
0
(b)
0
(b)
(b)
0
(b)
(b)
0
2 x (b)
0
2 x (b)
Operation
byte (A) ← (dir)
byte (A) ← (addr16)
byte (A) ← (Ri)
byte (A) ← (ear)
byte (A) ← (eam)
byte (A) ← (io)
byte (A) ← imm8
byte (A) ← ((A))
byte (A) ← ((RLi)+disp8)
byte (A) ← imm4
byte (A) ← (dir)
byte (A) ← (addr16)
byte (A) ← (Ri)
byte (A) ← (ear)
byte (A) ← (eam)
byte (A) ← (io)
byte (A) ← imm8
byte (A) ← ((A))
byte (A) ← ((RWi)+disp8)
byte (A) ← ((RLi)+disp8
byte (dir) ← (A)
byte (addr16) ← (A)
byte (Ri) ← (A)
byte (ear) ← (A)
byte (eam) ← (A)
byte (io) ← (A)
byte ((RLi)+disp8) ← (A)
byte (Ri) ← (ear)
byte (Ri) ← (eam)
byte (ear) ← (Ri)
byte (eam) ← (Ri)
byte (Ri) ← imm8
byte (io) ← imm8
byte (dir) ← imm8
byte (ear) ← imm8
byte (eam) ← imm8
byte ((A)) ← (AH)
byte (A) ↔ (ear)
byte (A) ↔ (eam)
byte (Ri) ↔ (ear)
byte (Ri) ↔ (eam)
LH
AH
I
S
T
N
Z
V
C
RMW
Z
Z
Z
Z
Z
Z
Z
Z
Z
Z
X
X
X
X
X
X
X
X
X
X
Z
Z
-
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
-
-
-
*
*
*
*
*
*
*
*
*
R
-
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
-
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
-
-
-
-
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
516
APPENDIX
Table B.8-2 38 Transfer Instructions (Byte)
Mnemonic
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
XCHW
XCHW
XCHW
XCHW
MOVL
MOVL
MOVL
MOVL
MOVL
A,dir
A,addr16
A,SP
A,RWi
A,ear
A,eam
A,io
A,@A
A,#imm16
A,@RWi+disp8
A,@RLi+disp8
dir,A
addr16,A
SP,A
RWi,A
ear,A
eam,A
io,A
@RWi+disp8,A
@RLi+disp8,A
RWi,ear
ear,Rwi
eam,Rwi
RWi,#imm16
io,#imm16
ear,#imm16
eam,#imm16
@AL,AH / @A,T
A,ear
A,eam
RWi, ear
RWi, eam
A,ear
A,eam
A,#imm32
ear,A
eam,A
#
~
RG
B
2
3
3
1
2
2+
2
2
3
2
3
2
3
1
1
2
2+
2
2
3
2
2+
2
2+
3
4
4
4+
2
2
2+
2
2+
2
2+
5
2
2+
3
4
1
2
2
3 + (a)
3
3
2
5
10
3
4
1
2
2
3 + (a)
3
5
10
3
4 + (a)
4
5 + (a)
2
5
2
4 + (a)
3
4
5 + (a)
7
9 + (a)
4
5 + (a)
3
4
5 + (a)
0
0
0
1
1
0
0
0
2
1
2
0
0
0
1
1
0
0
1
2
2
1
2
1
1
0
1
0
0
2
0
4
2
2
0
0
2
0
(c)
(c)
0
0
0
(c)
(c)
(c)
0
(c)
(c)
(c)
(c)
0
0
0
(c)
(c)
(c)
(c)
0
(c)
0
(c)
0
(c)
0
(c)
(c)
0
2 x (c)
0
2 x (c)
0
(d)
0
0
(d)
Operation
word (A) ← (dir)
word (A) ← (addr16)
word (A) ← (SP)
word (A) ← (RWi)
word (A) ← (ear)
word (A) ← (eam)
word (A) ← (io)
word (A) ← ((A))
word (A) ← imm16
word (A) ← ((RWi)+disp8)
word (A) ← ((RLi)+disp8)
word (dir) ← (A)
word (addr16) ← (A)
word (SP) ← (A)
word (RWi) ← (A)
word (ear) ← (A)
word (eam) ← (A)
word (io) ← (A)
word ((RWi)+disp8) ← (A)
word ((RLi)+disp8) ← (A)
word (RWi) ← (ear)
word (RWi) ← (eam)
word (ear) ← (RWi)
word (eam) ← (RWi)
word (RWi) ← imm16
word (io) ← imm16
word (ear) ← imm16
word (eam) ← imm16
word ((A)) ← (AH)
word (A) ↔ (ear)
word (A) ↔ (eam)
word (RWi) ↔ (ear)
word (RWi) ↔ (eam)
long (A) ← (ear)
long (A) ← (eam)
long (A) ← imm32
long (ear1) ← (A)
long(eam1) ← (A)
LH
AH
I
S
T
N
Z
V
C
RMW
-
*
*
*
*
*
*
*
*
*
*
-
-
-
-
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
-
-
-
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
517
APPENDIX
Table B.8-3 42 Addition/Subtraction Instructions (Byte, Word, Long Word)
Mnemonic
#
~
RG
B
ADD
ADD
ADD
ADD
ADD
ADD
ADDC
ADDC
ADDC
ADDDC
A,#imm8
A,dir
A,ear
A,eam
ear,A
eam,A
A
A,ear
A,eam
A
2
2
2
2+
2
2+
1
2
2+
1
2
5
3
4 + (a)
3
5 + (a)
2
3
4 + (a)
3
0
0
1
0
2
0
0
1
0
0
0
(b)
0
(b)
0
2 x (b)
0
0
(b)
0
SUB
SUB
SUB
SUB
SUB
SUB
SUBC
SUBC
SUBC
SUBDC
A,#imm8
A,dir
A,ear
A,eam
ear,A
eam,A
A
A,ear
A,eam
A
2
2
2
2+
2
2+
1
2
2+
1
2
5
3
4 + (a)
3
5 + (a)
2
3
4 + (a)
3
0
0
1
0
2
0
0
1
0
0
0
(b)
0
(b)
0
2 x (b)
0
0
(b)
0
ADDW
ADDW
ADDW
ADDW
ADDW
ADDW
ADDCW
ADDCW
SUBW
SUBW
SUBW
SUBW
SUBW
SUBW
SUBCW
SUBCW
ADDL
ADDL
ADDL
SUBL
SUBL
SUBL
A
A,ear
A,eam
A,#imm16
ear,A
eam,A
A,ear
A,eam
A
A,ear
A,eam
A,#imm16
ear,A
eam,A
A,ear
A,eam
A,ear
A,eam
A,#imm32
A,ear
A,eam
A,#imm32
1
2
2+
3
2
2+
2
2+
1
2
2+
3
2
2+
2
2+
2
2+
5
2
2+
5
2
3
4+(a)
2
3
5+(a)
3
4+(a)
2
3
4+(a)
2
3
5+(a)
3
4+(a)
6
7+(a)
4
6
7+(a)
4
0
1
0
0
2
0
1
0
0
1
0
0
2
0
1
0
2
0
0
2
0
0
0
0
(c)
0
0
2 x (c)
0
(c)
0
0
(c)
0
0
2 x (c)
0
(c)
0
(d)
0
0
(d)
0
Operation
byte (A) ← (A) + imm8
byte (A) ← (A) + (dir)
byte (A) ← (A) + (ear)
byte (A) ← (A) + (eam)
byte (ear) ← (ear) + (A)
byte (eam) ← (eam) + (A)
byte (A) ← (AH) + (AL) + (C)
byte (A) ← (A) + (ear)+ (C)
byte (A) ← (A) + (eam)+ (C)
byte (A) ← (AH) + (AL) + (C)
(decimal)
byte (A) ← (A) - imm8
byte (A) ← (A) - (dir)
byte (A) ← (A) - (ear)
byte (A) ← (A) - (eam)
byte (ear) ← (ear) - (A)
byte (eam) ← (eam) - (A)
byte (A) ← (AH) - (AL) - (C)
byte (A) ← (A) - (ear) - (C)
byte (A) ← (A) - (eam) - (C)
byte (A) ← (AH) - (AL) - (C)
(decimal)
word (A) ← (AH) + (AL)
word (A) ← (A) + (ear)
word (A) ← (A) + (eam)
word (A) ← (A) + imm16
word (ear) ← (ear) + (A)
word (eam) ← (eam) + (A)
word (A) ← (A) + (ear) + (C)
word (A) ← (A) + (eam) + (C)
word (A) ← (AH) - (AL)
word (A) ← (A) - (ear)
word (A) ← (A) - (eam)
word (A) ← (A) - imm16
word (ear) ← (ear) - (A)
word (eam) ← (eam) - (A)
word (A) ← (A) - (ear) - (C)
word (A) ← (A) - (eam) - (C)
long (A) ← (A) + (ear)
long (A) ← (A) + (eam)
long (A) ← (A) + imm32
long (A) ← (A) - (ear)
long (A) ← (A) - (eam)
long (A) ← (A) - imm32
LH
AH
I
S
T
N
Z
V
C
RMW
Z
Z
Z
Z
Z
Z
Z
Z
Z
-
-
-
-
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
-
Z
Z
Z
Z
Z
Z
Z
Z
-
-
-
-
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
-
-
-
-
-
-
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
-
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
518
APPENDIX
Table B.8-4 12 Increment/decrement Instructions (Byte, Word, Long Word)
Mnemonic
#
~
RG
B
INC
ear
2
3
2
0
INC
eam
2+
5+(a)
0
2 x (b)
DEC
ear
2
3
2
0
DEC
eam
2+
5+(a)
0
2 x (b)
INCW
ear
2
3
2
0
INCW
eam
2+
5+(a)
0
2 x (c)
DECW
ear
2
3
2
0
DECW
eam
2+
5+(a)
0
2 x (c)
INCL
ear
2
7
4
0
INCL
eam
2+
9+(a)
0
2 x (d)
DECL
ear
2
7
4
0
DECL
eam
2+
9+(a)
0
2 x (d)
Operation
LH
AH
I
S
T
N
Z
V
C
RMW
byte (ear) ← (ear) + 1
-
-
-
-
-
*
*
*
-
-
byte (eam) ← (eam) + 1
-
-
-
-
-
*
*
*
-
*
byte (ear) ← (ear) - 1
-
-
-
-
-
*
*
*
-
-
byte (eam) ← (eam) - 1
-
-
-
-
-
*
*
*
-
*
word (ear) ← (ear) + 1
-
-
-
-
-
*
*
*
-
-
word (eam) ← (eam) + 1
-
-
-
-
-
*
*
*
-
*
word (ear) ← (ear) - 1
-
-
-
-
-
*
*
*
-
-
word (eam) ← (eam) - 1
-
-
-
-
-
*
*
*
-
*
long (ear) ← (ear) + 1
-
-
-
-
-
*
*
*
-
-
long (eam) ← (eam) + 1
-
-
-
-
-
*
*
*
-
*
long (ear) ← (ear) - 1
-
-
-
-
-
*
*
*
-
-
long (eam) ← (eam) - 1
-
-
-
-
-
*
*
*
-
*
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
Table B.8-5 11 Compare Instructions (Byte, Word, Long Word)
#
~
RG
B
LH
AH
I
S
T
N
Z
V
C
RMW
CMP
Mnemonic
A
1
1
0
0
byte (AH) - (AL)
Operation
-
-
-
-
-
*
*
*
*
-
CMP
A,ear
2
2
1
0
byte (A) - (ear)
-
-
-
-
-
*
*
*
*
-
CMP
A,eam
2+
3+(a)
0
(b)
byte (A) - (eam)
-
-
-
-
-
*
*
*
*
-
CMP
A,#imm8
2
2
0
0
byte (A) - imm8
-
-
-
-
-
*
*
*
*
-
CMPW
A
1
1
0
0
word (AH) - (AL)
-
-
-
-
-
*
*
*
*
-
CMPW
A,ear
2
2
1
0
word (A) - (ear)
-
-
-
-
-
*
*
*
*
-
CMPW
A,eam
2+
3+(a)
0
(c)
word (A) - (eam)
-
-
-
-
-
*
*
*
*
-
CMPW
A,#imm16
3
2
0
0
word (A) - imm16
-
-
-
-
-
*
*
*
*
-
CMPL
A,ear
2
6
2
0
long (A) - (ear)
-
-
-
-
-
*
*
*
*
-
CMPL
A,eam
2+
7+(a)
0
(d)
long (A) - (eam)
-
-
-
-
-
*
*
*
*
-
CMPL
A,#imm32
5
3
0
0
long (A) - imm32
-
-
-
-
-
*
*
*
*
-
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
519
APPENDIX
Table B.8-6 11 Unsigned Multiplication/Division Instructions (Word, Long Word)
Mnemonic
#
~
RG
B
Operation
LH
AH
I
S
T
N
Z
V
C
RMW
DIVU
A
1
*1
0
0
word (AH) / byte (AL)
quotient → byte (AL) remainder → byte (AH)
-
-
-
-
-
-
-
*
*
-
DIVU
A,ear
2
*2
1
0
word (A) / byte (ear)
quotient → byte (A) remainder → byte (ear)
-
-
-
-
-
-
-
*
*
-
DIVU
A,eam
2+
*3
0
*6
word (A) / byte (eam)
quotient → byte (A) remainder → byte (eam)
-
-
-
-
-
-
-
*
*
-
DIVUW
A,ear
2
*4
1
0
long (A) / word (ear)
quotient → word (A) remainder → word (ear)
-
-
-
-
-
-
-
*
*
-
DIVUW
A,eam
2+
*5
0
*7
long (A) / word (eam)
quotient → word (A) remainder → word (eam)
-
-
-
-
-
-
-
*
*
-
MULL
A
1
*8
0
0
byte (AH) * byte (AL) → word (A)
-
-
-
-
-
-
-
-
-
MULL
A,ear
2
*9
1
0
byte (A) * byte (ear) → word (A)
-
-
-
-
-
-
-
-
-
-
MULL
A,eam
2+
*10
0
(b)
byte (A) * byte (eam) → word (A)
-
-
-
-
-
-
-
-
-
-
MULEY
A
1
*11
0
0
word (AH) * word (AL) → Long (A)
-
-
-
-
-
-
-
-
-
-
MULEY
A,ear
2
*12
1
0
word (A) * word (ear) → Long (A)
-
-
-
-
-
-
-
-
-
-
MULEY
A,eam
2+
*13
0
(c)
word (A) * word (eam) → Long (A)
-
-
-
-
-
-
-
-
-
-
*1: 3: Division by 0 7: Overflow 15: Normal
*2: 4: Division by 0 8: Overflow 16: Normal
*3: 6+(a): Division by 0 9+(a): Overflow 19+(a): Normal
*4: 4: Division by 0 7: Overflow 22: Normal
*5: 6+(a): Division by 0 8+(a): Overflow 26+(a): Normal
*6: (b): Division by 0 or overflow 2 x (b): Normal
*7: (c): Division by 0 or overflow 2 x (c): Normal
*8: 3: Byte (AH) is 0. 7: Byte (AH) is not 0.
*9: 4: Byte (ear) is 0. 8: Byte (ear) is not 0.
*10: 5+(a): Byte (eam) is 0, 9+(a): Byte (eam) is not 0.
*11: 3: Word (AH) is 0. 11: Word (AH) is not 0.
*12: 4: Word (ear) is 0. 12: Word (ear) is not 0.
*13: 5+(a): Word (eam) is 0. 13+(a): Word (eam) is not 0.
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
520
APPENDIX
Table B.8-7 11 Signed Multiplication/Division Instructions (Word, Long Word)
Mnemonic
#
~
RG
B
Operation
LH
AH
I
S
T
N
Z
V
C
RMW
DIV
A
2
*1
0
0
word (AH) / byte (AL)
quotient → byte (AL) remainder → byte (AH)
Z
-
-
-
-
-
-
*
*
-
DIV
A,ear
2
*2
1
0
word (A) / byte (ear)
quotient → byte (A) remainder → byte (ear)
Z
-
-
-
-
-
-
*
*
-
DIV
A,eam
2+
*3
0
*6
word (A) / byte (eam)
quotient → byte (A) remainder → byte (eam)
Z
-
-
-
-
-
-
*
*
-
DIVW
A,ear
2
*4
1
0
long (A) / word (ear)
quotient → word (A) remainder → word (ear)
-
-
-
-
-
-
-
*
*
-
DIVW
A,eam
2+
*5
0
*7
long (A) / word (eam)
quotient → word (A) remainder → word (eam)
-
-
-
-
-
-
-
*
*
-
MUL
A
2
*8
0
0
byte (AH) * byte (AL) → word (A)
-
-
-
-
-
-
-
-
-
-
MUL
A,ear
2
*9
1
0
byte (A) * byte (ear) → word (A)
-
-
-
-
-
-
-
-
-
-
MUL
A,eam
2+
*10
0
(b)
byte (A) * byte (eam) → word (A)
-
-
-
-
-
-
-
-
-
-
MULW
A
2
*11
0
0
word (AH) * word (AL) → Long (A)
-
-
-
-
-
-
-
-
-
-
MULW
A,ear
2
*12
1
0
word (A) * word (ear) → Long (A)
-
-
-
-
-
-
-
-
-
-
MULW
A,eam
2+
*13
0
(c)
word (A) * word (eam) → Long (A)
-
-
-
-
-
-
-
-
-
-
*1:
*2:
*3:
*4:
3: Division by 0, 8 or 18: Overflow, 18: Normal
4: Division by 0, 11 or 22: Overflow, 23: Normal
5+(a): Division by 0, 12+(a) or 23+(a): Overflow, 24+(a): Normal
When dividend is positive; 4: Division by 0, 12 or 30: Overflow, 31: Normal
When dividend is negative; 4: Division by 0, 12 or 31: Overflow, 32: Normal
*5: When dividend is positive; 5+(a): Division by 0, 12+(a) or 31+(a): Overflow, 32+(a): Normal
When dividend is negative; 5+(a): Division by 0, 12+(a) or 32+(a): Overflow, 33+(a): Normal
*6: (b): Division by 0 or overflow, 2 x (b): Normal
*7: (c): Division by 0 or overflow, 2 x (c): Normal
*8: 3: Byte (AH) is 0, 12: result is positive, 13: result is negative
*9: 4: Byte (ear) is 0, 13: result is positive, 14: result is negative
*10: 5+(a): Byte (eam) is 0, 14+(a): result is positive, 15+(a): result is negative
*11: 3: Word (AH) is 0, 16: result is positive, 19: result is negative
*12: 4: Word (ear) is 0, 17: result is positive, 20: result is negative
*13: 5+(a): Word (eam) is 0, 18+(a): result is positive, 21+(a): result is negative
Notes:
• The execution cycle count found when an overflow occurs in a DIV or DIVW instruction may be a
pre-operation count or a post-operation count depending on the detection timing.
• When an overflow occurs with DIV or DIVW instruction, the contents of the AL are destroyed.
• See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
521
APPENDIX
Table B.8-8 39 Logic 1 Instructions (Byte, Word)
Mnemonic
#
~
RG
B
Operation
LH
AH
I
S
T
N
Z
V
C
RMW
-
AND
A,#imm8
2
2
0
0
byte (A) ← (A) and imm8
-
-
-
-
-
*
*
R
-
AND
A,ear
2
3
1
0
byte (A) ← (A) and (ear)
-
-
-
-
-
*
*
R
-
-
AND
A,eam
2+
4+(a)
0
(b)
byte (A) ← (A) and (eam)
-
-
-
-
-
*
*
R
-
-
byte (ear) ← (ear) and (A)
-
-
-
-
-
*
*
R
-
-
byte (eam) ← (eam) and (A)
-
-
-
-
-
*
*
R
-
*
-
AND
ear,A
2
3
2
0
AND
eam,A
2+
5+(a)
0
2 x (b)
OR
A,#imm8
2
2
0
0
byte (A) ← (A) or imm8
-
-
-
-
-
*
*
R
-
OR
A,ear
2
3
1
0
byte (A) ← (A) or (ear)
-
-
-
-
-
*
*
R
-
-
OR
A,eam
2+
4+(a)
0
(b)
byte (A) ← (A) or (eam)
-
-
-
-
-
*
*
R
-
-
OR
ear,A
2
3
2
0
byte (ear) ← (ear) or (A)
-
-
-
-
-
*
*
R
-
-
OR
eam,A
2+
5+(a)
0
2 x (b)
byte (eam) ← (eam) or (A)
-
-
-
-
-
*
*
R
-
*
XOR
A,#imm8
2
2
0
0
byte (A) ← (A) xor imm8
-
-
-
-
-
*
*
R
-
-
XOR
A,ear
2
3
1
0
byte (A) ← (A) xor (ear)
-
-
-
-
-
*
*
R
-
-
XOR
A,eam
2+
4+(a)
0
(b)
byte (A) ← (A) xor (eam)
-
-
-
-
-
*
*
R
-
-
XOR
ear,A
2
3
2
0
byte (ear) ← (ear) xor (A)
-
-
-
-
-
*
*
R
-
-
XOR
eam,A
2+
5+(a)
0
2 x (b)
byte (eam) ← (eam) xor (A)
-
-
-
-
-
*
*
R
-
*
NOT
A
1
2
0
0
byte (A) ← not (A)
-
-
-
-
-
*
*
R
-
-
NOT
ear
2
3
2
0
byte (ear) ← not (ear)
-
-
-
-
-
*
*
R
-
-
NOT
eam
2+
5+(a)
0
2 x (b)
byte (eam) ← not (eam)
-
-
-
-
-
*
*
R
-
*
ANDW
A
1
2
0
0
word (A) ← (AH) and (A)
-
-
-
-
-
*
*
R
-
-
ANDW
A,#imm16
3
2
0
0
word (A) ← (A) and imm16
-
-
-
-
-
*
*
R
-
-
ANDW
A,ear
2
3
1
0
word (A) ← (A) and (ear)
-
-
-
-
-
*
*
R
-
-
ANDW
A,eam
2+
4+(a)
0
(c)
word (A) ← (A) and (eam)
-
-
-
-
-
*
*
R
-
-
word (ear) ← (ear) and (A)
-
-
-
-
-
*
*
R
-
-
word (eam) ← (eam) and (A)
-
-
-
-
-
*
*
R
-
*
0
word (A) ← (AH) or (A)
-
-
-
-
-
*
*
R
-
-
0
word (A) ← (A) or imm16
-
-
-
-
-
*
*
R
-
-
1
0
word (A) ← (A) or (ear)
-
-
-
-
-
*
*
R
-
-
0
(c)
word (A) ← (A) or (eam)
-
-
-
-
-
*
*
R
-
-
ANDW
ear,A
2
3
2
0
ANDW
eam,A
2+
5+(a)
0
2 x (c)
ORW
A
1
2
0
ORW
A,#imm16
3
2
0
ORW
A,ear
2
3
ORW
A,eam
2+
4+(a)
word (ear) ← (ear) or (A)
-
-
-
-
-
*
*
R
-
-
word (eam) ← (eam) or (A)
-
-
-
-
-
*
*
R
-
*
0
word (A) ← (AH) xor (A)
-
-
-
-
-
*
*
R
-
-
0
word (A) ← (A) xor imm16
-
-
-
-
-
*
*
R
-
-
1
0
word (A) ← (A) xor (ear)
-
-
-
-
-
*
*
R
-
-
ORW
ear,A
2
3
2
0
ORW
eam,A
2+
5+(a)
0
2 x (c)
XORW
A
1
2
0
XORW
A,#imm16
3
2
0
XORW
A,ear
2
3
XORW
A,eam
2+
4+(a)
0
(c)
word (A) ← (A) xor (eam)
-
-
-
-
-
*
*
R
-
-
XORW
ear,A
2
3
2
0
word (ear) ← (ear) xor (A)
-
-
-
-
-
*
*
R
-
-
XORW
eam,A
2+
5+(a)
0
2 x (c)
word (eam) ← (eam) xor (A)
-
-
-
-
-
*
*
R
-
*
NOTW
A
1
2
0
0
word (A) ← not (A)
-
-
-
-
-
*
*
R
-
-
NOTW
ear
2
3
2
0
word (ear) ← not (ear)
-
-
-
-
-
*
*
R
-
-
NOTW
eam
2+
5+(a)
0
2 x (c)
word (eam) ← not (eam)
-
-
-
-
-
*
*
R
-
*
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
522
APPENDIX
Table B.8-9 6 Logic 2 Instructions (Long Word)
Mnemonic
#
~
RG
B
Operation
LH
AH
I
S
T
N
Z
V
C
RMW
ANDL
A,ear
2
6
2
0
long (A) ← (A) and (ear)
-
-
-
-
-
*
*
R
-
-
ANDL
A,eam
2+
7+(a)
0
(d)
long (A) ← (A) and (eam)
-
-
-
-
-
*
*
R
-
-
ORL
A,ear
2
6
2
0
long (A) ← (A) or (ear)
-
-
-
-
-
*
*
R
-
-
ORL
A,eam
2+
7+(a)
0
(d)
long (A) ← (A) or (eam)
-
-
-
-
-
*
*
R
-
-
XORL
A,ear
2
6
2
0
long (A) ← (A) xor (ear)
-
-
-
-
-
*
*
R
-
-
XORL
A,eam
2+
7+(a)
0
(d)
long (A) ← (A) xor (eam)
-
-
-
-
-
*
*
R
-
-
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
Table B.8-10 6 Sign Inversion Instructions (Byte, Word)
Mnemonic
NEG
A
#
~
RG
B
1
2
0
0
NEG
ear
2
3
2
0
NEG
eam
2+
5+(a)
0
2 x (b)
NEGW
A
1
2
0
0
NEGW
ear
2
3
2
0
NEGW
eam
2+
5+(a)
0
2 x (c)
Operation
LH
AH
I
S
T
N
Z
V
C
RMW
byte (A) ← 0 - (A)
X
-
-
-
-
*
*
*
*
-
byte (ear) ← 0 - (ear)
-
-
-
-
-
*
*
*
*
-
byte (eam) ← 0 - (eam)
-
-
-
-
-
*
*
*
*
*
word (A) ← 0 - (A)
-
-
-
-
-
*
*
*
*
-
word (ear) ← 0 - (ear)
-
-
-
-
-
*
*
*
*
-
word (eam) ← 0 - (eam)
-
-
-
-
-
*
*
*
*
*
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
Table B.8-11 1 Normalization Instruction (Long Word)
Mnemonic
NRML
A,R0
#
~
RG
B
2
*1
1
0
Operation
long (A) ← Shifts to the position where '1' is set for
the first time.
byte (RD) ← Shift count at that time
LH
AH
I
S
T
N
Z
V
C
RMW
-
-
-
-
-
-
*
-
-
-
*1: 4 when all accumulators have a value of 0; otherwise, 6+(R0)
523
APPENDIX
Table B.8-12 18 Shift Instructions (Byte, Word, Long Word)
Mnemonic
#
~
RG
B
Operation
LH
AH
I
S
T
N
Z
V
C
RMW
RORC
A
2
2
0
0
byte (A) ← With right rotation carry
-
-
-
-
-
*
*
-
*
-
ROLC
A
2
2
0
0
byte (A) ← With left rotation carry
-
-
-
-
-
*
*
-
*
-
RORC
ear
2
3
2
0
byte (ear) ← With right rotation carry
-
-
-
-
-
*
*
-
*
-
RORC
eam
2+
5+(a)
0
2 x (b)
byte (eam) ← With right rotation carry
-
-
-
-
-
*
*
-
*
*
ROLC
ear
2
3
2
0
byte (ear) ← With left rotation carry
-
-
-
-
-
*
*
-
*
-
ROLC
eam
2+
5+(a)
0
2 x (b)
byte (eam) ← With left rotation carry
-
-
-
-
-
*
*
-
*
*
ASR
A,R0
2
*1
1
0
byte (A) ← Arithmetic right shift (A, 1 bit)
-
-
-
-
-
*
*
-
*
-
LSR
A,R0
2
*1
1
0
byte (A) ← Logical right barrel shift (A, R0)
-
-
-
-
-
*
*
-
*
-
LSL
A,R0
2
*1
1
0
byte (A) ← Logical left barrel shift (A, R0)
-
-
-
-
-
*
*
-
*
-
ASRW
A
1
2
0
0
word (A) ← Arithmetic right shift (A, 1 bit)
-
-
-
-
*
*
*
-
*
-
LSRW
A/SHRW A
1
2
0
0
word (A) ← Logical right shift (A, 1 bit)
-
-
-
-
*
R
*
-
*
-
LSLW
A/SHLW A
1
2
0
0
word (A) ← Logical left shift (A, 1 bit)
-
-
-
-
-
*
*
-
*
-
ASRW
A,R0
2
*1
1
0
word (A) ← Arithmetic right barrel shift (A, R0)
-
-
-
-
*
*
*
-
*
-
LSRW
A,R0
2
*1
1
0
word (A) ← Logical right barrel shift (A, R0)
-
-
-
-
*
*
*
-
*
-
LSLW
A,R0
2
*1
1
0
word (A) ← Logical left barrel shift (A, R0)
-
-
-
-
-
*
*
-
*
-
ASRL
A,R0
2
*2
1
0
long (A) ← Arithmetic right barrel shift (A, R0)
-
-
-
-
*
*
*
-
*
-
LSRL
A,R0
2
*2
1
0
long (A) ← Logical right barrel shift (A, R0)
-
-
-
-
*
*
*
-
*
-
LSLL
A,R0
2
*2
1
0
long (A) ← Logical left barrel shift (A, R0)
-
-
-
-
-
*
*
-
*
-
*1: 6 when R0 is 0; otherwise, 5 + (R0)
*2: 6 when R0 is 0; otherwise, 6 + (R0)
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
524
APPENDIX
Table B.8-13 31 Branch 1 Instructions
Mnemonic
#
~
RG
B
Operation
LH
AH
I
S
T
N
Z
V
C
RMW
BZ/BEQ
rel
2
*1
0
0
Branch on (Z) = 1
-
-
-
-
-
-
-
-
-
-
BNZ/
BNE
rel
2
*1
0
0
Branch on (Z) = 0
-
-
-
-
-
-
-
-
-
-
BC/BLO
rel
2
*1
0
0
Branch on (C) = 1
-
-
-
-
-
-
-
-
-
-
BNC/
BHS
rel
2
*1
0
0
Branch on (C) = 0
-
-
-
-
-
-
-
-
-
-
BN
rel
2
*1
0
0
Branch on (N) = 1
-
-
-
-
-
-
-
-
-
-
BP
rel
2
*1
0
0
Branch on (N) = 0
-
-
-
-
-
-
-
-
-
-
BV
rel
2
*1
0
0
Branch on (V) = 1
-
-
-
-
-
-
-
-
-
-
BNV
rel
2
*1
0
0
Branch on (V) = 0
-
-
-
-
-
-
-
-
-
-
BT
rel
2
*1
0
0
Branch on (T) = 1
-
-
-
-
-
-
-
-
-
-
BNT
rel
2
*1
0
0
Branch on (T) = 0
-
-
-
-
-
-
-
-
-
-
BLT
rel
2
*1
0
0
Branch on (V) nor (N) = 1
-
-
-
-
-
-
-
-
-
-
BGE
rel
2
*1
0
0
Branch on (V) nor (N) = 0
-
-
-
-
-
-
-
-
-
-
BLE
rel
2
*1
0
0
Branch on ((V) xor (N)) or (Z) = 1
-
-
-
-
-
-
-
-
-
-
BGT
rel
2
*1
0
0
Branch on ((V) xor (N)) or (Z) = 0
-
-
-
-
-
-
-
-
-
-
BLS
rel
2
*1
0
0
Branch on (C) or (Z) = 1
-
-
-
-
-
-
-
-
-
-
BHI
rel
2
*1
0
0
Branch on (C) or (Z) = 0
-
-
-
-
-
-
-
-
-
-
BRA
rel
2
*1
0
0
Unconditional branch
-
-
-
-
-
-
-
-
-
-
JMP
@A
1
2
0
0
word (PC) ← (A)
-
-
-
-
-
-
-
-
-
-
JMP
addr16
3
3
0
0
word (PC) ← addr16
-
-
-
-
-
-
-
-
-
-
JMP
@ear
2
3
1
0
word (PC) ← (ear)
-
-
-
-
-
-
-
-
-
-
JMP
@eam
2+
4+(a)
0
(c)
-
JMPP
@ear *3
2
5
2
0
JMPP
@eam *3
2+
6+(a)
0
(d)
JMPP
addr24
4
4
0
0
CALL
@ear *4
2
6
1
(c)
CALL
addr16 *5
2+
7+(a)
0
CALL
@eam *4
3
6
CALLV
#vct4 *5
1
CALLP
@ear *6
CALLP
CALLP
word (PC) ← (eam)
-
-
-
-
-
-
-
-
-
word (PC) ← (ear), (PCB) ← (ear+2)
-
-
-
-
-
-
-
-
-
-
word (PC) ← (eam), (PCB) ← (eam+2)
-
-
-
-
-
-
-
-
-
-
word (PC) ← ad24 0-15, (PCB) ← ad24 16-23
-
-
-
-
-
-
-
-
-
-
word (PC) ← (ear)
-
-
-
-
-
-
-
-
-
-
2 x (c)
word (PC) ← (eam)
-
-
-
-
-
-
-
-
-
-
0
(c)
word (PC) ← addr16
-
-
-
-
-
-
-
-
-
-
7
0
2 x (c)
Vector call instruction
-
-
-
-
-
-
-
-
-
-
2
10
2
2 x (c)
word (PC) ← (ear)0-15, (PCB) ← (ear)16-23
-
-
-
-
-
-
-
-
-
-
@eam *6
2+
11+(a)
0
*2
word (PC) ← (eam)0-15, (PCB) ← (eam)16-23
-
-
-
-
-
-
-
-
-
-
addr24 *7
4
10
0
2 x (c)
word (PC) ← addr0-15, (PCB) ← addr16-23
-
-
-
-
-
-
-
-
-
-
*1: 4 when a branch is made; otherwise, 3
*2: 3 x (c) + (b)
*3: Read (word) of branch destination address
*4: W: Save to stack (word) R: Read (word) of branch destination address
*5: Save to stack (word)
*6: W: Save to stack (long word), R: Read (long word) of branch destination address
*7: Save to stack (long word)
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
525
APPENDIX
Table B.8-14 19 Branch 2 Instructions
Mnemonic
#
~
RG
B
Operation
LH
AH
I
S T N Z V C
RMW
CBNE
A,#imm8,rel
3
*1
0
0
Branch on byte (A) not equal to imm8
-
-
-
-
-
*
*
*
*
-
CWBNE
A,#imm16,rel
4
*1
0
0
Branch on word (A) not equal to imm16
-
-
-
-
-
*
*
*
*
-
CBNE
ear,#imm8,rel
4
*2
1
0
Branch on byte (ear) not equal to imm8
-
-
-
-
-
*
*
*
*
-
CBNE
eam,#imm8,rel *9
4+
*3
0
(b)
Branch on byte (eam) not equal to imm8
-
-
-
-
-
*
*
*
*
-
CWBNE
ear,#imm16,rel
5
*4
1
0
Branch on word (ear) not equal to imm16
-
-
-
-
-
*
*
*
*
-
CWBNE
eam,#imm16,rel*9
5+
*3
0
(c)
Branch on word (eam) not equal to imm16
-
-
-
-
-
*
*
*
*
-
DBNZ
ear,rel
3
*5
2
0
Branch on byte (ear) = (ear) - 1, (ear) not equal to 0
-
-
-
-
-
*
*
*
-
-
DBNZ
eam,rel
3+
*6
2
*
DWBNZ
ear,rel
3
*5
2
DWBNZ
eam,rel
3+
*6
2
INT
#vct8
2
20
0
8 x (c) Software interrupt
-
-
R
S
-
-
-
-
-
-
INT
addr16
3
16
0
6 x (c) Software interrupt
-
-
R
S
-
-
-
-
-
-
INTP
addr24
4
17
0
6 x (c) Software interrupt
-
-
R
S
-
-
-
-
-
-
1
20
0
8 x (c) Software interrupt
-
-
R
S
-
-
-
-
-
-
INT9
RETI
LINK
#imm8
UNLINK
2 x (b) Branch on byte (eam) = (eam) - 1, (eam) not equal to 0
0
Branch on word (ear) = (ear) - 1, (ear) not equal to 0
2 x (c) Branch on word (eam) = (eam) - 1, (eam) not equal to 0
-
-
-
-
-
*
*
*
-
-
-
-
-
-
*
*
*
-
-
-
-
-
-
-
*
*
*
-
*
1
*8
0
*7
Return from interrupt
-
-
*
*
*
*
*
*
*
-
2
6
0
(c)
Saves the old frame pointer in the stack upon entering the
function, then sets the new frame pointer and reserves the
local pointer area.
-
-
-
-
-
-
-
-
-
-
1
5
0
(c)
Recovers the old frame pointer from the stack upon exiting
the function.
-
-
-
-
-
-
-
-
-
-
RET
*10
1
4
0
(c)
Return from subroutine
-
-
-
-
-
-
-
-
-
-
RETP
*11
1
6
0
(d)
Return from subroutine
-
-
-
-
-
-
-
-
-
-
*1: 5 when a branch is made; otherwise, 4
*2: 13 when a branch is made; otherwise, 12
*3: 7+(a) when a branch is made; otherwise, 6+(a)
*4: 8 when a branch is made; otherwise, 7
*5: 7 when a branch is made; otherwise, 6
*6: 8+(a) when a branch is made; otherwise, 7+(a)
*7: 3 x (b) + 2 x (c) when jumping to the next interruption request; 6 x (c) when returning from the current interruption
*8: 15 when jumping to the next interruption request; 17 when returning from the current interruption
*9: Do not use RWj+ addressing mode with a CBNE or CWBNE instruction.
*10: Return from stack (word)
*11: Return from stack (long word)
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
526
APPENDIX
Table B.8-15 28 Other Control Instructions (Byte, Word, Long Word)
Mnemonic
#
~
RG
B
Operation
LH
AH
I
S
T
N
Z
V
C
RMW
PUSHW
A
1
4
0
(c)
word (SP) ← (SP) - 2, ((SP)) ← (A)
-
-
-
-
-
-
-
-
-
-
PUSHW
AH
1
4
0
(c)
word (SP) ← (SP) - 2, ((SP)) ← (AH)
-
-
-
-
-
-
-
-
-
-
PUSHW
PS
1
4
0
(c)
word (SP) ← (SP) - 2, ((SP)) ← (PS)
-
-
-
-
-
-
-
-
-
PUSHW
rlst
2
*3
*5
*4
(SP) ← (SP) - 2n, ((SP)) ← (rlst)
-
-
-
-
-
-
-
-
-
-
POPW
A
1
3
0
(c)
word (A) ← ((SP)), (SP) ← (SP) + 2
-
*
-
-
-
-
-
-
-
-
POPW
AH
1
3
0
(c)
word (AH) ← ((SP)), (SP) ← (SP) + 2
-
-
-
-
-
-
-
-
-
-
POPW
PS
1
4
0
(c)
word (PS) ← ((SP)), (SP) ← (SP) + 2
-
-
*
*
*
*
*
*
*
-
POPW
rlst
2
*2
*5
*4
(rlst) ← ((SP)), (SP) ← (SP)
-
-
-
-
-
-
-
-
-
-
JCTX
@A
1
14
0
6 x (c)
Context switch instruction
-
-
*
*
*
*
*
*
*
-
AND
CCR,#imm8
2
3
0
0
byte (CCR) ← (CCR) and imm8
-
-
*
*
*
*
*
*
*
-
OR
CCR,#imm8
2
3
0
0
byte (CCR) ← (CCR) or imm8
-
-
*
*
*
*
*
*
*
-
MOV
RP,#imm8
2
2
0
0
byte (RP) ← imm8
-
-
-
-
-
-
-
-
-
-
MOV
ILM,#imm8
2
2
0
0
byte (ILM) ← imm8
-
-
-
-
-
-
-
-
-
-
MOVEA
RWi,ear
2
3
1
0
word (RWi) ← ear
-
-
-
-
-
-
-
-
-
-
MOVEA
RWi,eam
2+
2+(a)
1
0
word (RWi) ← eam
-
-
-
-
-
-
-
-
-
-
MOVEA
A,ear
2
1
0
0
word (A) ← ear
-
*
-
-
-
-
-
-
-
-
MOVEA
A,eam
2+
1+(a)
0
0
word (A) ← eam
-
*
-
-
-
-
-
-
-
-
ADDSP
#imm8
2
3
0
0
word (SP) ← ext(imm8)
-
-
-
-
-
-
-
-
-
-
ADDSP
#imm16
3
3
0
0
word (SP) ← imm16
-
-
-
-
-
-
-
-
-
-
MOV
A,brg1
2
*1
0
0
byte (A) ← (brg1)
Z
*
-
-
-
*
*
-
-
-
MOV
brg2,A
2
1
0
0
byte (brg2) ← (A)
-
-
-
-
-
*
*
-
-
-
NOP
1
1
0
0
No operation
-
-
-
-
-
-
-
-
-
-
ADB
1
1
0
0
Prefix code for AD space access
-
-
-
-
-
-
-
-
-
-
DTB
1
1
0
0
Prefix code for DT space access
-
-
-
-
-
-
-
-
-
-
PCB
1
1
0
0
Prefix code for PC space access
-
-
-
-
-
-
-
-
-
-
SPB
1
1
0
0
Prefix code for SP space access
-
-
-
-
-
-
-
-
-
-
NCC
1
1
0
0
Prefix code for flag no-change
-
-
-
-
-
-
-
-
-
-
CMR
1
1
0
0
Prefix code for common register bank
-
-
-
-
-
-
-
-
-
-
*1: PCB, ADB, SSB, USB, SPB: 1, DTB, DPR: 2
*2: 7 + 3 x (POP count) + 2 x (POP last register number), 7 when RLST = 0 (no transfer register)
*3: 29 + 3 x (PUSH count) - 3 x (PUSH last register number), 8 when RLST = 0 (no transfer register)
*4: (POP count) x (c) or (PUSH count) x (c)
*5: (POP count) or (PUSH count)
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
527
APPENDIX
Table B.8-16 21 Bit Operand Instructions
Mnemonic
#
~
RG
B
Operation
LH
AH
I
S
T
N
Z
V
C
RMW
MOVB
A,dir:bp
3
5
0
(b)
byte (A) ← (dir:bp)b
Z
*
-
-
-
*
*
-
-
-
MOVB
A,addr16:bp
4
5
0
(b)
byte (A) ← (addr16:bp)b
Z
*
-
-
-
*
*
-
-
-
MOVB
A,io:bp
3
4
0
(b)
byte (A) ← (io:bp)b
Z
*
-
-
-
*
*
-
-
-
MOVB
dir:bp,A
3
7
0
2 x (b)
bit (dir:bp)b ← (A)
-
-
-
-
-
*
*
-
-
*
MOVB
addr16:bp,A
4
7
0
2 x (b)
bit (addr16:bp)b ← (A)
-
-
-
-
-
*
*
-
-
*
MOVB
io:bp,A
3
6
0
2 x (b)
bit (io:bp)b ← (A)
-
-
-
-
-
*
*
-
-
*
SETB
dir:bp
3
7
0
2 x (b)
bit (dir:bp)b ← 1
-
-
-
-
-
-
-
-
-
*
SETB
addr16:bp
4
7
0
2 x (b)
bit (addr16:bp)b ← 1
-
-
-
-
-
-
-
-
-
*
SETB
io:bp
3
7
0
2 x (b)
bit (io:bp)b ← 1
-
-
-
-
-
-
-
-
-
*
CLRB
dir:bp
3
7
0
2 x (b)
bit (dir:bp)b ← 0
-
-
-
-
-
-
-
-
-
*
CLRB
addr16:bp
4
7
0
2 x (b)
bit (addr16:bp)b ← 0
-
-
-
-
-
-
-
-
-
*
CLRB
io:bp
3
7
0
2 x (b)
bit (io:bp)b ← 0
-
-
-
-
-
-
-
-
-
*
BBC
dir:bp,rel
4
*1
0
(b)
Branch on (dir:bp) b = 0
-
-
-
-
-
-
*
-
-
-
BBC
addr16:bp,rel
5
*1
0
(b)
Branch on (addr16:bp) b = 0
-
-
-
-
-
-
*
-
-
-
BBC
io:bp,rel
4
*2
0
(b)
Branch on (io:bp) b = 0
-
-
-
-
-
-
*
-
-
-
BBS
dir:bp,rel
4
*1
0
(b)
Branch on (dir:bp) b = 1
-
-
-
-
-
-
*
-
-
-
BBS
addr16:bp,rel
5
*1
0
(b)
Branch on (addr16:bp) b = 1
-
-
-
-
-
-
*
-
-
-
BBS
io:bp,rel
4
*1
0
(b)
SBBS
addr16:bp,rel
5
*3
0
2 x (b)
WBTS
io:bp
3
*4
0
WBTC
io:bp
3
*4
0
Branch on (io:bp) b = 1
-
-
-
-
-
-
*
-
-
-
Branch on (addr16:bp) b = 1, bit = 1
-
-
-
-
-
-
*
-
-
*
*5
Waits until (io:bp) b = 1
-
-
-
-
-
-
-
-
-
-
*5
Waits until (io:bp) b = 0
-
-
-
-
-
-
-
-
-
-
RMW
*1: 8 when a branch is made; otherwise, 7
*2: 7 when a branch is made; otherwise, 6
*3: 10 when the condition is met; otherwise, 9
*4: Undefined count
*5: Until the condition is met
Note:
See Table B.5-1 and Table B.5-2 for information on (a) to (d) in the table.
Table B.8-17 6 Accumulator Operation Instructions (Byte, Word)
#
~
RG
B
LH
AH
I
S
T
N
Z
V
C
SWAP
Mnemonic
1
3
0
0
byte (A)0-7 ↔ (A)8-15
Operation
-
-
-
-
-
-
-
-
-
-
SWAPW
1
2
0
0
word (AH) ↔ (AL)
-
*
-
-
-
-
-
-
-
-
EXT
1
1
0
0
Byte sign extension
X
-
-
-
-
*
*
-
-
-
EXTW
1
2
0
0
Word sign extension
-
X
-
-
-
*
*
-
-
-
ZEXT
1
1
0
0
Byte zero extension
Z
-
-
-
-
R
*
-
-
-
ZEXTW
1
1
0
0
Word zero extension
-
Z
-
-
-
R
*
-
-
-
528
APPENDIX
Table B.8-18 10 String Instructions
Mnemonic
#
~
RG
B
Operation
LH
AH
I
S
T
N
Z
V
C
RMW
-
MOVS / MOVSI
2
*2
*5
*3
byte transfer @AH+ ← @AL+, counter = RW0
-
-
-
-
-
-
-
-
-
MOVSD
2
*2
*5
*3
byte transfer @AH- ← @AL-, counter = RW0
-
-
-
-
-
-
-
-
-
-
SCEQ / SCEQI
2
*1
*5
*4
byte search @AH+ ← AL, counter RW0
-
-
-
-
-
*
*
*
*
-
SCEQD
2
*1
*5
*4
byte search @AH- ← AL, counter RW0
-
-
-
-
-
*
*
*
*
FILS / FILSI
2
6m+6
*5
*3
byte fill @AH+ ← AL, counter RW0
-
-
-
-
-
*
*
-
-
-
MOVSW / MOVSWI
2
*2
*5
*6
word transfer @AH+ ← @AL+, counter = RW0
-
-
-
-
-
-
-
-
-
-
MOVSWD
2
*2
*5
*6
word transfer @AH- ← @AL-, counter = RW0
-
-
-
-
-
-
-
-
-
-
SCWEQ / SCWEQI
2
*1
*5
*7
word search @AH+ - AL, counter = RW0
-
-
-
-
-
*
*
*
*
-
SCWEQD
2
*1
*5
*7
word search @AH- - AL, counter = RW0
-
-
-
-
-
*
*
*
*
-
FILSW / FILSWI
2
6m+6
*5
*6
word fill @AH+ ← AL, counter = RW0
-
-
-
-
-
*
*
-
-
-
*1: 5 when RW0 is 0, 4 + 7 x (RW0) when the counter expires, or 7n + 5 when a match occurs
*2: 5 when RW0 is 0; otherwise, 4 + 8 x (RW0)
*3: (b) x (RW0) + (b) x (RW0) When the source and destination access different areas, calculate the (b) item individually.
*4: (b) x n
*5: 2 x (RW0)
*6: (c) x (RW0) + (c) x (RW0) When the source and destination access different areas, calculate the (c) item individually.
*7: (c) x n
Note:
m: RW0 value (counter value), n: Loop count
See Table B.5-1 and Table B.5-2 for information on (b) to (c) in the table.
529
APPENDIX
B.9
Instruction Map
Each F2MC-16LX instruction code consists of 1 or 2 bytes. Therefore, the instruction
map consists of multiple pages. Table B.9-2 to Table B.9-21 summarize the F2MC-16LX
instruction map.
■ Structure of Instruction Map
Figure B.9-1 Structure of Instruction Map
Basic page map
Bit operation
instructions
Character string
operation
instructions
2-byte
instructions
: Byte 1
ea instructions × 9 : Byte 2
An instruction such as the NOP instruction that ends in one byte is completed within the basic page. An
instruction such as the MOVS instruction that requires two bytes recognizes the existence of byte 2 when it
references byte 1, and can check the following one byte by referencing the map for byte 2. Figure B.9-2
shows the correspondence between an actual instruction code and instruction map.
530
APPENDIX
Figure B.9-2 Correspondence between Actual Instruction Code and Instruction Map
Some instructions do
not contain byte 2.
Instruction
code
Length varies
depending on the
instruction.
Byte 1
Byte 2
Operand
Operand
...
[Basic page map]
XY
+Z
[Extended page map]*
UV
+W
*: The extended page map is a generic name of maps for bit operation instructions, character
string operation instructions, 2-byte instructions, and ea instructions. Actually, there are
multiple extended page maps for each type of instructions.
An example of an instruction code is shown in Table B.9-1.
Table B.9-1 Example of an Instruction Code
Byte 1
(from basic page map)
Byte 2
(from extended page map)
NOP
00 +0=00
-
AND A, #8
30 +4=34
-
MOV A, ADB
60 +F=6F
00 +0=00
@RW2+d8, #8rel
70 +0=70
F0 +2=F2
Instruction
531
532
+F
+E
+D
+C
+B
+A
+9
+8
+7
+6
+5
+4
+3
+2
+1
+0
A
ZEXT
SWAP
ADDSP
DTB
ADB
SPB
#8
A, #8
dir, A
A, dir
io, A
A, io
JMP
BRA
60
MULU
DIVU
ea
@A instruction 2
A
MOVW
MOVX
RET
SP, A A, addr16
A0
B0
C0
ea
instruction 8
D0
E0
rel
rel
LSRW
ASRW
LSLW
SWAPW
ZEXTW
XORW
ORW
ANDW
ORW
PUSHW
POPW
A, #16
AH
AH
MOVW
ea, RWi
Bit operation MOV
A instruction
ea, Ri
MOVW
RWi, ea
PUSHW
POPW
2-byte
XCHW
A
rlst
rlst instruction
RWi, ea
Character
XORW
PUSHW
POPW
XCH
operation
A
A, #16
PS
PS string
Ri, ea
instruction
A
ANDW
PUSHW
POPW
A
A, #16
A
CMPW
MOVL
MOVW
RETI
A, #16
A, #32 addr16, A
ADDSP
MULUW
NOTW
A
#16
A
A
A
EXTW
A
BHI
BLS
BGT
BLE
rel
rel
rel
rel
rel
BGE
CMPL
CMPW
A, #32
NEGW
A
rel
rel
rel
rel
rel
rel
BLT
BT
BNV
BV
BP
BN
BNC/BHS
rel
BC/BL0
BNZ/BNE
rel
BZ/BEQ
MOV
MOV
CBNE A, CWBNE A, MOVW
MOVW
INTP
MOV
RP, #8
ILM, #8
#8, rel
#16, rel
A, #16 A,addr16
addr24
Ri, ea
#4
F0
rel
ADDW
MOVW
MOVW
INT
ea
MOVW
MOVW
MOVW
MOV A,
MOVW @R
A, #16
A, dir
A, io
#vct8 instruction 9
A, RWi
RWi, A RWi, #16 @RWi+d8
Wi+d8, A
NOT
ea
instruction 7
MOVX
MOVX
CALLP
ea
A, dir
A, io
addr24 instruction 6
MOVW
MOVW
RETP
A, #8
A, SP
io, #16
A, #8
90
BNT
SUBL
SUBW
A, #32
A
A
A
XOR
OR
OR
CCR, #8
80
ea
MOV
MOV
MOV
MOV
MOVX A, MOV
CALL
rel instruction 1
A, Ri
Ri, A
Ri, #8
A, Ri @RWi+d8
A, #4
70
MOV
JMP
ea
A, addr16
addr16 instruction 3
MOV
MOV
50
MOVX
MOV
JMPP
ea
A, #8
A, #8 addr16, A
adde24 instruction 4
MOV
MOV
MOV
40
SUBW
MOVW
MOVW
INT
MOVEA
A
A, #16
dir, A
io, A
addr16
RWi, ea
UNLINK
A
CMP
A
A, #8
A, #8
SUBC
SUB
ADD
30
AND
AND
MOV
MOV
CALL
ea
CCR, #8
A, #8
dir, #8
io, #8
addr16 instruction 5
CMP
A
A, dir
A, dir
ADDC
SUB
ADD
20
LINK
ADDL
ADDW
#imm8
A, #32
EXT
@A
PCB
A
JCTX
SUBDC
ADDDC
NEG
NCC
INT9
A
CMR
10
NOP
00
APPENDIX
Table B.9-2 Basic Page Map
+F
+E
+D
+C
+B
+A
+9
+8
+7
+6
+5
+4
+3
+2
+1
+0
10
MOVB
io:bp, A
20
30
CLRB
io:bp
40
50
SETB
io:bp
60
70
BBC
io;bp, rel
80
90
BBS
io:bp, rel
A0
B0
MOVB
MOVB A, MOVB
MOVB
CLRB
CLRB
SETB
SETB
BBC
BBC
BBS
BBS
A, dir:bp addr16:bp
dir:bp, A addr16:bp,A
dir:bp addr16:bp
dir:bp addr16:bp dir:bp, rel addr16:bp,rel dir:bp, rel addr16:bp,rel
MOVB
A, io:bp
00
WBTS
io:bp
C0
D0
WBTC
io:bp
E0
SBBS
addr16:bp
F0
APPENDIX
Table B.9-3 Bit Operation Instruction Map (First Byte = 6CH)
533
534
MOVSI
MOVSD
PCB, PCB
PCB, DTB
PCB, ADB
PCB, SPB
DTB, PCB
DTB, DTB
DTB, ADB
DTB, SPB
ADB, PCB
ADB, DTB
ADB, ADB
ADB, SPB
SPB, PCB
SPB, DTB
SPB, ADB
SPB, SPB
+1
+2
+3
+4
+5
+6
+7
+8
+9
+A
+B
+C
+D
+E
+F
10
+0
00
MOVSWI
20
MOVSWD
30
40
50
60
70
90
A0
B0
C0
SPB
ADB
DTB
SPB
ADB
DTB
SPB
ADB
DTB
SPB
ADB
DTB
SPB
ADB
DTB
SCEQI
SCEQD
SCWEQI SCWEQD FILSI
PCB
PCB
PCB
PCB
PCB
80
D0
FILSI
SPB
ADB
DTB
PCB
E0
F0
APPENDIX
Table B.9-4 Character String Operation Instruction Map (First Byte = 6EH)
LSLW
LSLL
LSL
MOVW
MOVW
A, R0
A, R0
A, R0 @RL2+d8, A A, @RL2+d8
MOVW
MOVW
NRML
A, @A @AL, AH
A, R0
ASRW
ASRL
ASR
MOVW
MOVW
A, R0
A, R0
A, R0 @RL3+d8, A A, @RL3+d8
LSRW
LSRL
LSR
A, R0
A, R0
A, R0
+D
+E
+F
MOVW
MOVW
@RL1+d8, A A, @RL1+d8
MOVW
MOVW
@RL0+d8, A A, @RL0+d8
+C
+B
+A
+9
+8
A
MOV
MOV
MOVX
MOV
MOV
A, PCB
A, @A A, @RL3+d8 @RL3+d8, A A, @RL3+d8
+6
ROLC
MOV
MOV
A, @A @AL, AH
+5
A
MOV
MOV
MOVX
MOV
MOV
A, DPR
DPR, A A, @RL2+d8 @RL2+d8, A A, @RL2+d8
+4
ROLC
MOV
MOV
A, USB
USB, A
+3
+7
MOV
MOV
MOVX
MOV
MOV
A, SSB
SSB, A A, @RL1+d8 @RL1+d8, A A, @RL1+d8
+2
40
MOV
MOV
A, ADB
ADB, A
30
+1
20
MOV
MOV
MOVX
MOV
MOV
A, DTB
DTB, A A, @RL0+d8 @RL0+d8, A A, @RL0+d8
10
+0
00
50
DIVU
MULW
MUL
60
A
A
A
70
80
90
A0
B0
C0
D0
E0
F0
APPENDIX
Table B.9-5 2-byte Instruction Map (First Byte = 6FH)
535
536
50
90
B0
D0
@RW1, @RW1+d16 CMPL
CMPL A, ANDL
ANDL A, ORL
ORL A,
XORL
XORL A,
#16, rel
#16, rel A,@RW1 @RW1+d16 A,@RW1 @RW1+d16 A,@RW1 @RW1+d16 A,@RW1 @RW1+d16
@RW2, @RW2+d16 CMPL
CMPL A, ANDL
ANDL A, ORL
ORL A,
XORL
XORL A,
#16, rel
#16, rel A,@RW2 @RW2+d16 A,@RW2 @RW2+d16 A,@RW2 @RW2+d16 A,@RW2 @RW2+d16
@RW3, @RW3+d16 CMPL
CMPL A, ANDL
ANDL A, ORL
ORL A,
XORL
XORL A,
#16, rel
#16, rel A,@RW3 @RW3+d16 A,@RW3 @RW3+d16 A,@RW3 @RW3+d16 A,@RW3 @RW3+d16
SUBL
SUBL A,
A, RL2 @RW5+d8
SUBL
SUBL A,
A, RL3 @RW6+d8
SUBL
SUBL A,
A, RL3 @RW7+d8
ADDL
ADDL A,
A, RL2 @RW5+d8
ADDL
ADDL A,
A, RL3 @RW6+d8
ADDL
ADDL A,
A, RL3 @RW7+d8
ADDL
ADDL A, SUBL
SUBL A,
A,@RW0 @RW0+d16 A,@RW0 @RW0+d16
ADDL
ADDL A, SUBL
SUBL A,
A,@RW1 @RW1+d16 A,@RW1 @RW1+d16
ADDL
ADDL A, SUBL
SUBL A,
A,@RW2 @RW2+d16 A,@RW2 @RW2+d16
ADDL
ADDL A, SUBL
SUBL A,
A,@RW3 @RW3+d16 A,@RW3 @RW3+d16
ADDL
ADDL A, SUBL
SUBL A, Use
@RW0+RW7 CMPL
CMPL A, ANDL
ANDL A, ORL
ORL A,
XORL
XORL A, Use
@RW0+RW7
A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 prohibited
#16, rel A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 prohibited
,#8, rel
ADDL
ADDL A, SUBL
SUBL A, Use
@RW1+RW7 CMPL
CMPL A, ANDL
ANDL A, ORL
ORL A,
XORL
XORL A, Use
@RW1+RW7
A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 prohibited
#16, rel A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 prohibited
,#8, rel
ADDL
ADDL A,
A,@RW2+ @PC+d16
ADDL
ADDL A, SUBL
SUBL A, Use
A,@RW3+
addr16 A,@RW3+
addr16 prohibited
+5
+6
+7
+8
+9
+A
+B
+C
+D
+E
+F
SUBL
SUBL A,
A,@RW2+ @PC+d16
@RW0, @RW0+d16 CMPL
CMPL A, ANDL
ANDL A, ORL
ORL A,
XORL
XORL A,
#16, rel
#16, rel A,@RW0 @RW0+d16 A,@RW0 @RW0+d16 A,@RW0 @RW0+d16 A,@RW0 @RW0+d16
SUBL
SUBL A,
A, RL2 @RW4+d8
Use
prohibited
ANDL
ANDL A,
A,@RW2+ @PC+d16
ANDL
ANDL A,
A, RL3 @RW7+d8
ANDL
ANDL A,
A, RL3 @RW6+d8
ANDL
ANDL A,
A, RL2 @RW5+d8
ANDL
ANDL A,
A, RL2 @RW4+d8
ORL
ORL A,
A,@RW2+ @PC+d16
ORL
ORL A,
A, RL3 @RW7+d8
ORL
ORL A,
A, RL3 @RW6+d8
ORL
ORL A,
A, RL2 @RW5+d8
ORL
ORL A,
A, RL2 @RW4+d8
XORL
XORL A,
A,@RW2+ @PC+d16
XORL
XORL A,
A, RL3 @RW7+d8
XORL
XORL A,
A, RL3 @RW6+d8
XORL
XORL A,
A, RL2 @RW5+d8
XORL
XORL A,
A, RL2 @RW4+d8
XORL
XORL A,
A, RL1 @RW3+d8
addr16,
,#8, rel
Use
@PC+d16,
prohibited
,#8, rel
@RW3, @RW3+d16
#8, rel
,#8, rel
@RW2, @RW2+d16
#8, rel
,#8, rel
@RW1, @RW1+d16
#8, rel
,#8, rel
@RW0, @RW0+d16
#8, rel
,#8, rel
R7, @RW7+d8,
#8, rel
#8, rel
R6, @RW6+d8,
#8, rel
#8, rel
R5, @RW5+d8,
#8, rel
#8, rel
R4, @RW4+d8,
#8, rel
#8, rel
R3, @RW3+d8,
#8, rel
#8, rel
addr16, CMPL
CMPL A, ANDL
ANDL A, ORL
ORL A,
XORL
XORL A, Use
#16, rel A,@RW3+
addr16 A,@RW3+
addr16 A,@RW3+
addr16 A,@RW3+
addr16 prohibited
@PC+d16, CMPL
CMPL A,
#16, rel A,@RW2+ @PC+d16
RW7, @RW7+d8 CMPL
CMPL A,
#16, rel
#16, rel
A, RL3 @RW7+d8
RW6, @RW6+d8 CMPL
CMPL A,
#16, rel
#16, rel
A, RL3 @RW6+d8
RW5, @RW5+d8 CMPL
CMPL A,
#16, rel
#16, rel
A, RL2 @RW5+d8
RW4, @RW4+d8 CMPL
CMPL A,
#16, rel
#16, rel
A, RL2 @RW4+d8
ORL
ORL A,
A, RL1 @RW3+d8
R2, @RW2+d8,
#8, rel
#8, rel
R1, @RW1+d8,
#8, rel
#8, rel
ADDL
ADDL A,
A, RL2 @RW4+d8
ANDL
ANDL A,
A, RL1 @RW3+d8
XORL
XORL A,
A, RL1 @RW2+d8
XORL
XORL A,
A, RL0 @RW1+d8
+4
RW3, @RW3+d8 CMPL
CMPL A,
#16, rel
#16, rel
A, RL1 @RW3+d8
ORL
ORL A,
A, RL1 @RW2+d8
ORL
ORL A,
A, RL0 @RW1+d8
SUBL
SUBL A,
A, RL1 @RW3+d8
ANDL
ANDL A,
A, RL1 @RW2+d8
ANDL
ANDL A,
A, RL0 @RW1+d8
ADDL
ADDL A,
A, RL1 @RW3+d8
RW2, @RW2+d8 CMPL
CMPL A,
#16, rel
#16, rel
A, RL1 @RW2+d8
RW1, @RW1+d8 CMPL
CMPL A,
#16, rel
#16, rel
A, RL0 @RW1+d8
+3
CBNE ↓
F0
R0, @RW0+d8,
#8, rel
#8, rel
CBNE ↓
E0
SUBL
SUBL A,
A, RL1 @RW2+d8
XORL
XORL A,
A, RL0 @RW0+d8
C0
ADDL
ADDL A,
A, RL1 @RW2+d8
ORL
ORL A,
A, RL0 @RW0+d8
A0
+2
ANDL
ANDL A,
A, RL0 @RW0+d8
80
SUBL
SUBL A,
A, RL0 @RW1+d8
70
ADDL
ADDL A,
A, RL0 @RW1+d8
60
RW0, @RW0+d8 CMPL
CMPL A,
#16, rel
#16, rel
A, RL0 @RW0+d8
CWBNE ↓ CWBNE ↓
40
+1
30
+0
20
SUBL
SUBL A,
A, RL0 @RW0+d8
10
ADDL
ADDL A,
A, RL0 @RW0+d8
00
APPENDIX
Table B.9-6 ea Instruction 1 (First Byte = 70H)
JMPP
JMPP
CALLP
CALLP
INCL
INCL
DECL
DECL
MOVL
MOVL A, MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@RL3 @@RW7+d8
@RL3 @@RW7+d8
RL3 @RW7+d8
RL3 @RW7+d8
A, RL3 @RW7+d8
RL3, A @RW7+d8,A
R7, #8 @RW7+d8,#8
A, RW7 @RW7+d8
JMPP
JMPP @
CALLP
CALLP @
INCL
INCL
DECL
DECL
MOVL
MOVL A,
MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@@RW0 @RW0+d16 @@RW0 @RW0+d16
@RW0 @RW0+d16
@RW0 @RW0+d16 A,@RW0 @RW0+d16 @RW0,A @RW0+d16,A @RW0, #8 @RW0+d16,#8
A,@RW0 @RW0+d16
JMPP
JMPP @
CALLP
CALLP @
INCL
INCL
DECL
DECL
MOVL
MOVL A,
MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@@RW1 @RW1+d16 @@RW1 @RW1+d16
@RW1 @RW1+d16
@RW1 @RW1+d16 A,@RW1 @RW1+d16 @RW1,A @RW1+d16,A @RW1, #8 @RW1+d16,#8
A,@RW1 @RW1+d16
JMPP
JMPP @
CALLP
CALLP @
INCL
INCL
DECL
DECL
MOVL
MOVL A,
MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@@RW2 @RW2+d16 @@RW2 @RW2+d16
@RW2 @RW2+d16
@RW2 @RW2+d16 A,@RW2 @RW2+d16 @RW2,A @RW2+d16,A @RW2, #8 @RW2+d16,#8
A,@RW2 @RW2+d16
JMPP
JMPP @
CALLP
CALLP @
INCL
INCL
DECL
DECL
MOVL
MOVL A,
MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@@RW3 @RW3+d16 @@RW3 @RW3+d16
@RW3 @RW3+d16
@RW3 @RW3+d16 A,@RW3 @RW3+d16 @RW3,A @RW3+d16,A @RW3, #8 @RW3+d16,#8
A,@RW3 @RW3+d16
JMPP
JMPP @
CALLP
CALLP @
INCL
INCL
DECL
DECL
MOVL
MOVL A,
MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@@RW0+ @RW0+RW7 @@RW0+ @RW0+RW7 @RW0+ @RW0+RW7 @RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 @RW0+,A @RW0+RW7,A @RW0+, #8 @RW0+RW7,#8 A,@RW0+ @RW0+RW7
JMPP
JMPP @
CALLP
CALLP @
INCL
INCL
DECL
DECL
MOVL
MOVL A,
MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@@RW1+ @RW1+RW7 @@RW1+ @RW1+RW7 @RW1+ @RW1+RW7 @RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 @RW1+,A @RW1+RW7,A @RW1+, #8 @RW1+RW7,#8 A,@RW1+ @RW1+RW7
JMPP
JMPP
CALLP
CALLP
INCL
INCL
DECL
DECL
MOVL
MOVL A, MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@@RW2+ @@PC+d16 @@RW2+ @@PC+d16
@RW2+ @PC+d16
@RW2+ @PC+d16 A,@RW2+ @PC+d16 @RW2+,A @PC+d16, A @RW2+, #8 @PC+d16, #8 A,@RW2+ @PC+d16
JMPP
JMPP
CALLP
CALLP
INCL
INCL
DECL
DECL
MOVL
MOVL A, MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@@RW3+ @addr16 @@RW3+ @addr16 @RW3+
addr16 @RW3+
addr16 A,@RW3+
addr16 @RW3+,A
addr16, A @RW3+, #8
addr16, #8 A,@RW3+
addr16
+8
+9
+A
+B
+C
+D
+E
+F
F0
+7
E0
JMPP
JMPP
CALLP
CALLP
INCL
INCL
DECL
DECL
MOVL
MOVL A, MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@RL3 @@RW6+d8
@RL3 @@RW6+d8
RL3 @RW6+d8
RL3 @RW6+d8
A, RL3 @RW6+d8
RL3, A @RW6+d8,A
R6, #8 @RW6+d8,#8
A, RW6 @RW6+d8
D0
+6
C0
JMPP
JMPP
CALLP
CALLP
INCL
INCL
DECL
DECL
MOVL
MOVL A, MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@RL2 @@RW5+d8
@RL2 @@RW5+d8
RL2 @RW5+d8
RL2 @RW5+d8
A, RL2 @RW5+d8
RL2, A @RW5+d8,A
R5, #8 @RW5+d8,#8
A, RW5 @RW5+d8
B0
+5
A0
JMPP
JMPP
CALLP
CALLP
INCL
INCL
DECL
DECL
MOVL
MOVL A, MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@RL2 @@RW4+d8
@RL2 @@RW4+d8
RL2 @RW4+d8
RL2 @RW4+d8
A, RL2 @RW4+d8
RL2, A @RW4+d8,A
R4, #8 @RW4+d8,#8
A, RW4 @RW4+d8
90
+4
80
JMPP
JMPP
CALLP
CALLP
INCL
INCL
DECL
DECL
MOVL
MOVL A, MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@RL1 @@RW3+d8
@RL1 @@RW3+d8
RL1 @RW3+d8
RL1 @RW3+d8
A, RL1 @RW3+d8
RL1, A @RW3+d8,A
R3, #8 @RW3+d8,#8
A, RW3 @RW3+d8
70
+3
60
JMPP
JMPP
CALLP
CALLP
INCL
INCL
DECL
DECL
MOVL
MOVL A, MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@RL1 @@RW2+d8
@RL1 @@RW2+d8
RL1 @RW2+d8
RL1 @RW2+d8
A, RL1 @RW2+d8
RL1, A @RW2+d8,A
R2, #8 @RW2+d8,#8
A, RW2 @RW2+d8
50
+2
40
JMPP
JMPP
CALLP
CALLP
INCL
INCL
DECL
DECL
MOVL
MOVL A, MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@RL0 @@RW1+d8
@RL0 @@RW1+d8
RL0 @RW1+d8
RL0 @RW1+d8
A, RL0 @RW1+d8
RL0, A @RW1+d8,A
R1, #8 @RW1+d8,#8
A, RW1 @RW1+d8
30
+1
20
JMPP
JMPP
CALLP
CALLP
INCL
INCL
DECL
DECL
MOVL
MOVL A, MOVL
MOVL
MOV
MOV
MOVEA
MOVEA A,
@RL0 @@RW0+d8
@RL0 @@RW0+d8
RL0 @RW0+d8
RL0 @RW0+d8
A, RL0 @RW0+d8
RL0, A @RW0+d8,A
R0, #8 @RW0+d8,#8
A, RW0 @RW0+d8
10
+0
00
APPENDIX
Table B.9-7 ea Instruction 2 (First Byte = 71H)
537
538
D0
E0
F0
ROLC
ROLC
RORC
RORC
INC
INC
DEC
DEC
MOV
MOV A,
MOV
MOV
MOVX
MOVX A,
XCH
XCH A,
@RW0+ @RW0+RW7
@RW0+ @RW0+RW7
@RW0+ @RW0+RW7
@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 @RW0+, A @RW0+RW7,A A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7
ROLC
ROLC
RORC
RORC
INC
INC
DEC
DEC
MOV
MOV A,
MOV
MOV
MOVX
MOVX A,
XCH
XCH A,
@RW1+ @RW1+RW7
@RW1+ @RW1+RW7
@RW1+ @RW1+RW7
@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 @RW1+, A @RW1+RW7,A A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7
ROLC
ROLC
RORC
RORC
INC
INC
DEC
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
@RW2+ @PC+d16
@RW2+ @PC+d16
@RW2+ @PC+d16
@RW2+ @PC+d16 A,@RW2+ @PC+d16 @RW2+, A @PC+d16, A A,@RW2+ @PC+d16 A,@RW2+ @PC+d16
ROLC
ROLC
RORC
RORC
INC
INC
DEC
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
@RW3+
addr16 @RW3+
addr16 @RW3+
addr16 @RW3+
addr16 A,@RW3+
addr16 @RW3+, A
addr16, A A,@RW3+
addr16 A,@RW3+
addr16
+D
+E
+F
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
R7 @RW7+d8
A, R7 @RW7+d8
R7, A @RW7+d8,A
A, R7 @RW7+d8
A, R7 @RW7+d8
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
R6 @RW6+d8
A, R6 @RW6+d8
R6, A @RW6+d8,A
A, R6 @RW6+d8
A, R6 @RW6+d8
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
R5 @RW5+d8
A, R5 @RW5+d8
R5, A @RW5+d8,A
A, R5 @RW5+d8
A, R5 @RW5+d8
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
R4 @RW4+d8
A, R4 @RW4+d8
R4, A @RW4+d8,A
A, R4 @RW4+d8
A, R4 @RW4+d8
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
R3 @RW3+d8
A, R3 @RW3+d8
R3, A @RW3+d8,A
A, R3 @RW3+d8
A, R3 @RW3+d8
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
R2 @RW2+d8
A, R2 @RW2+d8
R2, A @RW2+d8,A
A, R2 @RW2+d8
A, R2 @RW2+d8
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
R1 @RW1+d8
A, R1 @RW1+d8
R1, A @RW1+d8,A
A, R1 @RW1+d8
A, R1 @RW1+d8
+C
INC
DEC
R7 @RW7+d8
C0
ROLC
ROLC
RORC
RORC
INC
INC
DEC
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
@RW3 @RW3+d16
@RW3 @RW3+d16
@RW3 @RW3+d16
@RW3 @RW3+d16 A,@RW3 @RW3+d16 @RW3, A @RW3+d16,A
A,@RW3 @RW3+d16 A,@RW3 @RW3+d16
ROLC
RORC
RORC
INC
R7 @RW7+d8
R7 @RW7+d8
ROLC
INC
DEC
R6 @RW6+d8
B0
+B
ROLC
RORC
RORC
INC
R6 @RW6+d8
R6 @RW6+d8
ROLC
INC
DEC
R5 @RW5+d8
A0
ROLC
ROLC
RORC
RORC
INC
INC
DEC
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
@RW2 @RW2+d16
@RW2 @RW2+d16
@RW2 @RW2+d16
@RW2 @RW2+d16 A,@RW2 @RW2+d16 @RW2, A @RW2+d16,A
A,@RW2 @RW2+d16 A,@RW2 @RW2+d16
ROLC
RORC
RORC
INC
R5 @RW5+d8
R5 @RW5+d8
ROLC
INC
DEC
R4 @RW4+d8
90
+A
ROLC
RORC
RORC
INC
R4 @RW4+d8
R4 @RW4+d8
ROLC
INC
DEC
R3 @RW3+d8
INC
DEC
R2 @RW2+d8
INC
DEC
R1 @RW1+d8
80
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
R0 @RW0+d8
A, R0 @RW0+d8
R0, A @RW0+d8,A
A, R0 @RW0+d8
A, R0 @RW0+d8
70
ROLC
ROLC
RORC
RORC
INC
INC
DEC
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
@RW1 @RW1+d16
@RW1 @RW1+d16
@RW1 @RW1+d16
@RW1 @RW1+d16 A,@RW1 @RW1+d16 @RW1, A @RW1+d16,A
A,@RW1 @RW1+d16 A,@RW1 @RW1+d16
ROLC
RORC
RORC
INC
R3 @RW3+d8
R3 @RW3+d8
ROLC
60
INC
DEC
R0 @RW0+d8
50
+9
ROLC
RORC
RORC
INC
R2 @RW2+d8
R2 @RW2+d8
ROLC
40
ROLC
ROLC
RORC
RORC
INC
INC
DEC
DEC
MOV
MOV
A, MOV
MOV
MOVX
MOVX A, XCH
XCH
A,
@RW0 @RW0+d16
@RW0 @RW0+d16
@RW0 @RW0+d16
@RW0 @RW0+d16 A,@RW0 @RW0+d16 @RW0, A @RW0+d16,A
A,@RW0 @RW0+d16 A,@RW0 @RW0+d16
ROLC
RORC
RORC
INC
R1 @RW1+d8
R1 @RW1+d8
ROLC
30
ROLC
RORC
RORC
INC
R0 @RW0+d8
R0 @RW0+d8
20
ROLC
10
+8
+7
+6
+5
+4
+3
+2
+1
+0
00
APPENDIX
Table B.9-8 ea Instruction 3 (First Byte = 72H)
JMP
JMP @
CALL
CALL @
INCW
INCW @ DECW
DECW
MOVW
MOVW A, MOVW
MOVW
MOVW
MOVW
XCHW
XCHW A,
@@RW3 @RW3+d16 @@RW3 @RW3+d16 @RW3 @RW3+d16
@RW3 @RW3+d16 A,@RW3 @RW3+d16 @RW3, A @RW3+d16,A @RW3, #16 @RW3+d16,#16 A,@RW3 @RW3+d16
+B
JMP
JMP
CALL
CALL
INCW
INCW
DECW
DECW
MOVW
MOVW A, MOVW
MOVW
MOVW
MOVW
XCHW
XCHW A,
@@RW3+ @addr16 @@RW3+ @addr16 @RW3+
addr16 @RW3+
addr16 A,@RW3+
addr16 @RW3+, A
addr16, A @RW3+, #16
addr16, #16 A,@RW3+
addr16
INCW @
+F
INCW
JMP
JMP
CALL
CALL
INCW
INCW
DECW
DECW
MOVW
MOVW A, MOVW
MOVW
MOVW
MOVW
XCHW
XCHW A,
@@RW2+ @@PC+d16 @@RW2+ @@PC+d16 @RW2+ @@PC+d16
@RW2+ @PC+d16 A,@RW2+ @PC+d16 @RW2+, A @PC+d16, A @RW2+, #16 @PC+d16, #16 A,@RW2+ @PC+d16
CALL @
+E
CALL
DECW
DECW
MOVW
MOVW A,
MOVW
MOVW
MOVW
MOVW
XCHW
XCHW A,
@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 @RW1+, A @RW1+RW7,A @RW1+, #16 @RW1+RW7,#16 A,@RW1+ @RW1+RW7
XCHW
XCHW A,
A, RW7 @RW7+d8
XCHW
XCHW A,
A, RW6 @RW6+d8
XCHW
XCHW A,
A, RW5 @RW5+d8
+D @@RW1+ @RW1+RW7 @@RW1+ @RW1+RW7 @RW1+ @RW1+RW7
INCW @
MOVW
MOVW
RW7, #16 @RW7+d8,#16
MOVW
MOVW
RW6, #16 @RW6+d8,#16
MOVW
MOVW
RW5, #16 @RW5+d8,#16
XCHW
XCHW A,
A, RW4 @RW4+d8
DECW
DECW
MOVW
MOVW A,
MOVW
MOVW
MOVW
MOVW
XCHW
XCHW A,
@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 @RW0+, A @RW0+RW7,A @RW0+, #16 @RW0+RW7,#16 A,@RW0+ @RW0+RW7
INCW
INCW
INCW
DECW
DECW
MOVW
MOVW A, MOVW
MOVW
RW7 @RW7+d8
RW7 @RW7+d8
A, RW7 @RW7+d8
RW7, A @RW7+d8,A
INCW
INCW
DECW
DECW
MOVW
MOVW A, MOVW
MOVW
RW6 @RW6+d8
RW6 @RW6+d8
A, RW6 @RW6+d8
RW6, A @RW6+d8,A
INCW
INCW
DECW
DECW
MOVW
MOVW A, MOVW
MOVW
RW5 @RW5+d8
RW5 @RW5+d8
A, RW5 @RW5+d8
RW5, A @RW5+d8,A
MOVW
MOVW
RW4, #16 @RW4+d8,#16
+C @@RW0+ @RW0+RW7 @@RW0+ @RW0+RW7 @RW0+ @RW0+RW7
JMP @
JMP
JMP @
CALL
CALL @
INCW
INCW @ DECW
DECW
MOVW
MOVW A, MOVW
MOVW
MOVW
MOVW
XCHW
XCHW A,
@@RW2 @RW2+d16 @@RW2 @RW2+d16 @RW2 @RW2+d16
@RW2 @RW2+d16 A,@RW2 @RW2+d16 @RW2, A @RW2+d16,A @RW2, #16 @RW2+d16,#16 A,@RW2 @RW2+d16
+A
JMP
JMP
JMP @
CALL
CALL @
INCW
INCW @ DECW
DECW
MOVW
MOVW A, MOVW
MOVW
MOVW
MOVW
XCHW
XCHW A,
@@RW1 @RW1+d16 @@RW1 @RW1+d16 @RW1 @RW1+d16
@RW1 @RW1+d16 A,@RW1 @RW1+d16 @RW1, A @RW1+d16,A @RW1, #16 @RW1+d16,#16 A,@RW1 @RW1+d16
+9
CALL @
JMP
JMP @
CALL
CALL @
INCW
INCW @ DECW
DECW
MOVW
MOVW A, MOVW
MOVW
MOVW
MOVW
XCHW
XCHW A,
@@RW0 @RW0+d16 @@RW0 @RW0+d16 @RW0 @RW0+d16
@RW0 @RW0+d16 A,@RW0 @RW0+d16 @RW0,A @RW0+d16,A @RW0, #16 @RW0+d16,#16 A,@RW0 @RW0+d16
+8
CALL
CALL
CALL
RW7 @@RW7+d8
JMP
JMP
@RW7 @@RW7+d8
+7
JMP @
CALL
CALL
RW6 @@RW6+d8
JMP
JMP
@RW6 @@RW6+d8
+6
JMP
CALL
CALL
RW5 @@RW5+d8
JMP
JMP
@RW5 @@RW5+d8
+5
INCW
INCW
DECW
DECW
MOVW
MOVW A, MOVW
MOVW
RW4 @RW4+d8
RW4 @RW4+d8
A, RW4 @RW4+d8
RW4, A @RW4+d8,A
XCHW
XCHW A,
A, RW3 @RW3+d8
XCHW
XCHW A,
A, RW2 @RW2+d8
XCHW
XCHW A,
A, RW1 @RW1+d8
CALL
CALL
RW4 @@RW4+d8
MOVW
MOVW
RW3, #16 @RW3+d8,#16
MOVW
MOVW
RW2, #16 @RW2+d8,#16
MOVW
MOVW
RW1, #16 @RW1+d8,#16
JMP
JMP
@RW4 @@RW4+d8
INCW
INCW
DECW
DECW
MOVW
MOVW A, MOVW
MOVW
RW3 @RW3+d8
RW3 @RW3+d8
A, RW3 @RW3+d8
RW3, A @RW3+d8,A
INCW
INCW
DECW
DECW
MOVW
MOVW A, MOVW
MOVW
RW2 @RW2+d8
RW2 @RW2+d8
A, RW2 @RW2+d8
RW2, A @RW2+d8,A
INCW
INCW
DECW
DECW
MOVW
MOVW A, MOVW
MOVW
RW1 @RW1+d8
RW1 @RW1+d8
A, RW1 @RW1+d8
RW1, A @RW1+d8,A
+4
F0
XCHW
XCHW A,
A, RW0 @RW0+d8
E0
CALL
CALL
RW3 @@RW3+d8
D0
MOVW
MOVW
RW0, #16 @RW0+d8,#16
C0
JMP
JMP
@RW3 @@RW3+d8
B0
+3
A0
CALL
CALL
RW2 @@RW2+d8
90
JMP
JMP
@RW2 @@RW2+d8
80
+2
70
CALL
CALL
RW1 @@RW1+d8
60
JMP
JMP
@RW1 @@RW1+d8
50
INCW
INCW
DECW
DECW
MOVW
MOVW A, MOVW
MOVW
RW0 @RW0+d8
RW0 @RW0+d8
A, RW0 @RW0+d8
RW0, A @RW0+d8,A
40
+1
30
CALL
CALL
RW0 @@RW0+d8
20
JMP
JMP
@RW0 @@RW0+d8
10
+0
00
APPENDIX
Table B.9-9 ea Instruction 4 (First Byte = 73H)
539
540
ADD
A, SUB
SUB
SUB
ADDC
A, ADDC
A,
ADDC
ADDC A,
A, CMP
CMP
CMP
CMP
A,
A,
A, AND
AND
AND
AND
AND
AND
A,
A,
A, OR
OR
A, XOR
XOR
A, DBNZ
DBNZ @
A,@RW2+ @PC+d16, A,@RW2+ @PC+d16 @RW2+, r PC+d16, r
+F A,@RW3+
ADD
ADD
SUB
SUB
ADDC
ADDC
CMP
CMP
AND
AND
OR
OR
XOR
XOR
DBNZ
DBNZ
A, addr16 A,@RW3+ A, addr16 A,@RW3+ A, addr16 A,@RW3+ A, addr16 A,@RW3+ A, addr16 A,@RW3+
A, addr16 A,@RW3+ A, addr16 @RW3+, r
addr16, r
+E A,@RW2+ @PC+d16 A,@RW2+ @PC+d16 A,@RW2+ @PC+d16 A,@RW2+ @PC+d16 A,@RW2+ @PC+d16
ADD
SUB
CMP
XOR
XOR A,
DBNZ
DBNZ @R
A,@RW1+ @RW1+RW7 @RW1+, r W1+RW7, r
A,
CMP
OR
OR
A,
A,@RW1+ @RW1+RW7
ADD
ADD
ADDC A,
+D A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7
ADDC
XOR
XOR A,
DBNZ
DBNZ @R
A,@RW0+ @RW0+RW7 @RW0+, r W0+RW7, r
A,
OR
OR
A,
A,@RW0+ @RW0+RW7
SUB
+C A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7
SUB
XOR
XOR
A, DBNZ
DBNZ @R
A,@RW3 @RW3+d16 @RW3, r W3+d16, r
ADD
ADD
A, SUB
SUB
A, ADDC
ADDC A, CMP
CMP
A, AND
AND
A, OR
OR
A,
A,@RW3 @RW3+d16 A,@RW3 @RW3+d16 A,@RW3 @RW3+d16 A,@RW3 @RW3+d16 A,@RW3 @RW3+d16 A,@RW3 @RW3+d16
+B
A,
XOR
XOR
A, DBNZ
DBNZ @R
A,@RW2 @RW2+d16 @RW2, r W2+d16, r
ADD
ADD
A, SUB
SUB
A, ADDC
ADDC A, CMP
CMP
A, AND
AND
A, OR
OR
A,
A,@RW2 @RW2+d16 A,@RW2 @RW2+d16 A,@RW2 @RW2+d16 A,@RW2 @RW2+d16 A,@RW2 @RW2+d16 A,@RW2 @RW2+d16
+A
ADD
XOR
XOR
A, DBNZ
DBNZ @R
A,@RW1 @RW1+d16 @RW1, r W1+d16, r
ADD
ADD
A, SUB
SUB
A, ADDC
ADDC A, CMP
CMP
A, AND
AND
A, OR
OR
A,
A,@RW1 @RW1+d16 A,@RW1 @RW1+d16 A,@RW1 @RW1+d16 A,@RW1 @RW1+d16 A,@RW1 @RW1+d16 A,@RW1 @RW1+d16
+9
ADD
XOR
XOR
A, DBNZ
DBNZ @R
A,@RW0 @RW0+d16 @RW0, r W0+d16, r
ADD
ADD
A, SUB
SUB
A, ADDC
ADDC A, CMP
CMP
A, AND
AND
A, OR
OR
A,
A,@RW0 @RW0+d16 A,@RW0 @RW0+d16 A,@RW0 @RW0+d16 A,@RW0 @RW0+d16 A,@RW0 @RW0+d16 A,@RW0 @RW0+d16
ADD
A, SUB
SUB
A, ADDC
ADDC A, CMP
CMP
A, AND
AND
A, OR
OR
A, XOR
XOR
A, DBNZ
DBNZ @
A, R7 @RW7+d8
A, R7 @RW7+d8
A, R7 @RW7+d8
A, R7 @RW7+d8
A, R7 @RW7+d8
A, R7 @RW7+d8
A, R7 @RW7+d8
R7, r RW7+d8, r
ADD
F0
ADD
A, SUB
SUB
A, ADDC
ADDC A, CMP
CMP
A, AND
AND
A, OR
OR
A, XOR
XOR
A, DBNZ
DBNZ @
A, R6 @RW6+d8
A, R6 @RW6+d8
A, R6 @RW6+d8
A, R6 @RW6+d8
A, R6 @RW6+d8
A, R6 @RW6+d8
A, R6 @RW6+d8
R6, r RW6+d8, r
E0
ADD
D0
ADD
A, SUB
SUB
A, ADDC
ADDC A, CMP
CMP
A, AND
AND
A, OR
OR
A, XOR
XOR
A, DBNZ
DBNZ @
A, R5 @RW5+d8
A, R5 @RW5+d8
A, R5 @RW5+d8
A, R5 @RW5+d8
A, R5 @RW5+d8
A, R5 @RW5+d8
A, R5 @RW5+d8
R5, r RW5+d8, r
C0
ADD
B0
ADD
A, SUB
SUB
A, ADDC
ADDC A, CMP
CMP
A, AND
AND
A, OR
OR
A, XOR
XOR
A, DBNZ
DBNZ @
A, R4 @RW4+d8
A, R4 @RW4+d8
A, R4 @RW4+d8
A, R4 @RW4+d8
A, R4 @RW4+d8
A, R4 @RW4+d8
A, R4 @RW4+d8
R4, r RW4+d8, r
A0
ADD
90
ADD
A, SUB
SUB
A, ADDC
ADDC A, CMP
CMP
A, AND
AND
A, OR
OR
A, XOR
XOR
A, DBNZ
DBNZ @
A, R3 @RW3+d8
A, R3 @RW3+d8
A, R3 @RW3+d8
A, R3 @RW3+d8
A, R3 @RW3+d8
A, R3 @RW3+d8
A, R3 @RW3+d8
R3, r RW3+d8, r
80
ADD
70
ADD
A, SUB
SUB
A, ADDC
ADDC A, CMP
CMP
A, AND
AND
A, OR
OR
A, XOR
XOR
A, DBNZ
DBNZ @
A, R2 @RW2+d8
A, R2 @RW2+d8
A, R2 @RW2+d8
A, R2 @RW2+d8
A, R2 @RW2+d8
A, R2 @RW2+d8
A, R2 @RW2+d8
R2, r RW2+d8, r
60
ADD
50
ADD
A, SUB
SUB
A, ADDC
ADDC A, CMP
CMP
A, AND
AND
A, OR
OR
A, XOR
XOR
A, DBNZ
DBNZ @
A, R1 @RW1+d8
A, R1 @RW1+d8
A, R1 @RW1+d8
A, R1 @RW1+d8
A, R1 @RW1+d8
A, R1 @RW1+d8
A, R1 @RW1+d8
R1, r RW1+d8, r
40
ADD
30
ADD
A, SUB
SUB
A, ADDC
ADDC A, CMP
CMP
A, AND
AND
A, OR
OR
A, XOR
XOR
A, DBNZ
DBNZ @
A, R0 @RW0+d8
A, R0 @RW0+d8
A, R0 @RW0+d8
A, R0 @RW0+d8
A, R0 @RW0+d8
A, R0 @RW0+d8
A, R0 @RW0+d8
R0, r RW0+d8, r
20
ADD
10
+8
+7
+6
+5
+4
+3
+2
+1
+0
00
APPENDIX
Table B.9-10 ea Instruction 5 (First Byte = 74H)
NOT
NOT
R2 @RW2+d8
SUB
SUB
SUB
SUB
ADD
SUB
SUB
@RW1+RW7,A @RW1+, A @RW1+RW7,A
ADD @R
@RW0+RW7,A @RW0+, A @RW0+RW7,A
ADD @R
+F
ADD
ADD
@RW3+, A addr16, A
SUB
SUB
@RW3+, A addr16, A
+E @RW2+, A @PC+d16,A @RW2+, A @PC+d16,A
ADD
+D @RW1+, A
ADD
+C @RW0+, A
ADD
NOT
NOT
@RW1+ @RW1+RW7
NOT
NOT
@RW0+ @RW0+RW7
SUBC
SUBC A, NEG
NEG A,
AND
AND
A,@RW3+
addr16 @RW3+
addr16 @RW3+, A addr16, A
OR
OR
@RW3+, A addr16, A
XOR
XOR
@RW3+, A addr16, A
NOT
NOT
@RW3+
addr16
SUBC
SUBC A, NEG
NEG A,
AND
AND
OR
OR
XOR
XOR
NOT
NOT
A,@RW2+ @PC+d16
@RW2+ @PC+d16 @RW2+, A @PC+d16,A @RW2+, A @PC+d16,A @RW2+, A @PC+d16,A @RW2+ @PC+d16
SUBC
SUBC A,
NEG
NEG A,
AND
AND
OR
OR
XOR
XOR
A,@RW1+ @RW1+RW7 @RW1+ @RW1+RW7 @RW1+, A @RW1+RW7,A @RW1+, A @RW1+RW7,A @RW1+, A @RW1+RW7,A
SUBC
SUBC A,
NEG
NEG A,
AND
AND
OR
OR
XOR
XOR
A,@RW0+ @RW0+RW7 @RW0+ @RW0+RW7 @RW0+, A @RW0+RW7,A @RW0+, A @RW0+RW7,A @RW0+, A @RW0+RW7,A
NOT
NOT
@RW3 @RW3+d16
ADD
ADD @R
SUB
SUB
SUBC
SUBC A, NEG
NEG A,
AND
AND
OR
OR
XOR
XOR
@RW3, A @RW3+d16,A @RW3, A @RW3+d16,A A, @RW3 @RW3+d16
@RW3 @RW3+d16 @RW3, A @RW3+d16,A @RW3, A @RW3+d16,A @RW3, A @RW3+d16,A
+B
XOR
NOT
NOT
R7, A @RW7+d8, A
R7 @RW7+d8
XOR
NOT
NOT
R6, A @RW6+d8, A
R6 @RW6+d8
XOR
NOT
NOT
R5, A @RW5+d8, A
R5 @RW5+d8
XOR
NOT
NOT
R4, A @RW4+d8, A
R4 @RW4+d8
XOR
NOT
NOT
R3, A @RW3+d8, A
R3 @RW3+d8
XOR
R2, A @RW2+d8,A
XOR
NOT
NOT
R1, A @RW1+d8, A
R1 @RW1+d8
NOT
NOT
@RW2 @RW2+d16
XOR
F0
ADD
ADD @R
SUB
SUB
SUBC
SUBC A, NEG
NEG A,
AND
AND
OR
OR
XOR
XOR
@RW2, A @RW2+d16,A @RW2, A @RW2+d16,A A, @RW2 @RW2+d16
@RW2 @RW2+d16 @RW2, A @RW2+d16,A @RW2, A @RW2+d16,A @RW2, A @RW2+d16,A
NEG A,
AND
AND
OR
OR
R7 @RW7+d8
R7, A @RW7+d8, A
R7, A @RW7+d8, A
XOR
XOR
XOR
XOR
XOR
XOR
E0
XOR
NOT
NOT
R0, A @RW0+d8, A
R0 @RW0+d8
D0
+A
ADD
SUB
SUB
SUBC
SUBC A, NEG
R7, A @RW7+d8, A
R7, A @RW7+d8, A
A, R7 @RW7+d8
ADD
NEG A,
AND
AND
OR
OR
R6 @RW6+d8
R6, A @RW6+d8, A
R6, A @RW6+d8, A
NEG A,
AND
AND
OR
OR
R5 @RW5+d8
R5, A @RW5+d8, A
R5, A @RW5+d8, A
NEG A,
AND
AND
OR
OR
R4 @RW4+d8
R4, A @RW4+d8, A
R4, A @RW4+d8, A
NEG A,
AND
AND
OR
OR
R3 @RW3+d8
R3, A @RW3+d8, A
R3, A @RW3+d8, A
NEG A,
AND
AND
OR
OR
R2 @RW2+d8
R2, A @RW2+d8,A
R2, A @RW2+d8,A
NEG A,
AND
AND
OR
OR
R1 @RW1+d8
R1, A @RW1+d8, A
R1, A @RW1+d8, A
XOR
C0
NOT
NOT
@RW1 @RW1+d16
ADD
SUB
SUB
SUBC
SUBC A, NEG
R6, A @RW6+d8, A
R6, A @RW6+d8, A
A, R6 @RW6+d8
ADD
B0
ADD
ADD @R
SUB
SUB
SUBC
SUBC A, NEG
NEG A,
AND
AND
OR
OR
XOR
XOR
@RW1, A @RW1+d16,A @RW1, A @RW1+d16,A A, @RW1 @RW1+d16
@RW1 @RW1+d16 @RW1, A @RW1+d16,A @RW1, A @RW1+d16,A @RW1, A @RW1+d16,A
ADD
SUB
SUB
SUBC
SUBC A, NEG
R5, A @RW5+d8, A
R5, A @RW5+d8, A
A, R5 @RW5+d8
ADD
A0
+9
ADD
SUB
SUB
SUBC
SUBC A, NEG
R4, A @RW4+d8, A
R4, A @RW4+d8, A
A, R4 @RW4+d8
ADD
90
NOT
NOT
@RW0 @RW0+d16
ADD
SUB
SUB
SUBC
SUBC A, NEG
R3, A @RW3+d8, A
R3, A @RW3+d8, A
A, R3 @RW3+d8
ADD
80
NEG A,
AND
AND
OR
OR
R0 @RW0+d8
R0, A @RW0+d8, A
R0, A @RW0+d8, A
70
ADD
ADD
SUB
SUB
SUBC
SUBC A, NEG
NEG A,
AND
AND
OR
OR
XOR
XOR
@RW0, A @RW0+d16,A @RW0, A @RW0+d16,A A, @RW0 @RW0+d16
@RW0 @RW0+d16 @RW0, A @RW0+d16,A @RW0, A @RW0+d16,A @RW0, A @RW0+d16,A
ADD
SUB
SUB
SUBC
SUBC A, NEG
R2, A @RW2+d8,A
R2, A @RW2+d8,A
A, R2 @RW2+d8
60
ADD
50
ADD
SUB
SUB
SUBC
SUBC A, NEG
R1, A @RW1+d8, A
R1, A @RW1+d8, A
A, R1 @RW1+d8
40
ADD
30
ADD
SUB
SUB
SUBC
SUBC A, NEG
R0, A @RW0+d8, A
R0, A @RW0+d8, A
A, R0 @RW0+d8
20
ADD
10
+8
+7
+6
+5
+4
+3
+2
+1
+0
00
APPENDIX
Table B.9-11 ea Instruction 6 (First Byte = 75H)
541
542
ADDW A, SUBW
ADDW
ADDCW
CMPW
ADDCW A, CMPW
ADDCW A,
ANDW
CMPW A, ANDW
CMPW A,
ORW
ORW
ANDW A, ORW
ANDW A,
ANDW A,
ORW
ORW
ORW
A,
A,
A, XORW
XORW A, DWBNZ
DWBNZ
+F A,@RW3+
ADDW
ADDW A, SUBW
SUBW A, ADDCW
ADDCW A, CMPW
CMPW A, ANDW
ANDW A, ORW
ORW
A, XORW
XORW A, DWBNZ
DWBNZ
addr 16 A,@RW3+ addr 16
A,@RW3+
addr 16 A,@RW3+
addr 16 A,@RW3+
addr 16 A,@RW3+
addr r16 A,@RW3+
addr 16 @RW3+, r addr r16, r
+E A,@RW2+ @PC+d16 A,@RW2+ @PC+d16 A,@RW2+ @PC+d16 A,@RW2+ @PC+d16 A,@RW2+ @PC+d16 A,@RW2+ @PC+d16, A,@RW2+ @PC+d16 @RW2+, r @PC+d16,r
SUBW A, ADDCW
SUBW A,
ANDW
XORW
XORW A,
DWBNZ
DWBNZ
A,@RW1+ @RW1+RW7 @RW1+, r @RW1+RW7,r
SUBW
ADDW A,
ADDW
CMPW A,
+D A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7
CMPW
XORW
XORW A,
DWBNZ
DWBNZ
A,@RW0+ @RW0+RW7 @RW0+, r @RW0+RW7,r
ADDCW A,
+C A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7
ADDCW
XORW
XORW A, DWBNZ
DWBNZ
A,@RW3 @RW3+d16 @RW3, r @RW3+d16,r
ADDW
ADDW A, SUBW
SUBW A, ADDCW
ADDCW A, CMPW
CMPW A, ANDW
ANDW A, ORW
ORW
A,
A,@RW3 @RW3+d16 A,@RW3 @RW3+d16 A,@RW3 @RW3+d16 A,@RW3 @RW3+d16 A,@RW3 @RW3+d16 A,@RW3 @RW3+d16
+B
SUBW A,
XORW
XORW A, DWBNZ
DWBNZ
A,@RW2 @RW2+d16 @RW2, r @RW2+d16,r
ADDW
ADDW A, SUBW
SUBW A, ADDCW
ADDCW A, CMPW
CMPW A, ANDW
ANDW A, ORW
ORW
A,
A,@RW2 @RW2+d16 A,@RW2 @RW2+d16 A,@RW2 @RW2+d16 A,@RW2 @RW2+d16 A,@RW2 @RW2+d16 A,@RW2 @RW2+d16
+A
SUBW
XORW
XORW A, DWBNZ
DWBNZ
A,@RW1 @RW1+d16 @RW1, r @RW1+d16,r
ADDW
ADDW A, SUBW
SUBW A, ADDCW
ADDCW A, CMPW
CMPW A, ANDW
ANDW A, ORW
ORW
A,
A,@RW1 @RW1+d16 A,@RW1 @RW1+d16 A,@RW1 @RW1+d16 A,@RW1 @RW1+d16 A,@RW1 @RW1+d16 A,@RW1 @RW1+d16
+9
ADDW A,
XORW
XORW A, DWBNZ
DWBNZ
A,@RW0 @RW0+d16 @RW0, r @RW0+d16,r
ADDW
ADDW A, SUBW
SUBW A, ADDCW
ADDCW A, CMPW
CMPW A, ANDW
ANDW A, ORW
ORW
A,
A,@RW0 @RW0+d16 A,@RW0 @RW0+d16 A,@RW0 @RW0+d16 A,@RW0 @RW0+d16 A,@RW0 @RW0+d16 A,@RW0 @RW0+d16
+8
ADDW
ADDW
ADDW A, SUBW
SUBW A, ADDCW
ADDCW A, CMPW
CMPW A, ANDW
ANDW A, ORW
ORW
A, XORW
XORW A, DWBNZ
DWBNZ
A, RW7 @RW7+d8
A, RW7 @RW7+d8
A, RW7 @RW7+d8
A, RW7 @RW7+d8
A, RW7 @RW7+d8
A, RW7 @RW7+d8
A, RW7 @RW7+d8
RW7, r @RW7+d8,r
F0
+7
E0
ADDW
ADDW A, SUBW
SUBW A, ADDCW
ADDCW A, CMPW
CMPW A, ANDW
ANDW A, ORW
ORW
A, XORW
XORW A, DWBNZ
DWBNZ
A, RW6 @RW6+d8
A, RW6 @RW6+d8
A, RW6 @RW6+d8
A, RW6 @RW6+d8
A, RW6 @RW6+d8
A, RW6 @RW6+d8
A, RW6 @RW6+d8
RW6, r @RW6+d8,r
D0
+6
C0
ADDW
ADDW A, SUBW
SUBW A, ADDCW
ADDCW A, CMPW
CMPW A, ANDW
ANDW A, ORW
ORW
A, XORW
XORW A, DWBNZ
DWBNZ
A, RW5 @RW5+d8
A, RW5 @RW5+d8
A, RW5 @RW5+d8
A, RW5 @RW5+d8
A, RW5 @RW5+d8
A, RW5 @RW5+d8
A, RW5 @RW5+d8
RW5, r @RW5+d8,r
B0
+5
A0
ADDW
ADDW A, SUBW
SUBW A, ADDCW
ADDCW A, CMPW
CMPW A, ANDW
ANDW A, ORW
ORW
A, XORW
XORW A, DWBNZ
DWBNZ
A, RW4 @RW4+d8
A, RW4 @RW4+d8
A, RW4 @RW4+d8
A, RW4 @RW4+d8
A, RW4 @RW4+d8
A, RW4 @RW4+d8
A, RW4 @RW4+d8
RW4, r @RW4+d8,r
90
+4
80
ADDW
ADDW A, SUBW
SUBW A, ADDCW
ADDCW A, CMPW
CMPW A, ANDW
ANDW A, ORW
ORW
A, XORW
XORW A, DWBNZ
DWBNZ
A, RW3 @RW3+d8
A, RW3 @RW3+d8
A, RW3 @RW3+d8
A, RW3 @RW3+d8
A, RW3 @RW3+d8
A, RW3 @RW3+d8
A, RW3 @RW3+d8
RW3, r @RW3+d8,r
70
+3
60
ADDW
ADDW A, SUBW
SUBW A, ADDCW
ADDCW A, CMPW
CMPW A, ANDW
ANDW A, ORW
ORW
A, XORW
XORW A, DWBNZ
DWBNZ
A, RW2 @RW2+d8
A, RW2 @RW2+d8
A, RW2 @RW2+d8
A, RW2 @RW2+d8
A, RW2 @RW2+d8
A, RW2 @RW2+d8
A, RW2 @RW2+d8
RW2, r @RW2+d8,r
50
+2
40
ADDW
ADDW A, SUBW
SUBW A, ADDCW
ADDCW A, CMPW
CMPW A, ANDW
ANDW A, ORW
ORW
A, XORW
XORW A, DWBNZ
DWBNZ
A, RW1 @RW1+d8
A, RW1 @RW1+d8
A, RW1 @RW1+d8
A, RW1 @RW1+d8
A, RW1 @RW1+d8
A, RW1 @RW1+d8
A, RW1 @RW1+d8
RW1, r @RW1+d8,r
30
+1
20
ADDW
ADDW A, SUBW
SUBW A, ADDCW
ADDCW A, CMPW
CMPW A, ANDW
ANDW A, ORW
ORW
A, XORW
XORW A, DWBNZ
DWBNZ
A, RW0 @RW0+d8
A, RW0 @RW0+d8
A, RW0 @RW0+d8
A, RW0 @RW0+d8
A, RW0 @RW0+d8
A, RW0 @RW0+d8
A, RW0 @RW0+d8
RW0, r @RW0+d8,r
10
+0
00
APPENDIX
Table B.9-12 ea Instruction 7 (First Byte = 76H)
NEGW
NEGW
ANDW
ANDW
ORW
ORW
XORW
XORW
NOTW
NOTW
@RW3 @RW3+d16 @RW3, A @RW3+d16,A @RW3, A @RW3+d16,A @RW3, A @RW3+d16,A
@RW3 @RW3+d16
SUBW
SUBW
@RW3+, A addr16, A
ADDW
ADDW
@RW3+, A addr16, A
+F
SUBCW
SUBCW A, NEGW
NEGW
ANDW
ANDW
A,@RW3+
addr16 @RW3+
addr16 @RW3+, A addr16, A
ORW
ORW
@RW3+, A addr16, A
XORW
XORW
@RW3+, A addr16, A
NOTW
NOTW
@RW3+
addr16
SUBCW
SUBCW A, NEGW
NEGW
ANDW
ANDW
ORW
ORW
XORW
XORW
NOTW
NOTW
A,@RW2+ @PC+d16
@RW2+ @PC+d16 @RW2+, A @PC+d16,A @RW2+, A @PC+d16,A @RW2+, A @PC+d16,A
@RW2+ @PC+d16
SUBW
SUBW
@RW2+, A @PC+d16,A
ADDW
ADDW
@RW2+, A @PC+d16,A
+E
SUBCW A,
ADDW
ADDW
SUBW
SUBW
SUBCW
SUBCW A,
NEGW
NEGW
ANDW
ANDW
ORW
ORW
XORW
XORW
NOTW
NOTW
@RW1+, A @RW1+RW7,A @RW1+, A @RW1+RW7,A A,@RW1+ @RW1+RW7 @RW1+ @RW1+RW7 @RW1+, A @RW1+RW7,A @RW1+, A @RW1+RW7,A @RW1+, A @RW1+RW7,A @RW1+ @RW1+RW7
SUBCW
+D
SUBW
SUBCW A,
ADDW
ADDW
SUBW
SUBW
SUBCW
SUBCW A,
NEGW
NEGW
ANDW
ANDW
ORW
ORW
XORW
XORW
NOTW
NOTW
@RW0+, A @RW0+RW7,A @RW0+, A @RW0+RW7,A A,@RW0+ @RW0+RW7 @RW0+ @RW0+RW7 @RW0+, A @RW0+RW7,A @RW0+, A @RW0+RW7,A @RW0+, A @RW0+RW7,A @RW0+ @RW0+RW7
SUBW
SUBCW
+C
ADDW
ADDW
SUBW
SUBCW A,
+B @RW3, A @RW3+d16,A @RW3, A @RW3+d16,A A, @RW3 @RW3+d16
SUBW
SUBCW
NEGW
NEGW
ANDW
ANDW
ORW
ORW
XORW
XORW
NOTW
NOTW
@RW2 @RW2+d16 @RW2, A @RW2+d16,A @RW2, A @RW2+d16,A @RW2, A @RW2+d16,A
@RW2 @RW2+d16
ADDW
ADDW
SUBW
+A @RW2, A @RW2+d16,A @RW2, A @RW2+d16,A A, @RW2 @RW2+d16
SUBW
NEGW
NEGW
ANDW
ANDW
ORW
ORW
XORW
XORW
NOTW
NOTW
@RW1 @RW1+d16 @RW1, A @RW1+d16,A @RW1, A @RW1+d16,A @RW1, A @RW1+d16,A
@RW1 @RW1+d16
ADDW
ADDW
SUBCW A,
+9 @RW1, A @RW1+d16,A @RW1, A @RW1+d16,A A, @RW1 @RW1+d16
SUBCW
NEGW
NEGW
ANDW
ANDW
ORW
ORW
XORW
XORW
NOTW
NOTW
@RW0 @RW0+d16 @RW0, A @RW0+d16,A @RW0, A @RW0+d16,A @RW0, A @RW0+d16,A
@RW0 @RW0+d16
SUBW
NOTW
NOTW
RW7 @RW7+d8
NOTW
NOTW
RW6 @RW6+d8
NOTW
NOTW
RW5 @RW5+d8
+8 @RW0, A @RW0+d16,A @RW0, A @RW0+d16,A A, @RW0 @RW0+d16
SUBW
XORW
XORW
RW7, A @RW7+d8, A
ADDW
ADDW
SUBW
SUBW
SUBCW SUBCW A, NEGW
NEGW
ANDW
ANDW
ORW
ORW
RW7, A @RW7+d8, A
RW7, A @RW7+d8, A
A, RW7 @RW7+d8
RW7 @RW7+d8
RW7, A @RW7+d8, A
RW7, A @RW7+d8, A
+7
ADDW
XORW
XORW
RW6, A @RW6+d8, A
ADDW
ADDW
SUBW
SUBW
SUBCW SUBCW A, NEGW
NEGW
ANDW
ANDW
ORW
ORW
RW6, A @RW6+d8, A
RW6, A @RW6+d8, A
A, RW6 @RW6+d8
RW6 @RW6+d8
RW6, A @RW6+d8, A
RW6, A @RW6+d8, A
+6
ADDW
XORW
XORW
RW5, A @RW5+d8, A
ADDW
ADDW
SUBW
SUBW
SUBCW SUBCW A, NEGW
NEGW
ANDW
ANDW
ORW
ORW
RW5, A @RW5+d8, A
RW5, A @RW5+d8, A
A, RW5 @RW5+d8
RW5 @RW5+d8
RW5, A @RW5+d8, A
RW5, A @RW5+d8, A
+5
NOTW
NOTW
RW4 @RW4+d8
XORW
XORW
RW4, A @RW4+d8, A
ADDW
ADDW
SUBW
SUBW
SUBCW SUBCW A, NEGW
NEGW
ANDW
ANDW
ORW
ORW
RW4, A @RW4+d8, A
RW4, A @RW4+d8, A
A, RW4 @RW4+d8
RW4 @RW4+d8
RW4, A @RW4+d8, A
RW4, A @RW4+d8, A
+4
F0
NOTW
NOTW
RW0 @RW0+d8
E0
NOTW
NOTW
RW3 @RW3+d8
D0
XORW
XORW
RW3, A @RW3+d8, A
C0
ADDW
ADDW
SUBW
SUBW
SUBCW SUBCW A, NEGW
NEGW
ANDW
ANDW
ORW
ORW
RW3, A @RW3+d8, A
RW3, A @RW3+d8, A
A, RW3 @RW3+d8
RW3 @RW3+d8
RW3, A @RW3+d8, A
RW3, A @RW3+d8, A
B0
+3
A0
NOTW
NOTW
RW2 @RW2+d8
90
ADDW
ADDW
SUBW
SUBW
SUBCW SUBCW A, NEGW
NEGW
ANDW
ANDW
ORW
ORW
XORW
XORW
RW2, A @RW2+d8,A
RW2, A @RW2+d8,A
A, RW2 @RW2+d8
RW2 @RW2+d8
RW2, A @RW2+d8,A
RW2, A @RW2+d8,A
RW2, A @RW2+d8,A
80
+2
70
NOTW
NOTW
RW1 @RW1+d8
60
XORW
XORW
RW1, A @RW1+d8, A
50
ADDW
ADDW
SUBW
SUBW
SUBCW SUBCW A, NEGW
NEGW
ANDW
ANDW
ORW
ORW
RW1, A @RW1+d8, A
RW1, A @RW1+d8, A
A, RW1 @RW1+d8
RW1 @RW1+d8
RW1, A @RW1+d8, A
RW1, A @RW1+d8, A
40
+1
30
XORW
XORW
RW0, A @RW0+d8, A
20
ADDW
ADDW
SUBW
SUBW
SUBCW SUBCW A, NEGW
NEGW
ANDW
ANDW
ORW
ORW
RW0, A @RW0+d8, A
RW0, A @RW0+d8, A
A, RW0 @RW0+d8
RW0 @RW0+d8
RW0, A @RW0+d8, A
RW0, A @RW0+d8, A
10
+0
00
APPENDIX
Table B.9-13 ea Instruction 8 (First Byte = 77H)
543
544
DIV
DIV
A, DIVW
DIVW A,
A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7
DIV
DIV
A, DIVW
DIVW A,
A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7
MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A,
A, @RW1 @RW1+d16 A,@RW1 @RW1+d16 A,@RW1 @RW1+d16 A,@RW1 @RW1+d16
MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A,
A, @RW2 @RW2+d16 A,@RW2 @RW2+d16 A,@RW2 @RW2+d16 A,@RW2 @RW2+d16
MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A,
A, @RW3 @RW3+d16 A,@RW3 @RW3+d16 A,@RW3 @RW3+d16 A,@RW3 @RW3+d16
MULU
MULU A, MULUW MULUW A,
A,@RW1 @RW1+d16 A,@RW1 @RW1+d16
MULU
MULU A, MULUW MULUW A,
A,@RW2 @RW2+d16 A,@RW2 @RW2+d16
MULU
MULU A, MULUW MULUW A,
A,@RW3 @RW3+d16 A,@RW3 @RW3+d16
MULU
MULU A, MULUW
MULUW A, MUL
MUL A,
MULW
MULW A,
DIVU
DIVU A,
DIVUW
DIVUW A,
A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7 A,@RW0+ @RW0+RW7
MULU
MULU A, MULUW
MULUW A, MUL
MUL A,
MULW
MULW A,
DIVU
DIVU A,
DIVUW
DIVUW A,
A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7 A,@RW1+ @RW1+RW7
MULU
MULU A, MULUW
MULUW A, MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A, DIV
DIV
A, DIVW
DIVW A,
A,@RW2+ @PC+d16 A,@RW2+ @PC+d16 A,@RW2+ @PC+d16 A,@RW2+ @PC+d16 A,@RW2+ @PC+d16 A,@RW2+ @PC+d16
A,@RW2+ @PC+d16
A,@RW2+ @PC+d16
+9
+A
+B
+C
+D
+E
+F A, @RW3+
MULU
DIV
DIV
A, DIVW
DIVW A,
A,@RW3 @RW3+d16 A,@RW3 @RW3+d16
MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A,
A, @RW0 @RW0+d16 A,@RW0 @RW0+d16 A,@RW0 @RW0+d16 A,@RW0 @RW0+d16
MULU
MULU A, MULUW MULUW A,
A,@RW0 @RW0+d16 A,@RW0 @RW0+d16
+8
MULU A, MULUW
MULUW A, MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A, DIV
DIV
addr16 A,@RW3+ addr16
A,@RW3+
addr16 A,@RW3+
addr16 A,@RW3+
addr16 A,@RW3+
addr16 A,@RW3+
A, DIVW
DIVW A,
addr16 A,@RW3+
addr16
DIV
DIV
A, DIVW
DIVW A,
A,@RW2 @RW2+d16 A,@RW2 @RW2+d16
DIV
DIV
A, DIVW
DIVW A,
A,@RW1 @RW1+d16 A,@RW1 @RW1+d16
DIV
DIV
A, DIVW
DIVW A,
A,@RW0 @RW0+d16 A,@RW0 @RW0+d16
MULU
MULU A, MULUW MULUW A, MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A, DIV
DIV
A, DIVW
DIVW A,
A, R7 @RW7+d8
A, RW7 @RW7+d8
A, R7 @RW7+d8
A, RW7 @RW7+d8
A, R7 @RW7+d8
A, RW7 @RW7+d8
A, R7 @RW7+d8
A, RW7 @RW7+d8
F0
+7
E0
MULU
MULU A, MULUW MULUW A, MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A, DIV
DIV
A, DIVW
DIVW A,
A, R6 @RW6+d8
A, RW6 @RW6+d8
A, R6 @RW6+d8
A, RW6 @RW6+d8
A, R6 @RW6+d8
A, RW6 @RW6+d8
A, R6 @RW6+d8
A, RW6 @RW6+d8
D0
+6
C0
MULU
MULU A, MULUW MULUW A, MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A, DIV
DIV
A, DIVW
DIVW A,
A, R5 @RW5+d8
A, RW5 @RW5+d8
A, R5 @RW5+d8
A, RW5 @RW5+d8
A, R5 @RW5+d8
A, RW5 @RW5+d8
A, R5 @RW5+d8
A, RW5 @RW5+d8
B0
+5
A0
MULU
MULU A, MULUW MULUW A, MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A, DIV
DIV
A, DIVW
DIVW A,
A, R4 @RW4+d8
A, RW4 @RW4+d8
A, R4 @RW4+d8
A, RW4 @RW4+d8
A, R4 @RW4+d8
A, RW4 @RW4+d8
A, R4 @RW4+d8
A, RW4 @RW4+d8
90
+4
80
MULU
MULU A, MULUW MULUW A, MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A, DIV
DIV
A, DIVW
DIVW A,
A, R3 @RW3+d8
A, RW3 @RW3+d8
A, R3 @RW3+d8
A, RW3 @RW3+d8
A, R3 @RW3+d8
A, RW3 @RW3+d8
A, R3 @RW3+d8
A, RW3 @RW3+d8
70
+3
60
MULU
MULU A, MULUW MULUW A, MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A, DIV
DIV
A, DIVW
DIVW A,
A, R2 @RW2+d8
A, RW2 @RW2+d8
A, R2 @RW2+d8
A, RW2 @RW2+d8
A, R2 @RW2+d8
A, RW2 @RW2+d8
A, R2 @RW2+d8
A, RW2 @RW2+d8
50
+2
40
MULU
MULU A, MULUW MULUW A, MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A, DIV
DIV
A, DIVW
DIVW A,
A, R1 @RW1+d8
A, RW1 @RW1+d8
A, R1 @RW1+d8
A, RW1 @RW1+d8
A, R1 @RW1+d8
A, RW1 @RW1+d8
A, R1 @RW1+d8
A, RW1 @RW1+d8
30
+1
20
MULU
MULU A, MULUW MULUW A, MUL
MUL
A, MULW
MULW A, DIVU
DIVU
A, DIVUW
DIVUW A, DIV
DIV
A, DIVW
DIVW A,
A, R0 @RW0+d8
A, RW0 @RW0+d8
A, R0 @RW0+d8
A, RW0 @RW0+d8
A, R0 @RW0+d8
A, RW0 @RW0+d8
A, R0 @RW0+d8
A, RW0 @RW0+d8
10
+0
00
APPENDIX
Table B.9-14 ea Instruction 9 (First Byte = 78H)
MOVEA
MOVEA RW1
RW1,RW4 ,@RW4+d8
MOVEA
MOVEA RW1
RW1,RW5 ,@RW5+d8
MOVEA
MOVEA RW1
RW1,RW6 ,@RW6+d8
MOVEA
MOVEA RW1
RW1,RW7 ,@RW7+d8
MOVEA
MOVEA RW1
RW1,@RW0 ,@RW0+d16
MOVEA
MOVEA RW1
RW1,@RW1 ,@RW1+d16
MOVEA
MOVEA RW1
RW1,@RW2 ,@RW2+d16
MOVEA
MOVEA RW1
RW1,@RW3 ,@RW3+d16
MOVEA
MOVEA RW0
RW0,RW4 ,@RW4+d8
MOVEA
MOVEA RW0
RW0,RW5 ,@RW5+d8
MOVEA
MOVEA RW0
RW0,RW6 ,@RW6+d8
MOVEA
MOVEA RW0
RW0,RW7 ,@RW7+d8
MOVEA RW0
MOVEA RW0
MOVEA RW0
MOVEA RW0
MOVEA RW0
MOVEA RW0
MOVEA
MOVEA
MOVEA
MOVEA
MOVEA
MOVEA
+4
+5
+6
+7
50
70
90
B0
C0
D0
F0
MOVEA
MOVEA RW3
RW3,@RW2+ ,@PC+d16
MOVEA
MOVEA RW4
RW4,@RW2+ ,@PC+d16
MOVEA
MOVEA RW7
RW7,@RW2+ ,@PC+d16
MOVEA
MOVEA
MOVEA
MOVEA
RW6,@RW3+ RW6, addr16 RW7@RW3+ RW7, addr16
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6
RW5,@RW2+ ,@PC+d16
RW6,@RW2+ ,@PC+d16
MOVEA
MOVEA
MOVEA
MOVEA
MOVEA
MOVEA
MOVEA
MOVEA
MOVEA
MOVEA
MOVEA
MOVEA
RW0,@RW3+ RW0, addr16 RW1,@RW3+ RW1, addr16 RW2,@RW3+ RW2, addr16 RW3,@RW3+ RW3, addr16 RW4,@RW3+ RW4, addr16 RW5,@RW3+ RW5, addr16
MOVEA
MOVEA RW2
RW2,@RW2+ ,@PC+d16
+F
MOVEA
MOVEA RW1
RW1,@RW2+ ,@PC+d16
MOVEA
MOVEA RW0
RW0,@RW2+ ,@PC+d16
MOVEA RW1
+E
MOVEA
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6 MOVEA
MOVEA RW7
RW5,@RW1+ ,@RW1+RW7 RW6,@RW1+ ,@RW1+RW7 RW7,@RW1+ ,@RW1+RW7
MOVEA
MOVEA RW7
RW7,@RW3 ,@RW3+d16
MOVEA
MOVEA RW7
RW7,@RW2 ,@RW2+d16
MOVEA
MOVEA RW7
RW7,@RW1 ,@RW1+d16
MOVEA
MOVEA RW7
RW7,@RW0 ,@RW0+d16
MOVEA
MOVEA RW7
RW7,RW7 ,@RW7+d8
MOVEA
MOVEA RW7
RW7,RW6 ,@RW6+d8
MOVEA
MOVEA RW7
RW7,RW5 ,@RW5+d8
MOVEA
MOVEA RW7
RW7,RW4 ,@RW4+d8
MOVEA
MOVEA RW7
RW7,RW3 ,@RW3+d8
MOVEA
MOVEA RW7
RW7,RW2 ,@RW2+d8
MOVEA
MOVEA RW7
RW7,RW1 ,@RW1+d8
MOVEA
MOVEA RW7
RW7,RW0 ,@RW0+d8
E0
MOVEA
MOVEA RW2 MOVEA
MOVEA RW3 MOVEA
MOVEA RW4
RW2,@RW1+ ,@RW1+RW7 RW3,@RW1+ ,@RW1+RW7 RW4,@RW1+ ,@RW1+RW7
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6
RW5,@RW3 ,@RW3+d16 RW6,@RW3 ,@RW3+d16
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6
RW5,@RW2 ,@RW2+d16 RW6,@RW2 ,@RW2+d16
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6
RW5,@RW1 ,@RW1+d16 RW6,@RW1 ,@RW1+d16
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6
RW5,@RW0 ,@RW0+d16 RW6,@RW0 ,@RW0+d16
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6
RW5,RW7 ,@RW7+d8
RW6,RW7 ,@RW7+d8
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6
RW5,RW6 ,@RW6+d8
RW6,RW6 ,@RW6+d8
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6
RW5,RW5 ,@RW5+d8
RW6,RW5 ,@RW5+d8
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6
RW5,RW4 ,@RW4+d8
RW6,RW4 ,@RW4+d8
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6
RW5,RW3 ,@RW3+d8
RW6,RW3 ,@RW3+d8
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6
RW5,RW2 ,@RW2+d8
RW6,RW2 ,@RW2+d8
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6
RW5,RW1 ,@RW1+d8
RW6,RW1 ,@RW1+d8
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6
RW5,RW0 ,@RW0+d8
RW6,RW0 ,@RW0+d8
A0
+D RW0,@RW1+ ,@RW1+RW7 RW1,@RW1+ ,@RW1+RW7
MOVEA
MOVEA RW4
RW4,@RW3 ,@RW3+d16
MOVEA
MOVEA RW4
RW4,@RW2 ,@RW2+d16
MOVEA
MOVEA RW4
RW4,@RW1 ,@RW1+d16
MOVEA
MOVEA RW4
RW4,@RW0 ,@RW0+d16
MOVEA
MOVEA RW4
RW4,RW7 ,@RW7+d8
MOVEA
MOVEA RW4
RW4,RW6 ,@RW6+d8
MOVEA
MOVEA RW4
RW4,RW5 ,@RW5+d8
MOVEA
MOVEA RW4
RW4,RW4 ,@RW4+d8
MOVEA
MOVEA RW4
RW4,RW3 ,@RW3+d8
MOVEA
MOVEA RW4
RW4,RW2 ,@RW2+d8
MOVEA
MOVEA RW4
RW4,RW1 ,@RW1+d8
MOVEA
MOVEA RW4
RW4,RW0 ,@RW0+d8
80
MOVEA
MOVEA RW5 MOVEA
MOVEA RW6 MOVEA
MOVEA RW7
RW5,@RW0+ ,@RW0+RW7 RW6,@RW0+ ,@RW0+RW7 RW7,@RW0+ ,@RW0+RW7
MOVEA
MOVEA RW3
RW3,@RW3 ,@RW3+d16
MOVEA
MOVEA RW3
RW3,@RW2 ,@RW2+d16
MOVEA
MOVEA RW3
RW3,@RW1 ,@RW1+d16
MOVEA
MOVEA RW3
RW3,@RW0 ,@RW0+d16
MOVEA
MOVEA RW3
RW3,RW7 ,@RW7+d8
MOVEA
MOVEA RW3
RW3,RW6 ,@RW6+d8
MOVEA
MOVEA RW3
RW3,RW5 ,@RW5+d8
MOVEA
MOVEA RW3
RW3,RW4 ,@RW4+d8
MOVEA
MOVEA RW3
RW3,RW3 ,@RW3+d8
MOVEA
MOVEA RW3
RW3,RW2 ,@RW2+d8
MOVEA
MOVEA RW3
RW3,RW1 ,@RW1+d8
MOVEA
MOVEA RW3
RW3,RW0 ,@RW0+d8
60
MOVEA
MOVEA RW2 MOVEA
MOVEA RW3 MOVEA
MOVEA RW4
RW2,@RW0+ ,@RW0+RW7 RW3,@RW0+ ,@RW0+RW7 RW4,@RW0+ ,@RW0+RW7
MOVEA
MOVEA RW2
RW2,@RW3 ,@RW3+d16
MOVEA
MOVEA RW2
RW2,@RW2 ,@RW2+d16
MOVEA
MOVEA RW2
RW2,@RW1 ,@RW1+d16
MOVEA
MOVEA RW2
RW2,@RW0 ,@RW0+d16
MOVEA
MOVEA RW2
RW2,RW7 ,@RW7+d8
MOVEA
MOVEA RW2
RW2,RW6 ,@RW6+d8
MOVEA
MOVEA RW2
RW2,RW5 ,@RW5+d8
MOVEA
MOVEA RW2
RW2,RW4 ,@RW4+d8
MOVEA
MOVEA RW2
RW2,RW3 ,@RW3+d8
MOVEA
MOVEA RW2
RW2,RW2 ,@RW2+d8
MOVEA
MOVEA RW2
RW2,RW1 ,@RW1+d8
MOVEA
MOVEA RW2
RW2,RW0 ,@RW0+d8
40
+C RW0,@RW0+ ,@RW0+RW7 RW1,@RW0+ ,@RW0+RW7
+B RW0,@RW3 ,@RW3+d16
+A RW0,@RW2 ,@RW2+d16
+9 RW0,@RW1 ,@RW1+d16
MOVEA RW1
MOVEA
MOVEA RW1
RW1,RW3 ,@RW3+d8
MOVEA
MOVEA RW0
RW0,RW3 ,@RW3+d8
+3
MOVEA
MOVEA
MOVEA RW1
RW1,RW2 ,@RW2+d8
MOVEA
MOVEA RW0
RW0,RW2 ,@RW2+d8
+2
+8 RW0,@RW0 ,@RW0+d16
MOVEA
MOVEA RW1
RW1,RW1 ,@RW1+d8
MOVEA
MOVEA RW0
RW0,RW1 ,@RW1+d8
+1
30
MOVEA
MOVEA RW1
RW1,RW0 ,@RW0+d8
20
MOVEA
MOVEA RW0
RW0,RW0 ,@RW0+d8
10
+0
00
APPENDIX
Table B.9-15 MOVEA RWi, ea Instruction (First Byte = 79H)
545
546
MOV
MOV R0, MOV
MOV R1, MOV
MOV R2, MOV
MOV R3, MOV
MOV R4, MOV
MOV R5, MOV
MOV R6, MOV
MOV R7,
R0, R7 @RW7+d8
R1, R7 @RW7+d8
R2, R7 @RW7+d8
R3, R7 @RW7+d8
R4, R7 @RW7+d8
R5, R7 @RW7+d8
R6, R7 @RW7+d8
R7, R7 @RW7+d8
MOV
MOV R0, MOV
MOV R1, MOV
MOV R2, MOV
MOV R3, MOV
MOV R4, MOV
MOV R5, MOV
MOV R6, MOV
MOV R7,
R0,@RW0 @RW0+d16 R1,@RW0 @RW0+d16 R2,@RW0 @RW0+d16 R3,@RW0 @RW0+d16 R4,@RW0 @RW0+d16 R5,@RW0 @RW0+d16 R6,@RW0 @RW0+d16 R7,@RW0 @RW0+d16
MOV
MOV R0, MOV
MOV R1, MOV
MOV R2, MOV
MOV R3, MOV
MOV R4, MOV
MOV R5, MOV
MOV R6, MOV
MOV R7,
R0,@RW1 @RW1+d16 R1,@RW1 @RW1+d16 R2,@RW1 @RW1+d16 R3,@RW1 @RW1+d16 R4,@RW1 @RW1+d16 R5,@RW1 @RW1+d16 R6,@RW1 @RW1+d16 R7,@RW1 @RW1+d16
MOV
MOV R0, MOV
MOV R1, MOV
MOV R2, MOV
MOV R3, MOV
MOV R4, MOV
MOV R5, MOV
MOV R6, MOV
MOV R7,
R0,@RW2 @RW2+d16 R1,@RW2 @RW2+d16 R2,@RW2 @RW2+d16 R3,@RW2 @RW2+d16 R4,@RW2 @RW2+d16 R5,@RW2 @RW2+d16 R6,@RW2 @RW2+d16 R7,@RW2 @RW2+d16
MOV
MOV R0, MOV
MOV R1, MOV
MOV R2, MOV
MOV R3, MOV
MOV R4, MOV
MOV R5, MOV
MOV R6, MOV
MOV R7,
R0,@RW3 @RW3+d16 R1,@RW3 @RW3+d16 R2,@RW3 @RW3+d16 R3,@RW3 @RW3+d16 R4,@RW3 @RW3+d16 R5,@RW3 @RW3+d16 R6,@RW3 @RW3+d16 R7,@RW3 @RW3+d16
MOV R0, MOV R0,
MOV R1, MOV R1,
MOV R2, MOV R2,
MOV R3, MOV R3,
MOV R4, MOV R4,
MOV R5, MOV R5,
MOV R6, MOV R6,
MOV R7, MOV R7,
@RW0+ @RW0+RW7
@RW0+ @RW0+RW7
@RW0+ @RW0+RW7
@RW0+ @RW0+RW7
@RW0+ @RW0+RW7
@RW0+ @RW0+RW7
@RW0+ @RW0+RW7
@RW0+ @RW0+RW7
MOV R0, MOV R0,
MOV R1, MOV R1,
MOV R2, MOV R2,
MOV R3, MOV R3,
MOV R4, MOV R4,
MOV R5, MOV R5,
MOV R6, MOV R6,
MOV R7, MOV R7,
@RW1+ @RW1+RW7
@RW1+ @RW1+RW7
@RW1+ @RW1+RW7
@RW1+ @RW1+RW7
@RW1+ @RW1+RW7
@RW1+ @RW1+RW7
@RW1+ @RW1+RW7
@RW1+ @RW1+RW7
MOV R0, MOV R0, MOV R1, MOV R1, MOV R2, MOV R2, MOV R3, MOV R3, MOV R4, MOV R4, MOV R5, MOV R5, MOV R6, MOV R6, MOV R7, MOV R7,
@RW2+ @PC+d16
@RW2+ @PC+d16
@RW2+ @PC+d16
@RW2+ @PC+d16
@RW2+ @PC+d16
@RW2+ @PC+d16
@RW2+ @PC+d16
@RW2+ @PC+d16
MOV R0, MOV R0, MOV R1, MOV R1, MOV R2, MOV R2, MOV R3, MOV R3, MOV R4, MOV R4, MOV R5, MOV R5, MOV R6, MOV R6, MOV R7, MOV R7,
@RW3+
addr16 @RW3+
addr16
@RW3+
addr16 @RW3+
addr16 @RW3+
addr16 @RW3+
addr16 @RW3+
addr16
@RW3+
addr16
+8
+9
+A
+B
+C
+D
+E
+F
F0
+7
E0
MOV
MOV R0, MOV
MOV R1, MOV
MOV R2, MOV
MOV R3, MOV
MOV R4, MOV
MOV R5, MOV
MOV R6, MOV
MOV R7,
R0, R6 @RW6+d8
R1, R6 @RW6+d8
R2, R6 @RW6+d8
R3, R6 @RW6+d8
R4, R6 @RW6+d8
R5, R6 @RW6+d8
R6, R6 @RW6+d8
R7, R6 @RW6+d8
D0
+6
C0
MOV
MOV R0, MOV
MOV R1, MOV
MOV R2, MOV
MOV R3, MOV
MOV R4, MOV
MOV R5, MOV
MOV R6, MOV
MOV R7,
R0, R5 @RW5+d8
R1, R5 @RW5+d8
R2, R5 @RW5+d8
R3, R5 @RW5+d8
R4, R5 @RW5+d8
R5, R5 @RW5+d8
R6, R5 @RW5+d8
R7, R5 @RW5+d8
B0
+5
A0
MOV
MOV R0, MOV
MOV R1, MOV
MOV R2, MOV
MOV R3, MOV
MOV R4, MOV
MOV R5, MOV
MOV R6, MOV
MOV R7,
R0, R4 @RW4+d8
R1, R4 @RW4+d8
R2, R4 @RW4+d8
R3, R4 @RW4+d8
R4, R4 @RW4+d8
R5, R4 @RW4+d8
R6, R4 @RW4+d8
R7, R4 @RW4+d8
90
+4
80
MOV
MOV R0, MOV
MOV R1, MOV
MOV R2, MOV
MOV R3, MOV
MOV R4, MOV
MOV R5, MOV
MOV R6, MOV
MOV R7,
R0, R3 @RW3+d8
R1, R3 @RW3+d8
R2, R3 @RW3+d8
R3, R3 @RW3+d8
R4, R3 @RW3+d8
R5, R3 @RW3+d8
R6, R3 @RW3+d8
R7, R3 @RW3+d8
70
+3
60
MOV
MOV R0, MOV
MOV R1, MOV
MOV R2, MOV
MOV R3, MOV
MOV R4, MOV
MOV R5, MOV
MOV R6, MOV
MOV R7,
R0, R2 @RW2+d8
R1, R2 @RW2+d8
R2, R2 @RW2+d8
R3, R2 @RW2+d8
R4, R2 @RW2+d8
R5, R2 @RW2+d8
R6, R2 @RW2+d8
R7, R2 @RW2+d8
50
+2
40
MOV
MOV R0, MOV
MOV R1, MOV
MOV R2, MOV
MOV R3, MOV
MOV R4, MOV
MOV R5, MOV
MOV R6, MOV
MOV R7,
R0, R1 @RW1+d8
R1, R1 @RW1+d8
R2, R1 @RW1+d8
R3, R1 @RW1+d8
R4, R1 @RW1+d8
R5, R1 @RW1+d8
R6, R1 @RW1+d8
R7, R1 @RW1+d8
30
+1
20
MOV
MOV R0, MOV
MOV R1, MOV
MOV R2, MOV
MOV R3, MOV
MOV R4, MOV
MOV R5, MOV
MOV R6, MOV
MOV R7,
R0, R0 @RW0+d8
R1, R0 @RW0+d8
R2, R0 @RW0+d8
R3, R0 @RW0+d8
R4, R0 @RW0+d8
R5, R0 @RW0+d8
R6, R0 @RW0+d8
R7, R0 @RW0+d8
10
+0
00
APPENDIX
Table B.9-16 MOV Ri, ea Instruction (First Byte = 7AH)
MOVW
MOVW RW5,
RW5,@RW3 @RW3+d16
MOVW
MOVW
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4,
RW0,@RW1 @RW1+d16 RW1,@RW1 @RW1+d16 RW2,@RW1 @RW1+d16 RW3,@RW1 @RW1+d16 RW4,@RW1 @RW1+d16
MOVW
MOVW
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4,
RW0,@RW2 @RW2+d16 RW1,@RW2 @RW2+d16 RW2,@RW2 @RW2+d16 RW3,@RW2 @RW2+d16 RW4,@RW2 @RW2+d16
MOVW
MOVW
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4,
RW0,@RW3 @RW3+d16 RW1,@RW3 @RW3+d16 RW2,@RW3 @RW3+d16 RW3,@RW3 @RW3+d16 RW4,@RW3 @RW3+d16
MOVW
MOVW
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4, MOVW
MOVW RW5, MOVW
MOVW RW6, MOVW
MOVW RW7,
RW0,@RW0+ @RW0+RW7 RW1,@RW0+ @RW0+RW7 RW2,@RW0+ @RW0+RW7 RW3,@RW0+ @RW0+RW7 RW4,@RW0+ @RW0+RW7 RW5,@RW0+ @RW0+RW7 RW6,@RW0+ @RW0+RW7 RW7,@RW0+ @RW0+RW7
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4,
RW1, @RW2+ @PC+d16
RW2, @RW2+ @PC+d16
RW3, @RW2+ @PC+d16
RW4, @RW2+ @PC+d16
MOVW
MOVW
RW1, @RW3+ RW1, addr16
MOVW
RW0, @RW1+
MOVW
MOVW
RW0, @RW2+ @PC+d16
MOVW
MOVW
RW0, @RW3+ RW0, addr16
+9
+A
+B
+C
+D
+E
+F
MOVW
MOVW
RW2, @RW3+ RW2, addr16
MOVW
MOVW
RW3, @RW3+ RW3, addr16
MOVW
MOVW
RW5, @RW3+ RW5, addr16
MOVW
MOVW
RW5, @RW2+ @PC+d16
MOVW
MOVW
RW6, @RW3+ RW6, addr16
MOVW
MOVW RW6,
RW6, @RW2+ @PC+d16
MOVW
MOVW
RW7, @RW3+ RW7, addr16
MOVW
MOVW RW7,
RW7, @RW2+ @PC+d16
MOVW RW7,
@RW1+RW7
MOVW
MOVW RW7,
RW7,@RW3 @RW3+d16
MOVW
MOVW RW7,
RW7,@RW2 @RW2+d16
MOVW
MOVW RW7,
RW7,@RW1 @RW1+d16
MOVW
MOVW RW7,
RW7,@RW0 @RW0+d16
MOVW
MOVW RW7,
RW7, RW7 @RW7+d8
MOVW
MOVW RW7,
RW7, RW6 @RW6+d8
MOVW
MOVW RW7,
RW7, RW5 @RW5+d8
MOVW
MOVW RW7,
RW7, RW4 @RW4+d8
MOVW RW6, MOVW
@RW1+RW7 RW7, @RW1+
MOVW
MOVW RW6,
RW6,@RW3 @RW3+d16
MOVW
MOVW RW6,
RW6,@RW2 @RW2+d16
MOVW
MOVW RW6,
RW6,@RW1 @RW1+d16
MOVW
MOVW RW6,
RW6,@RW0 @RW0+d16
MOVW
MOVW RW6,
RW6, RW7 @RW7+d8
MOVW
MOVW RW6,
RW6, RW6 @RW6+d8
MOVW
MOVW RW6,
RW6, RW5 @RW5+d8
MOVW
MOVW RW6,
RW6, RW4 @RW4+d8
MOVW
MOVW
@RW1+RW7 RW6, @RW1+
MOVW
MOVW RW5,
RW5, RW6 @RW6+d8
MOVW
MOVW RW5,
RW5, RW5 @RW5+d8
MOVW RW4, MOVW
@RW1+RW7 RW5, @RW1+
MOVW
MOVW
RW4, @RW3+ RW4, addr16
MOVW RW3, MOVW
@RW1+RW7 RW4, @RW1+
MOVW
MOVW RW5,
RW5,@RW2 @RW2+d16
MOVW
MOVW
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4,
RW0,@RW0 @RW0+d16 RW1,@RW0 @RW0+d16 RW2,@RW0 @RW0+d16 RW3,@RW0 @RW0+d16 RW4,@RW0 @RW0+d16
+8
MOVW RW2, MOVW
@RW1+RW7 RW3, @RW1+
MOVW
MOVW RW5,
RW5,@RW1 @RW1+d16
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4,
RW1, RW7 @RW7+d8
RW2, RW7 @RW7+d8
RW3, RW7 @RW7+d8
RW4, RW7 @RW7+d8
MOVW
MOVW
RW0, RW7 @RW7+d8
+7
MOVW RW1, MOVW
@RW1+RW7 RW2, @RW1+
MOVW
MOVW RW5,
RW5,@RW0 @RW0+d16
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4,
RW1, RW6 @RW6+d8
RW2, RW6 @RW6+d8
RW3, RW6 @RW6+d8
RW4, RW6 @RW6+d8
MOVW
MOVW
RW0, RW6 @RW6+d8
+6
MOVW
MOVW
@RW1+RW7 RW1, @RW1+
MOVW
MOVW RW5,
RW5, RW7 @RW7+d8
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4,
RW1, RW5 @RW5+d8
RW2, RW5 @RW5+d8
RW3, RW5 @RW5+d8
RW4, RW5 @RW5+d8
MOVW
MOVW
RW0, RW5 @RW5+d8
+5
MOVW
MOVW RW5,
RW5, RW4 @RW4+d8
MOVW
MOVW RW7,
RW7, RW3 @RW3+d8
MOVW
MOVW RW7,
RW7, RW2 @RW2+d8
MOVW
MOVW RW7,
RW7, RW1 @RW1+d8
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4,
RW1, RW4 @RW4+d8
RW2, RW4 @RW4+d8
RW3, RW4 @RW4+d8
RW4, RW4 @RW4+d8
MOVW
MOVW RW6,
RW6, RW3 @RW3+d8
MOVW
MOVW RW6,
RW6, RW2 @RW2+d8
MOVW
MOVW RW6,
RW6, RW1 @RW1+d8
MOVW
MOVW
RW0, RW4 @RW4+d8
MOVW
MOVW RW5,
RW5, RW3 @RW3+d8
MOVW
MOVW RW5,
RW5, RW2 @RW2+d8
MOVW
MOVW RW5,
RW5, RW1 @RW1+d8
+4
F0
MOVW
MOVW RW7,
RW7, RW0 @RW0+d8
E0
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4,
RW1, RW3 @RW3+d8
RW2, RW3 @RW3+d8
RW3, RW3 @RW3+d8
RW4, RW3 @RW3+d8
D0
MOVW
MOVW RW6,
RW6, RW0 @RW0+d8
C0
MOVW
MOVW
RW0, RW3 @RW3+d8
B0
MOVW
MOVW RW5,
RW5, RW0 @RW0+d8
A0
+3
90
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4,
RW1, RW2 @RW2+d8
RW2, RW2 @RW2+d8
RW3, RW2 @RW2+d8
RW4, RW2 @RW2+d8
80
MOVW
MOVW
RW0, RW2 @RW2+d8
70
+2
60
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4,
RW1, RW1 @RW1+d8
RW2, RW1 @RW1+d8
RW3, RW1 @RW1+d8
RW4, RW1 @RW1+d8
50
MOVW
MOVW
RW0, RW1 @RW1+d8
40
+1
30
MOVW
MOVW RW1, MOVW
MOVW RW2, MOVW
MOVW RW3, MOVW
MOVW RW4,
RW1, RW0 @RW0+d8
RW2, RW0 @RW0+d8
RW3, RW0 @RW0+d8
RW4, RW0 @RW0+d8
20
MOVW
MOVW
RW0, RW0 @RW0+d8
10
+0
00
APPENDIX
Table B.9-17 MOVW RWi, ea Instruction (First Byte = 7BH)
547
548
+F
+E
+D
+C
+B
+A
+9
+8
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
@RW3+, R1 addr16, R1
MOV
MOV
@RW3+, R0 addr16, R0
MOV
MOV
MOV
@RW2+, R1 @PC+d16, R1
@RW2+, R0 @PC+d16, R0
MOV
MOV
MOV
MOV
MOV
@RW0+, R1 @RW0+RW7, R1
MOV
@RW3, R1 @RW3+d16, R1
MOV
@RW2, R1 @RW2+d16, R1
MOV
@RW1, R1 @RW1+d16, R1
MOV
@RW1+, R1 @RW1+RW7, R1
MOV
MOV
@RW0, R1 @RW0+d16, R1
MOV
@RW1+, R0 @RW1+RW7, R0
MOV
@RW0+, R0 @RW0+RW7, R0
MOV
@RW3, R0 @RW3+d16, R0
MOV
@RW2, R0 @RW2+d16, R0
MOV
@RW1, R0 @RW1+d16, R0
MOV
@RW0, R0 @RW0+d16, R0
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
@RW3+, R2 addr16, R2
MOV
@RW2+, R2 @PC+d16, R2
MOV
@RW1+, R2 @RW1+RW7, R2
MOV
@RW0+, R2 @RW0+RW7, R2
MOV
@RW3, R2 @RW3+d16, R2
MOV
@RW2, R2 @RW2+d16, R2
MOV
@RW1, R2 @RW1+d16, R2
MOV
@RW0, R2 @RW0+d16, R2
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
@RW3+, R3 addr16, R3
MOV
@RW2+, R3 @PC+d16, R3
MOV
@RW1+, R3 @RW1+RW7, R3
MOV
@RW0+, R3 @RW0+RW7, R3
MOV
@RW3, R3 @RW3+d16, R3
MOV
@RW2, R3 @RW2+d16, R3
MOV
@RW1, R3 @RW1+d16, R3
MOV
@RW0, R3 @RW0+d16, R3
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
@RW3+, R4 addr16, R4
MOV
@RW2+, R4 @PC+d16, R4
MOV
@RW1+, R4 @RW1+RW7, R4
MOV
@RW0+, R4 @RW0+RW7, R4
MOV
@RW3, R4 @RW3+d16, R4
MOV
@RW2, R4 @RW2+d16, R4
MOV
@RW1, R4 @RW1+d16, R4
MOV
@RW0, R4 @RW0+d16, R4
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
@RW3+, R5 addr16, R5
MOV
@RW2+, R5 @PC+d16, R5
MOV
@RW1+, R5 @RW1+RW7, R5
MOV
@RW0+, R5 @RW0+RW7, R5
MOV
@RW3, R5 @RW3+d16, R5
MOV
@RW2, R5 @RW2+d16, R5
MOV
@RW1, R5 @RW1+d16, R5
MOV
@RW0, R5 @RW0+d16, R5
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
@RW3+, R6 addr16, R6
MOV
@RW2+, R6 @PC+d16, R6
MOV
@RW1+, R6 @RW1+RW7, R6
MOV
@RW0+, R6 @RW0+RW7, R6
MOV
@RW3, R6 @RW3+d16, R6
MOV
@RW2, R6 @RW2+d16, R6
MOV
@RW1, R6 @RW1+d16, R6
MOV
@RW0, R6 @RW0+d16,
R6
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
@RW3+, R7 addr16, R7
MOV
@RW2+, R7 @PC+d16, R7
MOV
@RW1+, R7 @RW1+RW7, R7
MOV
@RW0+, R7 @RW0+RW7, R7
MOV
@RW3, R7 @RW3+d16, R7
MOV
@RW2, R7 @RW2+d16, R7
MOV
@RW1, R7 @RW1+d16, R7
MOV
@RW0, R7 @RW0+d16, R7
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
R7, R0 @RW7+d8, R0
R7, R1 @RW7+d8, R1
R7, R2 @RW7+d8, R2
R7, R3 @RW7+d8, R3
R7, R4 @RW7+d8, R4
R7, R5 @RW7+d8, R5
R7, R6 @RW7+d8, R6
R7, R7 @RW7+d8, R7
F0
+7
E0
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
R6, R0 @RW6+d8, R0
R6, R1 @RW6+d8, R1
R6, R2 @RW6+d8, R2
R6, R3 @RW6+d8, R3
R6, R4 @RW6+d8, R4
R6, R5 @RW6+d8, R5
R6, R6 @RW6+d8, R6
R6, R7 @RW6+d8, R7
D0
+6
C0
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
R5, R0 @RW5+d8, R0
R5, R1 @RW5+d8, R1
R5, R2 @RW5+d8, R2
R5, R3 @RW5+d8, R3
R5, R4 @RW5+d8, R4
R5, R5 @RW5+d8, R5
R5, R6 @RW5+d8, R6
R5, R7 @RW5+d8, R7
B0
+5
A0
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
R4, R0 @RW4+d8, R0
R4, R1 @RW4+d8, R1
R4, R2 @RW4+d8, R2
R4, R3 @RW4+d8, R3
R4, R4 @RW4+d8, R4
R4, R5 @RW4+d8, R5
R4, R6 @RW4+d8, R6
R4, R7 @RW4+d8, R7
90
+4
80
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
R3, R0 @RW3+d8, R0
R3, R1 @RW3+d8, R1
R3, R2 @RW3+d8, R2
R3, R3 @RW3+d8, R3
R3, R4 @RW3+d8, R4
R3, R5 @RW3+d8, R5
R3, R6 @RW3+d8, R6
R3, R7 @RW3+d8, R7
70
+3
60
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
R2, R0 @RW2+d8, R0
R2, R1 @RW2+d8, R1
R2, R2 @RW2+d8, R2
R2, R3 @RW2+d8, R3
R2, R4 @RW2+d8, R4
R2, R5 @RW2+d8, R5
R2, R6 @RW2+d8, R6
R2, R7 @RW2+d8, R7
50
+2
40
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
R1, R0 @RW1+d8, R0
R1, R1 @RW1+d8, R1
R1, R2 @RW1+d8, R2
R1, R3 @RW1+d8, R3
R1, R4 @RW1+d8, R4
R1, R5 @RW1+d8, R5
R1, R6 @RW1+d8, R6
R1, R7 @RW1+d8, R7
30
+1
20
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
R0, R0 @RW0+d8, R0
R0, R1 @RW0+d8, R1
R0, R2 @RW0+d8, R2
R0, R3 @RW0+d8, R3
R0, R4 @RW0+d8, R4
R0, R5 @RW0+d8, R5
R0, R6 @RW0+d8, R6
R0, R7 @RW0+d8, R7
10
+0
00
APPENDIX
Table B.9-18 MOV ea, Ri Instruction (First Byte = 7CH)
MOVW
MOVW@RW2
@RW2, RW1 +d16, RW1
MOVW
MOVW@RW3
@RW3, RW1 +d16, RW1
MOVW
MOVW@RW0
@RW0+, RW1 +RW7,RW1
MOVW
MOVW@RW1
@RW1+,RW1 +RW7,RW1
MOVW
MOVW@PC
@RW2+,RW1 +d16, RW1
MOVW
MOVW
@RW3+,RW1 addr16, RW1
MOVW
MOVW@RW2
@RW2, RW0 +d16, RW0
MOVW
MOVW@RW3
@RW3, RW0 +d16, RW0
MOVW
MOVW@RW0
@RW0+,RW0 +RW7,RW0
MOVW
MOVW@RW1
@RW1+,RW0 +RW7,RW0
MOVW
MOVW@PC
@RW2+,RW0 +d16, RW0
MOVW
MOVW
@RW3+,RW0 addr16, RW0
+B
+C
+D
+E
+F
MOVW
MOVW
@RW3+,RW2 addr16, RW2
MOVW
MOVW@PC
@RW2+,RW2 +d16, RW2
MOVW
MOVW@RW1
@RW1+,RW2 +RW7,RW2
MOVW
MOVW@RW0
@RW0+,RW2 +RW7,RW2
MOVW
MOVW@RW3
@RW3, RW2 +d16, RW2
MOVW
MOVW@RW2
@RW2, RW2 +d16, RW2
MOVW
MOVW
@RW3+,RW3 addr16, RW3
MOVW
MOVW@PC
@RW2+,RW3 +d16, RW3
MOVW
MOVW@RW1
@RW1+,RW3 -+RW7,RW3
MOVW
MOVW@RW0
@RW0+,RW3 +RW7,RW3
MOVW
MOVW@RW3
@RW3, RW3 +d16, RW3
MOVW
MOVW@RW2
@RW2, RW3 +d16, RW3
MOVW
MOVW@RW1
@RW1, RW3 +d16, RW3
MOVW
MOVW
@RW3+,RW4 addr16, RW4
MOVW
MOVW@PC
@RW2+,RW4 +d16, RW4
MOVW
MOVW@RW1
@RW1+,RW4 +RW7,RW4
MOVW
MOVW@RW0
@RW0+,RW4 +RW7,RW4
MOVW
MOVW@RW3
@RW3, RW4 +d16, RW4
MOVW
MOVW@RW2
@RW2, RW4 +d16, RW4
MOVW
MOVW@RW1
@RW1, RW4 +d16, RW4
MOVW
MOVW
@RW3+,RW5 addr16, RW5
MOVW
MOVW@PC
@RW2+,RW5 +d16, RW5
MOVW
MOVW@RW1
@RW1+,RW5 +RW7,RW5
MOVW
MOVW@RW0
@RW0+,RW5 +RW7,RW5
MOVW
MOVW@RW3
@RW3, RW5 +d16, RW5
MOVW
MOVW@RW2
@RW2, RW5 +d16, RW5
MOVW
MOVW@RW1
@RW1, RW5 +d16, RW5
MOVW
MOVW
@RW3+,RW6 addr16, RW6
MOVW
MOVW @PC
@RW2+,RW6 +d16, RW6
MOVW
MOVW@RW1
@RW1+,RW6 +RW7,RW6
MOVW
MOVW@RW0
@RW0+,RW6 +RW7,RW6
MOVW
MOVW@RW3
@RW3, RW6 +d16, RW6
MOVW
MOVW@RW2
@RW2, RW6 +d16, RW6
MOVW
MOVW@RW1
@RW1, RW6 +d16, RW6
MOVW
MOVW
@RW3+,RW7 addr16, RW7
MOVW
MOVW@PC
@RW2+,RW7 +d16, RW7
MOVW
MOVW@RW1
@RW1+,RW7 +RW7,RW7
MOVW
MOVW@RW0
@RW0+,RW7 +RW7,RW7
MOVW
MOVW@RW3
@RW3, RW7 +d16, RW7
MOVW
MOVW@RW2
@RW2, RW7 +d16, RW7
MOVW
MOVW@RW1
@RW1, RW7 +d16, RW7
MOVW
MOVW@RW0
@RW0, RW7 +d16, RW7
+A
MOVW
MOVW@RW1
@RW1, RW2 +d16, RW2
MOVW
MOVW@RW0
@RW0, RW6 +d16, RW6
MOVW
MOVW@RW1
@RW1, RW1 +d16, RW1
MOVW
MOVW@RW0
@RW0, RW5 +d16, RW5
MOVW
MOVW@RW1
@RW1, RW0 +d16, RW0
MOVW
MOVW@RW0
@RW0, RW4 +d16, RW4
+9
MOVW
MOVW@RW0
@RW0, RW3 +d16, RW3
MOVW
MOVW@RW0
@RW0, RW1 +d16, RW1
MOVW
MOVW@RW0
@RW0, RW0 +d16, RW0
+8
MOVW
MOVW@RW0
@RW0, RW2 +d16, RW2
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
RW7, RW0 @RW7+d8, RW0
RW7, RW1 @RW7+d8, RW1 RW7, RW2 @RW7+d8, RW2 RW7, RW3 @RW7+d8, RW3 RW7, RW4 @RW7+d8, RW4 RW7, RW5 @RW7+d8, RW5 RW7, RW6 @RW7+d8, RW6 RW7, RW7 @RW7+d8, RW7
F0
+7
E0
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
RW6, RW0 @RW6+d8, RW0
RW6, RW1 @RW6+d8, RW1 RW6, RW2 @RW6+d8, RW2 RW6, RW3 @RW6+d8, RW3 RW6, RW4 @RW6+d8, RW4 RW6, RW5 @RW6+d8, RW5 RW6, RW6 @RW6+d8, RW6 RW6, RW7 @RW6+d8, RW7
D0
+6
C0
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
RW5, RW0 @RW5+d8, RW0
RW5, RW1 @RW5+d8, RW1 RW5, RW2 @RW5+d8, RW2 RW5, RW3 @RW5+d8, RW3 RW5, RW4 @RW5+d8, RW4 RW5, RW5 @RW5+d8, RW5 RW5, RW6 @RW5+d8, RW6 RW5, RW7 @RW5+d8, RW7
B0
+5
A0
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
RW4, RW0 @RW4+d8, RW0
RW4, RW1 @RW4+d8, RW1 RW4, RW2 @RW4+d8, RW2 RW4, RW3 @RW4+d8, RW3 RW4, RW4 @RW4+d8, RW4 RW4, RW5 @RW4+d8, RW5 RW4, RW6 @RW4+d8, RW6 RW4, RW7 @RW4+d8, RW7
90
+4
80
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
RW3, RW0 @RW3+d8, RW0
RW3, RW1 @RW3+d8, RW1 RW3, RW2 @RW3+d8, RW2 RW3, RW3 @RW3+d8, RW3 RW3, RW4 @RW3+d8, RW4 RW3, RW5 @RW3+d8, RW5 RW3, RW6 @RW3+d8, RW6 RW3, RW7 @RW3+d8, RW7
70
+3
60
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
RW2, RW0 @RW2+d8, RW0
RW2, RW1 @RW2+d8, RW1 RW2, RW2 @RW2+d8, RW2 RW2, RW3 @RW2+d8, RW3 RW2, RW4 @RW2+d8, RW4 RW2, RW5 @RW2+d8, RW5 RW2, RW6 @RW2+d8, RW6 RW2, RW7 @RW2+d8, RW7
50
+2
40
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
RW1, RW0 @RW1+d8, RW0
RW1, RW1 @RW1+d8, RW1 RW1, RW2 @RW1+d8, RW2 RW1, RW3 @RW1+d8, RW3 RW1, RW4 @RW1+d8, RW4 RW1, RW5 @RW1+d8, RW5 RW1, RW6 @RW1+d8, RW6 RW1, RW7 @RW1+d8, RW7
30
+1
20
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
RW0, RW0 @RW0+d8, RW0
RW0, RW1 @RW0+d8, RW1 RW0, RW2 @RW0+d8, RW2 RW0, RW3 @RW0+d8, RW3 RW0, RW4 @RW0+d8, RW4 RW0, RW5 @RW0+d8, RW5 RW0, RW6 @RW0+d8, RW6 RW0, RW7 @RW0+d8, RW7
10
+0
00
APPENDIX
Table B.9-19 MOVW ea, Rwi Instruction (First Byte = 7DH)
549
550
XCH
XCH
XCH
XCH
R1,
XCH
XCH R1,
R1,@RW2 W2+d16, A
XCH
XCH
R2,
XCH
XCH R2,
R2,@RW2 W2+d16, A
XCH
XCH
R3,
XCH
XCH R3,
R3,@RW2 W2+d16, A
XCH
XCH
R4,
XCH
XCH R4,
R4,@RW2 W2+d16, A
XCH
XCH
R5,
XCH
XCH R5,
R5,@RW2 W2+d16, A
XCH
XCH
R6,
XCH
XCH R6,
R6,@RW2 W2+d16, A
XCH
XCH
R7,
XCH
XCH R7,
R7,@RW2 W2+d16, A
XCH
XCH
XCH
XCH
XCH
R1, XCH
XCH
R2, XCH
XCH
R3, XCH
XCH
R4, XCH
XCH
R5, XCH
XCH
R6, XCH
XCH
R7,
+F R0,@RW3+ R0, addr16
XCH
XCH
R1,@RW3+ R1, addr16
XCH
XCH
R2,@RW3+ R2, addr16
XCH
XCH
R3,@RW3+ R3, addr16
XCH
XCH
R4,@RW3+ R4, addr16
XCH
XCH
R5,@RW3+ R5, addr16
XCH
XCH
R6,@RW3+ R6, addr16
XCH
XCH
R7,@RW3+ R7, addr16
+E R0,@RW2+ @PC+d16 R1,@RW2+ @PC+d16 R2,@RW2+ @PC+d16 R3,@RW2+ @PC+d16 R4,@RW2+ @PC+d16 R5,@RW2+ @PC+d16 R6,@RW2+ @PC+d16 R7,@RW2+ @PC+d16
R0, XCH
XCH R0,
XCH
XCH R1,
XCH
XCH R2,
XCH
XCH R3,
XCH
XCH R4,
XCH
XCH R5,
XCH
XCH R6,
XCH
XCH R7,
@RW1+RW7 R1,@RW1+ @RW1+RW7 R2,@RW1+ @RW1+RW7 R3,@RW1+ @RW1+RW7 R4,@RW1+ @RW1+RW7 R5,@RW1+ @RW1+RW7 R6,@RW1+ @RW1+RW7 R7,@RW1+ @RW1+RW7
+D R0,@RW1+
XCH
XCH R0,
XCH
XCH R1,
XCH
XCH R2,
XCH
XCH R3,
XCH
XCH R4,
XCH
XCH R5,
XCH
XCH R6,
XCH
XCH R7,
@RW0+RW7 R1,@RW0+ @RW0+RW7 R2,@RW0+ @RW0+RW7 R3,@RW0+ @RW0+RW7 R4,@RW0+ @RW0+RW7 R5,@RW0+ @RW0+RW7 R6,@RW0+ @RW0+RW7 R7,@RW0+ @RW0+RW7
XCH
+C R0,@RW0+
+B R0,@RW3 @RW3+d16 R1,@RW3 @RW3+d16 R2,@RW3 @RW3+d16 R3,@RW3 @RW3+d16 R4,@RW3 @RW3+d16 R5,@RW3 @RW3+d16 R6,@RW3 @RW3+d16 R7,@RW3 @RW3+d16
R0,
+A R0,@RW2 W2+d16, A
R0,
XCH
XCH R0, XCH
XCH R1, XCH
XCH R2, XCH
XCH R3, XCH
XCH R4, XCH
XCH R5, XCH
XCH R6, XCH
XCH R7,
R0,@RW1 @RW1+d16 R1,@RW1 @RW1+d16 R2,@RW1 @RW1+d16 R3,@RW1 @RW1+d16 R4,@RW1 @RW1+d16 R5,@RW1 @RW1+d16 R6,@RW1 @RW1+d16 R7,@RW1 @RW1+d16
+9
XCH
XCH
XCH R0, XCH
XCH R1, XCH
XCH R2, XCH
XCH R3, XCH
XCH R4, XCH
XCH R5, XCH
XCH R6, XCH
XCH R7,
R0,@RW0 @RW0+d16 R1,@RW0 @RW0+d16 R2,@RW0 @RW0+d16 R3,@RW0 @RW0+d16 R4,@RW0 @RW0+d16 R5,@RW0 @RW0+d16 R6,@RW0 @RW0+d16 R7,@RW0 @RW0+d16
+8
XCH
XCH
XCH R0, XCH
XCH R1, XCH
XCH R2, XCH
XCH R3, XCH
XCH R4, XCH
XCH R5, XCH
XCH R6, XCH
XCH R7,
R0, R7 @RW7+d8
R1, R7 @RW7+d8
R2, R7 @RW7+d8
R3, R7 @RW7+d8
R4, R7 @RW7+d8
R5, R7 @RW7+d8
R6, R7 @RW7+d8
R7, R7 @RW7+d8
F0
+7
E0
XCH
XCH R0, XCH
XCH R1, XCH
XCH R2, XCH
XCH R3, XCH
XCH R4, XCH
XCH R5, XCH
XCH R6, XCH
XCH R7,
R0, R6 @RW6+d8
R1, R6 @RW6+d8
R2, R6 @RW6+d8
R3, R6 @RW6+d8
R4, R6 @RW6+d8
R5, R6 @RW6+d8
R6, R6 @RW6+d8
R7, R6 @RW6+d8
D0
+6
C0
XCH
XCH R0, XCH
XCH R1, XCH
XCH R2, XCH
XCH R3, XCH
XCH R4, XCH
XCH R5, XCH
XCH R6, XCH
XCH R7,
R0, R5 @RW5+d8
R1, R5 @RW5+d8
R2, R5 @RW5+d8
R3, R5 @RW5+d8
R4, R5 @RW5+d8
R5, R5 @RW5+d8
R6, R5 @RW5+d8
R7, R5 @RW5+d8
B0
+5
A
XCH
XCH R0, XCH
XCH R1, XCH
XCH R2, XCH
XCH R3, XCH
XCH R4, XCH
XCH R5, XCH
XCH R6, XCH
XCH R7,
R0, R4 @RW4+d8
R1, R4 @RW4+d8
R2, R4 @RW4+d8
R3, R4 @RW4+d8
R4, R4 @RW4+d8
R5, R4 @RW4+d8
R6, R4 @RW4+d8
R7, R4 @RW4+d8
90
+4
80
XCH
XCH R0, XCH
XCH R1, XCH
XCH R2, XCH
XCH R3, XCH
XCH R4, XCH
XCH R5, XCH
XCH R6, XCH
XCH R7,
R0, R3 @RW3+d8
R1, R3 @RW3+d8
R2, R3 @RW3+d8
R3, R3 @RW3+d8
R4, R3 @RW3+d8
R5, R3 @RW3+d8
R6, R3 @RW3+d8
R7, R3 @RW3+d8
70
+3
60
XCH
XCH R0, XCH
XCH R1, XCH
XCH R2, XCH
XCH R3, XCH
XCH R4, XCH
XCH R5, XCH
XCH R6, XCH
XCH R7,
R0, R2 @RW2+d8
R1, R2 @RW2+d8
R2, R2 @RW2+d8
R3, R2 @RW2+d8
R4, R2 @RW2+d8
R5, R2 @RW2+d8
R6, R2 @RW2+d8
R7, R2 @RW2+d8
50
+2
40
XCH
XCH R0, XCH
XCH R1, XCH
XCH R2, XCH
XCH R3, XCH
XCH R4, XCH
XCH R5, XCH
XCH R6, XCH
XCH R7,
R0, R1 @RW1+d8
R1, R1 @RW1+d8
R2, R1 @RW1+d8
R3, R1 @RW1+d8
R4, R1 @RW1+d8
R5, R1 @RW1+d8
R6, R1 @RW1+d8
R7, R1 @RW1+d8
30
+1
20
XCH
XCH R0, XCH
XCH R1, XCH
XCH R2, XCH
XCH R3, XCH
XCH R4, XCH
XCH R5, XCH
XCH R6, XCH
XCH R7,
R0, R0 @RW0+d8
R1, R0 @RW0+d8
R2, R0 @RW0+d8
R3, R0 @RW0+d8
R4, R0 @RW0+d8
R5, R0 @RW0+d8
R6, R0 @RW0+d8
R7, R0 @RW0+d8
10
+0
00
APPENDIX
Table B.9-20 XCH Ri, ea Instruction (First Byte = 7EH)
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0,@RW2+ @PC+d16
RW1,@RW2+ @PC+d16
RW2,@RW2+ @PC+d16
RW3,@RW2+ @PC+d16
RW4,@RW2+ @PC+d16
RW5,@RW2+ @PC+d16
RW6,@RW2+ @PC+d16
RW7,@RW2+ @PC+d16
XCHW
XCHW
RW0,@RW3+ RW0, addr16
+E
+F
XCHW
XCHW
RW7,@RW3+ RW7, addr16
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0,@RW1+ @RW1+RW7 RW1,@RW1+ @RW1+RW7 RW2,@RW1+ @RW1+RW7 RW3,@RW1+ @RW1+RW7 RW4,@RW1+ @RW1+RW7 RW5,@RW1+ @RW1+RW7 RW6,@RW1+ @RW1+RW7 RW7,@RW1+ @RW1+RW7
+D
XCHW
XCHW
RW6,@RW3+ RW6, addr16
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0,@RW0+ @RW0+RW7 RW1,@RW0+ @RW0+RW7 RW2,@RW0+ @RW0+RW7 RW3,@RW0+ @RW0+RW7 RW4,@RW0+ @RW0+RW7 RW5,@RW0+ @RW0+RW7 RW6,@RW0+ @RW0+RW7 RW7,@RW0+ @RW0+RW7
+C
XCHW
XCHW
RW5,@RW3+ RW5, addr16
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0,@RW3 @RW3+d16
RW1,@RW3 @RW3+d16
RW2,@RW3 @RW3+d16
RW3,@RW3 @RW3+d16
RW4,@RW3 @RW3+d16
RW5,@RW3 @RW3+d16
RW6,@RW3 @RW3+d16
RW7,@RW3 @RW3+d16
+B
XCHW
XCHW
RW4,@RW3+ RW4, addr16
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0,@RW2 @RW2+d16
RW1,@RW2 @RW2+d16
RW2,@RW2 @RW2+d16
RW3,@RW2 @RW2+d16
RW4,@RW2 @RW2+d16
RW5,@RW2 @RW2+d16
RW6,@RW2 @RW2+d16
RW7,@RW2 @RW2+d16
+A
XCHW
XCHW
RW3,@RW3+ RW3, addr16
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0,@RW1 @RW1+d16
RW1,@RW1 @RW1+d16
RW2,@RW1 @RW1+d16
RW3,@RW1 @RW1+d16
RW4,@RW1 @RW1+d16
RW5,@RW1 @RW1+d16
RW6,@RW1 @RW1+d16
RW7,@RW1 @RW1+d16
+9
XCHW
XCHW
RW2,@RW3+ RW2, addr16
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0,@RW0 @RW0+d16
RW1,@RW0 @RW0+d16
RW2,@RW0 @RW0+d16
RW3,@RW0 @RW0+d16
RW4,@RW0 @RW0+d16
RW5,@RW0 @RW0+d16
RW6,@RW0 @RW0+d16
RW7,@RW0 @RW0+d16
+8
XCHW
XCHW
RW1,@RW3+ RW1, addr16
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0, RW7 @RW7+d8
RW1, RW7 @RW7+d8
RW2, RW7 @RW7+d8
RW3, RW7 @RW7+d8
RW4, RW7 @RW7+d8
RW5, RW7 @RW7+d8
RW6, RW7 @RW7+d8
RW7, RW7 @RW7+d8
F0
+7
E0
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0, RW6 @RW6+d8
RW1, RW6 @RW6+d8
RW2, RW6 @RW6+d8
RW3, RW6 @RW6+d8
RW4, RW6 @RW6+d8
RW5, RW6 @RW6+d8
RW6, RW6 @RW6+d8
RW7, RW6 @RW6+d8
D0
+6
C0
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0, RW5 @RW5+d8
RW1, RW5 @RW5+d8
RW2, RW5 @RW5+d8
RW3, RW5 @RW5+d8
RW4, RW5 @RW5+d8
RW5, RW5 @RW5+d8
RW6, RW5 @RW5+d8
RW7, RW5 @RW5+d8
B0
+5
A0
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0, RW4 @RW4+d8
RW1, RW4 @RW4+d8
RW2, RW4 @RW4+d8
RW3, RW4 @RW4+d8
RW4, RW4 @RW4+d8
RW5, RW4 @RW4+d8
RW6, RW4 @RW4+d8
RW7, RW4 @RW4+d8
90
+4
80
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0, RW3 @RW3+d8
RW1, RW3 @RW3+d8
RW2, RW3 @RW3+d8
RW3, RW3 @RW3+d8
RW4, RW3 @RW3+d8
RW5, RW3 @RW3+d8
RW6, RW3 @RW3+d8
RW7, RW3 @RW3+d8
70
+3
60
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0, RW2 @RW2+d8
RW1, RW2 @RW2+d8
RW2, RW2 @RW2+d8
RW3, RW2 @RW2+d8
RW4, RW2 @RW2+d8
RW5, RW2 @RW2+d8
RW6, RW2 @RW2+d8
RW7, RW2 @RW2+d8
50
+2
40
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0, RW1 @RW1+d8
RW1, RW1 @RW1+d8
RW2, RW1 @RW1+d8
RW3, RW1 @RW1+d8
RW4, RW1 @RW1+d8
RW5, RW1 @RW1+d8
RW6, RW1 @RW1+d8
RW7, RW1 @RW1+d8
30
+1
20
XCHW
XCHW RW0, XCHW
XCHW RW1, XCHW
XCHW RW2, XCHW
XCHW RW3, XCHW
XCHW RW4, XCHW
XCHW RW5, XCHW
XCHW RW6, XCHW
XCHW RW7,
RW0, RW0 @RW0+d8
RW1, RW0 @RW0+d8
RW2, RW0 @RW0+d8
RW3, RW0 @RW0+d8
RW4, RW0 @RW0+d8
RW5, RW0 @RW0+d8
RW6, RW0 @RW0+d8
RW7, RW0 @RW0+d8
10
+0
00
APPENDIX
Table B.9-21 XCHW RWi, ea Instruction (First Byte = 7FH)
551
APPENDIX
APPENDIX C Timing Diagrams in Flash Memory Mode
Each timing diagram for the external pins of the Flash devices in MB90860A series
during Flash Memory mode is shown below.
■ Data Read By Read access
Figure C-1 Timing Diagram for Read access
tRC
Address stable
AQ16 to AQ0
tACC
CE
tDF
tOE
OE
tOEH
WE
tOH
tCE
High
impedance
DQ7 to DQ0
552
High impedance
Output defined
APPENDIX
■ Write, Data Polling, Read (WE Control)
Figure C-2 Write, Data Polling, Read (WE Control)
Third bus cycle
AQ18
to
AQ0
Data polling
6AAAAH or
7AAAH
PA
tWC
tAS
PA
tRC
tAH
CE
tGHWL
OE
tWP
tWHWH1
WE
tCS
DQ7
to
DQ0
tOE
tWPH
tDF
tDH
A0H
PD
DQ7
DOUT
tDS
tOH
5.0 V
PA: Write address
PD: Write data
DQ7: Reverse output of write data
DOUT: Output of write data
tCE
Note:
Describes the last 2-bus cycle of 4-bus cycle sequences.
553
APPENDIX
■ Write, Data Polling, Read (CE Control)
Figure C-3 Timing Diagram for Write access (CE Control)
Third bus cycle
Data polling
AQ18 to AQ0
6AAAAH or
7AAAAH
PA
tWC
tAS
PA
tAH
tWH
WE
tGHWL
OE
tCP
tWHWH1
CE
tCPH
tWS
tDH
A0H
PD
DQ7 to DQ0
tDS
5.0 V
PA: Write address
PD: Write data
DQ7: Reverse output of write data
DOUT: Output of write data
Note:
Describes the last 2-bus cycle of 4-bus cycle sequences.
554
DQ7
DOUT
APPENDIX
■ Chip Erase/Sector Erase Command Sequence
Figure C-4 Timing Diagram for Write access (Chip Erasing/Sector Erasing)
tAS
AQ18
to
AQ0
6AAAAH or
7AAAAH
tAH
65555H or
75555H
6AAAAH or
7AAAAH
6AAAAH or
7AAAAH
65555H or
75555H
SA
CE
tGHWL
OE
tWP
WE
tWPH
tCS
DQ7
to
DQ0
tDH
AAH
55H
80H
AAH
55H
10H/30H
tDS
VCC
tVCS
Notes:
• SA is the sector address at sector erasing.
• The chip erase sector address is "6AAAAH" or "7AAAAH".
555
APPENDIX
■ Data Polling
Figure C-5 Timing Diagram for Data Polling
tCH
CE
tOE
tDF
OE
tOEH
WE
tCE
tOH
*
DQ7
DQ7
DQ7 = Valid data
High-Z
tWHWH1 or
tWHWH2
DQ6 to DQ0
DQ6 to DQ0
= Valid data
DQ6 to DQ0 = Invalid
tOE
Note:
DQ7 is valid data (The device terminates automatic operation).
■ Toggle Bit
Figure C-6 Timing Diagram for Toggle Bit
CE
tOEH
WE
tOES
OE
*
Data (DQ7 to DQ0)
DQ6 = Toggle
DQ6 = Toggle
DQ6 = Stop toggling
tOE
Note:
DQ6 stops toggling (The device terminates automatic operation).
556
DQ7 to
DQ0 = Valid
APPENDIX
■ RY/BY Timing during Writing/Erasing
Figure C-7 Timing Diagram for Output of RY/BY Signal during Writing/Erasing
CE
Rising edge of last write pulse
WE
Writing or erasing
RY/BY
tBUSY
■ RST and RY/BY Timing
Figure C-8 Timing Diagram for Output of RY/BY Signal at Hardware Reset
CE
RY/BY
tRP
RST
tReady
557
APPENDIX
■ Enable Sector Protect/Verify Sector Protect
Figure C-9 Enable Sector Protect/Verify Sector Protect
AQ18 to AQ9
SAx
AQ8, AQ2, and AQ1
SAy
(AQ8, AQ2, AQ1) = (0, 1, 0)
MD0 12 V
5V
MD2 12 V
5V
tVLHT
tVLHT
OE
WE
tWPP
tOESP
CE
tCSP
DQ7 to DQ0
01H
SAx: First sector address
SAy: Next sector address
558
tOE
APPENDIX
■ Temporary Sector Protect Cancellation
Figure C-10 Temporary Sector Protect Cancellation
MD1
12 V
5V
5V
CE
WE
tVLHT
Write/erase command sequence
RY/BY
559
APPENDIX
APPENDIX D MB90860A Series List of Interrupt Vectors
The interrupt vector table to be referenced for interrupt processing is allocated to
"FFFC00H" to "FFFFFFH" in the memory area and also used for software interrupts.
■ List of Interrupt Vectors
Table D-1 lists the interrupt vectors for the MB90860A series.
Table D-1 Interrupt Vectors (1/2)
Interrupt
request
Interrupt cause
Interrupt control
register
Number
Address
Vector
address L
Vector
address H
Vector
address
bank
Mode
register
INT 0 (*)
-
-
-
FFFFFCH
FFFFFDH
FFFFFEH
Unused
INT 1 (*)
-
-
-
FFFFF8H
FFFFF9H
FFFFFAH
Unused
-
-
-
.
.
.
.
.
.
.
.
.
.
.
.
-
-
-
FFFFE0H
FFFFE1H
FFFFE2H
Unused
.
.
.
INT 7 (*)
INT 8
Reset
-
-
FFFFDCH
FFFFDDH
FFFFDEH
FFFFDFH
INT 9
INT9 instruction
-
-
FFFFD8H
FFFFD9H
FFFFDAH
Unused
INT 10
Exception
-
-
FFFFD4H
FFFFD5H
FFFFD6H
Unused
INT 11
(Reserved)
FFFFD1H
FFFFD2H
Unused
0000B0H
FFFFD0H
ICR00
FFFFCCH
FFFFCDH
FFFFCEH
Unused
FFFFC8H
FFFFC9H
FFFFCAH
Unused
FFFFC4H
FFFFC5H
FFFFC6H
Unused
FFFFC0H
FFFFC1H
FFFFC2H
Unused
FFFFBCH
FFFFBDH
FFFFBEH
Unused
FFFFB8H
FFFFB9H
FFFFBAH
Unused
FFFFB4H
FFFFB5H
FFFFB6H
Unused
FFFFB0H
FFFFB1H
FFFFB2H
Unused
FFFFACH
FFFFADH
FFFFAEH
Unused
FFFFA8H
FFFFA9H
FFFFAAH
Unused
FFFFA4H
FFFFA5H
FFFFA6H
Unused
FFFFA0H
FFFFA1H
FFFFA2H
Unused
FFFF9CH
FFFF9DH
FFFF9EH
Unused
FFFF98H
FFFF99H
FFFF9AH
Unused
FFFF94H
FFFF95H
FFFF96H
Unused
INT 12
(Reserved)
INT 13
Input Capture 6
ICR01
INT 14
Input Capture 7
INT 15
I2C 0
INT 16
(Reserved)
INT 17
16-bit Reload Timer 0
ICR02
ICR03
INT 18
16-bit Reload Timer 1
INT 19
16-bit Reload Timer 2
ICR04
INT 20
16-bit Reload Timer 3
INT 21
PPG0/PPG1/PPG4/PPG5
ICR05
INT 22
PPG2/PPG3/PPG6/PPG7
INT 23
PPG8/PPG9/PPGC/PPGD
ICR06
INT 24
PPGA/PPGB/PPGE/PPGF
INT 25
Time Base Timer
ICR07
INT 26
560
External Interrupt 0-3/8-11
0000B1H
0000B2H
0000B3H
0000B4H
0000B5H
0000B6H
0000B7H
APPENDIX
Table D-1 Interrupt Vectors (2/2)
Interrupt
request
INT 27
Interrupt cause
Interrupt control
register
Number
Address
ICR08
0000B8H
Watch Timer
INT 28
External Interrupt 4 to 7/12 to
15
INT 29
A/D Converter
ICR09
INT 30
I/O Timer 0/1
INT 31
Input Capture 4/5 / I2C 1
INT 32
Output Compare 0/1/4/5
INT 33
Input Capture 0 to 3
ICR10
ICR11
INT 34
Output Compare 2/3/6/7
INT 35
UART 0 RX
ICR12
INT 36
UART 0 TX
INT 37
UART 1 RX / UART 3 RX
ICR13
INT 38
UART 1 TX / UART 3 TX
INT 39
UART 2 RX / UART 4 RX
ICR14
INT 40
UART 2 TX / UART 4 TX
INT 41
Flash Memory
ICR15
INT 42
Delayed Interrupt
0000B9H
0000BAH
0000BBH
0000BCH
0000BDH
0000BEH
0000BFH
Vector
address L
Vector
address H
Vector
address
bank
Mode
register
FFFF90H
FFFF91H
FFFF92H
Unused
FFFF8CH
FFFF8DH
FFFF8EH
Unused
FFFF88H
FFFF89H
FFFF8AH
Unused
FFFF84H
FFFF85H
FFFF86H
Unused
FFFF80H
FFFF81H
FFFF82H
Unused
FFFF7CH
FFFF7DH
FFFF7EH
Unused
FFFF78H
FFFF79H
FFFF7AH
Unused
FFFF74H
FFFF75H
FFFF76H
Unused
FFFF70H
FFFF71H
FFFF72H
Unused
FFFF6CH
FFFF6DH
FFFF6EH
Unused
FFFF68H
FFFF69H
FFFF6AH
Unused
FFFF64H
FFFF65H
FFFF66H
Unused
FFFF60H
FFFF61H
FFFF62H
Unused
FFFF5CH
FFFF5DH
FFFF5EH
Unused
FFFF58H
FFFF59H
FFFF5AH
Unused
FFFF54H
FFFF55H
FFFF56H
Unused
-
-
-
FFFF50H
FFFF51H
FFFF52H
Unused
-
-
-
.
.
.
.
.
.
.
.
.
.
.
.
INT 254
-
-
-
FFFC04H
FFFC05H
FFFC06H
Unused
INT 255
-
-
-
FFFC00H
FFFC01H
FFFC02H
Unused
INT 43
.
.
.
*: When PCB is "FFH", the vector area for the CALLV instruction is the same as that for INT #vct8 (#0 to #7).
Care must be taken when using the vector for the CALLV instruction.
561
APPENDIX
■ Interrupt Causes, Interrupt Vectors, and Interrupt Control Registers
Table D-2 summarizes the relationships among the interrupt causes, interrupt vectors, and interrupt control
registers of the MB90860A series.
Table D-2 Interrupt Causes, Interrupt Vectors, and Interrupt Control Registers (1/2)
Interrupt cause
2
EI OS
clear
DMA
channel
number
Interrupt vector
Interrupt control
register
Number
Address
Number
Address
Reset
N
-
#08
FFFFDCH
-
-
INT9 instruction
N
-
#09
FFFFD8H
-
-
Exception
N
-
#10
FFFFD4H
-
-
(Reserved)
N
-
#11
FFFFD0H
ICR00
N
-
#12
FFFFCCH
0000B0H
(Reserved)
Input Capture 6
N
-
#13
FFFFC8H
ICR01
N
-
#14
FFFFC4H
0000B1H
Input Capture 7
I2C 0
N
-
#15
FFFFC0H
ICR02
0000B2H
(Reserved)
N
-
#16
FFFFBCH
16-bit Reload Timer 0
Y1
0
#17
FFFFB8H
ICR03
Y1
1
#18
FFFFB4H
0000B3H
16-bit Reload Timer 1
16-bit Reload Timer 2
Y1
2
#19
FFFFB0H
ICR04
Y1
-
#20
FFFFACH
0000B4H
16-bit Reload Timer 3
PPG0/PPG1/PPG4/PPG5
N
-
#21
FFFFA8H
ICR05
N
-
#22
FFFFA4H
0000B5H
PPG2/PPG3/PPG6/PPG7
PPG8/PPG9/PPGC/PPGD
N
-
#23
FFFFA0H
ICR06
N
-
#24
FFFF9CH
0000B6H
PPGA/PPGB/PPGE/PPGF
Time Base Timer
N
-
#25
FFFF98H
ICR07
Y1
3
#26
FFFF94H
0000B7H
External Interrupt 0 to 3, 8 to 11
Watch Timer
N
-
#27
FFFF90H
ICR08
Y1
4
#28
FFFF8CH
0000B8H
External Interrupt 4 to 7, 12 to 15
A/D Converter
Y1
5
#29
FFFF88H
ICR09
N
-
#30
FFFF84H
0000B9H
I/O Timer 0 / I/O Timer 1
562
APPENDIX
Table D-2 Interrupt Causes, Interrupt Vectors, and Interrupt Control Registers (2/2)
Interrupt cause
EI2OS
clear
DMA
channel
number
Interrupt vector
Number
Address
Input Capture 4/5 / I2C 1
Y1
6
#31
FFFF80H
Output Compare 0/1/4/5
Y1
7
#32
FFFF7CH
Input Capture 0 to 3
Y1
8
#33
FFFF78H
Output Compare 2/3/6/7
Y1
9
#34
FFFF74H
UART 0 RX
Y2
10
#35
FFFF70H
UART 0 TX
Y1
11
#36
FFFF6CH
UART 1 RX / UART 3 RX
Y2
12
#37
FFFF68H
UART 1 TX / UART 3 TX
Y1
13
#38
FFFF64H
UART 2 RX / UART 4 RX
Y2
14
#39
FFFF60H
UART 2 TX / UART 4 TX
Y1
15
#40
FFFF5CH
Flash Memory
N
-
#41
FFFF58H
Delayed interrupt
N
-
#42
FFFF54H
Interrupt control
register
Number
Address
ICR10
0000BAH
ICR11
0000BBH
ICR12
0000BCH
ICR13
0000BDH
ICR14
0000BEH
ICR15
0000BFH
Y1: An EI2OS interrupt clear signal or EI2OS register read access clears the interrupt request flag.
Y2: An EI2OS interrupt clear signal or EI2OS register read access clears the interrupt request flag. A stop request is issued.
N: An EI2OS interrupt clear signal does not clear the interrupt request flag.
Note:
For a peripheral module having two interrupt causes for one interrupt number, an EI2OS interrupt
clear signal clears both interrupt request flags.
When EI2OS ends, an EI2OS clear signal is sent to every interrupt flag assigned to each interrupt
number.
EI2OS is activated when one of two interrupts assigned to an interrupt control register (ICR) is
caused while EI2OS is enabled. This means that an EI2OS descriptor that should essentially be
specific to each interrupt cause is shared by two interrupts. Therefore, while one interrupt is enabled,
the other interrupt must be disabled.
563
APPENDIX
564
INDEX
INDEX
The index follows on the next page.
This is listed in alphabetic order.
565
INDEX
Index
Numerics
16-bit Data Bus
Status of Each Pin in the External BUS 16-bit Data
Bus Mode ........................................... 162
16-bit Free-running Timer
16-bit Free-running Timer................................. 206
16-bit Free-running Timer 0 and 1 ..................... 208
16-bit Free-running Timer Block Diagram .......... 210
16-bit Free-running Timer Operation.................. 215
16-bit Free-running Timer Timing ..................... 216
16-bit I/O Timer
Block Diagram of 16-bit I/O Timer .................... 207
16-bit Input Capture
16-bit Input Capture ......................................... 209
16-bit Output Compare
16-bit Output Compare ..................................... 208
16-bit Reload Register
Register Layout of 16-bit Timer Register (TMR)/16bit Reload Register (TMRLR) .............. 249
16-bit Reload Timer
16-bit Reload Timer Register............................. 245
Block Diagram of 16-bit Reload Timer............... 244
Input Pin Functions of 16-bit Reload Timer (in
Internal Clock Mode)........................... 251
Internal Clock Operation of 16-bit Reload Timer
.......................................................... 250
Outline of 16-bit Reload Timer (with Event Count
Function) ............................................ 244
Output Pin Functions of 16-bit Reload Timer ...... 253
Underflow Operation of 16-bit Reload Timer...... 252
16-bit Timer Register
Register Layout of 16-bit Timer Register (TMR)/16bit Reload Register (TMRLR) .............. 249
1M-bit Flash Memory
1M-bit Flash Memory Features.......................... 424
Programming Example of 1M-bit Flash Memory
.......................................................... 454
Sector Configuration of the 1M-bit Flash Memory
.......................................................... 425
24-bit Operand
24-bit Operand Specification ............................... 33
8/16-bit PPG
8/16-bit PPG Interrupts ..................................... 278
8/16-bit PPG Output Operation.......................... 275
8/16-bit PPG Registers...................................... 266
Block Diagram of 8/16-bit PPG ......................... 264
Controlling Pin Output of 8/16-bit PPG Pulses
.......................................................... 277
Function of 8/16-bit PPG .................................. 262
566
Initial Values of 8/16-bit PPG Hardware ............ 279
Operation Modes of 8/16-bit PPG...................... 274
Operations of 8/16-bit PPG ............................... 274
Relationship between 8/16-bit PPG Reload Value and
Pulse Width........................................ 275
Selecting a Count Clock for 8/16-bit PPG .......... 276
8-bit Data Bus
Status of Each Pin in the External BUS 8-bit Data Bus
Mode ................................................. 164
A
A
Accumulator (A)................................................ 40
A/D Converter
Block Diagram of A/D Converter ...................... 295
Features of A/D Converter ................................ 292
Registers for A/D Converter.............................. 296
Accessing
Accessing Multi-byte Data.................................. 36
Accumulator
Accumulator (A)................................................ 40
Acknowledgement
Acknowledgement ........................................... 407
ADCR
Data Register (ADCR0/ADCR1) ....................... 302
ADCS
Control Status Register (ADCS0) ...................... 297
Control Status Register (ADCS1) ...................... 299
Address Generation
Address Generation Types .................................. 31
address Match Detection
Block Diagram of the address Match Detection
Function............................................. 412
Operation of the address Match Detection Function
......................................................... 415
System Configuration Example of the address Match
Detection Function.............................. 416
Addressing
Addressing ...................................................... 493
Addressing Slaves............................................ 406
Bank Addressing Types ...................................... 34
Direct Addressing ............................................ 495
Indirect Addressing .......................................... 501
ADSR
Setting Register (ADSR0/ADSR1) .................... 303
Alternative Mode
Alternative Mode ............................................. 427
Analog Input Enable Register
Analog Input Enable Register............................ 292
INDEX
Analog Input Enable Registers
Analog Input Enable Registers .......................... 195
Arbitration
Arbitration....................................................... 406
ARSR
Automatic Ready Function Selection Register
(ARSR).............................................. 177
Asynchronous LIN Mode
Operation in Asynchronous LIN Mode (Operation
Mode 3) ............................................. 368
Asynchronous Mode
Operation in Asynchronous Mode ..................... 363
Automatic Ready Function Selection Register
Automatic Ready Function Selection Register
(ARSR).............................................. 177
B
Bank Addressing
Bank Addressing Types ...................................... 34
Bank Select Prefix
Bank Select Prefix.............................................. 48
BAP
Buffer address Pointer (BAP)........................ 73, 92
Basic Configuration
Basic Configuration of MB90F867A(S) Serial
Programming Connection .................... 460
Baud Rate
Calculating the Baud Rate................................. 356
UART Baud Rate Selection .............................. 354
Baud Rate Generator Register
Baud Rate Generator Register (BGRn0/BGRn1)
.......................................................... 346
Baud Rate/Reload Counter Register
Baud Rate/Reload Counter Register ................... 346
Baud Rates
Suggested Division Ratios for Different Machine
Speeds and Baud Rates ........................ 357
BGRn
Baud Rate Generator Register (BGRn0/BGRn1)
.......................................................... 346
Bidirectional Communication
Bidirectional Communication Function .............. 372
Bit
SCC, MSS and INT Bit Competition.................. 394
Block Diagram
16-bit Free-running Timer Block Diagram.......... 210
Block Diagram of 16-bit I/O Timer.................... 207
Block Diagram of 16-bit Reload Timer .............. 244
Block Diagram of 8/16-bit PPG......................... 264
Block Diagram of A/D Converter ...................... 295
Block Diagram of Delayed Interrupt .................... 98
Block Diagram of DTP/external Interrupts ......... 282
Block Diagram of External Memory Access ....... 175
Block Diagram of Flash/Mask ROM Version ..........6
Block Diagram of MB90V340(S)...........................5
Block Diagram of Pull-up Control Register (RDR)
..........................................................194
Block Diagram of ROM Mirroring Module .........420
Block Diagram of the address Match Detection
Function .............................................412
Block Diagram of the Clock Generation Block
..........................................................104
Block Diagram of the Clock Monitor..................320
Block Diagram of the Entire Flash Memory ........425
Block Diagram of the Low-Power Consumption
Control Circuit ....................................141
Block Diagram of Timebase Timer.....................200
Block Diagram of UART ..................................327
Block Diagram of Watch Timer .........................256
Input Capture Block Diagram ............................229
Output Compare Block Diagram ........................217
Watch-dog Timer Block Diagram ......................238
Block Diagrams
Block Diagrams of the External Reset Pin...........130
Buffer address Pointer
Buffer address Pointer (BAP) ........................73, 92
Bus Control Signal Selection Register
Bus Control Signal Selection Register (ECSR)
..........................................................180
Bus Mode
Memory Space in Each Bus Mode......................173
Bus Pin Control Circuit
External Memory Access (Bus Pin Control Circuit)
..........................................................175
C
CCR
Condition Code Register (CCR) ...........................42
CE Control
Write, Data Polling, Read (CE Control) ..............554
Chip Erase
Chip Erase/Sector Erase Command Sequence
..........................................................555
Chips
Erasing All Data in the Flash Memory (Erasing Chips)
..........................................................446
Circuit
External Memory Access (Bus Pin Control Circuit)
..........................................................175
Circuits
Input-output Circuits ...........................................18
CKSCR
Configuration of the Clock Selection Register
(CKSCR) ............................................107
CLKR
Clock Output Enable Register (CLKR) ...............321
567
INDEX
Clock
Clock Supply Map............................................ 103
Clock Frequency
Oscillating Clock Frequency and Serial Clock Input
Frequency........................................... 463
Clock Generation Block
Block Diagram of the Clock Generation Block
.......................................................... 104
Clock Mode
Clock Mode ..................................................... 139
Clock Mode Transition ..................................... 113
Clock Modulator
Recommended Startup Sequence for the Clock
Modulator........................................... 123
Clock Modulator Control Register
Clock Modulator Control Register (CMCR)........ 121
Clock Modulator Control Register Contents........ 122
Clock Monitor
Block Diagram of the Clock Monitor ................. 320
Clock Output Enable Register
Clock Output Enable Register (CLKR)............... 321
Clock Prescaler
Clock Prescaler Settings.................................... 404
Clock Selection Register
Configuration of the Clock Selection Register
(CKSCR)............................................ 107
Clock Selection Registers
Clock Selection Registers.................................. 106
Clock Supply Map
Clock Supply Map............................................ 103
Clocks
Clocks............................................................. 102
CMCR
Clock Modulator Control Register (CMCR)........ 121
CMOD
Sample Output Waveform when CMOD[1:0]= 00B
.......................................................... 224
Sample Output Waveform when CMOD[1:0]= 10B
.......................................................... 226
Sample Output Waveform when CMOD[1:0]= 11B
.......................................................... 227
Sample Output Waveform with Two Compare
Registers when CMOD[1:0]= 01B ........ 225
CMR
Common Register Bank Prefix (CMR) ................. 49
Command
Command Sequence Table ................................ 431
Command Sequence Table
Command Sequence Table ................................ 431
Common Machine Clock Frequencies
Common Machine Clock Frequencies ................ 404
Common Register Bank Prefix
Common Register Bank Prefix (CMR) ................. 49
568
Communication
Bidirectional Communication Function .............. 372
LIN-master-slave Communication Function ....... 377
Master-slave Communication Function .............. 374
Compare Registers
Sample Output Waveform with Two Compare
Registers when CMOD[1:0]= 01B........ 225
Condition Code Register
Condition Code Register (CCR) .......................... 42
Connection
Connection of an Oscillator or an External Clock to the
Microcontroller................................... 118
Continuous Mode
Continuous Mode............................................. 307
Example of Starting of EI2OS in Continuous Mode
......................................................... 312
Control Status Register
Control Status Register ..................................... 231
Control Status Register (ADCS0) ...................... 297
Control Status Register (ADCS1) ...................... 299
Control Status Register of Free-running Timer
(Lower).............................................. 212
Control Status Register of Free-running Timer
(Upper) .............................................. 214
Control Status Register of Output Compare (Lower
Byte) ................................................. 219
Control Status Register of Output Compare (Upper
Byte) ................................................. 221
Conversion
Conversion Using EI2OS .................................. 309
Converted-data
Converted-data Protection Function ................... 316
Count Clock
Selecting a Count Clock for 8/16-bit PPG .......... 276
Counter Operation State
Counter Operation State ................................... 254
CPU
CPU Intermittent Operating Mode ..................... 139
CPU Intermittent Operation Mode ..................... 146
CPU Operating Modes and Current Consumption
......................................................... 138
Inter-CPU Connection Method .......................... 362
Outline of CPU Memory Space ........................... 29
Outline of the CPU............................................. 28
CPU Intermittent Operating Mode
CPU Intermittent Operating Mode ..................... 139
CPU Intermittent Operation Mode
CPU Intermittent Operation Mode ..................... 146
Current Consumption
CPU Operating Modes and Current Consumption 138
Cycle Number
Data Transferring Cycle Number (Internal Transfer)
........................................................... 95
INDEX
D
Data
Value in Data Counter ........................................ 88
Data Allocation
Multi-byte Data Allocation in Memory Space ....... 36
Data Counter
Data Counter (DCT)..................................... 72, 88
Data Direction Register
Data Direction Register .................................... 192
Data Polling Flag
Data Polling Flag (DQ7)................................... 435
Data Protection
Example of Flow of Data Protection Function (when
EI2OS is Used) ................................... 317
Data Register
Data Register (ADCR0/ADCR1) ....................... 302
Data Register of Free-running Timer.................. 211
Input Capture Data Register .............................. 230
Data Registers
Reception and Transmission Data Registers (RDR/
TDR) ................................................. 340
Data Transferring Cycle Number
Data Transferring Cycle Number (Internal Transfer)
............................................................ 95
DCSR
DMA Descriptor Channel Specification Register
(DCSR)................................................ 82
DCT
Data Counter (DCT)..................................... 72, 88
DDWR
Configuration of DMA Descriptor Window Register
(DDWR) .............................................. 87
Delayed Interrupt
Block Diagram of Delayed Interrupt .................... 98
Delayed Interrupt Occurrence............................ 100
Delayed Interrupt Cause Issuance/Cancellation
Register
Delayed Interrupt Cause Issuance/Cancellation
Register (DIRR: Delayed Interrupt Request
Register) .............................................. 99
DER
DMA Enable Register (DER) .............................. 86
Descriptor
Extended Intelligent I/O Service Descriptor (ISD)
............................................................ 72
Detection
Slave address Detection .................................... 405
Device
Handling the Device........................................... 23
Different Blocks
Explanation of the Different Blocks ................... 328
Direct Addressing
Direct Addressing ............................................ 495
Direct Memory access
Direct Memory access (DMA) .............................55
Direct Pin access
UART Direct Pin access....................................371
DIRR
Delayed Interrupt Cause Issuance/Cancellation
Register (DIRR: Delayed Interrupt Request
Register) ...............................................99
Division Ratios
Suggested Division Ratios for Different Machine
Speeds and Baud Rates.........................357
DMA
Direct Memory access (DMA) .............................55
Each Register of DMA Descriptor........................87
Intelligent I/O Service (EI2OS) Function, DMA and
Interrupts ............................................244
DMA Control Register
DMA Control Register (DMACS) ........................90
DMA Descriptor
Each Register of DMA Descriptor........................87
DMA Descriptor Channel Specification Register
DMA Descriptor Channel Specification Register
(DCSR) ................................................82
DMA Descriptor Window Register
Configuration of DMA Descriptor Window Register
(DDWR)...............................................87
DMA Enable Register
DMA Enable Register (DER) ..............................86
DMA Status Register
DMA Status Register (DSR) ................................84
DMA Stop Status Register
DMA Stop Status Register (DSSR) ......................85
DMAC
DMAC Operation ...............................................93
DMACS
DMA Control Register (DMACS) ........................90
DQ2
Toggle Bit-2 Flag (DQ2) ...................................440
DQ3
Sector Erase Timer Flag (DQ3)..........................439
DQ5
Timing Limit Exceeded Flag (DQ5) ...................438
DQ6
Toggle Bit Flag (DQ6) ......................................437
DQ7
Data Polling Flag (DQ7) ...................................435
DSR
DMA Status Register (DSR) ................................84
DSSR
DMA Stop Status Register (DSSR) ......................85
DTP
Conditions on the Behavior of External Circuit for the
DTP Function......................................290
569
INDEX
DTP Operation................................................. 288
Switching between External Interrupt and DTP
Requests............................................. 289
DTP/External Interrupts
DTP/External Interrupts Registers...................... 283
DTP/external Interrupts
Block Diagram of DTP/external Interrupts.......... 282
Outline of DTP/external Interrupts ..................... 282
E
ECCR
Extended Communication Control Register (ECCR)
.......................................................... 344
ECSR
Bus Control Signal Selection Register (ECSR)
.......................................................... 180
Effective Address
Effective Address Field............................. 494, 512
2
EI OS
Conversion Using EI2OS .................................. 309
EI2OS Operation Flow........................................ 76
Example of Flow of Data Protection Function (when
EI2OS is Used).................................... 317
Example of Starting of EI2OS in Continuous Mode
.......................................................... 312
Example of Starting of EI2OS in Single Mode
.......................................................... 310
Example of Starting of EI2OS in Stop Mode ....... 314
Extended Intelligent I/O Service (EI2OS) ....... 54, 70
Intelligent I/O Service (EI2OS) Function, DMA and
Interrupts............................................ 244
LIN-UART Interrupts and EI2OS....................... 349
UART EI2OS Functions.................................... 349
UART Interrupt and EI2OS ............................... 326
2
EI OS Status Register
EI2OS Status Register (ISCS) .............................. 74
EIRR
Interrupt/DTP Flags (EIRR: External Interrupt
Request Register) ................................ 284
ELVR
Request Level Setting Register (ELVR: External
Interrupt Level Register) ...................... 285
ENIR
Interrupt/DTP Enable Register (ENIR: External
Interrupt Request Enable Register)........ 284
Erase
Chip Erase/Sector Erase Command Sequence
.......................................................... 555
Detailed Explanation of Flash Memory Write/Erase
.......................................................... 442
Sector Erase Timer Flag (DQ3) ......................... 439
Erasing
Erasing All Data in the Flash Memory (Erasing Chips)
.......................................................... 446
570
Erasing Optional Data (Erasing Sectors) in the Flash
Memory ............................................. 447
Erasing Sectors in the Flash Memory ................. 447
Restarting Erasing of Flash Memory Sectors ...... 450
RY/BY Timing during Writing/Erasing.............. 557
Suspending Erasing of Flash Memory Sectors
......................................................... 449
Writing to/Erasing Flash Memory...................... 424
ESCR
Extended Status/Control Register (ESCR) .......... 342
Event Count Function
Outline of 16-bit Reload Timer (with Event Count
Function) ........................................... 244
Exceptions
Exceptions ........................................................ 55
Execution Cycle
Calculating the Execution Cycle Count .............. 510
Execution Cycle Count..................................... 509
Extended Communication Control Register
Extended Communication Control Register (ECCR)
......................................................... 344
Extended Intelligent I/O Service
Extended Intelligent I/O Service (EI2OS) ....... 54, 70
Extended Intelligent I/O Service Descriptor
Extended Intelligent I/O Service Descriptor (ISD)
........................................................... 72
Extended Status/Control Register
Extended Status/Control Register (ESCR) .......... 342
External Address Output Control Register
External Address Output Control Register (HACR)
......................................................... 179
External BUS
Status of Each Pin in the External BUS 16-bit Data
Bus Mode........................................... 162
Status of Each Pin in the External BUS 8-bit Data Bus
Mode ................................................. 164
External BUS 16-bit Data Bus Mode
Status of Each Pin in the External BUS 16-bit Data
Bus Mode........................................... 162
External BUS 8-bit Data Bus Mode
Status of Each Pin in the External BUS 8-bit Data Bus
Mode ................................................. 164
External Circuit
Conditions on the Behavior of External Circuit for the
DTP Function ..................................... 290
External Clock
Connection of an Oscillator or an External Clock to the
Microcontroller................................... 118
Using External Clock ....................................... 358
External Event Counter
External Event Counter .................................... 251
External Interrupt
External Interrupt Operation ............................. 287
External Interrupt Request Level ....................... 290
INDEX
Switching between External Interrupt and DTP
Requests............................................. 289
External Interrupt Level Register
Request Level Setting Register (ELVR: External
Interrupt Level Register)...................... 285
External Interrupt Request Enable Register
Interrupt/DTP Enable Register (ENIR: External
Interrupt Request Enable Register)........ 284
External Interrupt Request Register
Interrupt/DTP Flags (EIRR: External Interrupt
Request Register) ................................ 284
External Interrupt Source Select Register
External Interrupt Source Select Register ........... 286
External Memory Access
Block Diagram of External Memory Access ....... 175
External Memory Access (Bus Pin Control Circuit)
.......................................................... 175
External Memory Access Control Signal ............ 182
External Memory Access Registers.................... 176
External Reset
Block Diagrams of the External Reset Pin .......... 130
F
F2MC-16LX
F2MC-16LX Instruction List ............................. 516
Fetch
Mode Fetch ..................................................... 132
Sample of Input Capture Fetch Timing............... 235
Flag
Clearing Interrupt Flag ..................................... 290
Data Polling Flag (DQ7)................................... 435
Reception Interrupt Generation and Flag Set Timing
.......................................................... 350
Sector Erase Timer Flag (DQ3) ......................... 439
Timing Limit Exceeded Flag (DQ5)................... 438
Toggle Bit Flag (DQ6) ..................................... 437
Toggle Bit-2 Flag (DQ2) .................................. 440
Transmission Interrupt Generation and Flag Set
Timing ............................................... 352
Flag Change Disable Prefix
Flag Change Disable Prefix (NCC) ...................... 49
Flags
Hardware Sequence Flags ................................. 433
Flash
Block Diagram of Flash/Mask ROM Version ......... 6
Flash Memory
1M-bit Flash Memory Features ......................... 424
Block Diagram of the Entire Flash Memory........ 425
Detailed Explanation of Flash Memory Write/Erase
.......................................................... 442
Erasing All Data in the Flash Memory (Erasing Chips)
.......................................................... 446
Erasing Optional Data (Erasing Sectors) in the Flash
Memory ............................................. 447
Erasing Sectors in the Flash Memory..................447
Flash Memory Control Signals...........................427
Flash Memory Mode.........................................427
Notes on Using Flash Memory...........................451
Programming Example of 1M-bit Flash Memory
..........................................................454
Restarting Erasing of Flash Memory Sectors .......450
Sector Configuration of the 1M-bit Flash Memory
..........................................................425
Setting the Flash Memory to the Read/Reset State
..........................................................443
Suspending Erasing of Flash Memory Sectors
..........................................................449
Writing Data to the Flash Memory .....................444
Writing to the Flash Memory .............................444
Writing to/Erasing Flash Memory ......................424
Flash Memory Control Status Register
Flash Memory Control Status Register (FMCS)
..................................................424, 429
Flash Memory Mode
Flash Memory Mode.........................................427
Flash Microcomputer Programmer
Example of Minimum Connection to the Flash
Microcomputer
Programmer
(Power
Supplied from the Programmer) ............470
Example of Minimum Connection to the Flash
Microcomputer Programmer (User Power
Supply Used).......................................468
Flash Security
Behavior Under the Flash Security Feature..........453
How to Disable the Flash Security Feature ..........453
How to Enable the Flash Security Feature ...........453
Flow Charts
Programming Flow Charts.................................408
FMCS
Flash Memory Control Status Register (FMCS)
..................................................424, 429
Free-running Timer
16-bit Free-running Timer .................................206
16-bit Free-running Timer 0 and 1......................208
16-bit Free-running Timer Block Diagram ..........210
16-bit Free-running Timer Operation ..................215
16-bit Free-running Timer Timing......................216
Control Status Register of Free-running Timer
(Lower) ..............................................212
Control Status Register of Free-running Timer
(Upper)...............................................214
Data Register of Free-running Timer ..................211
Frequency
Oscillating Clock Frequency and Serial Clock Input
Frequency ...........................................463
G
General-purpose Registers
General-purpose Registers ...................................39
571
INDEX
H
HACR
External Address Output Control Register (HACR)
.......................................................... 179
Hardware
Hardware Sequence Flags ................................. 433
Initial Values of 8/16-bit PPG Hardware............. 279
Hardware Interrupt
Hardware Interrupt Operation.............................. 64
Occurrence and Release of Hardware Interrupt...... 65
Structure of Hardware Interrupt ........................... 63
Hardware Interrupts
Hardware Interrupts...................................... 52, 63
Hardware Sequence Flags
Hardware Sequence Flags ................................. 433
Hold Function
Hold Function .................................................. 186
I
I/O
I/O Area ............................................................ 30
I/O Map
I/O Map (79XX - 7FXX Addresses)................... 484
I/O Maps
I/O Maps (00H to FFH Addresses)..................... 476
I/O Port
I/O Port Registers............................................. 189
I/O Ports
I/O Ports.......................................................... 188
I/O Register address Pointer
I/O Register address Pointer (IOA) ................ 73, 89
I/O Timer
Block Diagram of 16-bit I/O Timer .................... 207
2
I C
I2C Bus Control Register (IBCR)....................... 391
I2C Bus Control Register (IBCR) Contents ......... 392
I2C Bus Status Register (IBSR) ......................... 388
I2C Bus Status Register (IBSR) Contents............ 389
I2C Clock Control Register (ICCR).................... 402
I2C Clock Control Register (ICCR) Contents ...... 403
I2C Data Register (IDAR) ................................. 401
I2C Data Register Contents ............................... 401
I2C Interface Registers...................................... 386
I2C Seven Bit Slave address Mask Register (ISMK)
.......................................................... 399
I2C Seven Bit Slave address Mask Register Contents
.......................................................... 400
I2C Seven Bit Slave address Register ................. 399
I2C Seven Bit Slave address Register Contents
.......................................................... 399
I2C Ten Bit address Mask Register (ITMK) ........ 398
I2C Ten Bit address Mask Register (ITMK) Contents
.......................................................... 398
I2C Ten Bit Slave address Register (ITBA)......... 397
572
I2C Ten Bit Slave address Register (ITBA) Contents
......................................................... 397
2
I C Bus Control Register
I2C Bus Control Register (IBCR) ...................... 391
I2C Bus Control Register (IBCR) Contents......... 392
2
I C Bus Status Register
I2C Bus Status Register (IBSR) ......................... 388
I2C Bus Status Register (IBSR) Contents ........... 389
I2C Clock Control Register
I2C Clock Control Register (ICCR) ................... 402
I2C Clock Control Register (ICCR) Contents...... 403
2
I C Data Register
I2C Data Register (IDAR)................................. 401
I2C Data Register Contents ............................... 401
I2C Interface
I2C Interface Registers ..................................... 386
2
I C Seven Bit Slave address Mask Register
I2C Seven Bit Slave address Mask Register (ISMK)
......................................................... 399
I2C Seven Bit Slave address Mask Register Contents
......................................................... 400
2
I C Seven Bit Slave address Register
I2C Seven Bit Slave address Register ................. 399
I2C Seven Bit Slave address Register Contents
......................................................... 399
I2C Ten Bit address Mask Register
I2C Ten Bit address Mask Register (ITMK)........ 398
I2C Ten Bit address Mask Register (ITMK) Contents
......................................................... 398
2
I C Ten Bit Slave address Register
I2C Ten Bit Slave address Register (ITBA) ........ 397
I2C Ten Bit Slave address Register (ITBA) Contents
......................................................... 397
IBCR
I2C Bus Control Register (IBCR) ...................... 391
I2C Bus Control Register (IBCR) Contents......... 392
IBSR
I2C Bus Status Register (IBSR) ......................... 388
I2C Bus Status Register (IBSR) Contents ........... 389
ICCR
I2C Clock Control Register (ICCR) ................... 402
I2C Clock Control Register (ICCR) Contents...... 403
ICE
Input Capture Edge Register (ICE01, ICE23, ICE45,
ICE67) ............................................... 233
ICR
Interrupt Control Register (ICR).......................... 58
IDAR
I2C Data Register (IDAR)................................. 401
ILM
Interrupt Level Mask Register (ILM) ................... 44
ILSR
Initialization of ILSR ....................................... 197
INDEX
Indirect Addressing
Indirect Addressing .......................................... 501
Input Capture
16-bit Input Capture ......................................... 209
Input Capture................................................... 229
Input Capture (2 Channels per One Module)....... 207
Input Capture Block Diagram............................ 229
Input Capture Data Register .............................. 230
Input Capture Input Timing............................... 235
Sample of Input Capture Fetch Timing............... 235
Input Capture Edge Register
Input Capture Edge Register (ICE01, ICE23, ICE45,
ICE67) ............................................... 233
Input Level Select Register
Input Level Select Register ............................... 196
Input-output Circuits
Input-output Circuits .......................................... 18
Instruction
Description of Instruction Presentation Items and
Symbols ............................................. 513
Exception Due to Execution of an Undefined
Instruction ............................................ 96
Execution of an Undefined Instruction ................. 96
F2MC-16LX Instruction List............................. 516
Instruction Types ............................................. 492
Structure of Instruction Map ............................. 530
Instructions
Interrupt Disable Instructions .............................. 50
Restrictions on Interrupt Disable Instructions and
Prefix Instructions................................. 50
INT Bit
SCC, MSS and INT Bit Competition.................. 394
Intelligent I/O Service
Intelligent I/O Service (EI2OS) Function, DMA and
Interrupts............................................ 244
Inter-CPU Connection Method
Inter-CPU Connection Method .......................... 362
Internal Clock
Internal Clock Operation of 16-bit Reload Timer
.......................................................... 250
Internal Clock Mode
Input Pin Functions of 16-bit Reload Timer (in
Internal Clock Mode) .......................... 251
Internal Transfer
Data Transferring Cycle Number (Internal Transfer)
............................................................ 95
Interrupt
Block Diagram of Delayed Interrupt .................... 98
Clearing Interrupt Flag ..................................... 290
Delayed Interrupt Occurrence............................ 100
Hardware Interrupt Operation.............................. 64
Interrupt Disable Instructions .............................. 50
Interrupt Flow.................................................... 61
Interval Interrupt Function ................................ 203
Interval Interrupt Function of Watch Timer ........ 259
Occurrence and Release of Hardware Interrupt ......65
Reception Interrupt Generation and Flag Set Timing
..........................................................350
Restrictions on Interrupt Disable Instructions and
Prefix Instructions..................................50
Software Interrupt Operation ...............................68
Structure of Hardware Interrupt ...........................63
Switching to a Standby Mode and Interrupt.........166
Transmission Interrupt Generation and Flag Set
Timing................................................352
Transmission Interrupt Request Generation Timing
..........................................................353
UART Interrupt and EI2OS ...............................326
Interrupt Causes
Interrupt Causes,Interrupt Vectors,and Interrupt
Control Registers .................................562
Interrupt Control Register
Interrupt Control Register (ICR) ..........................58
Interrupt Control Registers
Interrupt Causes,Interrupt Vectors,and Interrupt
Control Registers .................................562
Interrupt Disable Instructions
Interrupt Disable Instructions...............................50
Restrictions on Interrupt Disable Instructions and
Prefix Instructions..................................50
Interrupt Flag
Clearing Interrupt Flag ......................................290
Interrupt Level Mask Register
Interrupt Level Mask Register (ILM)....................44
Interrupt Vector
Interrupt Vector ..................................................56
Interrupt Vectors
Interrupt Causes,Interrupt Vectors,and Interrupt
Control Registers .................................562
List of Interrupt Vectors ..............................68, 560
Interrupt/DTP Enable Register
Interrupt/DTP Enable Register (ENIR: External
Interrupt Request Enable Register) ........284
Interrupt/DTP Flags
Interrupt/DTP Flags (EIRR: External Interrupt
Request Register).................................284
Interrupts
8/16-bit PPG Interrupts .....................................278
Hardware Interrupts ......................................52, 63
Intelligent I/O Service (EI2OS) Function, DMA and
Interrupts ............................................244
LIN-UART Interrupts .......................................347
LIN-UART Interrupts and EI2OS .......................349
Multiple Interrupts..............................................67
Software Interrupts .......................................53, 68
Structure of Software Interrupts ...........................68
Interval Interrupt
Interval Interrupt Function.................................203
Interval Interrupt Function of Watch Timer .........259
573
INDEX
IOA
I/O Register address Pointer (IOA) ................ 73, 89
ISCS
EI2OS Status Register (ISCS) .............................. 74
ISD
Extended Intelligent I/O Service Descriptor (ISD)
............................................................ 72
ISMK
I2C Seven Bit Slave address Mask Register (ISMK)
.......................................................... 399
ITBA
I2C Ten Bit Slave address Register (ITBA)......... 397
I2C Ten Bit Slave address Register (ITBA) Contents
.......................................................... 397
ITMK
I2C Ten Bit address Mask Register (ITMK) ........ 398
I2C Ten Bit address Mask Register (ITMK) Contents
.......................................................... 398
L
LIN
LIN-master-slave Communication Function........ 377
Operation in Asynchronous LIN Mode (Operation
Mode 3).............................................. 368
LIN-master-slave Communication
LIN-master-slave Communication Function........ 377
LIN-UART
LIN-UART Interrupts ....................................... 347
LIN-UART Interrupts and EI2OS....................... 349
Low-Power Consumption Control Circuit
Block Diagram of the Low-Power Consumption
Control Circuit .................................... 141
Low-Power Consumption Mode Control Register
Low-Power Consumption Mode Control Register
(LPMCR) ........................................... 143
LPMCR
Low-Power Consumption Mode Control Register
(LPMCR) ........................................... 143
M
Machine Clock
Common Machine Clock Frequencies ................ 404
Machine Clock................................................. 114
Machine Speeds
Suggested Division Ratios for Different Machine
Speeds and Baud Rates ........................ 357
Main Clock Mode
Main Clock Mode, PLL Clock Mode and Sub-clock
Mode ................................................. 113
Mask ROM
Block Diagram of Flash/Mask ROM Version.......... 6
Masking
Slave address Masking...................................... 406
574
Master Device
UART as Master Device................................... 378
Master-slave Communication
Master-slave Communication Function .............. 374
MB90F867A
Basic Configuration of MB90F867A(S) Serial
Programming Connection .................... 460
MB90V340
Block Diagram of MB90V340(S) .......................... 5
µDMAC
µDMAC Functions ............................................ 80
Memory Access Modes
Memory Access Modes .................................... 170
Memory Space
Memory Space in Each Bus Mode ..................... 173
Memory Space Map ........................................... 32
Multi-byte Data Allocation in Memory Space....... 36
Outline of CPU Memory Space ........................... 29
Microcontroller
Connection of an Oscillator or an External Clock to the
Microcontroller................................... 118
Minimum Connection
Example of Minimum Connection to the Flash
Microcomputer
Programmer
(Power
Supplied from the Programmer) ........... 470
Example of Minimum Connection to the Flash
Microcomputer Programmer (User Power
Supply Used)...................................... 468
Mode
Alternative Mode ............................................. 427
Clock Mode..................................................... 139
Clock Mode Transition ..................................... 113
Continuous Mode............................................. 307
CPU Intermittent Operating Mode ..................... 139
Example of Starting of EI2OS in Continuous Mode
......................................................... 312
Example of Starting of EI2OS in Single Mode
......................................................... 310
Example of Starting of EI2OS in Stop Mode....... 314
Flash Memory Mode ........................................ 427
Input Pin Functions of 16-bit Reload Timer (in
Internal Clock Mode) .......................... 251
Main Clock Mode, PLL Clock Mode and Sub-clock
Mode ................................................. 113
Memory Space in Each Bus Mode ..................... 173
Mode Data ...................................................... 172
Mode Fetch ..................................................... 132
Mode Pins ............................................... 131, 171
Operation in Asynchronous LIN Mode (Operation
Mode 3) ............................................. 368
Operation in Asynchronous Mode ..................... 363
Operation in Synchronous Mode (Operation Mode 2)
......................................................... 365
Operation Status during Standby Mode .............. 147
INDEX
Operation Status in Each Operating Mode Table
.......................................................... 160
Release of Sleep Mode ..................................... 149
Release of Stop Mode....................................... 157
Release of Timebase Timer Mode...................... 152
Release of Watch Mode .................................... 155
Signal Mode .................................................... 362
Single Mode 1/2............................................... 307
Standby Mode ................................................. 139
Status of Each Pin in the External BUS 16-bit Data
Bus Mode........................................... 162
Status of Each Pin in the External BUS 8-bit Data Bus
Mode ................................................. 164
Status of Each Pin in the Single Chip Mode........ 161
Status of Pins after Mode Data is Read............... 135
Stop Mode....................................................... 308
Switching to a Standby Mode and Interrupt ........ 166
Switching to Sleep Mode .................................. 149
Switching to the Stop Mode .............................. 156
Switching to the Timebase Timer Mode ............. 152
Switching to the Watch Mode ........................... 154
Mode Data
Mode Data ...................................................... 172
Status of Pins after Mode Data is Read............... 135
Mode Fetch
Mode Fetch ..................................................... 132
Mode Pins
Mode Pins ............................................... 131, 171
Modes
CPU Operating Modes and Current Consumption
.......................................................... 138
Memory Access Modes .................................... 170
Operation Modes of 8/16-bit PPG...................... 274
UART Operation Modes................................... 325
MSS
SCC, MSS and INT Bit Competition.................. 394
Multi-byte Data
Accessing Multi-byte Data.................................. 36
Multi-byte Data Allocation in Memory Space ....... 36
Multiple Interrupts
Multiple Interrupts ............................................. 67
Multiplier
Selection of a PLL Clock Multiplier .................. 114
N
NCC
Flag Change Disable Prefix (NCC) ...................... 49
O
Operand
24-bit Operand Specification............................... 33
Operating Mode
CPU Intermittent Operating Mode ..................... 139
Operation Status in Each Operating Mode Table
..........................................................160
Operating Modes
CPU Operating Modes and Current Consumption
..........................................................138
Operation Clock
Setting Operation Clock of Watch-dog Timer......259
Operation Enable Bit
Operation Enable Bit.........................................362
Operation Mode
CPU Intermittent Operation Mode......................146
Operation in Asynchronous LIN Mode (Operation
Mode 3) ..............................................368
Operation in Synchronous Mode (Operation Mode 2)
..........................................................365
Operation Mode Control Register
PPG0 Operation Mode Control Register (PPGC0)
..........................................................267
PPG1 Operation Mode Control Register (PPGC1)
..........................................................269
Operation Modes
Operation Modes of 8/16-bit PPG ......................274
UART Operation Modes ...................................325
Oscillating Clock Frequency
Oscillating Clock Frequency and Serial Clock Input
Frequency ...........................................463
Oscillation Stabilization Wait
Oscillation Stabilization Wait and Reset State .....129
Oscillation Stabilization Wait Interval ................117
Oscillation Stabilization Wait Time
Oscillation Stabilization Wait Time ....................167
Oscillation Stabilization Wait Times
Reset Causes and Oscillation Stabilization Wait Times
..........................................................128
Oscillator
Connection of an Oscillator or an External Clock to the
Microcontroller ...................................118
Output Compare
16-bit Output Compare......................................208
Control Status Register of Output Compare (Lower
Byte) ..................................................219
Control Status Register of Output Compare (Upper
Byte) ..................................................221
Output Compare ...............................................217
Output Compare (2 Channels per One Module)
..........................................................206
Output Compare Block Diagram ........................217
Output Compare Register ..................................218
Output Compare Timing....................................228
Output Compare Register
Clearing the Counter upon a Match with Output
Compare Register 0 .............................216
575
INDEX
Output Waveform
Sample Output Waveform when CMOD[1:0]= 00B
.......................................................... 224
Sample Output Waveform when CMOD[1:0]= 10B
.......................................................... 226
Sample Output Waveform when CMOD[1:0]= 11B
.......................................................... 227
Sample Output Waveform with Two Compare
Registers when CMOD[1:0]= 01B ........ 225
Overflow
Clearing the Counter By an Overflow................. 215
P
Package Dimensions
Package Dimensions............................................. 9
PACSR
Program address Detection Control Status Register
(PACSR) ............................................ 414
PADR
Program address Detection Registers (PADR0 to
PADR5) ............................................. 413
PC
Program Counter (PC) ........................................ 45
Pin Assignment
Pin Assignment .................................................... 7
Pin Functions
Pin Functions ..................................................... 11
PLL Clock Mode
Main Clock Mode, PLL Clock Mode and Sub-clock
Mode ................................................. 113
PLL Clock Multiplier
Selection of a PLL Clock Multiplier................... 114
PLL/Subclock Control Register
Configuration of the PLL/Subclock Control Register
(PSCCR) ............................................ 111
Polling
Data Polling..................................................... 556
Data Polling Flag (DQ7) ................................... 435
Write, Data Polling, Read (CE Control).............. 554
Write, Data Polling,Read (WE Control).............. 553
Port Data Register
Port Data Register ............................................ 190
Power Supplied
Example of Serial Programming Connection (Power
Supplied from the Programmer)............ 466
Power Supply
Example of Serial Programming Connection (User
Power Supply Used) ............................ 464
PPG
8/16-bit PPG Interrupts ..................................... 278
8/16-bit PPG Output Operation.......................... 275
8/16-bit PPG Registers...................................... 266
Block Diagram of 8/16-bit PPG ......................... 264
576
Controlling Pin Output of 8/16-bit PPG Pulses
......................................................... 277
Function of 8/16-bit PPG .................................. 262
Initial Values of 8/16-bit PPG Hardware ............ 279
Operation Modes of 8/16-bit PPG...................... 274
Operations of 8/16-bit PPG ............................... 274
PPG0 Operation Mode Control Register (PPGC0)
......................................................... 267
PPG1 Operation Mode Control Register (PPGC1)
......................................................... 269
Relationship between 8/16-bit PPG Reload Value and
Pulse Width........................................ 275
Selecting a Count Clock for 8/16-bit PPG .......... 276
PPG0/PPG1 Clock Select Register
PPG0/PPG1 Clock Select Register (PPG01) ....... 271
PPG01
PPG0/PPG1 Clock Select Register (PPG01) ....... 271
PPGC
PPG0 Operation Mode Control Register (PPGC0)
......................................................... 267
PPG1 Operation Mode Control Register (PPGC1)
......................................................... 269
Prefix
Bank Select Prefix ............................................. 48
Common Register Bank Prefix (CMR)................. 49
Consecutive Prefix Codes ................................... 50
Flag Change Disable Prefix (NCC) ...................... 49
Restrictions on Interrupt Disable Instructions and
Prefix Instructions................................. 50
Presentation Items
Description of Instruction Presentation Items and
Symbols ............................................. 513
PRLH
Reload Register (PRLL/PRLH) ......................... 273
PRLL
Reload Register (PRLL/PRLH) ......................... 273
Processor Status
Processor Status (PS) ......................................... 42
Product Overview
Product Overview ................................................ 2
Program address Detection Control Status Register
Program address Detection Control Status Register
(PACSR)............................................ 414
Program address Detection Registers
Program address Detection Registers (PADR0 to
PADR5) ............................................. 413
Program Counter
Program Counter (PC) ........................................ 45
Program Patch Processing
Example of Program Patch Processing ............... 417
Programmable Restart
Programmable Restart ...................................... 359
INDEX
Programmer
Example of Serial Programming Connection (Power
Supplied from the Programmer)............ 466
Programming
Programming Flow Charts ................................ 408
Programming Example
Programming Example of 1M-bit Flash Memory
.......................................................... 454
Protect
Enable Sector Protect/Verify Sector Protect........ 558
Temporary Sector Protect Cancellation .............. 559
Protection
Converted-data Protection Function ................... 316
Example of Flow of Data Protection Function (when
EI2OS is Used) ................................... 317
PS
Processor Status (PS).......................................... 42
PSCCR
Configuration of the PLL/Subclock Control Register
(PSCCR) ............................................ 111
PUCR
Pull-up Control Register (PUCR) ...................... 194
Pull-up Control Register
Block Diagram of Pull-up Control Register (RDR)
.......................................................... 194
Pull-up Control Register (PUCR) ...................... 194
Pulse Width
Relationship between 8/16-bit PPG Reload Value and
Pulse Width ........................................ 275
R
RAM
RAM Area ........................................................ 30
RDR
Block Diagram of Pull-up Control Register (RDR)
.......................................................... 194
Reception and Transmission Data Registers (RDR/
TDR) ................................................. 340
Read access
Data Read By Read access ................................ 552
Ready Function
Ready Function................................................ 184
Reception
Reception and Transmission Data Registers (RDR/
TDR) ................................................. 340
Reception Interrupt
Reception Interrupt Generation and Flag Set Timing
.......................................................... 350
Recommended Setting
Recommended Setting...................................... 173
Recommended Startup Sequence
Recommended Startup Sequence for the Clock
Modulator .......................................... 123
Register Bank
Register Bank.....................................................46
Register Bank Pointer
Register Bank Pointer (RP)..................................43
Reload Register
Register Layout of 16-bit Timer Register (TMR)/16bit Reload Register (TMRLR)...............249
Reload Register (PRLL/PRLH)..........................273
Reload Timer
16-bit Reload Timer Register .............................245
Block Diagram of 16-bit Reload Timer ...............244
Input Pin Functions of 16-bit Reload Timer (in
Internal Clock Mode) ...........................251
Internal Clock Operation of 16-bit Reload Timer
..........................................................250
Outline of 16-bit Reload Timer (with Event Count
Function) ............................................244
Output Pin Functions of 16-bit Reload Timer ......253
Underflow Operation of 16-bit Reload Timer ......252
Reload Value
Relationship between 8/16-bit PPG Reload Value and
Pulse Width.........................................275
Request Level Setting Register
Request Level Setting Register (ELVR: External
Interrupt Level Register) ......................285
Reset
Block Diagrams of the External Reset Pin...........130
Causes of a Reset..............................................126
Correspondence between Reset Cause Bits and Reset
Causes ................................................133
Oscillation Stabilization Wait and Reset State .....129
Overview of Reset Operation .............................131
Reset Cause Bits...............................................133
Reset Causes and Oscillation Stabilization Wait Times
..........................................................128
Status of Pins during a Reset..............................135
Reset Cause Bits
Correspondence between Reset Cause Bits and Reset
Causes ................................................133
Notes about Reset Cause Bits.............................134
Reset Cause Bits...............................................133
Restart
Programmable Restart .......................................359
ROM
Block Diagram of Flash/Mask ROM Version ..........6
ROM Area .........................................................30
ROM Mirroring Module
Block Diagram of ROM Mirroring Module .........420
ROM Mirroring Register
ROM Mirroring Register (ROMM) ....................421
ROM Security
Overview of ROM Security Function .................474
ROMM
ROM Mirroring Register (ROMM) ....................421
577
INDEX
RP
Register Bank Pointer (RP) ................................. 43
RST
RST and RY/BY Timing................................... 557
RY/BY
RST and RY/BY Timing................................... 557
RY/BY Timing during Writing/Erasing .............. 557
S
SCC
SCC, MSS and INT Bit Competition.................. 394
SCR
Serial Control Register (SCR)............................ 334
Sector
Enable Sector Protect/Verify Sector Protect ........ 558
Sector Configuration of the 1M-bit Flash Memory
.......................................................... 425
Sector Erase Timer Flag (DQ3) ......................... 439
Temporary Sector Protect Cancellation............... 559
Sector Erase
Chip Erase/Sector Erase Command Sequence
.......................................................... 555
Sector Erase Timer Flag
Sector Erase Timer Flag (DQ3) ......................... 439
Sector Protect
Enable Sector Protect/Verify Sector Protect ........ 558
Sectors
Erasing Optional Data (Erasing Sectors) in the Flash
Memory ............................................. 447
Erasing Sectors in the Flash Memory ................. 447
Restarting Erasing of Flash Memory Sectors....... 450
Suspending Erasing of Flash Memory Sectors
.......................................................... 449
Security
Behavior Under the Flash Security Feature ......... 453
How to Disable the Flash Security Feature.......... 453
How to Enable the Flash Security Feature........... 453
Serial Clock Input Frequency
Oscillating Clock Frequency and Serial Clock Input
Frequency........................................... 463
Serial Control Register
Serial Control Register (SCR)............................ 334
Serial Mode Register
Serial Mode Register (SMR) ............................. 336
Serial Programming Connection
Basic Configuration of MB90F867A(S) Serial
Programming Connection..................... 460
Example of Serial Programming Connection (Power
Supplied from the Programmer)............ 466
Example of Serial Programming Connection (User
Power Supply Used) ............................ 464
Serial Status Register
Serial Status Register (SSR) .............................. 338
578
Setting Register
Setting Register (ADSR0/ADSR1) .................... 303
Signal Mode
Signal Mode .................................................... 362
Single Chip Mode
Status of Each Pin in the Single Chip Mode........ 161
Single Mode
Example of Starting of EI2OS in Single Mode
......................................................... 310
Single Mode 1/2 .............................................. 307
Slave address
Slave address Detection .................................... 405
Slave address Masking ..................................... 406
Slave Device
UART as Slave Device..................................... 379
Sleep Mode
Release of Sleep Mode ..................................... 149
Switching to Sleep Mode .................................. 149
SMR
Serial Mode Register (SMR) ............................. 336
Software Interrupt
Software Interrupt Operation............................... 68
Software Interrupts
Software Interrupts....................................... 53, 68
Structure of Software Interrupts........................... 68
Special Registers
Special Registers................................................ 37
SSP
User Stack Pointer (USP) and System Stack Pointer
(SSP) ................................................... 41
SSR
Serial Status Register (SSR).............................. 338
Stack Pointer
User Stack Pointer (USP) and System Stack Pointer
(SSP) ................................................... 41
Standby Mode
Operation Status during Standby Mode .............. 147
Standby Mode ................................................. 139
Switching to a Standby Mode and Interrupt ........ 166
Startup Sequence
Recommended Startup Sequence for the Clock
Modulator .......................................... 123
Status Change Diagram
Status Change Diagram .................................... 159
Stop Mode
Example of Starting of EI2OS in Stop Mode....... 314
Release of Stop Mode....................................... 157
Stop Mode....................................................... 308
Switching to the Stop Mode .............................. 156
Sub-clock Mode
Main Clock Mode, PLL Clock Mode and Sub-clock
Mode ................................................. 113
INDEX
Symbols
Description of Instruction Presentation Items and
Symbols ............................................. 513
Synchronization Methods
Synchronization Methods ................................. 362
Synchronous Mode
Operation in Synchronous Mode (Operation Mode 2)
.......................................................... 365
System Stack Pointer
User Stack Pointer (USP) and System Stack Pointer
(SSP) ................................................... 41
T
TBTC
Timebase Timer Control Register (TBTC).......... 201
TDR
Reception and Transmission Data Registers (RDR/
TDR) ................................................. 340
Temporary Sector Protect
Temporary Sector Protect Cancellation .............. 559
Timebase Counter
Timebase Counter Clear ................................... 203
Timebase Timer
Block Diagram of Timebase Timer .................... 200
Outline of Timebase Timer ............................... 200
Timebase Timer Control Register
Timebase Timer Control Register (TBTC).......... 201
Timebase Timer Mode
Release of Timebase Timer Mode...................... 152
Switching to the Timebase Timer Mode ............. 152
Timer Control Register
Register Contents of Timer Control Register
(TMCSR) ........................................... 246
Register Layout of Timer Control Register (TMCSR)
.......................................................... 246
Timer Register
Register Layout of 16-bit Timer Register (TMR)/16bit Reload Register (TMRLR) .............. 249
Timing Limit Exceeded Flag
Timing Limit Exceeded Flag (DQ5)................... 438
TMCSR
Register Contents of Timer Control Register
(TMCSR) ........................................... 246
Register Layout of Timer Control Register (TMCSR)
.......................................................... 246
TMR
Register Layout of 16-bit Timer Register (TMR)/16bit Reload Register (TMRLR) .............. 249
TMRLR
Register Layout of 16-bit Timer Register (TMR)/16bit Reload Register (TMRLR) .............. 249
Toggle
Toggle Bit Flag (DQ6) ..................................... 437
Toggle Bit-2 Flag (DQ2) ...................................440
Toggle Bit
Toggle Bit........................................................556
Toggle Bit Flag
Toggle Bit Flag (DQ6) ......................................437
Toggle Bit-2 Flag
Toggle Bit-2 Flag (DQ2) ...................................440
Transferring
Data Transferring Cycle Number (Internal Transfer)
............................................................95
Transmission Data Registers
Reception and Transmission Data Registers (RDR/
TDR)..................................................340
Transmission Interrupt
Transmission Interrupt Generation and Flag Set
Timing................................................352
Transmission Interrupt Request Generation Timing
..........................................................353
U
UART
Block Diagram of UART ..................................327
Notes on Using UART ......................................380
Operation of UART ..........................................361
UART as Master Device ...................................378
UART as Slave Device .....................................379
UART Baud Rate Selection ...............................354
UART Direct Pin access....................................371
UART EI2OS Functions ....................................349
UART Functions ..............................................324
UART Interrupt and EI2OS ...............................326
UART Operation Modes ...................................325
UART Pins ......................................................332
UART Registers ...............................................333
Undefined Instruction
Exception Due to Execution of an Undefined
Instruction.............................................96
Execution of an Undefined Instruction..................96
Underflow
Underflow Operation of 16-bit Reload Timer ......252
User Power Supply
Example of Serial Programming Connection (User
Power Supply Used) ............................464
User Stack Pointer
User Stack Pointer (USP) and System Stack Pointer
(SSP)....................................................41
USP
User Stack Pointer (USP) and System Stack Pointer
(SSP)....................................................41
W
Watch Mode
Release of Watch Mode ....................................155
Switching to the Watch Mode ............................154
579
INDEX
Watch Timer
Block Diagram of Watch Timer......................... 256
Interval Interrupt Function of Watch Timer......... 259
Watch Timer.................................................... 259
Watch Timer Register....................................... 256
Watch Timer Control Register
Watch Timer Control Register (WTC)................ 257
Watch-dog Counter
Watch-dog Counter .......................................... 241
Watch-dog Stop
Watch-dog Stop ............................................... 241
Watch-dog Timer
Setting Operation Clock of Watch-dog Timer ..... 259
Watch-dog Timer Block Diagram ...................... 238
580
Watch-dog Timer Control Register
Watch-dog Timer Control Register (WDTC) ...... 239
WDTC
Watch-dog Timer Control Register (WDTC) ...... 239
WE Control
Write, Data Polling, Read (WE Control) ............ 553
Write
Detailed Explanation of Flash Memory Write/Erase
......................................................... 442
Writing
RY/BY Timing during Writing/Erasing.............. 557
Writing Data to the Flash Memory..................... 444
Writing to the Flash Memory ............................ 444
Writing to/Erasing Flash Memory...................... 424
WTC
Watch Timer Control Register (WTC) ............... 257
CM44-10130-2E
FUJITSU SEMICONDUCTOR • CONTROLLER MANUAL
F2MC-16LX
16-BIT MICROCONTROLLER
MB90860A Series
HARDWARE MANUAL
July 2006 the second edition
Published
FUJITSU LIMITED
Edited
Business Promotion Dept.
Electronic Devices