The HD404358 Series is a 4-bit HMCS400-Series microcomputer designed to increase program
productivity and also incorporate large-capacity memory. Each microcomputer has an A/D converter, input
capture timer, and two low-power dissipation modes.
HD404358 Series
Rev. 6.0
Sept. 1998
The HD404358 Series includes seven chips: the HD404354, HD40A4354 with 4-kword ROM; the
HD404356, HD40A4356 with 6-kword ROM; the HD404358, HD40A4358 with 8-kword ROM; the
HD407A4359 with 16-kword PROM.
The HD40A4354, HD40A4356, HA40A4358, and HD407A4359 are high speed versions (minimum
instruction cycle time: 0.47 µs)
The HD407A4359 is a PROM version (ZTATmicrocomputer). A program can be written to the PROM
by a PROM writer, which can dramatically shorten system development periods and smooth the process
from debugging to mass production. (The ZTAT version is 27256-compatible.)
ZTAT: Zero Turn Around Time ZTAT is a trademark of Hitachi Ltd.
Features
• 34 I/O pins
One input-only pin
33 input/output pins: 4 pins are intermediate-voltage NMOS open drain with high-current pins (15
mA, max.)
• On-chip A/D converter (8-bit × 8-channel)
Low power voltage 2.7 V to 6.0 V
• Three timers
One event counter input
One timer output
One input capture timer
• Eight-bit clock-synchronous serial interface (1 channel)
• Alarm output
HD404358 Series
• Built-in oscillators
Ceramic oscillator or crystal
External clock drive is also possible
• Seven interrupt sources
Two by external sources
Three by timers
One by A/D converter
One by serial interface
TestTEST61ICannot be used in user applications. Connect this pin
ResetRESET72IResets the MCU
OscillatorOSC
PortD0–D
InterruptINT0, INT122, 2317, 18IInput pins for external interrupts
Stop clear STOPC2621IInput pin for transition from stop mode to active mode
Serial
Interface
TimerTOC543OTimer output pin
AlarmBUZZ2520OSquare waveform output pin
A/D
converter
V
CC
2116Applies power voltage
GND105Connected to ground
to GND.
83IInput/output pin for the internal oscillator. Connect
1
these pins to the ceramic oscillator or crystal oscillator,
OSC
2
8
RA
1
R00–R13,
–R43,
R3
0
–R8
R8
0
or OSC
94O
22–3017–21,
23–26
I/OInput/output pins addressed individually by bits; D0–D
are all standard-voltage I/O pins.
139IOne-bit standard-voltage input port pin
3
2–5,
12–19,
31–38
40–43,
7–14
27–34
I/OFour-bit input/output pins consisting of standard-voltage
pins
to an external oscillator circuit.
1
R20–R2339–4235–38I/OFour-bit input/output pins consisting of intermediate
voltage pins
SCK240I/OSerial interface clock input/output pin
SI341ISerial interface receive data input pin
SO442OSerial interface transmit data output pin
EVNB2419IEvent count input pin
AV
AV
CC
SS
2015Power supply for the A/D converter. Connect this pin
as close as possible to the V
voltage as V
. If the power supply voltage to be used
CC
for the A/D converter is not equal to V
µF bypass capacitor between the AV
(However, this is not necessary when the AV
directly connected to the V
pin and at the same
CC
, connect a 0.1-
CC
and AVSS pins.
CC
pin.)
CC
pin is
CC
116Ground for the A/D converter. Connect this pin as
close as possible to GND at the same voltage as GND.
AN0–AN712–197–14IAnalog input pins for the A/D converter
8
4
Block Diagram
INT
0
INT
1
EVNB
TOC
Interrupt
control
Timer A
Timer B
Timer C
STOPC
TEST
RESET
System control
RAM
(384 4 bits)
×
(512 4 bits)
×
1
OSC
2
VCCOSC
W
(2 bits)
X
(4 bits)
SPX
(4 bits)
Y
(4 bits)
SPY
(4 bits)
GND
HD404358 Series
D
0
D
1
D
2
D
3
D
4
D portR0 port
D
5
D
6
D
7
D
8
R0
0
R0
1
R0
2
R0
3
R1
0
R1
1
R1
R1 port
R1
2
3
SI
SO
SCK
AV
SS
AN
0
•
•
•
AN
7
AV
CC
BUZZ
Data bus
Intermediate
voltage pin
Directional
signal line
•
•
•
Serial
interface
A/D
converter
Buzzer
Internal address bus
Internal data bus
ST
(1 bit)CA(1 bit)
(4 bits)
(4 bits)
(10 bits)
Instruction
decoder
ROM
×
(4,096 10 bits) (6,144 10 bits)
×
(16,384 10 bits)(8,192 10 bits)
SP
A
B
ALU
(14 bits)
×
×
PC
Internal data bus
R2 port
R3 port
R4 port
R8 port
RA port
R2
R2
R2
R2
R3
R3
R3
R3
R4
R4
R4
R4
R8
R8
R8
R8
RA
0
1
2
3
0
1
2
3
0
1
2
3
0
1
2
3
1
5
HD404358 Series
Memory Map
ROM Memory Map
The ROM memory map is shown in figure 1 and described below.
Vector Address Area ($0000–$000F): Reserved for JMPL instructions that branch to the start addresses
of the reset and interrupt routines. After MCU reset or an interrupt, program execution continues from the
vector address.
Zero-Page Subroutine Area ($0000–$003F): Reserved for subroutines. The program branches to a
subroutine in this area in response to the CAL instruction.
Pattern Area ($0000–$0FFF): Contains ROM data that can be referenced with the P instruction.
Program Area ($0000-$0FFF (HD404354, HD40A4354), $0000–$17FF (HD404356, HD40A4356),
$0000–$1FFF (HD404358, HD40A4358), $0000–$3FFF (HD407A4359)): The entire ROM area can be
used for program coding.
$0000
$000F
$0010
$003F
$0040
$0FFF
$1000
$17FF
$1800
$1FFF
$2000
$3FFF
Vector address
(16 words)
Zero-page subroutine
(64 words)
Pattern (4,096 words)
Program (4,096 words)
For HD404354, HD40A4354
Program
(6,144 words)
For HD404356, HD40A4356
Program
(8,192 words)
For HD404358, HD40A4358
Program
(16,384 words)
HD407A4359
$0000
$0001
$0002
$0003
$0004
$0005
$0006
$0007
$0008
$0009
$000A
$000B
$000C
$000D
$000E
$000F
JMPL instruction
(jump to RESET, STOPC routine)
JMPL instruction
(jump to INT routine)
JMPL instruction
(jump to INT routine)
JMPL instruction
(jump to timer A routine)
JMPL instruction
(jump to timer B routine)
JMPL instruction
(jump to timer C routine)
JMPL instruction
(jump to A/D converter routine)
JMPL instruction
(jump to serial routine)
0
1
Note: Since the ROM address areas between $0000–$0FFF overlap, the user can
determine how these areas are to be used.
Figure 1 ROM Memory Map
6
HD404358 Series
RAM Memory Map
The HD404354, HD40A4354, HD404356, HD40A4356, HD404358 and HD40A4358 MCUs contain 384digit × 4-bit RAM areas. The HD407A4359 MCU contain 512-digit × 4-bit RAM areas. Both of these
RAM areas consist of a memory register area, a data area, and a stack area. In addition, an interrupt control
bits area, special function register area, and register flag area are mapped onto the same RAM memory
space labeled as a RAM-mapped register area. The RAM memory map is shown in figure 2 and described
below.
RAM-Mapped Register Area ($000–$03F):
• Interrupt Control Bits Area ($000–$003)
This area is used for interrupt control bits (figure 3). These bits can be accessed only by RAM bit
manipulation instructions (SEM/ SEMD, REM/REMD, and TM/TMD). However, note that not all the
instructions can be used for each bit. Limitations on using the instructions are shown in figure 4.
• Special Function Register Area ($004–$01F, $024–$03F)
This area is used as mode registers and data registers for external interrupts, serial interface,
timer/counters, A/D converter, and as data control registers for I/O ports. The structure is shown in
figures 2 and 5. These registers can be classified into three types: write-only (W), read-only (R), and
read/write (R/W). RAM bit manipulation instructions cannot be used for these registers.
• Register Flag Area ($020–$023)
This area is used for the DTON, WDON, and other register flags and interrupt control bits (figure 3).
These bits can be accessed only by RAM bit manipulation instructions (SEM/ SEMD, REM/REMD,
and TM/TMD). However, note that not all the instructions can be used for each bit. Limitations on
using the instructions are shown in figure 4.
Memory Register (MR) Area ($040–$04F): Consisting of 16 addresses, this area (MR0–MR15) can be
accessed by register-register instructions (LAMR and XMRA). The structure is shown in figure 6.
Data Area ($050–$17F for HD404354/HD40A4354/HD404356/HD40A4356/HD404358/HD40A4358,
$050–$1FF for HD407A4359)
Stack Area ($3C0–$3FF): Used for saving the contents of the program counter (PC), status flag (ST), and
carry flag (CA) at subroutine call (CAL or CALL instruction) and for interrupts. This area can be used as a
16-level nesting subroutine stack in which one level requires four digits. The data to be saved and the save
conditions are shown in figure 6.
The program counter is restored by either the RTN or RTNI instruction, but the status and carry flags can
only be restored by the RTNI instruction. Any unused space in this area is used for data storage.
7
HD404358 Series
RAM Memory Map
$000$000
$040
$050
$180
$200
$3C0
$3FF
RAM-mapped registers
Memory registers (MR)
HD404354, HD40A4354,
HD404356, HD40A4356,
HD404358, HD40A4358
Data (304 digits)
HD407A4359
Data (432 digits)
Not used
Stack (64 digits)
$003
$004
$005
$006
$007
$008
$009
$00A
$00B
$00C
$00D
$00E
$00F
$016
$017
$018
$019
$01A
Interrupt control bits area
Port mode register A (PMRA)
Serial mode register (SMR)
Serial data register lower (SRL)
Serial data register upper (SRU)
Timer mode register A (TMA)
Timer mode register B1 (TMB1)
Timer B (TRBL/TWBL)
(TRBU/TWBU)
Miscellaneous register (MIS)
Timer mode register C (TMC)
Timer C (TRCL/TWCL)
Note: WDON is reset by MCU reset or by STOPC enable for stop mode cancellation.
The REM or REMD instuction must not be executed for ADSF during A/D conversion.
If the TM or TMD instruction is executed for the inhibited bits or non-existing bits,
the value in ST becomes invalid.
Figure 4 Usage Limitations of RAM Bit Manipulation Instructions
9
HD404358 Series
$000
$003
PMRA $004
SMR $005
SRL $006
SRU $007
TMA $008
TMB1 $009
TRBL/TWBL $00A
TRBU/TWBU $00B
MIS $00C
TMC $00D
TRCL/TWCL $00E
TRCU/TWCU $00F
ACR $016
ADRL $017
ADRU $018
AMR1$019
AMR2 $01A
Bit 3Bit 2Bit 1
Interrupt control bits area
/BUZZR03/TOCR02/SO
D
3
R0
0
/SCK
Serial transmit clock speed selection
R01/SI
Serial data register (lower digit)
Serial data register (upper digit)
Not used
*
1
Clock source selection (timer A)
Clock source selection (timer B)
Timer B register (lower digit)
Timer B register (upper digit)
*
2
*
1
SO PMOS control
Clock source selection (timer C)
Not used
Timer C register (lower digit)
Timer C register (upper digit)
Not used
Not used
Analog channel selection
A/D data register (lower digit)
A/D data register (upper digit)
/ANR32/AN
R3
3
3
Not used
R31/AN
2
R4/AN
4
–AN
1
7
Not used
Bit 0
R30/AN
*
3
0
$020
$023
PMRB $024
PMRC $025
TMB2 $026
DCD0 $02C
DCD1 $02D
DCD2 $02E
DCR0 $030
DCR1 $031
DCR2 $032
DCR3 $033
DCR4 $034
DCR8 $038
$03F
Register flag area
D
/STOPC
4
D2/EVNB*6D1/INT
Buzzer output
Not used
Not used
DCD
3
Port D
2
Port D6 DCD
Port D
Port D7 DCD
DCD
Not used
Not used
Port R0
DCR
Port R02 DCR
3
DCR
3
DCR
3
DCR
3
Port R12 DCR
DCR
Port R2
2
Port R3
DCR
2
Port R4
DCR
2
Port R13 DCR
Port R2
Port R3
Port R4
Not used
Port R83 DCR Port R82 DCR
Not used
Figure 5 Special Function Register Area
D0/INT
1
*4
0
*5
EVNB detection edge selection
Port D
DCD
Port D0 DCD
1
Port D5 DCD
Port D4 DCD
Port D8 DCD
Port R01 DCR
Port R11 DCR
Port R21 DCR
Port R3
Port R41 DCR
Port R8
Port R00 DCR
Port R10 DCR
Port R20 DCR
DCR
Port R3
1
DCR
0
Port R40 DCR
DCR Port R80 DCR
1
Notes:
1.
Auto-reload on/off
2.
Pull-up MOS control
3.
A/D conversion time
4.
SO output level control in idle states
5.
Serial clock source selection
6.
Input capture selection
10
HD404358 Series
Memory registers
MR(0)
64
MR(1)
65
MR(2)
66
MR(3)
67
MR(4)
68
MR(5)
69
MR(6)
70
MR(7)
71
MR(8)
72
MR(9)
73
MR(10)
74
MR(11)
75
MR(12)
76
MR(13)
77
MR(14)
78
MR(15)
79
PC –PC :
13
ST: Status flag
$040
$041
$042
$043
$044
$045
$046
$047
$048
$049
$04A
$04B
$04C
$04D
$04E
$04F
Program counter
0
CA: Carry flag
Figure 6 Configuration of Memory Registers and Stack Area, and Stack Position
The MCU has nine registers and two flags for CPU operations. They are shown in figure 7 and described
below.
30
Accumulator
B register
W register
X register
Y register
Initial value: Undefined, R/W
Initial value: Undefined, R/W
Initial value: Undefined, R/W
Initial value: Undefined, R/W
Initial value: Undefined, R/W
(A)
30
(B)
0
1
(W)
30
(X)
30
(Y)
30
SPX register
SPY register
Carry
Status
Program counter
Initial value: 0,
no R/W
Stack pointer
Initial value: $3FF, no R/W
Initial value: Undefined, R/W
Initial value: Undefined, R/W
Initial value: Undefined, R/W
Initial value: 1, no R/W
13
95
1111
(SPX)
30
(SPY)
0
(CA)
0
(ST)
0
(PC)
0
(SP)
Figure 7 Registers and Flags
Accumulator (A), B Register (B): Four-bit registers used to hold the results from the arithmetic logic unit
(ALU) and transfer data between memory, I/O, and other registers.
W Register (W), X Register (X), Y Register (Y): Two-bit (W) and four-bit (X and Y) registers used for
indirect RAM addressing. The Y register is also used for D-port addressing.
12
HD404358 Series
SPX Register (SPX), SPY Register (SPY): Four-bit registers used to supplement the X and Y registers.
Carry Flag (CA): One-bit flag that stores any ALU overflow generated by an arithmetic operation. CA is
affected by the SEC, REC, ROTL, and ROTR instructions. A carry is pushed onto the stack during an
interrupt and popped from the stack by the RTNI instruction—but not by the RTN instruction.
Status Flag (ST): One-bit flag that latches any overflow generated by an arithmetic or compare instruction,
not-zero decision from the ALU, or result of a bit test. ST is used as a branch condition of the BR, BRL,
CAL, and CALL instructions. The contents of ST remain unchanged until the next arithmetic, compare, or
bit test instruction is executed, but become 1 after the BR, BRL, CAL, or CALL instruction is read,
regardless of whether the instruction is executed or skipped. The contents of ST are pushed onto the stack
during an interrupt and popped from the stack by the RTNI instruction—but not by the RTN instruction.
Program Counter (PC): 14-bit binary counter that points to the ROM address of the instruction being
executed.
Stack Pointer (SP): Ten-bit pointer that contains the address of the stack area to be used next. The SP is
initialized to $3FF by MCU reset. It is decremented by 4 when data is pushed onto the stack, and
incremented by 4 when data is popped from the stack. The top four bits of the SP are fixed at 1111, so a
stack can be used up to 16 levels.
The SP can be initialized to $3FF in another way: by resetting the RSP bit with the REM or REMD
instruction.
Reset
The MCU is reset by inputting a high-level voltage to the RESET pin. At power-on or when stop mode is
cancelled, RESET must be high for at least one tRC to enable the oscillator to stabilize. During operation,
RESET must be high for at least two instruction cycles.
Initial values after MCU reset are listed in table 1.
Interrupts
The MCU has 7 interrupt sources: two external signals (INT0 and INT1), three timer/counters (timers A, B,
and C), serial interface, and A/D converter.
An interrupt request flag (IF), interrupt mask (IM), and vector address are provided for each interrupt
source, and an interrupt enable flag (IE) controls the entire interrupt process.
Interrupt Control Bits and Interrupt Processing: Locations $000 to $003 in RAM are reserved for the
interrupt control bits which can be accessed by RAM bit manipulation instructions.
The interrupt request flag (IF) cannot be set by software. MCU reset initializes the interrupt enable flag (IE)
and the IF to 0 and the interrupt mask (IM) to 1.
A block diagram of the interrupt control circuit is shown in figure 8, interrupt priorities and vector
addresses are listed in table 2, and interrupt processing conditions for the 7 interrupt sources are listed in
table 3.
13
HD404358 Series
An interrupt request occurs when the IF is set to 1 and the IM is set to 0. If the IE is 1 at that point, the
interrupt is processed. A priority programmable logic array (PLA) generates the vector address assigned to
that interrupt source.
The interrupt processing sequence is shown in figure 9 and an interrupt processing flowchart is shown in
figure 10. After an interrupt is acknowledged, the previous instruction is completed in the first cycle. The
IE is reset in the second cycle, the carry, status, and program counter values are pushed onto the stack
during the second and third cycles, and the program jumps to the vector address to execute the instruction
in the third cycle.
Program the JMPL instruction at each vector address, to branch the program to the start address of the
interrupt program, and reset the IF by a software instruction within the interrupt program.
14
HD404358 Series
Table 1Initial Values After MCU Reset
ItemAbbr.Initial ValueContents
Program counter(PC)$0000Indicates program execution point
Status flag(ST)1Enables conditional branching
Stack pointer(SP)$3FFStack level 0
Interrupt
flags/mask
I/OPort data register(PDR)All bits 1Enables output at level 1
Timer/
counters,
serial
interface
Interrupt enable flag(IE)0Inhibits all interrupts
Interrupt request flag(IF)0Indicates there is no interrupt
A/DA/D mode register 1(AMR1)0000Refer to description of A/D mode register
A/D mode register 2(AMR2)- - 00
A/D channel register(ACR)- 000Refer to description of A/D channel register
A/D data register(ADRL)0000Refer to description of A/D data register
(ADRU)1000
Bit registersWatchdog timer on flag(WDON) 0Refer to description of timer C
A/D start flag(ADSF)0Refer to description of A/D converter
IAD off flag(IAOF)0Refer to the description of A/D converter
Input capture status flag(ICSF)0Refer to description of timer B
Input capture error flag(ICEF)0Refer to description of timer B
OthersMiscellaneous register(MIS)00 - -Refer to description of operati n g modes, I/O,
Notes: 1. The statuses of other registers and flags after MCU reset are shown in the following table.
2. X indicates invalid value. – indicates that the bit does not exist.
Value Contents
and serial interface
Status After Cancellation of
ItemAbbr.
Carry flag(CA)Pre-stop-mode values are not
Accumulator(A)
B register(B)
W register(W)
X/SPX register(X/SPX)
Y/SPY register(Y/SPY)
Serial data register(SRL, SRU)
RAMPre-stop-mode values are
RAM enable flag(RAME)10
Port mode register
B bit 3
(PMRB3)Pre-stop-mode values are
Stop Mode by STOPC Input
guaranteed; values must be
initialized by program
retained
retained
Status After all Other Types of
Reset
Pre-MCU-reset values are not
guaranteed; values must be
initialized by program
External Interrupt Masks (IM0: $000, Bit 3; IM1: $001, Bit 1): Prevent (mask) interrupt requests
caused by the corresponding external interrupt request flags, as listed in table 6.
Table 6External Interrupt Masks (IM0: $000, Bit 3; IM1: $001, Bit 1)
IM0, IM1Interrupt Request
0Enabled
1Disabled (masked)
Timer A Interrupt Request Flag (IFTA: $001, Bit 2): Set by overflow output from timer A, as listed in
table 7.
Table 7Timer A Interrupt Request Flag (IFTA: $001, Bit 2)
IFTAInterrupt Request
0No
1Yes
Timer A Interrupt Mask (IMTA: $001, Bit 3): Prevents (masks) an interrupt request caused by the timer
A interrupt request flag, as listed in table 8.
21
HD404358 Series
Table 8Timer A Interrupt Mask (IMTA: $001, Bit 3)
IMTAInterrupt Request
0Enabled
1Disabled (masked)
Timer B Interrupt Request Flag (IFTB: $002, Bit 0): Set by overflow output from timer B, as listed in
table 9.
Table 9Timer B Interrupt Request Flag (IFTB: $002, Bit 0)
IFTBInterrupt Request
0No
1Yes
Timer B Interrupt Mask (IMTB: $002, Bit 1): Prevents (masks) an interrupt request caused by the timer
B interrupt request flag, as listed in table 10.
Table 10Timer B Interrupt Mask (IMTB: $002, Bit 1)
IMTBInterrupt Request
0Enabled
1Disabled (masked)
Timer C Interrupt Request Flag (IFTC: $002, Bit 2): Set by overflow output from timer C, as listed in
table 11.
Table 11Timer C Interrupt Request Flag (IFTC: $002, Bit 2)
IFTCInterrupt Request
0No
1Yes
Timer C Interrupt Mask (IMTC: $002, Bit 3): Prevents (masks) an interrupt request caused by the timer
C interrupt request flag, as listed in table 12.
Table 12Timer C Interrupt Mask (IMTC: $002, Bit 3)
IMTCInterrupt Request
0Enabled
1Disabled (masked)
22
HD404358 Series
Serial Interrupt Request Flag (IFS: $003, Bit 2): Set when data transfer is completed or when data
transfer is suspended, as listed in table 13.
Table 13Serial Interrupt Request Flag (IFS: $003, Bit 2)
IFSInterrupt Request
0No
1Yes
Serial Interrupt Mask (IMS: $003, Bit 3): Prevents (masks) an interrupt request caused by the serial
interrupt request flag, as listed in table 14.
Table 14Serial Interrupt Mask (IMS: $003, Bit 3)
Mask IMSInterrupt Request
0Enabled
1Disabled (masked)
A/D Interrupt Request Flag (IFAD: $003, Bit 0): Set at the completion of A/D conversion, as listed in
table 15.
Table 15A/D Interrupt Request Flag (IFAD: $003, Bit 0)
IFADInterrupt Request
0No
1Yes
A/D Interrupt Mask (IMAD: $003, Bit 1): Prevents (masks) an interrupt request caused by the A/D
interrupt request flag, as listed in table 16.
Table 16A/D Interrupt Mask (IMAD: $003, Bit 1)
IMADInterrupt Request
0Enabled
1Disabled (masked)
23
HD404358 Series
Operating Modes
The MCU has three operating modes as shown in table 17. The operations in each mode are listed in tables
18 and 19. Transitions between operating modes are shown in figure 11.
Table 17Operating Modes and Clock Status
Mode Name
ActiveStandbyStop
Activation methodRESET cancellation,
interrupt request, STOPC
cancellation in stop mode
Active Mode: All MCU functions operate according to the clock generated by the system oscillator OSC
and OSC2.
1
Standby Mode: In standby mode, the oscillators continue to operate, but the clocks related to instruction
execution stop. Therefore, the CPU operation stops, but all RAM and register contents are retained, and the
D or R port status, when set to output, is maintained. Peripheral functions such as interrupts, timers, and
serial interface continue to operate. The power dissipation in this mode is lower than in active mode
because the CPU stops.
The MCU enters standby mode when the SBY instruction is executed in active mode.
Standby mode is terminated by a RESET input or an interrupt request. If it is terminated by RESET input,
the MCU is reset as well. After an interrupt request, the MCU enters active mode and executes the next
instruction after the SBY instruction. If the interrupt enable flag is 1, the interrupt is then processed; if it is
0, the interrupt request is left pending and normal instruction execution continues. A flowchart of operation
in standby mode is shown in figure 12.
25
HD404358 Series
Stop
Oscillator: Stop
Peripheral clocks: Stop
All other clocks: Stop
No
RESET = 0?
No
STOPC = 0?
Yes
RAME = 1
Yes
Oscillator: Active
Peripheral clocks: Active
All other clocks: Stop
Yes
No
IF0 • IMO = 1?
RESET = 0?
RAME = 0
Standby
Yes
IF1 • IM1 = 1?
No
Yes
No
IFTA • IMTA
= 1?
Yes
No
IFTB •
IMTB = 1?
Yes
No
IFTC •
IMTC = 1?
Yes
No
IFAD •
IMAD = 1?
Yes
No
IMS = 1?
IFS •
No
Yes
Restart
processor clocks
Reset MCU
Restart
processor clocks
Execute
next instruction
No
Execute
next instruction
IF = 1,
IM = 0, and
IE = 1?
Yes
Accept interrupt
Figure 12 MCU Operation Flowchart
Stop Mode: In stop mode, all MCU operations stop and RAM data is retained. Therefore, the power
dissipation in this mode is the least of all modes. The OSC1 and OSC2 oscillator stops.
Stop mode is terminated by a RESET input or a STOPC input as shown in figure 13. RESET or STOPC
must be applied for at least one tRC to stabilize oscillation (refer to the AC Characteristics section). When
the MCU restarts after stop mode is cancelled, all RAM contents before entering stop mode are retained,
but the accuracy of the contents of the accumulator, B register, W register, X/SPX register, Y/SPY register,
carry flag, and serial data register cannot be guaranteed.
26
HD404358 Series
Stop mode
Oscillator
Internal
clock
RESET
or STOPC
t
STOP instruction execution
≥ tRC (stabilization period)
res
Figure 13 Timing of Stop Mode Cancellation
Stop Mode Cancellation by STOPC: The MCU enters active mode from stop mode by inputting STOPC
as well as by R E SE T . In either case, the MCU starts instruction execution from the starting address
(address 0) of the program. However, the value of the RAM enable flag (RAME: $021, bit 3) differs
between cancellation by STOPC and by RESET. When stop mode is cancelled by R E SE T , RAME = 0;
when cancelled by STOPC, RAME = 1. RESET can cancel all modes, but STOPC is valid only in stop
mode; STOPC input is ignored in other modes. Therefore, when the program requires to confirm that stop
mode has been cancelled by STOPC (for example, when the RAM contents before entering stop mode is
used after transition to active mode), execute the TEST instruction to the RAM enable flag (RAME) at the
beginning of the program.
t
res
MCU Operation Sequence: The MCU operates in the sequence shown in figure 15. It is reset by an
asynchronous RESET input, regardless of its status.
The low-power mode operation sequence is shown in figure 16. With the IE flag cleared and an interrupt
flag set together with its interrupt mask cleared, if a STOP/SBY instruction is executed, the instruction is
cancelled (regarded as an NOP) and the following instruction is executed. Before executing a STOP/SBY
instruction, make sure all interrupt flags are cleared or all interrupts are masked.
A block diagram of the clock generation circuit is shown in figure 17. As shown in table 20, a ceramic
oscillator or crystal oscillator can be connected to OSC1 and OSC2. The system oscillator can also be
operated by an external clock. See figure 18 for the layout of crystal and ceramic oscillator.
OSC
OSC
1/4
f
cyc
t
cyc
Timing
generator
circuit
ø
CPU
ø
PER
f
2
1
System
oscillator
OSC
division
circuit
CPU with ROM,
RAM, registers,
flags, and I/O
Peripheral
function
interrupt
Figure 17 Clock Generation Circuit
TEST
RESET
OSC
1
OSC
2
GND
30
AV
SS
Figure 18 Typical Layout of Crystal and Ceramic Oscillator
Loading...
+ 70 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.