Intel 80C186XL User Manual page 248

Intel microprocessor user's manual
Table of Contents

Advertisement

lib_80186 segment public 'code'
assume cs:lib_80186, ds:data
public _set_time
_set_time proc far
push
bp
mov
bp, sp
hour
equ word ptr[bp+6]
minute equ word ptr[bp+8]
second equ word ptr[bp+10]
T2Compare equ word ptr[bp+12]
push
ax
push
dx
push
si
push
ds
xor
ax, ax
mov
ds, ax
mov
si, 4*timer_2_int
mov
word ptr ds:[si], offset
timer_2_interrupt_routine
inc
si
inc
si
mov
ds:[si], cs
pop
ds
mov
ax, hour
mov
_hour, al
mov
ax, minute
mov
_minute, al
mov
ax, second
mov
_second, al
mov
_msec, 0
mov
dx, T2CNT
xor
ax, ax
out
dx, al
mov
dx, T2CMPA
mov
ax, T2Compare
out
dx, al
mov
dx, T2CON
mov
ax, 0E001H
out
dx, al
mov
dx, TCUCON
xor
ax, ax
out
dx, al
Example 9-1. Configuring a Real-Time Clock (Continued)
;save caller's bp
;get current top of stack
;get parameters off stack
;save registers used
;set interrupt vector
;set time
;clear Count register
;set maximum count value
;see note in header above
;set up the control word:
;enable counting,
;generate interrupt on MC,
;continuous counting
;set up interrupt controller
;unmask highest priority interrupt
TIMER/COUNTER UNIT
9-19

Advertisement

Table of Contents
loading

This manual is also suitable for:

80c188xl

Table of Contents