Intel 80C188XL User Manual

Page 252

Advertising
background image

9-23

TIMER/COUNTER UNIT

Example 9-3. Configuring a Digital One-Shot (Continued)

_CMPB

equ word ptr[bp+6]

;get parameter off the stack

push

ax

;save registers that will be

push dx

;modified

mov

dx, T1CNT

;Clear Timer 1 Counter

xor ax,

ax

out dx,

al

mov

dx, T1CMPA

;set time before t_shot to 0

mov ax,

1

out dx,

al

mov

dx, T1CMPB

;set pulse time

mov ax,

_CMPB

out dx,

al

mov dx,

T1CON

mov

ax, C002H

;start Timer 1

out dx,

al

CountDown:

in ax, dx

;read in T1CON

test

ax, MaxCount

;max count occurred?

jz

CountDown

;no: then wait

and

ax, not MaxCount

;clear max count bit

out

dx, al

;update T1CON

pop

dx

;restore saved registers

pop ax
pop bp

;restore

caller’s

bp

ret

_one_shot endp
lib_80186

ends

end

Advertising
This manual is related to the following products: