12.07.2015 Views

80C186EB/80C188EB Microprocessor User's Manual - CEUNES

80C186EB/80C188EB Microprocessor User's Manual - CEUNES

80C186EB/80C188EB Microprocessor User's Manual - CEUNES

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

SERIAL COMMUNICATIONS UNIT$mod186nameexample_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 xxxxhS1STS equ xxxxh ; Serial Port 1 Status registerS1CON equ xxxxh ; Serial Port 1 Control registerS1TBUF equ xxxxh ; Serial Port 1 Transmit Buffer register;lib_80186segment public ‘code’assume cs:lib_80186public_send_slave_cmd_send_slave_cmd proc farpush bp ; save caller’s bpmov bp, sp ; get current top of stack; get slave command off the stack_slave_cmd equ word ptr [bp+6]push ax ; save registers that are modifiedpush dx_send_slave_cmdendpmov dx, S1STS ; clear any pending exceptionsin ax, dxmov dx, S1CON ; prepare to send commandmov ax, 0003h ; Mode 3out dx, axmov dx, S1TBUF ; select slavemov ax, _slave_cmd ; get command to send to slaveout dx, al ; send itpop dx ; restore saved registerspop axpop bx ; restore caller’s bpretlib_80186endsendExample 10-6. Master/Slave — The _send_slave_command Routine10-35

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

Saved successfully!

Ooh no, something went wrong!