
SERIAL & SPI PORTS BASIC SECTION 4
Page 4-4
Figure 4-4 Data packet
RS-422/485 Termination network
W10 enables the network terminator. When the RPC-
210 is the last physical unit on a network (RS-485) or is
the only unit (RS-422), the receiver must be terminated
to prevent ringing and noise pick up. Insert jum pers into
W10[1-2][3-4]. See Figure 4-2 above for jumper
example.
Only one slave device on a RS-485 network should have
a terminator installed. The host transmitter should also
have a 120 ohm resistor in series with a 0.01 mfd
capacitor. T he term inator on the RPC -210 includes p ull
up and pull down resistors to prevent lines form floating
and generating er roneous char acters.
RS-485 transmitter turn-off
The RS-485 transmitter is controlled by the RPBASIC-
52 operating system. The 485 transmitter is turned off
when the last character is sent. You must specify RS-
485 mode in the CONFIG BAUD 1 comm and.
There is a small potential for having two transmitters on
at the same time. The RS-485 transmitter on the RPC-
210 stays on for approximately ½ character time after
the last byte is sent. Nor mally, this is not a problem
when baud rates are 9600 and above as receivers usually
do not respond with 1 mSec anyway. However, if you
are transmitting at 4800 baud and below, there is this
potential. When a host (or other peer) is responding,
ensure there is a character time delay before responding.
Multidrop Network
You can use the RPC-210 in a multidrop network by
using COM1's RS-422/485 port or even a radio modem.
You can connect up to 32 units (including other RPC-
210' s) over a 4 ,00 0 foot range. The num ber of r adio
modems is virtually unlimited.
A network includes a host and one or more devices. The
host transmits data packets to all of the devices, or
nodes, in the network. A data packet includes an
address, com mand, data, and a checksum. See figure 4-
2. The packet is received by all devices, and ignored by
all except the one addressed.
The relationship described below between nodes and the
host is a master-slave. The host dir ects all
communication. Nodes "do not speak unless spoken to".
Peer to peer communication, while possible with the
RPC-210, is not discussed here.
There are m any communication protocols. F or this
example, a protocol might look som ething like this:
> 22MB1
The protocol starts w ith the < cr> character. This
character synchronizes all units and alerts them that the
next few characters coming down are address and data.
In this case, "> 22" is the units address. "M " is the
comm and and " B1" is the checksum . T he comm and is
terminated with a < cr> character.
The response depends upon the nature of the command.
Suppose the command M means "return a digital I/O
port status". The RPC-210 could read the port and
respond with AA2< cr> . The first A is an
acknowledge, that is no errors were detected in the
message. The data, A2, can be broken down as follows:
Bit/line 7 6 5 4 3 2 1 0
Status 1 0 1 0 0 0 1 0 = A2
Lines 1, 5 and 7 are high while the others are low.
The following program fragment uses ON C OM$ and
STR in a network environment. ON COM$ generates an
interrupt when a < CR> is received. The interr upt
program uses a STR fun ction to deter mine if the data
packet was addressed to this card.
10 STRING 200,20
20 ON COM$ 1,0,13,1000
30 $(1) = ">05"
.
.
.
1000 $(0) = COM$(1)
1010 A = STR(8,$(0),$(1))
1020 IF A = 0 THEN RETURN
.
.
Comentarios a estos manuales