Program Example For Pwm Timer; Program Example Of Interval Timer Functions - Fujitsu F2MC-8L F202RA Hardware Manual

F2mc-8l 8-bit microcontroller
Hide thumbs Also See for F2MC-8L F202RA:
Table of Contents

Advertisement

7.10

Program Example for PWM Timer

This section describes program examples of an 8-bit PWM timer.

Program Example of Interval Timer Functions

● Processing specifications
5 ms interval timer interrupts occur repeatedly.
The square waveform that inverts at an interval is output to the P50/PWM pin.
The following expression yields the COMR register value for which the interval is about 5 ms when the
top speed of the gear (one instruction cycle = 4/F
MHz. The count clock is 64 t
COMR register value = 5 ms/(64 × 4/12.5 MHz) - 1 = 244.1 (0F4
● Coding example
CNTR
COMR
TPE
TIR
ILR3
INT_V
IRQ9
INT_V
;------------------------Main program---------------------------------------------------------------------------------
;------------------------Interrupt program----------------------------------------------------------------------------
WARI1
of the internal count clock.
INST
EQU
0022H
EQU
0023H
EQU
CNTR:3
EQU
CNTR:2
EQU
007D
DSEG
ABS
ORG
0FFF8H
DW
WARI1
ENDS
CSEG
:
CLRI
CLRB
TPE
MOV
ILR3,#11110111B
MOV
COMR,#0F4H
MOV
CNTR,#00101011B
SETI
:
CLRB
TIR
PUSHW
A
XCHW
A,T
PUSHW
A
CHAPTER 7 8-BIT PWM TIMER
) is obtained at an oscillation frequency of 12.5
CH
)
H
; Address of the PWM control register
; Address of the PWM compare register
; Defining the bit to enable the counter operation
; Defining the interrupt request flag bit
; Address of the register to set the interrupt level
; [DATA SEGMENT]
; Setting the interrupt vector
; [CODE SEGMENT]
; The stack pointer (SP) and others are assumed to have
been initialized.
; Disabling interrupts
; Stopping the counter operation
; Setting the interrupt level (level 1)
; Comparison value with the counter value (interval)
; Enabling the output of the PWM
; Interval timer operation, selection of 64 t
; Starting the counter operation and enabling the output
of interrupt requests
; Enabling interrupts
; Clearing the interrupt request flag
; Saving A and T
INST
157

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

F2mc-8l mb89202Mb89202/f202ra series

Table of Contents