Programming Notes - Epson S1C6P366 Technical Manual

Cmos 4-bit single chip microcomputer
Table of Contents

Advertisement

4.9.5 Programming notes

(1) When reading counter data, be sure to read the low-order 4 bits (PTD00–PTD03, PTD10–PTD13) first.
Furthermore, the high-order 4 bits (PTD04–PTD07, PTD14–PTD17) should be read within 0.73 msec of
reading the low-order 4 bits (PTD00–PTD03, PTD10–PTD13).
For the 16 bit × 1 mode, be sure to read as following sequence:
(PTD00–PTD03) → (PTD04–PTD07) → (PTD10–PTD13) → (PTD14–PTD17)
The read sequence time should be within 1.46 msec.
(2) The programmable timer actually enters RUN/STOP status in synchronization with the falling edge
of the input clock after writing to the PTRUN0/PTRUN1 register. Consequently, when "0" is written to
the PTRUN0/PTRUN1 register, the timer enters STOP status at the point where the counter is
decremented (-1). The PTRUN0/PTRUN1 register maintains "1" for reading until the timer actually
stops.
Figure 4.9.5.1 shows the timing chart for the RUN/STOP control.
It is the same even in the event counter mode. Therefore, be aware that the counter does not enter
RUN/STOP status if a clock is not input after setting the RUN/STOP control register (PTRUN0).
(3) Since the TOUT signal is generated asynchronously from the PTOUT register, a hazard within 1/2
cycle is generated when the signal is turned ON and OFF by setting the register.
(4) When the OSC3 oscillation clock is selected for the clock source, it is necessary to turn the OSC3
oscillation ON, prior to using the programmable timer. However the OSC3 oscillation circuit requires
a time interval of at least 5 msec from turning the circuit ON until the oscillation stabilizes. Therefore,
allow an adequate interval from turning the OSC3 oscillation circuit ON to starting the programmable
timer. Refer to Section 4.3, "Oscillation Circuit", for the control and notes of the OSC3 oscillation
circuit.
At initial reset, the OSC3 oscillation circuit is set in the OFF state.
(5) After an interrupt occurs, the same interrupt will occur again if the interrupt enabled state (I flag =
"1") is set or the RETI instruction is executed unless the interrupt factor flag is reset. Therefore, be sure
to reset (write "1" to) the interrupt factor flag in the interrupt service routine before shifting to the
interrupt enabled state.
(6) For the reason below, pay attention to the reload data write timing when changing the interval of the
programmable timer interrupts while the programmable timer is running.
The programmable timer counts down at the falling edge of the input clock and at the same time it
generates an interrupt if the counter underflows. Then it starts loading the reload data to the counter
and the counter data is determined at the next rising edge of the input clock (period shown in as
the figure).
Input clock
Counter data
(continuous mode)
To avoid improper reloading, do not rewrite the reload data after an interrupt occurs until the counter
data is determined including the reloading period
speed clock) as the clock source of the programmable timer and the CPU is operating with the OSC3
(high-speed clock).
S1C6P366 TECHNICAL MANUAL
CHAPTER 4: PERIPHERAL CIRCUITS AND OPERATION (Programmble Timer)
Input clock
PTRUN0/PTRUN1 (RD)
PTRUN0/PTRUN1 (WR)
PTD0X/PTD1X
Fig. 4.9.5.1 Timing chart for RUN/STOP control
03H
02H
01H
Underflow (interrupt is generated)
Fig. 4.9.5.2 Reload timing for programmable timer
"1" (RUN)
"0" (STOP)
writing
42H
41H 40H 3FH 3EH
00H
25H
24H
Counter data is determined by reloading.
. Be especially careful when using the OSC1 (low-
EPSON
writing
3DH
(Reload data = 25H)
in
73

Advertisement

Table of Contents
loading

Table of Contents