LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unknown errors from ModBus Read Holding Registers

I have been using the ModBus routines to read registers in a DIRISA A10 Power Monitor.  I'm using the ModBus routines built into my version of Labview 2017.  I have been getting intermittent "unknown errors" (see screen shot of an example) when the holding registers are read.  These errors occur with the following error codes:

-389100

-389236

-389291

-389160

-389159

-389126

-389182

-389221

-389210

This may not be an exhaustive list because every once in a while a new -389xxx error shows up and kills my program.  I have installed code in the program to ignore these errors.  The code continues to run reading the registers.  Note that registers are read by the program every 250 ms.  The program runs without a problem for hours, but eventually dies on one of these errors.  I have also attached a screen shot of the ModBus vi that generates these errors.  I have a couple of questions:  Is there any known fix to this type of "unknown error"?  And is it possible to get a full list of such unknown errors that can be generated by the ModBus routines in Labview?

0 Kudos
Message 1 of 5
(1,432 Views)

@samcat wrote:

Is there any known fix to this type of "unknown error"? 

 


Hmm... Well I think "Unknown" pretty much says it all.

 

How can you fix something without knowing what caused the error?

 

Instead of trying to ignore only certain errors, I ignore them all for four retries. (5 total tries)

 

My Modbus "Get Primary Measurment.vi" block diagramMy Modbus "Get Primary Measurment.vi" block diagram

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 5
(1,406 Views)

Ultimately, because new unknown error codes kept turning up, I decided to ignore all of the unknown errors in the range -389400<=code<=-389100 as well as time-out errors (code=56) (see code snippet below).  The reason I'm getting these intermittent errors is a mystery, but it may be that it is because I'm reading the instrument every 250 ms, while the spec update time is 1 s.  I found that I could read more often and get new values from the instrument to allow better time resolution in the data.  But it may be that the RS485 communication is not up to that rate.  If, as a result of my more rapid reading, the instrument returns gibberish to the National Instruments ModBus code, it may respond with one of the unknown error codes, perhaps depending on where gibberish starts.  "Unknown Error" is obviously not a great error message.  The ModBus code should be modified by National Instruments programmers to return a more explanatory and understandable error message.

0 Kudos
Message 3 of 5
(1,310 Views)

You can add a range of values to one case in a Case Structure like this:

 

errrange.png

 

If you can't open the snippet, the Default case just passes the Error Cluster straight through.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 5
(1,298 Views)

Yes, much more elegant than what I wrote.  Thanks

0 Kudos
Message 5 of 5
(1,279 Views)