Intel 80C188EC User Manual page 357

Hide thumbs Also See for 80C188EC:
Table of Contents

Advertisement

SERIAL COMMUNICATIONS UNIT
mov
in
mov
mov
out
mov
mov
out
mov
mov
out
xor
mov
Check_4_RI:
dec
jnz
xor
jmp
NoTimeOut:
in
test ax, 0040h
jz
mov
in
and
xor
not
SlaveExit:
pop
pop
pop
ret
_select_slave
endp
lib_80186
ends
end
Example 11-4. Master/Slave — The _select_slave Routine (Continued)
11-28
dx, S1STS
;clear any pending exceptions
ax, dx
dx, S1CON
;prepare to send address
ax, 0083h
;d9=1, mode 3
dx, ax
dx, S1TBUF
;select slave
ax, _slave_addr
;get slave address
dx, al
;send it
dx, S1CON
ax, 0023h
;set REN
dx, ax
;enable receiver
cx, cx
;reset time-out counter
dx, S1STS
;check to see if data is waiting
cx
;decrement time-out counter
NoTimeOut
;time-out=false:then continue
ax, ax
;time-out=true:set return
;value false (0)
short SlaveExit
ax, dx
;test for RI bit
Check_4_RI
;keep checking till data received
dx, S1RBUF
;get slave response
ax, dx
ax, 0ffh
;mask off unwanted bits
ax, _slave_addr;did addressed slave respond?
;ax=0:true else false
ax
;invert state of ax to be consistent
;with false(0) and true(non zero)
dx
;restore saved registers
cx
bp
;restore caller's bp

Advertisement

Table of Contents
loading

This manual is also suitable for:

80c186ec

Table of Contents