
APPLICATION
2.3 Timer X and timer Y
3820 GROUP USER’S MANUAL
2–70
I
Real time port function
Figure 2.3.27 shows an example of setting registers for using the real time port (referred as RTP)
function.
Fig. 2.3.27 Example of setting registers for using RTP
P6D : Port P6 direction register [Address 0D
16
]
Port P6 direction register
b7
b0
b0, b1 :
Bits corresponding to ports P6
0
(RTP
0
) and P6
1
(RTP
1
)
0 : Input mode
1 : Output mode
Set timer X stop control bit of timer X mode register to “0” to start counting
Set count value (low-order) to timer X (low-order) (TXL) [Address 20
16
]
Set count value (high-order) to timer X (high-order) (TXH) [Address 21
16
]
TXM : Timer X mode register [Address 27
16
]
b0 : Timer X write control bit
0 : Write value in latch and counter
1 : Write value in latch only
b1 : Real time port control bit
1 : Real time port function valid
b2 : P6
0
data for real time port
b3 : P6
1
data for real time port
b5, b4 : Timer X operating mode bits
0 0 : Timer mode
0 1 : Pulse output mode
1 0 : Event counter mode
1 1 : Pulse width measurement mode
b7
1
b0
Setting of timer X mode register
Select RTP or others
b6 : CNTR
0
active edge switch bit
CNTR
0
interrupt
0 : Falling edge active
1 : Rising edge active
Pulse output mode
0 : Start at initial level “H” output
0 : Start at initial level “L” output
Event counter mode
0 : Rising edge active
1 : Falling edge active
Pulse width measurement mode
0 : Measure “H” level width
1 : Measure “L” level width
b7 : Timer X stop control bit
1 : Count stop
[Notes on use]
Notes 1:
After reset release, port P6 direction register is set for the input mode, so pins P6
0
/INT
3
/RTP
0
and P6
1
/RTP
1
operate as ordinary input ports. For using as RTP, be sure to set the
corresponding bits of the port P6 direction register for the output mode.
2:
Change RTP output data as required, for example, by using an interrupt.
3:
Do not change ports P6
0
and P6
1
selected as RTP into input pins during RTP operation.
1
: Nothing is allocated