English
Language : 

M16C1N Datasheet, PDF (99/238 Pages) Renesas Technology Corp – RENESAS 16-BIT SINGLE-CHIP MICROCOMPUTER M16C FAMILY / M16C/10 SERIES
M16C/1N Group
12. Timers
12.3.2 Programmable Waveform Generation Mode
In this mode, the microcontroller, while counting the set values of Timer Y primary and Timer Y sec-
ondary alternately, outputs from the TYOUT pin a waveform whose polarity is inverted each time Timer
Y secondary underflows.
(See Table 12.9) A counting starts by counting the set value in the Timer Y primary. Figure 12.18
shows Timer Y, Z mode register in programmable waveform generation mode. Figure 12.19 shows
the operation example.
Table 12.9 Specifications of programmable waveform generation mode
Item
Specification
Count source
Count operation
f1, f8, on-chip oscillator output, fC32
• 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 Y, m: Set value of Timer Y primary, l: Set value of Timer Y secondary
Count start condition
Count stop condition
Count start flag is set (=1)
Count start flag is reset (=0) (Note 1)
Interrupt request generation timing When Timer Y underflows during secondary period
TYOUT pin function
Pulse output (Note 2)
Read from timer
Count value can be read out by reading Timer Y primary register.
Same applies to Prescaler Y register. (Note 3)
Write to timer
When a value is written to Timer Y primary register, it is written to only reload register.
Same applies to Timer Y secondary register and Prescaler Y register. (Note 4)
Select function
• Output level latch select function
The output level of a 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 P32 register for output.
• Waveform extend function (Note 6)
The waveform output primary period and secondary period can each be extended 0.5
cycles of the count source.
Frequency when waveform extended: 2xfi/((2x(m+1))+(2x(l+1))+TYPUM0+TYPUM1)
Duty: (2x(m+1)+TYPUM0)/((2x(m+1)+TYPUM0)+(2x(l+1)+TYPUM1))
m: set value of Timer Y primary, l: set value of Timer Y secondary
TYPUM0: Timer Y primary waveform extension control bit
TYPUM1: Timer Y secondary waveform extension control bit
Note 1: When the count is stopped, the Timer Y interrupt request bit becomes "1" and an interrupt may occur. Thus,
interrupts must be disabled before the count is stopped. Furthermore, set the Timer Y 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 Y primary register.
Note 4: The set value of Timer Y secondary register and waveform extension control bits as well as Timer Y primary
register are made effective by writing a value to the Timer Y primary register. The written values are reflected to
the waveform output from the next primary period after writing to the Timer Y primary register.
Note 5: The output is switched in sync with Timer Y secondary underflow.
Note 6: When using the waveform extend function, the Prescaler Y register must be set to "0016".
Rev.1.00 Oct 20, 2004 page 87 of 222
REJ09B0007-0100Z