EasyManua.ls Logo

Panasonic MN101L Series

Panasonic MN101L Series
563 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 9
16-bit Timer
IX - 38 16-bit High-Precision PWM Output (with Continuously Variable Period/Duty)
9.7.2 Setup Example
High Precision PWM Output Setup Example
Here is an example that, using Timer 7, the PWM output waveform with the 1/4 duty cycle and 400 Hz is output
from TM7IO output pin. HCLK/2 (at f
HCLK
= 8 MHz) is selected as a clock source.
The setup procedure and its description are shown below.
Figure:9.7.4 Output Waveform of TM7IO output pin
Step Setting Register Description
1 Disable the timer counter TM7MD.TM7EN = 0 Disable the timer count operation.
2 Select the timer output pin TMIOEN1.TM7OEN = 1 Select the timer output pin.
[Chapter 7 I/O Port]
3 P0DIR.P0DIR4 = 1
4 Set the timer mode register TM7MD2.TM7PWM = 1 Select the PWM output.
5
TM7MD2.TM7BCR = 1
TM7MD2.T7PWMSL = 1
Select the TM7BC clear source and the duty determination
source of PWM output.
6
TM7MD1.TM7CK1-0 = 00
TM7MD1.TM7PS1-0 = 01
Select HCLK/2 as the count clock source.
7
Set the PWM cycle TM7PR1 = 0x270F Set the cycle PWM output.
Setup value: 10000 - 1 = 9999 (0x270F)
8
Set the "High" period of PWM TM7PR2 = 0x09C3 Set the "High" period of PWM output.
Setup value: 10000 / 4 - 1 = 2499 (0x09C3)
9 Enable the timer counter TM7MD1.TM7EN = 1 Enable the timer count operation.
TM7IO output
400 Hz

Table of Contents

Related product manuals