English
Language : 

M38203M4 Datasheet, PDF (162/344 Pages) Mitsubishi Electric Semiconductor – 8-BIT SINGLE-CHIP MICROCOMPUTER
APPLICATION
2.3 Timer X and timer Y
b7
b0
X X X 1 X X X X P5D : Port P5 direction register [Address 0B16]
b4 : Bit corresponding to port P54
1 : Output mode
b7
b0
1 X 0 1 X X X X TXM : Timer X mode register [Address 2716]
b5, b4 : Timer X operating mode bits
0 1 : Pulse output mode
b7 : Timer X stop control bit
1 : Count stop
7C16
TXL : Timer X (low-order) [Address 2016]
0016
TXH : Timer X (high-order) [Address 2116]
Set “division ratio – 1 (124 : 007C16)” in the timer X register
Note : Write values in the order of
the low-order byte and the
high-order byte.
b7
b0
X X X 1 X X X X ICON1 : Interrupt control register 1 [Address 3E16]
b4 : Timer X interrupt enable bit
1 : Interrupt enabled
Fig. 2.3.34 Setting of related registers
RESET
Initialization
CLT
CLD
SEI
All interrupts; Disabled
ICON1 (Address 3E16) ← XXX0XXXX2
TXM (Address 2716)
← 1X01XXXX2
P5D (Address 0B16), bit 4 ← 1
P5 (Address 0A16), bit 4 ← 1
TXL (Address 2016)
← 7C16
TXH (Address 2116)
← 0016 (125 – 1)
Timer X interrupt; Disabled
CNTR0 output stops at this point (A piezoelectric buzzer output stops)
Set port conditions at stop of a piezoelectric buzzer output
(“H” level output)
ICON1 (Address 3E16) ← XXX1XXXX2 Timer X interrupt; Enabled
CLI
Interrupts; Enabled
Main processing
Output unit
A piezoelectric buzzer
request has occurred?
N (= OFF)
TXM (Address 2716), bit 7 ← 1
P5 (Address 0A16), bit 4
←1
A piezoelectric buzzer request generated during the
main processing is processed at the output unit
Y (= ON)
Switch bit 7 of TXM
Count (ON)↔ Stop (OFF)
Immediately after no request?
N (= Request)
Y (= No request)
TXL (Address 2016)
TXH (Address 2116)
TXM (Address 2716), bit 7
← 7C16
← 0016 (125 – 1)
←0
Fig. 2.3.35 Control procedure
2–76
3820 GROUP USER’S MANUAL