Thank you very much for your continued patronage of Fujitsu semiconductor products.
The MB90360 series has b een developed as a ge neral-purpose version of the F
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 MB90360 series for engineers who actually
use the MB90360 series to design products. Please read this manual first.
■ Tr ademark
2
F
MC, an abbreviation of FUJIT SU Flexible Microco ntroller, is a registered trademark of FUJITSU
Ltd.
Embedded Algorithm is a registered trademark of Advanced Micro Devices Inc.
■ Structure of this preliminary manual
This manual contains the following 26 chapters and appendix.
2
MC-16LX family,
CHAPTER 1 OVERVIEW
2
The MB90360 Series is a family member of the F
CHAPTER 2 CPU
This chapter explains the CPU.
CHAPTER 3 INTERRUPTS
This chapter explains the interrupts and function and op eration of the extended intelligent I/O
service in the MB90360 series.
CHAPTER 4 DELAYED INTERRUPT GENERATION MODULE
This chapter explains the functions and operations of the delayed interrupt generation module.
CHAPTER 5 CLOCKS
This chapter explains the clocks used by MB90360 series microcontrollers.
CHAPTER 6 CLOCK SUPERVISOR
This chapter explain s the function and the operation of the cloc k supervisor. Only the product
with built-in clock supervisor of the MB90360 series is valid to this function.
CHAPTER 7 RESETS
This chapter describes resets for the MB90360-series microcontrollers.
CHAPTER 8 LOW-POWER CONSUMPTION MODE
MC-16LX micro controllers.
This chapter explains the low-power consumption mode of MB90360 series microcontrollers.
CHAPTER 9 MEMORY ACCESS MODES
This chapter explains the functions and operations of the memory access modes.
i
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 WATCHDOG TIMER
This chapter describes the function and operation of the watchdog timer.
CHAPTER 13 16-Bit I/O TIMER
This chapter explains the function and operation of the 16- bit I/O timer.
CHAPTER 14 16-BIT RELOAD TIMER
This chapter describes the functions and operation of the 16-bit reload timer.
CHAPTER 15 WATCH TIMER
This chapter describes the functions and operations of the watch timer.
CHAPTER 16 8-/16-BIT PPG TIMER
This chapter describes the functions and operations of the 8-/16-bit PPG timer.
CHAPTER 17 DTP/EXTERNAL INTERRUPTS
This chapter explains the functions and operations of DTP/external interrupt.
CHAPTER 18 8-/10-BIT A/D CONVERTER
This chapter explains the functions and operation of 8-/10-bit A/D converter.
CHAPTER 19 LOW VOLTAGE DETECTION/CPU OPERATING DETECTION RESET
This chapter explains the function and operating the low voltage detection/CPU operating
detection reset. This function can use only the product with "T" suffix of MB90360 series.
CHAPTER 20 LIN-UART
This chapter explains the functions and operation of LIN-UART.
CHAPTER 21 CAN CONTROLLER
This chapter explains the functions and operations of the CAN controller.
CHAPTER 22 ADDRESS MATCH DETECTION FUNCTION
This chapter explains the address match detection function and its operation.
CHAPTER 23 ROM MIRRORING MODULE
This chapter describes the functions and operations of the ROM mirroring function select
module.
CHAPTER 24 512K-BIT FLASH MEMORY
This chapter explains the functions and operation of the 512K-bit flash mem ory. 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”.
ii
CHAPTER 25 EXAMPLES OF MB90F362/T(S), MB90F367/T(S) SERIAL PROGRAMMING
CONNECTION
This chapter shows an examp le of a serial programming connection using the AF220/AF210/
AF120/AF110 Flas h Micro-computer Programmer by Yo kogawa Digital Computer Corporation
when the AF220/AF210/AF120/AF110 flash serial microcontroller programer from Yokogawa
Digital Computer Corporation is used.
CHAPTER 26 ROM SECURITY FUNCTION
This chapter explains the ROM security function.
APPENDIX
The appendixes provide I/O maps, instructions, and other information.
iii
• 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.
APPENDIX A I/O Maps .............................................................................................................................. 568
APPENDIX B Instructions ........................................................................................................................... 576
APPENDIX C Timing Diagrams in Flash Memory Mode ............................................................................ 636
APPENDIX D List of Interrupt Vectors ........................................................................................................ 644
2
MC-16LX Instruction List ............................................................................................................ 600
xii
CHAPTER 1
OVERVIEW
The MB90360 Series is a family member of the F2MC16LX micro controllers.
1.1 Overview of MB90360
1.2 Block Diagram of MB90360 series
1.3 Package Dimensions
1.4 Pin Assignment
1.5 Pin Functions
1.6 Input-Output Circuits
1.7 Handling Device
1
CHAPTER 1 OVERVIEW
1.1Overview of MB90360
The MB90360 Series is a 16-bit micr ocont roller designed for automotive applications
and contains CAN function, capture, compare timer, A/D converter, and so on.
■ Features of MB9036 0 Seri es
MB90360 series has the following features:
Clock
●
• Built-in PLL clock multiplying circuit
• Machine clock (PLL clock) selectable from 1/2 frequency of oscillation clock or 1 to 6-multiplied
oscillation clock (4 MHz to 24 MHz when oscillation clock is 4 MHz)
Maintains I/O timer value by pin input (rising edge, falling edge, or both edges) and generates
interrupt.
2 channels8 channels
Supports 8-bit and 16-bit operation modes
Four 8-bit reload counter
Four 8-bit reload registers for L pulse width
Four 8-bit reload registers for H pulse width
Supports 8-bit and 16-bit operation modes
Sixteen 8-bit reload counter
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 coun ter or as 8-bit prescaler
plus 8-bit reload counter
Operation clock freq.: fsys, fsys/2
1
, fsys/22, fsys/23, fsys/24 or 102.4 µs fosc=@5MHz
Conforms to CAN Specification Version 2.0 Part A and B
Automatic re-transmission in case of error
Automatic transmission responding to Remote Frame
16 message buffers for transmission/reception
Supports multiple messages
Flexible configuration of acceptance filtering:
• Full bit compare/Full bit mask/2 partial bit masks
• Supports up to 1 Mbps communication
External interrupt (8
Can be programmed edge sensitive or level sensitive
- 36 ports (product with S-suffix)
Input level setting:
- Port2, Port4, Port6, Port8: s electable from
CMOS/Automotive level
Supports general-purpose I/O (CMOS output):
- 80 ports (product without S-suffix)
- 82 ports (product with S-suffix)
Input level setting
- Port 0 to Port 3: selectable from CMOS/
Automotive/TTL level
- Port 4 to Port A: selectable from CMOS/
Automotive level
Flash memory
Supports automatic progr amming, Embedded Algorit hm
commands
A flag indicating completion of the algorithm
Number of erase cycles: 10,000 times
Data retention time: 20 years
Flash Security Feature for protecting the content of the Flash
ROM securityProtects the content of ROM (MASK ROM
product only)
*:Embedded Algorithm is a registered trademark of Advanced Micro Device Inc.
TM*
, Write/Erase/Erase-Suspend/Resume
-
8
1.2Block Diagram of MB90360 series
Figure 1.2-3 shows a block diagram of the MB90360.
■ Block Diagram of Evaluation Chip
Figure 1.2-1 Block Diagram of Evaluation Chip (MB90V340A-101/102)
CHAPTER 1 OVERVIEW
X0, X1
X0A, X1A *
RST
SOT4 to SOT0
SCK4 to SCK0
SIN4 to SIN0
AV
CC
AV
SS
AN23 to AN0
AVRH
AVRL
ADTG
DA01, DA00
PPGF to PPG0
Clock
control
RAM 30KB
Prescaler
(5 channels)
UART
(5 channels)
8-/10-bit
A/D
converter
24 channels
10-bit
D/A
converter
2 channels
8-/16-bit
PPG
16 channels
2
MC-16LX core
F
Internal data bus
16-bit
I/O timer 0
Input
capture
8 channels
Output
compare
8 channels
16-bit
I/O timer 1
CAN
controller
3 channels
16-bit
reload
timer
4 channels
External
bus
FRCK0
IN7 to IN0
OUT7 to OUT0
FRCK1
RX2 to RX0
TX2 to TX0
TIN3 to TIN0
TOT3 to TOT0
AD15 to AD00
A23 to A16
ALE
RD
WRL
WRH
HRQ
HAK
RDY
CLK
SDA1, SDA0
SCL1, SCL0
I2C
interface
2channels
DMA
*: Support MB90V340A-102 only
DTP/
external
interrupt
Clock
monitor
INT15 to INT8
(INT15R to INT8R)
INT7 to INT0
CKOT
9
CHAPTER 1 OVERVIEW
Figure 1.2-2 Block Diagram of Evaluation Chip (MB90V340A-103/104)
X0,X1
X0A,X1A
RST
SOT4 to SOT0
SCK4 to SCK0
SIN4 to SIN0
AV
cc
AV
ss
AN23 to AN0
AVRH
AVRL
ADTG
DA01 , DA00
PPGF to PPG0
SDA1 , SDA0
SCL1 , SCL0
*
Clock
control
CR
oscillation
circuit
RAM 30KB
Prescaler
(5 channels)
UART
5 channels
8-/10-bit
A/D
converter
24 channels
F2MC-16LX core
16-bit
I/O timer 0
Input
capture
8 channels
Output
compare
8 channels
16-bit
I/O timer 1
CAN
controller
3 channels
16-bit
reload timer
4 channels
FRCK0
IN7 to IN0
OUT7 to OUT0
FRCK1
RX2 to RX0
TX2 to TX0
TIN3 to TIN0
TOT3 to TOT0
AD15 to AD00
Internal data bus
A23 to A16
ALE
10-bit D/A
converter
2 channels
External
bus
RD
WRL
WRH
HRQ
8-/16-bit
PPG
16 channels
2
I
C
Interface
2 channels
DTP/
external
interrupt
INT15 to INT8
(INT15R to INT8R)
INT7 to INT0
HAK
RDY
CLK
10
DMA
: Support MB90V340A-104 only
*
Clock
monitor
CKOT
■ Block Diagram of Flash/Mask ROM Version
Figure 1.2-3 Block Diagram of Flash/Mask ROM Version
CHAPTER 1 OVERVIEW
X0A,X1A *
SOT0,SOT1
SCK0,SCK1
SIN0,SIN1
X0,X1
RST
1
Clock
control/
monitor *
CR
oscillation
circuit
Low voltage
detection*
CPU operation
detection*
RAM
3KB
ROM
64KB
Prescaler
(2 channels)
UART
2 channels
3
F2MC-16LX core
Input
capture
IN0 to IN3
4 channels
2
2
Internal data bus
16-bit
I/O
timer 0
CAN
controller
1 chnnal
16-bit
reload
timer
FRCK0
RX1
TX1
TIN2,TIN3
TOT2,TOT3
2 channels
AV
CC
AV
SS
AN15 to AN0
AVR
8/10-bit
A/D
converter
16 channels
ADTG
INT8,INT9R
INT10,INT11
INT12R,INT13
INT14R,INT15R
PPGF(E),PPGD(C),
PPGC(D),PPGE(F)
8/16bit
PPG
2 channels
DTP/
external
interrupt
*1: Product without S-suffix
*2: Product with T-suffix
*3: CR oscillation circuit/clock supervisor supports MB90367/T(S), MB90F367/T(S) only
11
CHAPTER 1 OVERVIEW
1.3Package Dimensions
MB90360 series has a package.
Note that the dimensions show below are reference dimensions. For formal dimensions
of each package, contact us.
■ Package Dimensions
Figure 1.3-1 shows the package dimensions of LQFP-48 type.
Figure 1.3-1 Package Dimensions of LQFP-48 Type
48-pin plastic LQFPLead pitch0.50 mm
(FPT-48P-M26)
48-pin plastic LQFP
(FPT
-48P-M26)
9.00±0.20(.354±.008)SQ
+0.40
*
.276
7.00
–0.10
36
37
+.016
–.004
Package width ×
package length
7 × 7 mm
Lead shapeGullwing
Sealing methodPlastic mold
Mounting height1.70 mm MAX
Weight0.17 g
Code
(Reference)
Note 1)* : These dimensions include resin protrusion.
Note 2) Pins width and pins thickness include plating thickness.
Note 3) Pins width do not include tie bar cutting remainder.
SQ
25
24
0.145±0.055
(.006±.002)
P-LFQFP48-7×7-0.50
12
INDEX
48
1
LEAD No.
0.50(.020)
C
2003 FUJITSU LIMITED F48040S-c-2-2
12
0.20±0.05
(.008±.002)
13
0.08(.003)
0.08(.003)
"A"
M
Details of "A" part
+0.20
1.50
–0.10
(Mounting height)
+.008
.059
–.004
0.10±0.10
0˚~8˚
0.60±0.15
(.024±.006)
Dimensions in mm (inches).
Note: The values in parentheses are reference values.
(.004±.004)
0.25(.010)
(Stand off)
1.4Pin Assignment
This section shows the pin assignments for the MB90360 series.
■ Pin assignment (LQFP-48)
Figure 1.4-1 shows the pin assignments of LQFP-48 type.
CMOS hysteresis inputs
(with the sta ndby-time inpu t shutdown
No
function)
Automotive input
R
Hysteresis input
Automotive input
Standby control for
input shutdown
Analog input
(with the sta ndby-time inpu t shutdown
function)
A/D analog input
IPower supply input protection circuit
JCMOS level output
(I
Pull-up control
= 20 mA, IOH =-14 mA)
OL
CMOS hysteresis inputs
High current output
Pout
(with the sta ndby-time inpu t shutdown
function)
Automotive inputs
High current output
Nout
R
Hysteresis input
Automotive input
Standby control for
input shutdown
(with the sta ndby-time inpu t shutdown
function)
Programmable pull-up resistor: approx. 50 kΩ
19
CHAPTER 1 OVERVIEW
r
Table 1.6-1 I/O Circuit Types (4/4)
TypeCircuitRemarks
KCMOS level output
(I
= 4 mA, IOH = -4 mA)
OL
Pout
CMOS hysteresis inputs
(with the standby-time input shutdown
function)
Nout
R
CMOS input
Automotive input
Standby control fo
input shutdown
Automotive hysteresis inputs
(with the standby-time input shutdown
function)
20
1.7Handling Device
This section explains notes on handling the MB90360 series.
■ Handling the Device
Preventing latch-up
●
CMOS IC chips may suffer latch-up under the following conditions:
• A voltage higher than V
• A voltage higher than the rated voltage is applied between V
•The AV
Latch-up may increase the power supply current drastically, causing thermal damage to the device.
When used, note that maximum rated voltage is not exceeded.
For the same reason, also be careful not to let the analog power-supply voltage (AV
digital power-supply volt age.
power supply is applied before the VCC voltage.
CC
or lower than VSS is applied to an input or output pin.
CC
and VSS.
CC
CHAPTER 1 OVERVIEW
AVR) exceed the
CC,
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.
21
CHAPTER 1 OVERVIEW
Using external clock
●
To use external clock, drive the X0 (X0A) pin and leave X1 (X1A) pin open.
Figure 1.7-1 Using External Clock
MB90360 series
X0 (X0A)
Open
Precautions for when not using a sub clock signal
●
If you do not connect pins X0A and X1A to an os cillator, 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 attempts to be working with the free-running
frequency of self-oscillating circuit in the PLL 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 V
and VSS pins, from the point of view of device design, pins to be of the same
CC
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 V
• Connect V
and VSS pins to the power supply and ground externally (see Figure 1.7-2 ).
CC
and VSS to the device from the power supply source with lowest possible impedance.
CC
• It is recommended to connect a capacitor of about 0.1 µF as a bypass capacitor between V
the vicinity of V
and VSS pins of the device
CC
X1 (X1A)
and VSS in
CC
22
CHAPTER 1 OVERVIEW
Pull-up/down resistors
●
The MB90360 Series does not support internal pull-up/down resistors (except Port2:
programmable pull-up resistors). Use pull-up/down handling where needed.
Figure 1.7-2 Power Supply Pins (V
Vss
Vcc
Vss
Vcc
MB90360
series
Vss
Vcc
Vss
Vcc
CC/VSS
Vcc
Vss
)
Crystal Oscillator Circuit
●
Noises aroun d X 0 or X 1 pin s ma y be p oss ibl e cau ses of abno rm al op era tions . M ake s ure to pro vide byp ass
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 (AV
after turning-on the digital power supply (V
CC
).
, AVR) and analog inputs (AN0 to AN15)
CC
Turn-off the digital power supply after turning off the A/D converter power supply and analog inputs. In
this case, make sure that the voltage not exceed AVR or AV
Connection of Unused Pins of A/D Converter
●
Connect unused pins of A/D converter as AV
= VCC, AVSS = AVR = VSS.
CC
CC
.
23
CHAPTER 1 OVERVIEW
Notes on Energization
●
To prevent malfunction of the internal voltage regulator, supply voltage profile while turning on the power
supply should be slower than 50 µs from 0.2 V to 2.7 V.
Stabilization of power supply voltage
●
If the power supply voltage varies acutely even within the operation assurance range of the V
supply voltage, a malfunction may occur. The V
stabilization guidelines, stabilize the power supply voltage so that V
power supply voltage must therefore be stabilized. As
CC
ripple fluctuations (peak to peak
CC
value) in the commercial frequencies (50 to 60 Hz) fall within 10% of the standard V
voltage and the transient fluctuation rate becomes 0.1 V/m s or less in instantaneous fluctuation for power
supply switching .
Note on using CAN Function
●
The MB90360 series does not contain the clock modulation function. So, at using CAN, the DIRECT bit of
the CAN direct mode register (CDMR) must be set "1". (See Table 1.7-1 ). If the DIRECT bit is not set
correctly, the device does not operate normally.
Table 1.7-1 Setting of Clock Modulation and CAN Direct Mode
Clock modulation setting
(CMCR:PMOD bit)
Required setting0: Disable clock modulation
1: Enable CAN direct mode
CAN direct mode setting
(setting of CDMR:DIRECT bit)
(initial value)
Setting disabled1: Enable clock modulation0: Disable CAN direct mode
(initial value)
CC
power supply
CC
power
24
Note:
For details on the clock modulation, see "CHAPTER 6 CLOCK SUPERVISOR".
For details on the CAN direct mode, see "21.11 Setting Configuration of Multi-level Message Buffer".
Flash security Function
●
The security bit is located in the area of the flash memory.
If protection code 0 1
security.
Therefore please do not write 01
Please refer to following table for the address of the security bit.
CHAPTER 1 OVERVIEW
is written in the security bit, th e flash memor y is in the protected state by
H
in this address if you do not use the security function.
H
Flash memory sizeAddress of security bit
MB90F362/T(S),
MB90F367/T(S)
For the diversion of MB90340-series software assets
●
Embedded 512Kbit flash memoryFF0001
H
In programming of the MB90360 series, keep the following points in mind for the diversion of
MB90340-series software assets in particular.
• Access to the registers which do not exist in the MB90360 series.
As for the registe rs and bits wh ich exist i n MB90340 s eries but not in the MB903 60 series, d o
not access them or ensur e that the initial value is set. Setting any other value than the initial
value may cause an abnormal operation in emulation using MB90V340.
• Setting of the external interrupt factor select register (EISSR).
The MB90360 series i s not equipped with the external interrupt requ est input, INT8R, INT9,
INT10, INT11, INT12, INT13, INT14 and INT15.
Enabling unequipped terminals causes a false operation. First set the EISSR and then set
each of the registers when DTP/external interrupt is us ed.
25
CHAPTER 1 OVERVIEW
26
CHAPTER 2
This chapter explains the CPU.
2.1 Outline of the CPU
2.2 Memory Space
2.3 Memory Map
2.4 Linear Addressing
2.5 Bank Addressing Types
CPU
2.6 Multi-byte Data in Memory Space
2.7 Registers
2.8 Register Bank
2.9 Prefix Codes
2.10 Interrupt Disable Instructions
2.11 Precautions for Use of "DIV A, Ri" and "DIVW A, RWi" Instructions
27
CHAPTER 2 CPU
2.1Outline of the CPU
The F2MC-16LX CPU core is a 16-bit CPU designed for applications that require highspeed real-time proces sing, 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 F
compatible with high-level languages, expandi ng address ing mod es, reinforci ng multip lication and divisio n
instructions, and enhancing bit processing. The features of the F
2
MC-8 A-T architecture, has been reinforced by adding instructions
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
Instruction set compatible with high-level language (C)/multitasking
●
System stack pointer/instruction set symmetry/barrel-shift instructions
Improved execution speed: 4 bytes queue
●
28
CHAPTER 2 CPU
2.2Memory Space
An F2MC-16LX CPU has a 16M bytes memory space. All data program input and output
managed by the F2MC-16LX CPU are located in this 16M bytes memory space. The CPU
accesses the resources by indicating their addresses using a 24-bit address bus.
■ Outline of CPU Memory Space
Figure 2.2-1 shows a sample relationship between the F2MC-16LX system and memory map.
2
Figure 2.2-1 Sample Relationship between F
MC-16LX System and Memory Map
F2MC-16LX device
Programs
Peripheral circuit
2
F
MC-16LX
CPU
Data
EI
2
OS
Internal data bus
Peripheral circuit
Interrupt
Peripheral circuit
General-purpose
ports
*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.
FFFFFF
FFFC00
FF0000
100000
010000
008000
007900
001900
000380
000180
000100
0000F0
0000C0
0000B0
000020
000000
H
Vector table area
H
*1
H
H
H
H
H
*2
H
H
H
H
H
H
H
H
H
Program area
External area
ROM area
(FF bank image)
Peripheral function
control register area
Data area
General-purpose register
EI2OS
descriptor area
External area
Peripheral function control
register area
Interrupt control
register area
Peripheral function control
register area
I/O port control
register area
ROM area
*3
I/O area
RAM area
*3
I/O area
29
CHAPTER 2 CPU
■ ROM area
Vector table area (address: FFFC00H to FFFFFFH)
●
This area is used as a vector table for reset/interrupt and CALLV vector.
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: FF0000H 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 000CFFH (for 3K bytes))
●
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)
●
Extended intelligent I/O service (EI2OS) descriptor area (address: 000100H to 00017FH)
●
■ I/O Area
Interrupt control register area (address: 0000B0H to 0000BFH)
●
Peripheral function control register area (address: 000020H to 0000AF
●
007900H to 007FFFH)
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 high-
speed access with short instructions.
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.
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
2
OS).
(EI
0000C0H to 0000EF
H ,
H ,
30
This register controls the built-in peripheral functions and inputs and outputs data.
I/O port contr ol re giste r ar ea (addr es s: 000000H to 00001FH)
●
This register controls I/O ports, and inputs and outputs data.
■ Address generation types
The F2MC-16LX has the following 2 addressing modes:
Linear addressing
●
An entire 24-bit address is specified by an instruction.
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.
CHAPTER 2 CPU
31
CHAPTER 2 CPU
2.3Memory Map
The memory map of the MB90360 Series is shown in Figure 2.3-1 .
■ Memory 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. Sin ce the low-order 16 b its are iden tical, this part of the ROM dat a
can be referred without using the far specification in the pointer declaration.
For example, when 00C000
ROM area in the FF bank exceeds 32K bytes, its entire image cannot be mirrored in the 00 bank.
is accessed, the contents of ROM at FFC000H are read. However, since the
H
The image between FF8000
FF7FFF
is only visible in bank FF.
H
MB90V340A-101/102/103/104
FFFFFFH
FF0000H
FEFFFFH
FE0000H
FDFFFFH
FD0000H
FCFFFFH
FC0000H
FBFFFFH
FB0000H
FAFFFFH
FA0000H
F9FFFFH
F90000H
F8FFFFH
F80000H
00FFFFH
008000H
007FFFH
007900H
0078FFH
ROM (FF bank)
ROM (FE bank)
ROM (FD bank)
ROM (FC bank)
ROM (FB bank)
ROM (FA bank)
ROM (F9 bank)
ROM (F8 bank)
(image of FF bank)
Peripheral
and FFFFFFH is visible in bank 00, whereas the data between FF0000H and
H
Figure 2.3-1 Memory Map
MB90F362/T(S)
MB90362/T(S)
MB90F367/T(S)
MB90367/T(S)
ROM
FFFFFFH
FF0000H
FEFFFFH
010000H
00FFFFH
008000H
007FFFH
007900H
ROM (FF bank)
ROM
(image of FF bank)
Peripheral
32
000100H
0000EFH
000000H
RAM 30KB
Peripheral
Access prohibited
000CFFH
000100H
0000FFH
0000F0H
0000EFH
000000H
RAM 3KB
Peripheral
CHAPTER 2 CPU
2.4Linear Addressing
There are 2 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 operand specification)
JMPP 123456H
Old program counter
+ Program bank
New program counter
+ Program bank
12
17
452D
3456
17452DH
123456H
JMPP 123456H
Next instruction
Figure 2.4-2 Example of Linear Method (32-bit register indirect specification)
MOV A, @RL1+7
090700
Old AL
XXXX
7
(The high-o rder 8 bits ar e ignor ed.)
H
RL1
3A
240906F9
New AL
003A
33
CHAPTER 2 CPU
2.5Bank Addressing Types
In the bank method, the 16M bytes space is divided into 256 for 64K bytes banks. The
following 5 bank registers are used to specify the banks corresponding to each space:
• P rogram bank register (PCB)
• Data bank regist er (DTB)
• User stack bank register (USB)
• System stack bank register (SSB)
• Additional bank register (ADB)
■ Bank Addressing Types
Program bank register (PCB)
●
The 64K bytes 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 64K bytes 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 64K bytes bank specified by the USB or SSB 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 bank register (ADB)
●
The 64K bytes bank specified by the A DB is called an additional (AD) s pace. 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 00
by the reset vector. After reset, the DT, SP, and AD spaces are allocated in bank 00
00FFFF
), and the PC space is allocated in the bank specified by the reset vector.
H
. The PCB is initialized to a value specified
H
(000000H to
H
34
Table 2.5-1 Default Space
Default spaceAddressing mode
Program spacePC indirect, program access, branch
Data spaceAddressing mode using @RW0, @RW1, @RW4, or @RW5, @A, addr16, and dir
Stack spaceAddressing mode using PUSHW, POPW, @RW3, or @RW7
Additional spaceAddressing 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
CHAPTER 2 CPU
Physical address
FFFFFFH
FF0000H
B3FFFFH
B30000H
92FFFFH
920000H
68FFFFH
680000H
4BFFFFH
4B0000H
000000H
Program space
Additional space
User stack space
Data space
System stack space
FFH
B3H
92H
68H
4BH
: PCB (Program bank register)
: ADB (Additional bank register)
: USB (User stack bank register)
: DTB (Data bank register)
: SSB (System stack bank register)
35
CHAPTER 2 CPU
2.6Multi-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 inputted immediately after the low-order bits are written, the highorder 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
H
01010101
MSBLSB
01010101
1100110011111111 00010100
11001100
11111111
Address n
00010100
L
■ Accessing Multi-byte Data
Fundamentally, accesses are made within a bank. For an instruction accessing a multi-byte data item,
address FFFF
accessing multi-byte data.
80FFFF
800000H
is followed by address 0000H of the same bank. Figure 2.6-2 is an example of an instruction
H
Figure 2.6-2 Execution of MOVW A, 080FFFF
H
H
01H
23H
H
AL before execution
·
·
·
AL after execution
????
H
23
01H
36
L
CHAPTER 2 CPU
2.7Registers
The F2MC-16LX regist ers are largely classified into two types: special regist ers in the
CPU and general-purpose registers in memory. The special registers are dedicated
internal hardware of the CPU, and they ha v e spec if ic 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 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
AHAL
USP
SSP
PS
PC
DPR
PCB
DTB
USB
SSB
ADB
8 bits
Accumulator
User stack pointer
System stack pointer
Processor status
Program counter
Direct page register
Program bank register
Data bank register
User bank register
System stack bank register
Additional data bank register
32 bits
16 bits
38
■ 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 depend ent as desc ribed in Figure 2.7-2 .
• R 0 to R7: 8-bit general-purpose register
• RW0 to RW7: 16-bit genera l-purpose re gister
• RL0 to RL3: 32-bit general-purpose register
Figure 2.7-2 General-purpose Registers
CHAPTER 2 CPU
MSBLSB
16 bits
000180H RP x 10H
Start address of
general-purpose register
Low-order
High-order
R1
R3
R5
R7
RW0
RW1
RW2
RW3
R0
R2
R4
R6
RW4
RW5
RW6
RW7
RL0
RL1
RL2
RL3
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
= RW
(i)
(i × 2+1)
× 65536+RW
(i × 2)
[i=0 to 3]
39
CHAPTER 2 CPU
2.7.1Accumulator (A)
The accumulator (A) register consists of 2 16-bit arithmetic operation registers (AH and
AL), and is used as a temporary storage for operation results and transfer data.
■ Accumulator (A)
During 32-bit data processing, AH and AL are used together. Only AL is used for word processing in 16bit 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 F
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.
2
MC-8L, when a word or shorter data item is transferred to
A before
execution
A after
execution
A before
execution
A after
execution
MOVL A,@RW1+6
XXXXHXXXXH
8F74H2B52H
AH AL
MOVW A,@RW1+6
XXXXH
DTB
1234H1234H
Figure 2.7-3 32-bit Data Transfer
H
A61540
DTB
A6
H
+
A6153EH
6
RW1
Figure 2.7-4 AL-AH Transfer
A61540
1234H
A6
H
+6
H
A6153EH
RW1
MSB LSB
74H
52H
38H
74H
52H
38H
MSB
8F
2BH
15H
8FH
2BH
15H
H
LSB
40
CHAPTER 2 CPU
2.7.2User 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)
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 of PUSHW A when S flag is "0"
Before execution
After execution
Example of PUSHW A when S flag is "1"
AL A624
S flag
AL A624
AL A624
AL A624
H
H
H
1
H
USB USP
USB USP
USB USP
USB USP
C6
56
C6
56
C6
56
C6
56
H
H
SSPSSB0
H
H
SSPSSB0
H
H
SSPSSB
H
H
SSPSSB1
F328
1234
F326
1234
F328
1234
F328
1232
MSBLSB
H
C6F326
H
H
System stack is used because S
H
H
H
H
H
H
flag is "0".
C6F326
H
561232
H
561232
H
System stack is used because
S flag is "1".
XX
A6
XX
A6
XX
H
24
H
XX
H
24
H
Note:
Specify an even-numbered address in the stack pointer whenever possible.
41
CHAPTER 2 CPU
2.7.3Processor 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 ILM indicates the start address of a register bank. The loworder 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 1312 87 0
PSILMRPCCR
■ Condition Code Register (CCR)
Figure 2.7-7 is a diagram of condition code register (CCR) configuration.
Interrupt requests 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
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 in struction. Otherwise, 0 is set in the T f lag. 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:
●
CHAPTER 2 CPU
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 an d th e
internal RAM addresses. Specifically, the RP register indicates the first memory address of the currently
used register bank in the following conversion expression: [00180
RP register consists of five bits, and can take a value between 00
at addresses from 000180
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 zer oes by a reset. An instruction may t ransfer
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 value00000
+ (RP)*10H] (see Figure 2.7-8 ). The
H
and 1FH. Register banks can be allocated
H
to 00037H in memory.
H
B4B3B2B1B0: RP
43
CHAPTER 2 CPU
■ Interrupt level mask register (ILM)
The ILM register consists of thr ee bits, indicating th e CPU interrupt m asking level. An i nterrupt 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 th e 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 Mask Register (ILM)
ILM2ILM1ILM0: ILM
Initial value000
Table 2.7-1 Levels Indicated by the Interrupt Level Mask (ILM) Register
ILM2ILM1ILM0Level valueAcceptable interrupt level
0000Interrupt disabled
001 10 only
0102Level value smaller than 1
0113Level value smaller than 2
1004Level value smaller than 3
1015Level value smaller than 4
1106Level value smaller than 5
1117Level value smaller than 6
44
CHAPTER 2 CPU
2.7.4Program 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 acc ess.
■ Program Counter (PC)
Figure 2.7-10 shows the program counter.
Figure 2.7-10 Program Counter
PCB
HABCDH
FE
PC
Next instruction to be executed
FEABCDH
45
CHAPTER 2 CPU
2.8Register 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.
RL0 to RL3 are used as the linear pointer that directly accesses entire space.
■ 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 tur ned on, however, the register bank will have an
undefined value.
Table 2.8-1 Register Functions
R0 to R7
RW0 to RW7
RL0 to RL3
T a ble 2.8-2 Relationship between Registers
R0
R1
R2
R3
R4
R5
R6
R7
Used as operands of instructions.
Note: R0 is used as a counter for barrel shift and normalization instructio ns .
Used as pointers.
Used as operands of instructions.
Note: RW0 is used as a counter for string instructions.
Used as long pointers.
Used as operands of instructions.
RW0
RW1
RW2
RW3
RW4
RW5
RW6
RW7
RL0
RL1
RL2
RL3
46
Direct page register (DPR) <Initial value: 01H>
●
DPR specifies addr8 to addr15 of the instruction operands in direct addressing mode as shown in Figure
CHAPTER 2 CPU
2.8-1 . DPR is eight bits long, and is initialized to 01
by a reset. DPR can be read or written to by an
H
instruction.
Figure 2.8-1 Generating a Physical Address in Direct Addressing Mode
DTB register
DPR register
α α α α α α α αβ β β β β β β βγ γ γ γ γ γ γ γ
MSBLSB
24-bit physical address
Program counter bank register (PCB) <Initial value: Value in reset vector>
●
Data bank register (DTB) <Initial value: 00H>
●
α α α α α α α α β β β β β β β β γ γ γ γ γ γ γ γ
Direct address during instruction
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 00
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 16M
bytes space is executed or when an interrupt occurs. For operation of each register, see "2.2 Memory
Space".
by a reset. Bank registers other
H
47
CHAPTER 2 CPU
2.9Prefix 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.
T able 2.9-1 Bank Select Prefix
Bank select prefixSelected space
PCBPC space
DTBData space
ADBAD space
SPBEither the SSP or USP space is used according to the stack flag value.
Use the following instructions with care:
String instructions (MOVS, MO VSW, 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
●
MOVA,io/MOVio,A/MOVXA,io/MOVWA,io/MOVWio,A/MOVio,#imm8
MOVWio,#imm16/MOVBA,io:bp/MOVBio:bp,A/SETBio:bp/CLRBio:bp
BBCio:bp,rel/BBSio:bp,rel/WBTC,WBTS
The IO space of the bank is used regardless of the prefix.
48
Flag change instructions (AND CCR,#imm8, OR CCR,#imm8)
●
The instruction is executed normally, but the prefix affects the next instru ction.
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.
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,
the register accessed by that instruction can be changed to the common bank (the register bank selected
when RP=0) at addresses from 000180
If an interrupt request occurs during execution of a string instruction with a prefix code, the prefix code
becomes invalid when the string inst ruction is resumed after the interr upt 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.
CHAPTER 2 CPU
to 00018FH regardless of the current RP value. Use the following
H
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 P refix (NCC)
To disable flag changes, use the flag change disable prefix code (NCC). Placing NCC before an instruction
that suppresses unnecessary flag change disables flag changes associated with that instruction. Use the
following instructions with care:
If an interrupt request occurs during execution of a string instruction with a prefix code, the prefix code
becomes invalid when the string inst ruction is resumed after the interr upt is processed. Thus, the string
instruction is executed incorrectly after the interrupt is pro cessed. 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.
49
CHAPTER 2 CPU
MOV ILM,#imm8
●
The instruction is executed normally, but the prefix affects the next instru ction.
50
CHAPTER 2 CPU
2.10Interrupt Disable Instructions
Interrupt requests are not sampled for the following ten instructions:
- MOV ILM,#imm8 - PCB - SPB - OR CCR,#imm8 - NCC
- AND CCR,#imm8 - ADB - CMR - POPW PS - DTB
■ Interrupt Disable Instructions
If a valid hardware 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
• • • • • • • •
Interrupt request
(a)
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, FFH
CCR:XXX10XX
NCCADD A,01
MOV ILM,#imm8
••••
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 .
Ordinary
(a)
instruction
H
CCR:XXX10XX
Figure 2.10-3 Consecutive Prefix Codes
Prefix code
• • • • •• • • • •
ADBDTBPCBADD A,01H
PCB is valid as the prefix
code.
51
CHAPTER 2 CPU
2.11Precautions for Use of "DIV A, Ri" and "DIVW A, RWi"
Instructions
Set "00H" in the bank register before using the "DIV A, Ri" and "DIVW A, RWi"
instructions.
■ Precautions for Use of "DIV A, Ri" and "DIVW A, RWi" Instructions
Table 2.11-1 Precautions for Use of "DIVA,Ri" and "DIVWA,RWi" Instructions (i=0 to 7)
DIVWA,RW7
*1: Depends on the S bit of the CCR register
*2: In the event that S bit of the CCR register is 0
If the value of the bank registers (DTB, ADB, USB, and SSB) is "00H", the remainder after division is
stored in the register of the instruction operands. Otherwise, the upper eight bits is specified by the bank
register corresponding to the register of the instruction operand, and the lower 16 bits is the same as the
address of the register of the instruction operand. The remainder is stored in the bank register specified by
the upper eight bits.
") × "10H" + "08H" (R0 corresponding address) = "0001B8H". Since the data bank register (DTB)
("03
H
" and RP = "03H", the address of R0 is "0180H" + RP
H
is specified by "DIV A,R0" as the bank register, the remainder is stored in address "05301B8
was obtained by adding the bank address "053
".
H
Note:
For information about the bank register and Ri and RWi registers, see "2.7 Registers".
■ Use of the "DIV A, Ri" and "DIVW A, RWi" Instructions without Precautions
To enable users to develop programs without having to take precautions for using the "DIV A,Ri" and
"DIVW A,RWi" instructions, special compilers and assemblers are available. The special compiler does not
generate the instructions in Table 2.11-1 . The special assemblers have a function that replaces the
instructions in Table 2.11-1 with equivalent instruction strings. For the MB90360 series, use the following
types of compilers and assemblers:
Compiler
●
• cc907 V02L06 or later version, or fcc907s V30L02 or later version
", which
H
Assembler
●
• asm907a V03L04 or later version, or fasm907s V30L04 (Rev. 300004) or later version
53
CHAPTER 2 CPU
54
CHAPTER 3
INTERRUPTS
This chapter explains the interrupts and function and
operation of the extended intelligent I/O service in the
MB90360 series.
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 (EI
3.8 Operation Flow of and Procedure for Using the Extended Intelligent
I/O Service (EI
3.9 Exceptions
2
OS)
2
OS)
55
CHAPTER 3 INTERRUPTS
3.1Outline 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 four types of interrupt functions:
• Hardware interrupt: Interrupt processing due to an internal resource event
• Software interrupt: Interrupt processing due to a software event occurrence instruct ion
• Extended intelligent I/O service (EI2OS): 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 interr upt 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 th e hardware interrupt. To specify an interrup t 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.
Figure 3.1-1 Overview of Hardware Interrupts
Register file
bus
MC-16LX
2
F
Micro code
F2MC-16LX CPU
Peripheral
Enable FF
AND
Factor FF
PS : Processor status
PSIILM
IR
Check
Level comparator
Comparator
Interrupt
Interrupt level IL
controller
I: Interrupt enable flag
ILM : Interrupt level mask register
IR : Instruction register
56
■ Software Interrupts
Interrupts requested by executing the INT instru ction are software interrupts. An interrupt request by the
INT instruction does not have an interrupt request or enable flag. An interrupt request is iss ued 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.
CHAPTER 3 INTERRUPTS
Figure 3.1-2 Overview of Software Interru pt s
Register
bus
MC-16LX
2
F
F2MC-16LX
Save
file
Micro
code
IR
CPU
RAM
■ 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 EI
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 (EI
PSIS
Queue
Instruction bus
B unit
Fetch
PS : Processor status
I: Interrupt enable flag
ILM : Interrupt level mask register
IR : Instruction register
B unit : Bus interface unit
2
OS enables data
2
OS)
CPU
IOA
BAP
(4)
(3)
(3)
Memory space
I/O register
ISD
Buffer
ICS
I/O register
Interrupt request
(2)
(1) I/O requests transfer.
(2) Interrupt controller selects descriptor.
(3) Tr ansf er sou rce and destination are read
DCT
(4) Data is transferred between I/O and
Interrupt control register
Interrupt controller
from descriptor.
memory.
Peripheral
(1)
57
CHAPTER 3 INTERRUPTS
■ Exceptions
Exception processing is basically the same as interrupt processing. When an exception is detected between
instructions, ordinary processing is suspended, and exception processing is performed. In general,
exception processing occurs as a result of an unexpected operation. Therefore, use exception processing for
debugging programs or for activating recovery software in an emergency.
58
CHAPTER 3 INTERRUPTS
3.2Interrupt 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 Vector (1/2)
Interrupt
request
*
INT 0
*
INT 1
.
.
.
*
INT 7
INT 8
INT 9INT9 instruction
INT 10Exception processing
INT 11
INT 12
INT 13
INT 14
INT 29
INT 30
INT 31
INT 32
INT 33
INT 34
INT 35UART 0 reception
INT 36UART 0 transmission
INT 37UART 1 reception
INT 38UART 1 transmission
INT 39
INT 40
INT 41Flash memory
INT 42Delayed int e rrupt
*: When PCB is FFH, the vector area for the CALLV instruction overlaps that for INT #vct8 (#0 to #7). Care must be taken
when using the CALLV instruction.
60
CHAPTER 3 INTERRUPTS
3.3Interrupt 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 3 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)
15/7
WR/WR/W
14/613/512/411/310/2 9/18/0
ICS2IL0IL1IL2
ICS1ICS3
or
S1
ICS0
or
S0
ISE
R/WR/W**W
Interrupt control
register
00000111
when reset
B
*: '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 EI
2
OS 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.
[bit 10 to bit 8, bit 2 to bit 0] 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.
61
CHAPTER 3 INTERRUPTS
Table 3.3-1 Interrupt Level Setting Bits and Interrupt Levels
[bit 11, bit 3] ISE (extended intelligent I/O service enable bits)
The ISE bit is readable and writable. In response to an interrupt request, EI
set in the ISE bit and an interrupt sequence is activated when '0' is s et in the ISE bit. Upon completion
2
OS, the ISE bit is cleared to a zero. If the corresponding peripheral does not have the EI2OS
of EI
function, the ISE bit must be set to '0' on the software side.
2
OS is activated when '1' is
Upon a reset, the ISE bit is initialized to '0'.
62
CHAPTER 3 INTERRUPTS
[bit 15 to bit 12, bit 7 to bit 4] ICS 3 to ICS 0 (extended intelligent I/O service channel select bits)
ICS3 to ICS0 are write-only bits. These bits specify the EI
2
OS channel. The values set in these bits
determined the extended intelligent I/O service descriptor addresses in memory, which is explained
later. The ICS bits are initialized to "0000
" by a reset.
B
Table 3.3-2 describes the correspondence between the ICS bits, channel numbers, and descriptor
addresses.
Table 3.3-2 ICS Bits, Channel Numbers, and Descriptor Address
[bit 13, bit 12, bits 5, bit 4] 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 EI
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
S1S0End conditions
2
OS. These bits
00
2
OS running or not activated
EI
01Stop status by count end
10Reserved
11Stop status by request from internal resource
64
3.4Interrupt Flow
Figure 3.4-1 shows the interrupt flow.
■ Interrupt Flow
Figure 3.4-1 Interrupt Flow
START
CHAPTER 3 INTERRUPTS
I: Flag in CCR
ILM : CPU register level
IF: Internal resource interrupt request
IE: Internal resource interrupt enable flag
ISE : EI
IL: Internal resource interrupt request level
S: Flag in CCR
2
OS enable flag
No
I & IF & IE = 1
AND
ILM > IL
No
Fetching and decoding
the next instruction
INT
Yes
instruction
No
Executing an ordinary instruction
Completion
of string instruction
repetition
Yes
Updating PC
Yes
ISE = 1
Saving PS, PC, PCB, DTB,
DPR, and A into the stack
of SSP, and setting ILM = IL
Saving PS, PC, PCB,
DTB, ADB, DPR, and A
into the stack of SSP, and
setting I = O and ILM = IL
S 1
Fetching the interrupt
vector
Yes
No
Executing the extended
intelligent I/O service
65
CHAPTER 3 INTERRUPTS
Figure 3.4-2 Register Saving during Interrupt Processing
MSBLSB
"H"
DPR
DPB
"L"
Word (16 bits)
SSP (SSP value before interrupt)
AH
AL
ADB
PCB
PC
PS
SSP (SSP value after interrupt)
66
CHAPTER 3 INTERRUPTS
3.5Hardware 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 3 sections:
Internal resource s
●
Interrupt enable and request bits: Used to control interrupt requests from resources.
Interrupt controller
●
ICR: Assigns interrupt levels and determines the priority levels o f si multaneously 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 referred during interrupt processing is assigned to addresses FFFC00
FFFFFF
"Table D-2 Interrupt Causes, Interrupt Vectors, and Interrupt Control Registers" in "APPENDIX D List of
Interrupt Vectors" shows the assignment of the MB90360 series.
in memory. These addresses are shared with software interrupts.
H
to
H
67
CHAPTER 3 INTERRUPTS
3.5.1Hardware 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 reque sts an interrupt to the CPU. The interrupt request flag is set
when an event that is unique to the internal resource occurs. 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, sel ects the requ est at the h ighest level (the smallest IL value), then r eports 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 (IL) and the ILM in the PS reg ister. If the interrupt level is
smaller than the ILM value and the I bit of the P S register is set to '1', the CPU activates the interrupt
processing microcode after the currently executing instruction is completed. The CPU refers 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 3 bytes of interrupt vector, loads them onto PC and PCB, updates th e
ILM of PS to a level value of the received interrupt request, sets the S flag, then performs branch
processing. As a result, the interrupt processing program defined by the user is executed next.
68
CHAPTER 3 INTERRUPTS
3.5.2Occurrence 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: Processor status
I: Interrupt enable flag
ILM: Interrupt level mask register
IR: Instruction register
MC-16LX bus
2
F
Register file
Micro code
2
F
MC-16LX CPU
Enable FF
Factor FF
Peripheral
AND
IR
PSIILM
Comparator
Interrupt
controller
Interrupt level IL
Level comparator
•
•
•
Check
1. An interrupt cause occurs in a peripheral.
2. The interrupt enable bit in t he peripheral is referred. If interrupts are enabled, the peripheral issues an
interrupt request to the interrupt controller.
3. 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.
4. The CPU compares the interrupt level requested by the interrupt controller with the ILM bit of the
processor status register.
5. 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.
6. 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.
7. When the interrupt cause of step 1. is cleared by software in the user interrupt processing routine, the
interrupt request is completed.
69
CHAPTER 3 INTERRUPTS
The time required for the CPU to execute the interrupt processing in steps 6. and 7. is shown below.
See Table 3.5-1 for the cycle count compensation value.
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 interr upts. If an interrupt of a higher level occurs while another
interrupt is being processed, contro l is transferred to the high-level interru pt after the currently executing
instruction is completed. After processi ng of the high-level interrupt is com pleted, 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 s ources; while an extended intelligent I/O ser vice
is being processed, all other interrupt requests or extended intell igent I/O service requests are suspended.
Figure 3.5-2 shows the order of the registers saved in the stack.
"H"
"L"
MSB
DPR
Figure 3.5-2 Registers Saved in Stack
Word (16 bits)
LSB
SSP (SSP value before interrupt)
AH
AL
ADB
PCBDPB
PC
PS
SSP (SSP value after interrupt)
71
CHAPTER 3 INTERRUPTS
3.6Software 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 I 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 Interrupt Vectors" in APPENDIX D lists the interrupt vectors of the MB90360 series.
Software interrupts share the same interrupt vector area with hardware interrup ts.
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 3 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.
72
CHAPTER 3 INTERRUPTS
Figure 3.6-1 Occurrence and Release of Software Interrupt
■ Others
MC-16LX bus
2
F
Save
Register file
(2)
Micro code
F2MC-16LX • CPU
RAM
IR
(1)
PS
Queue
Instruction bus
SI
B unit
Fetch
PS: Processor status
I: Interrupt enable flag
ILM: Interrupt level mask register
IR: Instruction register
B unit : Bus interface unit
(1) The software interrupt instruction is executed.
(2) Special CPU registers in the register file are saved according to the microcode corresponding to the
software interrupt instruction.
(3) The interrupt processing is completed with the RETI instruction in the user interrupt processing
routine.
When the program bank register (PCB) is FFH, the CALLV instruction vector area overlaps the table of the
INT #vct8 instruction. When designing softwar e, ensure that the CALLV in struction doe s not use the same
address as that of the #vct8 instruction.
"Table D-2 Interrupt Causes, Interrupt Vectors, and Interrupt Control Registers" in APPENDIX D shows
the relationship of interrupt cause, interrupt vector, and interrupt control register in the MB9 0360 series.
73
CHAPTER 3 INTERRUPTS
3.7Extended Intelligent I/O Service (EI2OS)
The EI2OS function, a kind of hardware inte rrupt ope r ation, aut omat ic ally 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 (buffer address is update).
At the end of EI
condition is set. Thus, the user can identify the end condition.
To implement EI
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.
2
OS, processing automatically branches to an interrupt processing routine after the end
2
OS, the hardware is distributed in two blocks. Each block has the following registers and
74
CPU
Figure 3.7-1 Outline of Extended Intelligent I/O Service
Memory space
by IOA
I/O register
··· ··· ··· ··· ···
I/O register
Interrupt request
Peripheral
CHAPTER 3 INTERRUPTS
ISD
by BAP
Buffer
by ICS
by
DCT
Interrupt control register
Interrupt controller
I/O requests transfer.
Interrupt controller selects descriptor.
Transfer source and destination
are read from descriptor.
Data is transferred between I/O
and memory.
Note:
• The area that can be specified by IOA is between 000000
• The area that can be specified by BAP is between 000000
and 00FFFFH.
H
and FFFFFFH.
H
• The maximum transfer count that can be specified by DCT is 65,536.
■ Structure
EI2OS is handled by the following 4 sections:
Internal resources
Interrupt enable and request bits: Used to control interrupt requests from resources.
Interrupt controller
ICR: Assigns interrupt levels, determines the p riority levels of simu ltaneously requested interru pts, and
2
selects the EI
OS operation.
CPU
I and ILM: Used to compare the requested and current interrupt levels and to identify the interrupt
enable status
2
Microcode: EI
OS processing step
RAM
Descriptor: Describes the EI
2
OS transfer information.
75
CHAPTER 3 INTERRUPTS
3.7.1Extended 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 s ervice des criptor.
Figure 3.7-2 Extended Intelligent I/O Service Descriptor Configuration
000100
H
ISD start address
■ 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. EI
Figure 3.7-3 is a diagram of the data counter configuration.
B15B08 B07B04B10
B14 B13 B12 B11B09B00B01B02B03B05B06
High-order 8 bits of data counter (DCTH)
Low-order 8 bits of data counter (DCTL)
High-order 8 bits of I/O address pointer (IOAH)
Low-order 8 bits of I/O address pointer (IOAL)
2
OS status (ISCS)
EI
High-order 8 bits of buffer address pointer (BAPH)
ICS
Midium-order 8 bits of buffer address pointer (BAPM)
Low-order 8 bits of buffer address pointer(BAPL)
Figure 3.7-3 Data Counter Configuration
H
L
2
OS is terminated when this counter reaches 0.
0123456789101112131415
DCT
(Undefined
when reset)
76
■ 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
000000
and 00FFFFH can be specified. Figure 3.7-4 is a diagram of the IOA configuration.
This 24-bit register holds the address used for the next EI2OS transfer. BAP exists for each EI2OS channel.
2
Therefore, each EI
of ISCS is set to '0' (update enabled), only the low-order 16 bits of BAP changes and BAPH does not
change.
OS channel can be used for transfer with anywhere in the 16M bytes space. If the BF bit
CHAPTER 3 INTERRUPTS
IOA
(Undefined
when reset)
77
CHAPTER 3 INTERRUPTS
3.7.2EI2OS Status Register (ISCS)
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.
Be sure to write "0" in bit 7 to bit 5 of ISCS.
Figure 3.7-5 ISCS Configuration
7654 32 1 0
Reserved Reserved ReservedIFBWBFDIRSE
ISCS
(Undefined
when reset)
Each bit is described below.
[bit 4] 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.
[bit 3] BW: Specify the transfer data length.
0: Byte
1: Word
[bit 2] 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 pointer are updated. Only increment is allowed.
[bit 1] DIR: Specify the data transfer direction.
78
0: I/O --> Buffer
1: Buffer --> I/O
[bit 0] SE: Control the termination of the extended intelligent I/O service based on internal
resource requests.
0: The extended intelligent I/O service is not terminated by a internal resource request.
1: The extended intelligent I/O service is terminated by a internal resource request.
CHAPTER 3 INTERRUPTS
3.8Operation Flow of and Procedure for Using the Extended
Intelligent I/O Service (EI
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
Interrupt request issued
from internal resource
ISE = 1
YES
NO
2
OS)
BAP: Buffer address pointer
I/OA
ISD
ISCS: EI2OS status
DCT: Data counter
ISE: EI
S1 and S0: EI2OS end status
: I/O address pointer
:EI2OS descripter
2
OS enable bit
Interrupt sequence
Reading ISD/ISCS
End request from resource
NO
DIR = 1
NO
Data indicated by IOA
(Data transfer)
⇓
Memory indicated by BAP
IF = 0
NO
BF = 0
NO
Decrementing DCT
DCT = 00
NO
Setting S1 and S0
to "00"
YES
YES
YES
YES
YES
Update value
depends on BW.
Update value
depends on BW.
Setting S1 and S0
SE = 1
Data indicated by BAP
(Data transfer)
⇓
Memory indicated by IOA
Updating IOA
Updating BAP
to "01"
Setting S1 and S0
to "11"
Clearing resource
interrupt request
CPU operation return
Clearing ISE to "0"
Interrupt sequence
79
CHAPTER 3 INTERRUPTS
Setting of extended intelligent I/O service
Figure 3.8-2 EI
2
OS initialization
EI
JOB execution
(Switching channels)
Processing data in buffer
2
OS Use Flow
(Interrupt request)
Processing by EI2OSProcessing by CPU
AND (ISE=1)
Normal
termination
Data transfer
Count out or interrupt
generation by end
request from resource
The extended EI
When data transfer continues (when the stop condition is not satisfied)
●
2
OS execution time for each flow is described below.
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 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 instr uction 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.
82
CHAPTER 4
DELAYED INTERRUPT
GENERATION MODULE
This chapter explains the functions and operations of
the delayed interrupt generation module.
4.1 Overview of Delayed Interrupt Generation Module
4.2 Block Diagram of Delayed Interrupt Generation Module
4.3 Configuration of Delayed Interrupt Generation Module
4.4 Explanation of Operation of Delayed Interrupt Generation Module
4.5 Precautions when Using Delayed Interrupt Generation Module
4.6 Program Example of Delayed Interrupt Generation Module
83
CHAPTER 4 DELAYED INTERRUPT GENERATION MODULE
4.1Overview of Delayed Interrupt Generation Module
The delayed interrupt generation module generates the interrupt for task switching.
The hardware interrupt request can be generated/cancelled by software.
■ Overview of Delayed Interrupt Generation Module
By using the delayed interrupt generation module, a hardware interrupt request can be generated or
cancelled by software.
Table 4.1-1 shows the overview of the delayed interrupt generation module.
Table 4.1-1 Overview of Delayed Interrupt Generation Module
Function and control
Interrupt factorAn interrupt request is generated by setting the R0 bit in the delayed
interrupt request generate/cancel register to 1 (DIRR: R0 = 1).
An interrupt request is cancelled by setting the R0 bit in the delayed
interrupt request generate/cancel register to 0 (DIRR: R0 = 0).
Interrupt number#42 (2A
Interrupt controlAn interrupt is not enabled by the DIRR register.
Interrupt flagThe interrupt flag is held in the R0 bit in the DIRR register.
2
OSThe DIRR register does not correspond to the EI2OS.
EI
)
H
84
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.