12.7 Program Example For Watch Prescaler - Fujitsu F2MC-8L Series Hardware Manual

8-bit microcontroller
Hide thumbs Also See for F2MC-8L Series:
Table of Contents

Advertisement

12.7 Program Example for Watch Prescaler

This section provides a program example for the watch prescaler.
Program Example for Watch Prescaler
Processing description
Repeatedly generates a watch interrupt of 2
is 1 second (during operation at 32.768 kHz).
Coding example
WPCR
EQU
WIF
EQU
ILR2
EQU
INT_V
DSEG
ORG
IRQ7
DW
INT_V
ENDS
;-----Main program----------------------------------------------------------------------------------------------------------------------------------------
CSEG
:
CLRI
MOV
MOV
SETI
:
;-----Interrupt processing routine----------------------------------------------------------------------------------------------------------------------
WARI
CLRB
PUSHW
XCHW
PUSHW
:
000BH
WPCR:7
007DH
ABS
FFEAH
WARI
ILR2,#10111111B
WPCR,#01000110B
WIF
A
A,T
A
12.7 Program Example for Watch Prescaler
15
/F
(F
: subclock oscillation). The time interval
CL
CL
; Address of the watch prescaler control register
; Define the watch interrupt request flag bit.
; Address of interrupt level setting register
; [DATA SEGMENT]
; Set the interrupt vector.
; [CODE SEGMENT]
; Initialize stack pointer (SP) etc.
; Disable interrupts.
; Set interrupt level to 2.
; Clear the interrupt request flag and enable interrupt
; request output.
15
; Select 2
/F
and clear the watch prescaler.
CL
; Enable interrupts.
; Clear interrupt request flag.
273

Advertisement

Table of Contents
loading

Table of Contents