TIMERS and TIMER/COUNTERS

KS57C2308/P2308/C2316/P2316

 

 

+PROGRAMMING TIP — Using the Basic Timer

1. To read the basic timer count register (BCNT):

BITS

EMB

SMB

15

BCNTR LD

EA,BCNT

LD

YZ,EA

LD

EA,BCNT

CPSE

EA,YZ

JR

BCNTR

2. When stop mode is released by an interrupt, set the oscillation stabilization interval to 31.3 ms at 4.19 MHz:

BITS

EMB

 

 

 

 

 

 

 

SMB

15

 

 

 

 

 

 

 

 

 

LD

A,#0BH

 

 

 

 

 

 

 

LD

BMOD,A

 

; Wait time is 31.3 ms

 

 

 

NOP

 

 

 

 

 

 

 

 

 

 

STOP

 

 

 

 

; Get into stop for power-down mode

NOP

 

 

 

 

 

 

 

 

 

 

NOP

 

 

 

 

 

 

 

 

 

 

NOP

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

NORMAL

STOP MODE

 

IDLE MODE

 

NORMAL

CPU

OPERATING MODE

 

 

 

 

OPERATING MODE

 

 

 

OPERATION

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(31.3 ms)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

STOP

 

STOP MODE IS

 

 

 

 

INSTRUCTION

RELEASED BY

 

 

 

 

 

 

 

 

INTERRUPT

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3. To set the basic timer interrupt interval time to 1.95 ms (at 4.19 MHz):

BITS

EMB

 

SMB

15

 

LD

A,#0FH

 

LD

BMOD,A

 

EI

 

 

BITS

IEB

; Basic timer interrupt enable flag is set to "1"

4. Clear BCNT and the IRQB flag and restart the basic timer:

BITS

EMB

 

SMB

15

 

BITS

BMOD.3

 

 

 

 

11-6

Page 228
Image 228
Samsung KS57C2308 manual + Programming TIP Using the Basic Timer