Setup Example - Panasonic MN103S User Manual

Panaxseries
Hide thumbs Also See for MN103S:
Table of Contents

Advertisement

9.8.2

Setup Example

PWM Output Setup Example
The output pin (TM8AIO) using timer 8 outputs waveforms as shown below (repeating "L" output for 1.5 ms and
"H" output for the next 0.5 ms). IOCLK is selected as clock source to match the binary counter and the compare/
capture B register for every 1.5 ms and to match the binary counter and the compare/capture A register for every
2 ms. The oscillator frequency is set to 10 MHz, 6 multiplication and IOCLK=MCLK/2. A setup procedure with a
description of each step is shown below.
Output pin
(TM8BIO)
Setup Procedure
(1) Stop the counter
TM8MD(0x0000A200)
bp6: TMLDE=0
bp7: TMCNE=0
(2) Set the repeating cycle
TM8CB(0x0000A20C)=0xAFC7
(3) Set the repeating cycle
TM8CA(0x0000A208)=0xEA5F
(4) Select the count clock source
TM8MD(0x0000A200)
bp2-0: TMCK2-0=000
(5) Select the timer up/down
TM8MD(0x0000A200)
bp9-8: TMUD1-0=00
(6) Set the timer counter clear enabled
TM8MD(0x0000A200)
bp11: TMCLE=1
(7) Select the timer compare/capture B
operation mode
TM8MDB(0x0000A205)
bp7-6: TMAM1-0=00
1.5 ms
2 ms
Figure:9.8.3 PWM Output Setup Example
(1) Set the TMLDE flag and the TMCNE flag of the timer 8
mode register to "0" to stop counting of the timer 8.
(2) Set the repeating cycle to the timer 8 compare/capture B
register (TM8CB). Due to 45000 counts, the setting
value is 44999(0xAFC7).
(3) Set the repeating cycle to the timer 8 compare/capture A
register (TM8CA). Due to 60000 counts, the setting
value is 59999(0xEA5F). The setting value indicates
"L+H" period.
(4) Select the count clock source (IOCLK) by the TMCK2-0
flag of the TM8MD register.
(5) Select the timer up counting by the TMUD1-0 flag of the
TM8MD register.
(6) Set the TMCLE flag of the TM8MD register to "1" to
enable the clear operation of the TM8BC counter.
When the TM8CA register and the TM8BC counter
match, the TM8BC counter is cleared.
(7) Set the function of the timer 8 compare/capture register
to the compare register (double buffer) by the TMAM1-
0 flag of the timer 8 compare/capture B mode register
(TM8MDB).
Description
PWM Output
Chapter 9
16-bit Timer
IX - 61

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mn103sa7dMn103sa7g

Table of Contents