S3F84B8_UM_REV 1.00
10 BASIC TIMER
10-6
Example 10-1 Configuring the Basic Timer
This example shows how to configure the basic timer to sample specification.
ORG
0000H
;--------------<< Smart Option >>
ORG
003CH
DB
0FFH
; 003CH, must be initialized to 0FF
DB
0FFH
; 003DH, must be initialized to 0FF
DB
0FFH
; 003EH, must be initialized to 0FF
DB
0FFH
; 003FH, enables LVR, enables nRESET pin
;--------------<< Initialize System and Peripherals >>
ORG
0100H
RESET:
DI
;
Disables
interrupt
LD
CLKCON, #00011000B ; Selects non-divided CPU clock
LD
SPL, #0FFH
; Stack pointer must be set
LD
BTCON, #02H
; Enables watchdog function
;
Basic
timer
clock:
f
OSC
/4096
;
Clears
basic
counter
(BTCNT)
EI
;
Enable
interrupt
;--------------<< Main loop >>
MAIN:
LD
BTCON, #02H
; Enables watchdog function
;
Clears
basic
counter
(BTCNT)
JR
T,
MAIN ;