Setup Example - Panasonic MN101L Series User Manual

Lsi
Table of Contents

Advertisement

Chapter 8
8-bit Timer
8.5.2

Setup Example

Timer Pulse Output Setup Example
Here is an example that a 50 kHz pulse is output from TM0IO pin of Timer 0. In order to output a 50 kHz pulse,
select SYSCLK/2 for clock source, and set 1/2 cycle (100 kHz) in the Timer 0 compare register (at f
MHz).
The setup procedure and the description of each step are shown below.
Step
Setting
1
Disable the timer counter
2
Select the timer output pin
3
Set the timer mode register
4
5
Set the prescaler
6
Set the output cycle
7
8
Enable the timer counter
If any data are written to TMnOC while TMnBC is stopped, the timer output turns to "Low".
..
..
VIII - 24
8-bit Timer Pulse Output
Register
TM0MD.TM0EN = 0
TMIOEN0.TM0OEN = 1
P0DIR.P0DIR5 = 1
TM0MD.TM0PWM = 0
TM0MD.TM0MOD = 0
TM0MD.TM0CK1-0 = 01
CK0MD.TM0PSC1-0 = X0
CK0MD.TM0BAS = 1
TM0OC = 0x31
TM0MD.TM0EN = 1
Description
Disable the timer count operation.
Select the timer output pin.
[Chapter 7 I/O Port]
Select the timer normal operation.
Select the prescaler as the clock source.
Select SYSCLK/2.
Set the timer output cycle.
Setup value: 49 (0x31)
Enable the timer count operation.
= 10
sysclk

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mn101lr05dMn101lr04dMn101lr03dMn101lr02d

Table of Contents