104
ยตPD750008 USER'S MANUAL
(2) Reading the count
The count status of the basic interval timer (BT) can be read by using an 8-bit manipulation instruction.
No data can be loaded to the timer.
Caution When reading the count value of BT, execute a read instruction twice so that unstable
data which has been counted will not be read. If the two read values are reasonable, use
the second one as the result. If the two read values are far apart, retry from the beginning.
Examples 1. Read the count value of BT.
SET1 MBE
SEL MB15
MOV HL, #BT ; Set the BT address in HL
LOOP: MOV XA, @HL ; First read
MOV BC, XA
MOV XA, @HL ; Second read
SKE XA, BC
BR LOOP
2. Set the high level width of pulses applied to the INT4 interrupt pin (both edges detected).
(The pulse width is assumed not to exceed the value (5.46 ms or longer at 6.00 MHz) set
in the BTM.)
<INT4 interrupt routine (MBE = 0)>
LOOP: MOV XA, BT ; First read
MOV BC, XA ; Store data
MOV XA, BT ; Second read
SKE A, C
BR LOOP
MOV A, X
SKE A, B
BR LOOP
SKT PORT0.0 ; P00 = 1?
BR AA ; NO
MOV XA, BC ; Store data in data memory
MOV BUFF, XA
CLR1 FLAG ; Clear data presence flag
RETI
AA: MOV HL, #BUFF
MOV A, C
SUBC A, @HL
INCS L
MOV C, A
MOV A, B
SUBC A, @HL
MOV B, A