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

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<br />

mov dx, P1CON ;Get state of port 1 controls<br />

in ax, dx<br />

and ax, 0feh ;make sure P1.0 is port<br />

out dx, al<br />

mov dx, B1CMP<br />

mov ax, tran_freq<br />

or ax, 8000h ;set internal clocking bit<br />

out dx, ax ;Mode 0, 1 million bps<br />

mov dx, P2CON ;set Port 2.1 for TXD<br />

mov ax, 0ffh<br />

out dx, al<br />

mov dx, S1TBUF ;send user's data<br />

mov ax, user_data<br />

out dx, al<br />

mov dx, S1CON ;Mode 0, No CTS, Transmit<br />

xor ax, ax<br />

out dx, ax<br />

mov dx, S1STS<br />

Check_4_TI: in ax, dx<br />

test ax, 0020h ;check for TI bit<br />

jz Check_4_TI<br />

_parallel_serial endp<br />

lib_80186 ends<br />

end<br />

mov dx, P1LTCH ;pulse P1.0<br />

xor ax, ax<br />

out dx, al<br />

not ax ;set P1.0 high<br />

out dx, al<br />

not ax ;set P1.0 low<br />

out dx, al<br />

pop dx ;restore saved registers<br />

pop ax<br />

pop bp ;restore user's bp<br />

ret<br />

Example 11-2. Mode 0 Example (Continued)<br />

11.5.3 Master/Slave Example<br />

This section shows an example of a Mode 2 and 3 master/slave network. Figure 11-18 shows the<br />

proper connection of the master to the slaves. The buffer is necessary to avoid contention on the<br />

receive line. Alternatively, an open-collector buffer could be used and the port pin function could<br />

be deleted.<br />

11-24

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

Saved successfully!

Ooh no, something went wrong!