MB89620 series
CHAPTER 8 PULSE WIDTH COUNT TIMER (PWC)
177
n
Program Example 2 for Interval Timer Function (One-shot Timer Mode)
l
Processing description
•
Generates a single 3 ms interval timer interrupt (one-shot timer mode).
•
The WTO pin is output a pulse wave that inverts after each interval time cycle. The initial
value of a square wave is “H” level.
•
The following shows the RLBR register value that results in an interval time of approximately
3 ms for a 10 MHz source oscillation. The count clock is 32 t
inst
(t
inst
: divide-by-four source
oscillation).
RLBR register value = 3 ms/(32
×
4/10 MHz) = 233.4 (0EAH)
l
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 (01
H
→
00
H
) interrupt request flag bit.
ILR2
EQU
007DH
; Address of the interrupt level setting register 2
INT_V
DSEG
ABS
; [DATA SEGMENT]
ORG
0FFF0H
IRQ5
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.
MOV
A,RLBR
; Clear buffer full flag (PCR1: bit 0).
MOV
ILR2,#11110111B
; Set interrupt level (level 1).
MOV
RLBR,#0EAH
; Counter reload value (interval time)
MOV
PCR2,#01101000B
; Select interval timer function, one-shot timer mode, initial output
value of the WTO pin, and 32 t
inst
.
MOV
PCR1,#11100000B
; Start counter operation, enable WTO pin output, enable interrupt
request output, clear underflow (01
H
→
00
H
) interrupt request
flag, clear measurement complete 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
Содержание F2MC-8L MB89620 Series
Страница 8: ......
Страница 10: ...MB89620 series ...
Страница 11: ...vi MB89620 series ...
Страница 17: ...xii MB89620 series ...
Страница 18: ...xvi MB89620 series ...
Страница 30: ...MB89620 series CHAPTER 1 OVERVIEW 9 Memo ...
Страница 34: ...MB89620 series CHAPTER 1 OVERVIEW 13 Memo ...
Страница 42: ...MB89620 series CHAPTER 1 OVERVIEW 21 Memo ...
Страница 49: ...28 CHAPTER 1 OVERVIEW MB89620 series ...
Страница 62: ...MB89620 series CHAPTER 3 CPU 41 Memo ...
Страница 78: ...MB89620 series CHAPTER 3 CPU 57 Memo ...
Страница 82: ...MB89620 series CHAPTER 3 CPU 61 Memo ...
Страница 86: ...MB89620 series CHAPTER 3 CPU 65 Memo ...
Страница 90: ...MB89620 series CHAPTER 3 CPU 69 Memo ...
Страница 96: ...MB89620 series CHAPTER 3 CPU 75 Memo ...
Страница 122: ...MB89620 series CHAPTER 4 I O PORTS 101 Memo ...
Страница 144: ...MB89620 series CHAPTER 5 TIMEBASE TIMER 123 Memo ...
Страница 149: ...128 CHAPTER 5 TIMEBASE TIMER MB89620 series ...
Страница 157: ...136 CHAPTER 6 WATCHDOG TIMER MB89620 series ...
Страница 174: ...MB89620 series CHAPTER 7 8 BIT PWM TIMER 153 Memo ...
Страница 177: ...156 CHAPTER 7 8 BIT PWM TIMER MB89620 series ...
Страница 202: ...MB89620 series CHAPTER 9 16 BIT TIMER COUNTER 181 Memo ...
Страница 217: ...196 CHAPTER 9 16 BIT TIMER COUNTER MB89620 series ...
Страница 220: ...MB89620 series CHAPTER 10 8 BIT SERIAL I O SERIAL I O 1 AND SERIAL I O 2 199 Memo ...
Страница 228: ...MB89620 series CHAPTER 10 8 BIT SERIAL I O SERIAL I O 1 AND SERIAL I O 2 207 Memo ...
Страница 245: ...224 CHAPTER 10 8 BIT SERIAL I O SERIAL I O 1 AND SERIAL I O 2 MB89620 series ...
Страница 266: ...MB89620 series CHAPTER 13 A D CONVERTER 245 13 Memo ...
Страница 283: ...262 CHAPTER 13 A D CONVERTER MB89620 series ...
Страница 289: ...268 CHAPTER 14 CLOCK MONITOR FUNCTION MB89620 series ...
Страница 306: ...MB89620 series APPENDIX 285 APPEND Memo ...
Страница 319: ...298 APPENDIX MB89620 series Memo ...
Страница 321: ...2 ...
Страница 354: ......