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

Page 17

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

Image 17
Contents Revision REVTrademarks Table of Contents External Reset Sect ION 11 Watchdog Timer DescriptionInterrupt Characteristics Sect ION 13 Multi Mode Counter DescriptionSoftware Revision History Section OverviewDescription Manual OrganizationTechnical Support Symbols and Term inologySystem layout Overview SectionEquipment Operating PrecautionsIntroduction Using a Terminal Using a PCFirst Time Operation Uploading and Downloading ProgramsEditing programs and program ming hints Troubleshooting Where to GO from HereSaving a Program Saving ProgramsEprom W3 autorun jumperPreventing Autorun AutorunningLoading a Program Changing Eprom SizeAlternate Eproms CommandsBload BsaveCOM1 Serial Port Serial PortsCOM0 Serial Port RS-422/485 Termination network Serial Ports SectionRS-422/485 Operating Information Multidrop Network Accessing Serial BuffersTwo wire RS-485 Serial Port PIN OUT Accessing COM0 and COM1Disabling CONTROL-C RXD CTS Checking the battery Battery BackupRAM Memory Changing MemoryStoring Variables in RAM Reserved MemoryBlock Data Transfer Assembly Language InterfaceDigital Por t J3 Digital and Opto PortsDigital I/O Ports Digital Port P6 Digital I/O CommandsHigh Current Port L8 Optically Isolated InputHigh Current Output Digital I/ O prog ramm ing exam ple Interfacing to switches and other devicesInterfacing Digital I/O to an opto-module rack Ls e Width Modulation PWM Conne ctor pin ou t J3 Digital and Opto Ports SectionCount Config LineLine Line BM E Setting Date and TimeDate Section Programming Example Connecting DisplaysWriting to the Display Display Types Display Connector PIN OUTProgram explanation Keypad PortKeypad Port PIN OUT J5 Analog Input Connecting Analog InputsInitialization Overvoltage conditionsAcquiring Analog Data Differential ModeExamples u sing CON FIG AIN Noise Notes Temperature MeasurementAnalog Input Section Measuring Higher Voltages Data logging on a timer tickMeasuring 4-20 mA current loops Converting Analog MeasurementsAmplifiers Calibration External Reset Watchdog TimerProgram Example Interrupt CharacteristicsOptically Isolated Interrupt Optically isolated and TTL interrup ts GND ProgrammingLoad GateCOU NT0 Further Power Reduction Power ManagementProgram Examp le Power Management SectionTechnical Information Electrical SpecificationsMemory and I/O Bank MAP Mechanical SpecificationsJumper Descriptions Bank