RS485 Multidrop Communications


rexp

Recommended Posts

I have DF polling a single device with a single channel being polled on Com1 via a multidrop RS485 network.

I want to extend this to talking to multiple devices each with 8 channels of A/D and I/O.

The devices are ADAM series telemetry units.

Basically to address one unit you send #02 for the unit number and then the channel number eg #020\r and the unit comes back with the analogue value or the port state.

What I now want to do is poll all of the devices on the network and store the individual responses in separate channels so they can be used within DF to display the values.

As an example of the poll routine I need to send #020\r, #021\r, #022\r, ....... #030\r, ........#040\r, #041\r etc

After each of the polls the returned value needs to be stored in a channel to be processed by DF.

Hope you are able to assist

Thanks

Rex

Link to comment
Share on other sites

There are basically two parts to this: building the output string based on the desired channel/device number, and putting the data into the right channel. I'm not sure if you are using a sequence, or you have created your own protocol.

In a sequence:

if you have a sequence, you can use it as a function, and pass in the device number and channel number

function pollAdam(deviceNumber, channel)

private string out = "#0" + deviceNumber + channel + chr(13)

... etc...

Then to stuff the value into a channel with that deviceNumber and channel without having to know the channel's name, use the channel.addvalue() function. Since we called the parameter "Channel", which will override the global channel object, we need to use local.channel.addvalue():

local.channel.addvalue("MyDevice", deviceNumber, "MyIOType", channel, result)

If you are doing this in a protocol and you've created an I/O Type, the channel and deviceNumber will be passed in as variables just like the function without you having to create the prototype (see section 15.2.2 in the help). You can simply return the resultant value instead of using addvalue() and it will go into the channel that made the request.

Link to comment
Share on other sites

Hi

Thanks for the quick answer.

I didn't understand adding the sequence to do the polling but managed to setup the protocol in the comms package to include all the i/o points and drop the results into the relevant channels.

Have it fully polling all the points and devices in the network.

Will look into the scripting for using sequences later but thanks again for the help

Rex

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.