English
Language : 

M16C1N Datasheet, PDF (109/238 Pages) Renesas Technology Corp – RENESAS 16-BIT SINGLE-CHIP MICROCOMPUTER M16C FAMILY / M16C/10 SERIES
M16C/1N Group
12. Timers
12.4.2 Programmable Waveform Generation Mode
In this mode, the microcontroller, while counting the set values of Timer Z primary and Timer Z sec-
ondary alternately, outputs from the TZOUT pin a waveform whose polarity is inverted each time Timer
Z secondary underflows. (See Table 12.11) A counting starts by counting the value set in the Timer Z
primary. Figure 12.26 shows Timer Y, Z mode register and Timer Y, Z waveform output control regis-
ter in this mode. The Timer Z operates in the same way as the Timer Y in this mode. See Figure 12.19
shown the Timer Y operating example in programmable waveform generation mode.
Table 12.11 Specifications of programmable waveform generating mode
Item
Specification
Count source
f1, f8, Timer Y underflow, fC32
Count operation
• Down count
• When the timer underflows, it reloads the contents of primary reload register and sec-
ondary reload register alternately before continuing counting.
• When a counting stops, the timer reloads the content of the reload register before it
Divide ratio
stops.
fi
(n+1) X ((m+1)+(l+1))
n: Set value of Prescaler Z, m: Set value of Timer Z primary, l: Set value of Timer Z secondary
Count start condition
Count start flag is set (=1)
Count stop condition
Count start flag is reset (=0) (Note 1)
Interrupt request generation timing When Timer Z underflows during secondary period
TZOUT pin function
Pulse output (Note 2)
INT0 pin function
Programmable I/O port, or external interrupt input pin
Read from timer
Count value can be read out by reading Timer Z primary register.
Same applies to Prescaler Z register. (Note 3)
Write to timer
When a value is written to Timer Z primary register, it is written to only reload register.
Same applies to Timer Z secondary register and Prescaler Z register. (Note 4)
Select function
• Output level latch select function
The output level of an waveform being counted during primary and secondary periods
is selectable.
• Programmable waveform generation output switching function (Note 5)
Can select either programmable waveform or the value of port P31 register for output.
• Waveform extend function (Note 6)
The waveform output primary and secondary periods can each be extended 0.5 cycles
of the count source.
Frequency when waveform extended: 2xfi/((2x(m+1))+(2x(l+1))+TZPUM0+TZPUM1)
Duty: (2x(m+1)+TZPUM0)/((2x(m+1)+TZPUM0)+(2x(l+1)+TZPUM1))
m: set value of Timer Z primary, l: set value of Timer Z secondary
TZPUM0: Timer Z primary waveform extension control bit
TZPUM1: Timer Z secondary waveform extension control bit
Note 1: When the count is stopped, the Timer Z interrupt request bit becomes "1" and an interrupt may occur. Thus,
interrupts must be disabled before the count is stopped. Furthermore, set the Timer Z interrupt request bit to "0"
before starting counting again.
Note 2: When the counting stopped, the pin is the secondary period output level.
Note 3: Even when counting the secondary period, read out the Timer Z primary register.
Note 4: The set value of Timer Z secondary register and waveform extension control bits as well as Timer Z primary
register are made effective by writing a value to the Timer Z primary register. The written values are reflected to
the waveform output from the next primary period after writing to the Timer Z primary register.
Note 5: The output is switched in sync with Timer Z secondary underflow.
Note 6: When using the waveform extend function, the Prescaler Z register must be set to "0016".
When selecting Timer Y underflow and f1 for the count source, the waveform extend function cannot be used.
Rev.1.00 Oct 20, 2004 page 97 of 222
REJ09B0007-0100Z