LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus I/O Server CommFail Bit

I am having an Issue with the Modbus I/O Server CommFail Bit, and its ability to detect communications failures. I am using a Modbus (TCP) I/O server to communicate with a serial device though a serial to Ethernet Gateway. The communications works fine from the computer, through the gateway, to the device.

Although, 

If I remove the Ethernet cable from the Gateway, Lab view detects a CommFail and sets the CommFail bit High (as it should). But if I remove the serial cable from the gateway, effectively breaking the communications link, The CommFail bit is not set high. In my library the I get the error (No Know Value) for each variable in the I/O server.

Is this typical? How is the comfail bit set? Is there anything I can do to allow the commfail bit to detect these errors that originate in the serial device?

 

Thanks 

 

0 Kudos
Message 1 of 8
(3,536 Views)

CDP,

 

This may not be exactly how you want to handle this, but you could use the non-traditional approach of checking for a specific error.

 

The error experienced when serial fails in DSC is -1967353911.

You could programmatically check for this error and set the commFail bit high when this occurs.

 

Anyone in the community have any other suggestions?

 

 

Daniel

Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(3,526 Views)

Hello,

I am having a similar issue with somewhat different results to the one I had a few months back,

 

I am attempting to poll a modbus power transducer (slave) with a Labview I/O server with a crio(Master). (via a serial to Ethernet gateway). Everything thing works fine when things are connected properly. I have several shared variables bound to the modbus registers for this power transducer.

 

But When I effectively break communications to the gateway, to simulate a communications failure (by disconnecting its Ethernet cord). The Modbus I/O server's CommFail bit is set "True".(Image #1) This is expected.  And when the Ethernet cable is restored the commfail bit is also restored to false, also as expected(Image #2). But the Shared variables stay in a "No know Value" state after the network cable is restored. I Have checked and the Crio is not getting valid data from these shared variables and reading the variables induces a error in Labview. This is problematic as the Crio will not be able to receive valid data following a commfail (as the result of a rebooted router for example).

 

 

The only way I seemed to be able to get the shared variables to populate with real data following a commfail is to stop and start the process containing the I/O server. It also seems that the shared variables are updated properly once any register is changed in the modbus slave device.

 

It seems as if the shared variable engine is reading the modbus variables correctly but is not putting the data in the shared variables until one of the above mentioned step happen and then the shared variables are updated.

 

CDP

 

 

 

 

 

CDP

 

 

Chris

Download All
0 Kudos
Message 3 of 8
(3,480 Views)

Hi Chris,

 

Have you tried programmatically redeploying your shared variables after the comm fail? It sounds like the variables are just not connected to anything after the comm fail, so I would be interested to see if a redeploy helps resolve it.

 

Regards,

0 Kudos
Message 4 of 8
(3,461 Views)

Thanks Jeff.

 

I just tried undelpoying and redeploying the library programmability following a CommFail . This seemed to work, the variables were refreshed with valid data.

FYI.

I achieved the same results by disabling and enabling the the process for this library.

 

Is this how you would recommend me solve this issue? Is there anyway for the shared variable engine to accomplish this?

 

 

Chris

0 Kudos
Message 5 of 8
(3,449 Views)

Hi Chris,

 

I am glad to hear that worked. I don't believe there is a way to handle this automatically in the shared variable engine. I would recommend just using the programmatic undeploy and redeploy to handle it.

 

Regards,

0 Kudos
Message 6 of 8
(3,444 Views)

Hola

La verdad es que soy nueva en esto de LabVIEW y tengo que implementar un programa similar,  es decir debo establecer comunicación a través de I/O Server y variables compartidas utilizando un cRIO como Maestro y una tarjeta ICP DAS como esclavo, pero aun no comprendo muy bien como ligar mis variables de modbus para obtener los datos del esclavo, si alguien puedo apoyarme con un ejemplo lo agradeceré mucho!!! 

^-^

0 Kudos
Message 7 of 8
(3,060 Views)

Hi Pia_Grayson,

This forum thread is quite old, so I would recommend opening a new one for your questions. If you prefer communication in Spanish, give our Spanish-speaking community a try!
https://forums.ni.com/t5/La-Comunidad-en-Espa%C3%B1ol/ct-p/ESAForum

 

In the meantime, there are two resources I would suggest:
1. Our "Modbus Fundamentals.lvproj" example. You can access this by navigating to "Help >> Find Examples" in LabVIEW, and then search for the example I mentioned.
2. The LabVIEW help documentation covers a lot of the information needed for using Modbus I/O Servers. I recommend opening it on your system and searching for Modbus to see what you find. The following help page is a good place to start, and should exist in the LabVIEW help on your computer as well.

http://zone.ni.com/reference/en-XX/help/370622M-01/lvmve/dsc_modbus_using/

 

 

Charlie J.
National Instruments
0 Kudos
Message 8 of 8
(3,052 Views)