Panasonic MN101C77C User Manual

Page of 544
VII - 25
Chapter 7    16-bit Timer
16-bit Standard PWM Output
7-6-2
Setup Example
„
Standard PWM Output Setup Example (Timer 7)
The TM7IO output pin outputs the 1/4 duty PWM output waveform at 305.18 Hz with timer 7. The high
frequency oscillation (fosc) is set to be operated at 20 MHz. One cycle of the PWM output waveform is
decided by the overflow of a binary counter. "H" period of the PWM output waveform is decided by the
set value of a compare register 1.
An example setup procedure, with a description of each step is shown below.
TM7IO output
305.18 Hz
Figure 7-6-4    Output Waveform of TM7IO Output Pin
(1) Set the TM7EN flag of the timer 7 mode
register 1 (TM7MD1) to "0" to stop timer 7
counting.
(2) Set the P1OMD4 flag of the port 1 output mode
register (P1OMD) to "1" to set the P14 pin as a
special function pin. Set the P1DIR4 flag of the
port 1 direction control register (P1DIR) to "1"
to set output mode. Add pull-up resistor, if it
necessary.
(3) Set the TM7PWM flag of the timer 7 mode
register 2 (TM7MD2) to "1" to select the PWM
output.
(4) Set the TM7BCR flag of the TM7MD2 register
to "0" to select the full count over flow as a
binary counter clear source.
Setup Procedure
(1) Stop the counter.
TM7MD1 (x'3F78')
bp4
: TM7EN
= 0
(2) Set the special function pin to output
mode.
P1OMD (x'3F2F')
bp4
: P1OMD4 = 1
P1DIR (x'3F31')
bp4
: P1DIR4
= 1
(3) Set the PWM output.
TM7MD2 (x'3F79')
bp4
: TM7PWM = 1
(4) Set the standard PWM output
operation.
TM7MD2 (x'3F79')
bp5
: TM7BCR = 0
Description
 [  
 Chapter 4    I/O Ports  ]