Remote-processing RPC-330 Manuel d'utilisateur Page 16

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 48
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 15
SERIAL PORTS SECTION 4
Page 4-3 RPC-330
Figure 4-3 Data packet
Two wire RS-485
The RS-485 port on the RPC-330 is set up for 4 wire
mode. 2- wire mode will cause the tra nsmitted data to
be received. To use the RPC-330 is this mode, your
code should "flush" the received data or otherwise
remove 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-330 in a multidrop network by
using CO M1' s RS-422/485 port. You can c onnect up to
32 units (including other RPC-330' s) over a 4,000 foot
range.
Figure 4-2 shows an example of a multidrop network.
This network 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 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-330, 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-330 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 interrupt
program uses a STR function 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 COM$ 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 received message = this
card's address. If not, the subroutine ends. When there
is a match, further processing is performed.
ACCESSING SERIAL BUFFERS
Vue de la page 15
1 2 ... 11 12 13 14 15 16 17 18 19 20 21 ... 47 48

Commentaires sur ces manuels

Pas de commentaire