139
CHAPTER 7 8-BIT PWM TIMER
●
Coding example
CNTR EQU 0012H ; Address of the PWM control register
COMR EQU 0013H ; Address of the PWM compare register
TPE EQU CNTR:3 ; Define the counter operation enable bit.
TIR EQU CNTR:2 ; Define the interrupt request flag bit.
ILR1 EQU 007CH ; Address of the interrupt level setting register 3
INT_V DSEG ABS ; [DATA SEGMENT]
ORG 0FFF6H
IRQ2 DW WARI ; Set interrupt vector.
INT_V ENDS
;-----Main program---------------------------------------------------------------
CSEG ; [CODE SEGMENT]
; Stack pointer (SP) etc. are already initialized.
:
CLRI ; Disable interrupts.
CLRB TPE ; Stop counter operation.
MOV ILR1,#11011111B ; Set interrupt level (level 1).
MOV COMR,#061H ; Value compared with the counter value
(interval time)
MOV CNTR,#00101011B ; Operate interval timer, select 64 tinst,
start counter operation, clear interrupt request
flag, enable TO pin output, enable interrupt
request output.
SETI ; Enable interrupts.
:
;-----Interrupt program----------------------------------------------------------
WARI CLRB TIR ; Clear interrupt request flag.
PUSHW A
XCHW A,T ; Save A and T.
PUSHW A
:
User processing
:
POPW A
XCHW A,T ; Restore A and T.
POPW A
RETI
ENDS
;--------------------------------------------------------------------------------
END
Summary of Contents for MB89950 Series
Page 2: ......
Page 3: ...FUJITSU LIMITED F2MC 8L 8 BIT MICROCONTROLLER MB89950 950A Series HARDWARE MANUAL ...
Page 4: ......
Page 10: ...vi ...
Page 34: ...20 CHAPTER 2 HANDLING DEVICES ...
Page 134: ...120 CHAPTER 6 WATCHDOG TIMER ...
Page 236: ...222 CHAPTER 10 UART ...
Page 276: ...262 CHAPTER 12 LCD CONTROLLER DRIVER ...
Page 310: ...296 APPENDIX ...
Page 311: ...297 INDEX INDEX The index follows on the next page This is listed in alphabetic order ...
Page 316: ...302 INDEX ...
Page 318: ......