ETHERNET
TO RS-485
The
Coyote RS-485 interface is a two-wire, half-duplex
configuration. My RS-485 card in the RS-485 PC is
a four-wire, full-duplex configuration. So, I had
to do some more cabling.
After
checking the pinout diagram, I saw that the labels
for the RS-485 port (J9) matched the pin designations.
To turn the PC’s four-wire interface into a two-wire
interface, I tied the RS-485 “A,” or negative, transmit
and receive pins together, and then did the same for
the “B,” or positive, transmit and receive pins.
To
keep the wiring tangle factor low, I used a standard
eight-pin RJ-45 female connector, Cat 5 cabling, and
one of the Molex female headers and pins that comes
with the Coyote. I punched down a short between the
female RJ-45 connector’s pin 1 (TDB+) and 3 (RDB+),
and 2 (TDA–) and 4 (RDA–).
Because
the PC’s RS-485 interface is an RJ-45 female, I opted
for a standard 568B-wired Cat 5 patch cable to connect
the Coyote’s RS-485 interface to the RS-485 card.
This placed my PC’s RS-485+ on pins 1 and 3, and the
RS-485– on pins 2 and 4. I used pins 1 and 2 of the
Cat 5 patch cable to carry the RS-485 signals and
wired the corresponding pins into the Coyote’s J9
Molex connector.
I
also added a connection on the J9 Molex connector
ground pin to pin 8 of the Cat 5 patch cable, which
is ground on the PC’s RS-485 card. Technically, I
could run the RS-485 connection without a ground,
but it’s always a good idea to include the third wire.
I
used the same example program, serialexa.c, to build
the Ethernet-to-RS-485 converter firmware. All I had
to do was add a define block for the RS-485 port (serial
port D) and insert the ser485Rx() and ser485Tx() functions
ahead of every serial read (receive) and write (transmit)
call in the serialexa.c code.
The
ser485Rx() and ser485Tx() functions enable the functionality
of the RS-485 transmit-enable signal that’s assigned
to PA4 (i.e., I/O port A, pin 4). Because the Coyote
is configured for Half Duplex mode, the ser485Xx()
functions provide the code to enable and disable the
RS-485 transmitter on the Coyote’s Sipex SP483 RS-485
driver IC via PA4. Otherwise, the data transfers resemble
RS-232. A fragmented look at my modifications for
RS-485 operation is shown in Listing 2. The RS-485
portion of the Ethernet-to-RS-485 converter session
is shown in Photo 2. “Splash two.”
| Listing
2—The serX defines can be used with any of
the Rabbit’s six serial ports. Only four of the
six serial ports are pinned out directly on the
Coyote. The RS-232 library makes implementing
a buffered serial port easy on the Coyote. Note:
Asterisks (*) denote code between fragments.
|
|

(Click
here to enlarge)
|
Photo
2—I took advantage of some freeware from B&B Electronics,
who also supplied the RS-485 card I used in the
PC. The RS-485 card has four ports that can be
switched between RS-232, RS-422, and RS-485 among
all of the COM ports and IRQs. |