Fujitsu Semiconductor Controller MB89950/950A Hardware Manual page 154

F2mc-8l 8-bit microcontroller
Table of Contents

Advertisement

CHAPTER 7 8-BIT PWM TIMER
I Program example for PWM timer function
G
Processing description
• Generates a PWM wave with a duty ratio of 50%. Then, changes the duty ratio to 25%.
• Does not generate interrupts.
• For a 5 MHz main clock oscillation frequency (F
PWM wave cycle of 16 x 4/5 MHz x 256 = 3.277 ms.
• The following shows the COMR register value required for a duty ratio of 50%:
COMR register value = 50/100 x 256 = 128 (080
G
Coding example
CNTR
COMR
TPE
;-----Main program---------------------------------------------------------------
;--------------------------------------------------------------------------------
140
EQU
0012H
EQU
0013H
EQU
CNTR:3
CSEG
:
CLRB
TPE
MOV
COMR,#80H
MOV
CNTR,#10011010B ; Operate PWM timer, select 16 tinst,
:
:
MOV
COMR,#40H
:
ENDS
END
), selecting the interval 16 t
CH
)
H
; Address of the PWM control register
; Address of the PWM compare register
; Define the counter operation enable bit.
; [CODE SEGMENT]
; Stop counter operation.
; Set "H" width of pulse. Duty ratio = 50%
start counter operation, clear interrupt request
flag, enable PWM pin output, and disable
interrupt request output.
; Change the duty ratio to 25% (effective from
the next PWM wave cycle).
count clock gives a
inst

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mb89950 seriesMb89950a series

Table of Contents