Jump to content
patufet_99

LabVIEW Modbus API error handling

Recommended Posts

Hello,

in the LabVIEW Modbus API Master example there is no error handling.

Is there some function or method to explicitly check the status of the communication In case of communication interruption, Modbus Server restart or other modbus error,?

Should that be done by parsing the error codes if any when one read/writes registers and then re-trying the connection?

Thank you for your help.

 

 

Share this post


Link to post
Share on other sites

You might be better off asking this on the NI forums or the Github page for the library. I believe the NI Systems Engineering team supports the library.

Share this post


Link to post
Share on other sites

I see two general classes of errors. The underlying communication is just TCP/VISA primitives so, in many cases, the API will just throw standard connection errors (error 56). For specific Modbus protocol error codes (ILLEGAL DATA VALUE) should also be thrown as errors and look to have the value -389110 - ErrorCode.

Now what exactly you do with those errors is up to you.

Share this post


Link to post
Share on other sites
On 9/5/2019 at 9:21 AM, patufet_99 said:

Hello,

in the LabVIEW Modbus API Master example there is no error handling.

Is there some function or method to explicitly check the status of the communication In case of communication interruption, Modbus Server restart or other modbus error,?

Should that be done by parsing the error codes if any when one read/writes registers and then re-trying the connection?

Thank you for your help.

 

 

Labview doesn't provide a way to check the status of the TCP connection except by trying to use it. Serial modbus has no physical way to check the connection except by using it. In both cases you need to use it to see if it still works.

On the master (client) side you will see any of the TCP error codes (56, 62 and 63 being the most common as I recall) for the TCP master. For serial masters, you will only ever see 56. I suppose some VISA-specific codes are also possible, like if there are parity bit errors or if you're using a usb-serial device that gets unplugged, that sort of stuff. Modbus protocol errors are - 389110  as mentioned above.

On the slave (server) side you will never see an error from the data access methods because the access is local. You can check (via a property node, I think) on the status of all connected masters (clients) for TCP. Serial is 1-1 and has no concept of a connection, so I think it just tells you the last error to occur for the serial comms process.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.