SIC63616-(Rev. 1.0) NO. P87
3240-0412
4.8.6 Direct input function and key mask
The stopwatch timer has a direct input function that can control the RUN/STOP and LAP operation of the
stopwatch timer by external key input. This function is set by writing "1" to the EDIR register. When EDIR
is set to "0", only the software control is possible as explained in the previous section.
Input port configuration
In the direct input function, the input ports P10 and P11 are used as the RUN/STOP and LAP input
ports. The key assignment can be selected using the SWDIR register.
Table 4.8.6.1 RUN/STOP and LAP input ports
SWDIR
0
1
P10
RUN/STOP
LAP
P11
LAP
RUN/STOP
Direct RUN
When the direct input function is selected, RUN/STOP operation of the stopwatch timer can be con-
trolled by using the key connected to the input port P10/P11 (selected by SWDIR). P10/P11 works as a
normal input port, but the input signal is sent to the stopwatch control circuit. The key input signal from
the P10/P11 port works as a toggle switch. When it is input in STOP status, the stopwatch timer runs,
and in RUN status, the stopwatch timer stops. RUN/STOP status of the stopwatch timer can be checked
by reading the SWRUN register. An interrupt is generated by direct RUN input.
The sampling for key input signal is performed at the falling edge of 1,024 Hz signal same as the SW-
RUN control. The chattering judgment is performed at the point where the key turns off, and a chatter-
ing less than 46.8–62.5 msec is removed. Therefore, more time is needed for an interval between RUN
and STOP key inputs.
Figure 4.8.6.1 shows the operating timing for the direct RUN input.
f
OSC1
/32 (1,024 Hz)
Direct RUN input (P10/P11)
Direct RUN internal signal
SWRUN register
Count clock
Direct RUN interrupt
Fig. 4.8.6.1 Operating timing for direct RUN input
Direct LAP
Control for the LAP can also be done by key input same as the direct RUN. When the direct input func-
tion is selected, the input port P11/P10 (selected by SWDIR) becomes the LAP key input port. Sampling
for the input signal and the chattering judgment are the same as a direct RUN.
By entering the LAP key, the counter data at that point is latched into the capture buffer and is held. The
counter continues counting operation. Furthermore, an interrupt occurs by direct LAP input.
As stated above, the capture buffer data is held until SWD8–11 is read. If the LAP key is input when
data has been already held, it renews the content of the capture buffer. When SWD8–11 is read after
renewing, the capture renewal flag is set to "1". In this case, the hold status is not released by reading
SWD8–11, and it continues. Normally the LAP data should be read after the interrupt is generated. After
that, be sure to check the capture renewal flag. When the capture renewal flag is set, renewed data is
held in the capture buffer. So it is necessary to read from SWD0–3 again.