03.01.2015 Views

80C186EC/80C188EC Microprocessor User's Manual

80C186EC/80C188EC Microprocessor User's Manual

80C186EC/80C188EC Microprocessor User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SERIAL COMMUNICATIONS UNIT<br />

$mod186<br />

name<br />

example_slave_1_routine<br />

;**************************************************************;<br />

; slave_1<br />

;<br />

; FUNCTION: This function represents a slave unit connected to a multi-<br />

; processor master/slave network. This slave responds to two<br />

; commands:<br />

; Flash the LEDs on the EVAL Board, and<br />

; Disconnect from the Network.<br />

; Other commands are easily added.<br />

;<br />

; SYNTAX: extern void far slave_1(void);<br />

;<br />

; INPUTS: None<br />

;<br />

; OUTPUTS: None<br />

;<br />

; NOTE: Parameters are passed on the stack as required by high-level<br />

; languages. The slave should be running this code before the<br />

; master calls the slave. Example assumes PCB is in I/O space.<br />

;**************************************************************<br />

;substitute register offsets in place of xxxxh<br />

P1CON equ xxxxh ;Port 1 Control register<br />

P1LTCH equ xxxxh ;Port 1 Latch register<br />

P2CON equ xxxxh ;Port 2 Control register<br />

S1CON equ xxxxh ;Serial Port 1 Control register<br />

S1STS equ xxxxh ;Serial Port 1 Status register<br />

S1TBUF equ xxxxh ;Serial Port 1 Transmit Buffer<br />

S1RBUF equ xxxxh ;Serial Port 1 Receive Buffer<br />

lib_80186<br />

segment public 'code'<br />

assume cs:lib_80186<br />

My_Address equ 01h ;slave 1 network address<br />

TriStateEna equ 08h ;Tri-state buffer enable<br />

TriStateDis equ 00h ;Tri-state buffer disable<br />

FlashLEDs equ 01h ;list of commands unit 1 responds to<br />

Disconnect equ 0fh<br />

public<br />

_slave_1<br />

_slave_1 proc far<br />

push ax ;save registers that will be modified<br />

push bx<br />

push cx<br />

push dx<br />

Example 11-5. Master/Slave — The slave_1 Routine<br />

11-29

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!