R8C/1A Group, R8C/1B Group
14. Timers
Rev.1.30
Dec 08, 2006
Page 130 of 315
REJ09B0252-0130
14.2.2
Programmable Waveform Generation Mode
In programmable waveform generation mode, the signal output from the TZOUT pin is inverted each time the
counter underflows, while the values in registers TZPR and TZSC are counted alternately (refer to
Table 14.8
Programmable Waveform Generation Mode Specifications
).
Counting starts by counting the value set in the
TZPR register. Figure 14.17 shows Registers TZMR and PUM in Programmable Waveform Generation Mode.
Figure 14.18 shows an Operating Example of Timer Z in Programmable Waveform Generation Mode.
NOTES:
1. Even when counting the secondary period, the TZPR register may be read.
2. The value set in registers TZPR and TZSC are made effective by writing a value to the TZPR
register. The set values are reflected in the waveform output beginning with the following primary
period after writing to the TZPR register.
3. The TZOCNT bit is enabled by the following.
• When counting starts.
• When a timer Z interrupt request is generated. The contents after the TZOCNT bit is changed are
reflected from the output of the following primary period.
Table 14.8
Programmable Waveform Generation Mode Specifications
Item
Specification
Count sources
f1, f2, f8, timer X underflow
Count operations
• Decrement
• When the timer underflows, it reloads the contents of the primary reload and
secondary reload registers alternately before the count is continued.
Width and period of
output waveform
Primary period: (n+1)(m+1)/fi
Secondary period: (n+1)(p+1)/fi
Period: (n+1){(m+1)+(p+1)}/fi
fi: Count source frequency
n: Value set in PREZ register, m: value set in TZPR register, p: value set in TZSC
register
Count start condition
1 (count starts) is written to the TZS bit in the TZMR register.
Count stop condition
0 (count stops) is written to the TZS bit in the TZMR register.
Interrupt request
generation timing
In half a cycle of the count source, after timer Z underflows during the secondary
period (at the same time as the TZout output change) [timer Z interrupt].
TZOUT pin function
Pulse output
(To use this pin as a programmable I/O port, select timer mode.)
INT0 pin function
Programmable I/O port, or INT0 interrupt input
Read from timer
The count value can be read out by reading registers TZPR and PREZ
.
(1)
Write to timer
The value written to registers TZSC, PREZ, and TZPR is written to the reload
register only
(2)
Select functions
• Output level latch select function
The TZOPL bit can select the output level during primary and secondary
periods.
• Programmable waveform generation output switch function
When the TZOCNT bit in the TZOC register is set to 0, the output from the
TZOUT pin is inverted synchronously when timer Z underflows. When set to 1,
the value in the P1_3 bit is output from the TZOUT pin
(3)