166
CHAPTER 8 PULSE WIDTH COUNT TIMER (PWC)
●
Coding example
PCR1 EQU 0014H ; Address of the PWC pulse width control register 1
PCR2 EQU 0015H ; Address of the PWC pulse width control register 2
RLBR EQU 0016H ; Address of the PWC reload buffer register
EN EQU PCR1:7 ; Define the counter operation enable bit.
IE EQU PCR1:5 ; Define the interrupt request enable bit.
UF EQU PCR1:2 ; Define the underflow (01H 00H) interrupt
request flag bit.
BF EQU PCR1:0 ; Define the buffer full flag.
ILR1 EQU 007CH ; Address of the interrupt level setting register 1
INT_V DSEG ABS ; [DATA SEGMENT]
ORG 0FFF4H
IRQ3 DW WARI ; Set interrupt vector.
INT_V ENDS
;-----Main program----------------------------------------------------------------
CSEG ; [CODE SEGMENT]
; Stack pointer (SP) etc. are already initialized.
:
CLRI ; Disable interrupts.
CLRB EN ; Stop counter operation.
CLRB IE ; Disable interrupt request output.
CLRB BF ; Clear buffer full flag (PCR1: bit 0).
MOV ILR1,#10111111B ; Set interrupt level (level 2).
MOV RLBR,#075H ; Counter reload value (interval time)
MOV PCR2,#00001000B ; Select interval timer function, reload timer mode,
initial output value of the TO bit, and 32 tinst.
MOV PCR1,#11100000B ; Start counter operation, enable interrupt
request output, clear underflow (01H 00H)
interrupt request flag, clear measurement
completion interrupt request flag (bit 1).
SETI ; Enable interrupts.
:
;-----Interrupt processing routine------------------------------------------------
WARI CLRB UF ; Clear interrupt request flag.
PUSHW A
XCHW A,T
PUSHW A
:
User processing
:
POPW A
XCHW A,T
POPW A
RETI
ENDS
;---------------------------------------------------------------------------------
END
Содержание MB89950 Series
Страница 2: ......
Страница 3: ...FUJITSU LIMITED F2MC 8L 8 BIT MICROCONTROLLER MB89950 950A Series HARDWARE MANUAL ...
Страница 4: ......
Страница 10: ...vi ...
Страница 34: ...20 CHAPTER 2 HANDLING DEVICES ...
Страница 134: ...120 CHAPTER 6 WATCHDOG TIMER ...
Страница 236: ...222 CHAPTER 10 UART ...
Страница 276: ...262 CHAPTER 12 LCD CONTROLLER DRIVER ...
Страница 310: ...296 APPENDIX ...
Страница 311: ...297 INDEX INDEX The index follows on the next page This is listed in alphabetic order ...
Страница 316: ...302 INDEX ...
Страница 318: ......