12-09-2010 04:15 PM
Hi,
I have 6 devices connected on an RS485 chain and am reading the devices using an RS232 module.
The data is collected from the devices by sending out the command 'SEND 10' 'SEND 20' 'SEND 30' etc. and I can successfully read data from each device individually.
However, when I try to collect data from all the devices together it becomes garbled.
I have one device on an RS232 master and then the other 5 devices are on their own RS232 slaves. I have tried combining the SEND command all into the RS232 master and have also tried entering them into each individual slave but that stopped any data from being read.
It seems as though the devices are all trying to output their data at the same time. Can I add a delay between each send command or is there something else I am ommitting.
Kind regards
Donald
12-13-2010 04:34 AM
Hi Donald,
It would seem a delay of some sort would be a good thing to implement into your code. If I'm not mistaken there is a Time Delay module within DASYlab that you could use that should make the delays you need possible. I would recommend trying this initially to see if it helps your issue.
Thanks for posting on the forum.
12-13-2010 09:41 AM
Does the response string include identifying information? RS485 devices usually preceed the data with the device id. You can use that unique ID to anchor each data format string using the search string feature.
12-13-2010 03:46 PM
Hi, Michael and CJ.
Many thanks for your responses.
I have looked at the time delay module but cannot seem to attach it to the input com module to get it to control the data request commands. I don't know if it can be utilised with a com output module but I get an error if I try to use another com module on the same port so have drawn a blank there.
The RS845 devices are quite basic and cannot transmit their ID with the data. The data appears to be being sent out as a text string which can be programmed so I have given each piece of data a unique text string and am parsing the data using a search string in each channel on the com module.
i.e.
ch0 = "Dryer In=" 2a
ch1 = "Inlet aw=" 4a
ch2 = "Inlet T=" 3a
ch3 = "Inlet H2o=" 3a \r\n
I then repeat the parsing for the next device in a slave com module using 'outlet' as the search string instead of 'inlet'.
Whilst playing around I have found that I can use a \px command in the start command box in the options dialog of the com module to create a delay with x giving the delay in milliseconds.
So I have ended up with the following in the start command box;
SEND 10\r
\p 2000
SEND 20\r
\p 2000
SEND 30\r
and so on until there is a SEND command for each device with a delay between. On a com port monitor this shows as about a 2 second delay between each SEND command.
The only problem this left me with was that I could no longer use the auto data request to repeat the SEND commands out to the devices so I have now created an action module to stop and start the measurements within DASYLab every 25 seconds to refresh the data.
Don't think this is very elegant but will give it a go out on the plant in the next couple of days to see if the data gets collected from all of the devices.
Kind regards
Donald
12-13-2010 04:01 PM
Ah ha!
I see the problem.
I think that we need to talk... I'm not sure that I can explain this suitably here.Can you call and ask for CJ at 508-946-5100?
I need to understand the request commands -- you're using the Start Command box, and not the individual data request commands? Do you need a data request command for each data point from each device (or set of data points)?
DASYLab should be pretty well behaved... ask a device for data, then wait until it comes in, parse it, and then ask for the next one, and so on.