Sign in to follow this  
peterlink

Modbus device online or offline

Recommended Posts

I have some modbus device on rs-485 bus, some time when one of them power lose or can't work fine, I can see alerts in window,but have not device address,I want to know which one is error. pls tell me how can I do.

Tks.

Share this post


Link to post
Share on other sites

Two ways:

1) you could put the channels for each device on a different offset. The problem is that you'll probably get lock port errors if one times out and the offsets are too close, so this probably isn't the best solution

2) do your queries from script, then you can catch the timeout for each query and act however you want. Use the mychannel.addvalue() function to stuff the data into your channels. This is talked about in the help under modbus.

Share this post


Link to post
Share on other sites

Just surround your queries with a try / catch block:

try
  device.mydevice.readholding....
catch()
 // error, probably timeout, do something
endcatch

Share this post


Link to post
Share on other sites

Hi admin, i continue this thread. I have 2-3.. devices with modbus rs485 protocol. I used 1 rs485 to ethernet converter to connect these device. On DAQ i create 1 device with ip is ip of converter, and some group of channels, and this is my script:

 

while(1)

 device.mydevicename.readGroup("myGroupName1")   //device1

 device.mydevicename.readGroup("myGroupName2")   //device2

 device.mydevicename.readGroup("myGroupName3")   //device3

 ...

delay(5)

endwhile

 

DAQ Work fine when all devices are online. but when one of them is off (power off), i have some issues with this: data so slow, not correct,... . the timeout error is also appear but this ok.

 

please help me on this problem. why data not correct?... and when the off device is turn on again, i must restart daqfactory  :angry:.

 

Thanks so much.

Share this post


Link to post
Share on other sites

It is hard to say.  What happens if you comment out the readGroup for a device and then turn that device off.  Do you still see wrong data and slowness?

Share this post


Link to post
Share on other sites

hi admin, thanks for reply. when comment out the readGroup for a off device, everything is ok. Data is very correct, fast.

That error is only appear when i readGroup a off device.

 

And today, i have more a problem, i develop daq in win 7 32bit pro, but when i delivery this daq into winserver 2012 64bit standard, as a runtime license. DAQ so slow to display...., DAQ only 3-4%cpu and 10%Ram.

 

what happen with daq or windowserver ?

 

Thanks so much.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this