Setup Example - Panasonic MN103S User Manual

Panaxseries
Hide thumbs Also See for MN103S:
Table of Contents

Advertisement

8.5.2

Setup Example

Timer Output Setup Example
The TM1IO pin outputs 100 KHz pulse by using timer 1. In order to output 100 KHz, select IOCLK for a count
clock source, and set 1/2 cycle (200 KHz) to the timer 1 base register.
An example setup procedure, with a description of each step is shown below.
TMOIO output
Setup Procedure
(1) Check the counter stopped
TM1MD (0x0000A181)
bp6: TM1LDE=0
bp7: TM1CNE=0
(2) Set the TM1IO pin to output and mode
P3MD (0x0000A033)
bp1: P31M=1
P3DIR (0x0000A023)
bp1: P31D=1
(3) Set 1/2 cycle for timer output
TM1BR(0x0000A189)=0x95
(4) Select the count clock source
TM1MD(0x0000A181)
bp2-0: TM1CK2-0=000
(5) Initialize timer 1
TM1MD(0x0000A181)
bp6: TM1LDE=1
(6) Start the timer operation
TM1MD (0x0000A181)
bp7: TM1CNE=1
TM1BC starts to count down from 0x95. When an underflow occurs, the signal of theTM1IO output pin is
inverted; and, TM1BC starts to count down from 0x95 again.
100KHz
Figure:8.5.2 Output Waveform of TM1IO pin
(1) Set the TM1LDE flag and the TM1CNE flag of the timer
(2) Set the P3MD flag of the port 3 mode register (P31M) to
(3) Set 1/2 cycle of the timer output to the timer 1 base
(4) Select IOCLK to the count clock source by the TM1CK2-
(5) Set the TM1LDE flag of the TM1MD register to "1" to
(6) Set the TM1CNE flag of the TM1MD register to "1" to
Description
1 mode register (TM1MD) to "0" to stop timer 1
counting.
"1" for TM1IO pin setting.
Set the P31D flag of the port 3 I/O control register
(P3DIR) to "1" for output pin setting.
register (TM1BR). The setting value is 149 (0x95) due
to 200KHz. Setting value = (10MHZ × 2/6) / 200KHz -1
0 flag of the TM1MD register.
initialize timer 1. The value of the TM1BR register is
loaded to the TM1BC counter; and, output of TM1IO
changes "L". Reset the TM1LDE flag to "0".
operate timer 1.
Chapter 8
8-bit Timer
Timer Output Function
VIII - 37

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mn103sa7dMn103sa7g

Table of Contents