MB95630H Series
452 FUJITSU SEMICONDUCTOR LIMITED MN702-00009-2v0-E
CHAPTER 21 MULTI-PULSE GENERATOR
21.8 Sample Program for Multi-pulse Generator
21.8 Sample Program for Multi-pulse Generator
This section provides a sample program for the multi-pulse generator.
■ Sample Program for Multi-pulse Generator
● Processing
• An output in the PPG is directed to OPT0 and an inverted output in the PPG is directed to
OPT1 when write timing interrupt is generated.
• The OPDBRH0/OPDBRL0 write method is used for data transfer to 16-bit MPG output
data register (upper/lower) (OPDUR/OPDLR).
• The 16-bit PPG timer is used in PWM and is started with a software trigger.
• 16 MHz is used for the machine clock, and 62.5 ns is used for the count clock of the 16-bit
PPG timer.
● Coding example
;-------A demo program--------------------------------------------------------------------------------------
ILR4 EQU 007DH ;Interrupt control register for the waveform sequencer
PCSR1 EQU 0FB2H ;16-bit PPG cycle setting buffer register
PDUT1 EQU 0FB4H ;16-bit PPG duty setting buffer register
PCNT1 EQU 0044H ;16-bit PPG status control register
OPCUR EQU 0066H ;16-bit MPG output control register (upper)
OPCLR EQU 0067H ;16-bit MPG output control register (lower)
OPCR EQU OPCUR ;16-bit MPG output control register (upper+lower)
; ,for word access.
OPDBRH0 EQU 0FC4H ;16-bit MPG output data buffer register 0 (upper)
OPDBRL0 EQU 0FC5H ;16-bit MPG output data buffer register 0 (lower)
OPDBR0 EQU OPDBRH0 ;16-bit MPG output data buffer register 0
(upper+lower)
; ,for word access.
WTIF EQU OPCUR:1 ;Interrupt request flag bit
;-------Main program-----------------------------------------------------------------------------------------
CODE CSEG ABS
START:
; : ;Assumes that stack pointer (SP) has already been
CLRI ;Interrupt disable
MOV ILR4,#00H ;Interrupt level 0 (top priority)
MOVW A,#0064H
MOVW PCSR1,A ;Sets the period of the PPG output
MOVW A,#003CH
MOVW PDUT1,A ;Sets the duty ratio of the PPG output
MOVW A,#01100000000000110B