Intel 80C188EC User Manual page 361

Hide thumbs Also See for 80C188EC:
Table of Contents

Advertisement

SERIAL COMMUNICATIONS UNIT
$mod186
name
example_master_send_slave_command
;************************************************************************
;
;
send_slave_cmd
; FUNCTION:
This function transmits a slave command, _slave_cmd, over
;
the serial network to a previously addressed slave.
; SYNTAX:
extern void far send_slave_cmd (int slave_cmd)
;
; INPUTS:
_slave_cmd (command to send to addressed slave)
;
; OUTPUTS:
None
;
; NOTE:
Parameters are passed on the stack as required by
;
high-level languages. Example assumes PCB is in I/O space.
;************************************************************************;
; substitute register offsets in place of xxxxh
S1STS
equ
S1CON
equ
S1TBUF
equ
;
lib_80186
segment public 'code'
assume cs:lib_80186
public
_send_slave_cmd
_send_slave_cmd proc far
push bp
mov
; get slave command off the stack
_slave_cmd
equ
push ax
push dx
mov
in
mov
mov
out
mov
mov
out
pop
pop
pop
ret
_send_slave_cmd endp
lib_80186
ends
end
Example 11-6. Master/Slave — The _send_slave_command Routine
11-32
xxxxh
; Serial Port 1 Status register
xxxxh
; Serial Port 1 Control register
xxxxh
; Serial Port 1 Transmit Buffer register
; save caller's bp
bp, sp
; get current top of stack
word ptr [bp+6]
; save registers that are modified
dx, S1STS
; clear any pending exceptions
ax, dx
dx, S1CON
; prepare to send command
ax, 0003h
; Mode 3
dx, ax
dx, S1TBUF
; select slave
ax, _slave_cmd ; get command to send to slave
dx, al
; send it
dx
; restore saved registers
ax
bx
; restore caller's bp

Advertisement

Table of Contents
loading

This manual is also suitable for:

80c186ec

Table of Contents