SERIAL PORTS

Two wire RS-485

The RS- 485 port on the RPC - 320 is set up for 4 wire mode. 2- wire mode causes transmitted data to be received. T o use the RPC-320 is this mode, your code should "flush" the received data or otherwise r emove transmitted information.

Mechanically, to make a 2- wire system, simply connect T+ to R+ and T- to R -. M ake sure CON FIG BAUD is set up for RS-485 mode.

Multidrop Network

You can use the RPC-320 in a m ultidrop network by using CO M1' s RS-422/ 485 port. You can c onnect up to

32units (including other RPC -320' s) over a 4,000 foot range.

Figure 4-2 shows an exam ple of a multidrop network. This networ k includes a host and one or m ore 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-

3.The packe t is received by all devices, and ignored by all except the one addressed.

The relationship described below between nodes and the host is a maste r-slave. The host dir ects all communication . Nodes "do not speak unless spoken to" . Peer to peer com munication, while possible with the RPC-320, is not discussed here.

Ther e are m any com municatio n protoco ls. F or this example, a protocol might look som ething like this:

> 22M B1

The pr otocol starts w ith the < cr> charac ter. 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 ch ecksum . T he comm and is terminated with a < cr> character .

SECTION 4

Figure 4-3 Data packet

The response depends upon the nature of the command. Suppose the command M means "return a digital I/O port status". T he RPC-320 could rea d the port and respond with AA2< cr> . The first A is an acknowledge, that is no error s were detected in the message. The data, A 2, is a hex number and is 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 C OM$ generates an interrupt when a < CR> is received. The interr upt progr am uses a STR fun ction to deter mine if the da ta 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

.

.

Line 20 sets up ON CO M$ to interrupt on a < CR> and

branch to line 1000. Line 30 sets up this card' s address.

Line 1010 checks to see if the rece ived mess age = this card's address . If not, the subroutine ends. When there is a match, further processing is performed.

ACCESSING SERIAL BUFFERS

Page 4-3 RPC -320

Page 17
Image 17
Remote Technologies RPC-320 manual Accessing Serial Buffers, Two wire RS-485, Multidrop Network