Setup Example - Panasonic MN101L Series User Manual

Lsi
Table of Contents

Advertisement

Chapter 9
16-bit Timer
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
The setup procedure and its description are shown below.
TM7IO output
Step
Setting
1
Disable the timer counter
2
Select the timer output pin
3
4
Set the timer mode register
5
6
Set the PWM cycle
7
Set the "High" period of PWM
8
9
Enable the timer counter
IX - 38
16-bit High-Precision PWM Output (with Continuously Variable Period/Duty)
= 8 MHz) is selected as a clock source.
HCLK
400 Hz
Figure:9.7.4 Output Waveform of TM7IO output pin
Register
TM7MD.TM7EN = 0
TMIOEN1.TM7OEN = 1
P0DIR.P0DIR4 = 1
TM7MD2.TM7PWM = 1
TM7MD2.TM7BCR = 1
TM7MD2.T7PWMSL = 1
TM7MD1.TM7CK1-0 = 00
TM7MD1.TM7PS1-0 = 01
TM7PR1 = 0x270F
TM7PR2 = 0x09C3
TM7MD1.TM7EN = 1
Description
Disable the timer count operation.
Select the timer output pin.
[Chapter 7 I/O Port]
Select the PWM output.
Select the TM7BC clear source and the duty determination
source of PWM output.
Select HCLK/2 as the count clock source.
Set the cycle PWM output.
Setup value: 10000 - 1 = 9999 (0x270F)
Set the "High" period of PWM output.
Setup value: 10000 / 4 - 1 = 2499 (0x09C3)
Enable the timer count operation.

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mn101lr05dMn101lr04dMn101lr03dMn101lr02d

Table of Contents