NI Labs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

NI LabVIEW Modbus API Discussion

DWS23 and S1ack, thanks for sorting that out. That is an unfortunate legacy limitation of Modbus. It is worth noting two things. First, the master code is written such that it will request exactly what you tell it to--the error is not thrown by the master, but by the slave. Thus, if your slave supports 500 register reads, the master will not stop you. Second, the reason you got a disconnect is that my error handling is very stupid . Any error in the example will result in a disconnect. However during normal operation you would not need to disconnect just because of that error.

Hi India,

I am unfamiliar with that error code and I cannot find any record of it. Can you post back with some additional information? Where does the error occur? What VI throws it? What is the error message?

Thanks,

Daniel

0 Kudos
Message 51 of 527
(5,671 Views)

Hi Daniel,

The 6101 seems to be a generic error code . Refer http://forums.ni.com/t5/LabVIEW/Timeout-error-code-6101-for-acquisition-from-MODBUS-instrument/td-p/... .

I suggested the customer to use the following MODBUS Library https://decibel.ni.com/content/docs/DOC-30140 . However each time he runs the code, he doesn;t get the values from the register he is trying to read. The VIs timeout. However when the customer uses MODSCAN 32 application to access the register, he is successfully able to do so. He faces the issue only with the labview library. Let me know if you have any leads on this

Thanks

Pranav

AE

(India)

0 Kudos
Message 52 of 527
(5,671 Views)

Hi Pranav,

If you note the KB linked in that post, the error code is generated by the old modbus library, not the one the customer referenced. However you are correct that 6101 is thrown by that library in the timeout case.

As far as support goes, there is not much I can do with the information you provided. If the error occurs with both the old library and the new library, which were both written more-or-less independently, I have only a few thoughts and suggestions:

  1. Can we use modbus I/O servers to access the data?
  2. Is unit id set correctly to the device's non-zero ID?
  3. It is possible the CRC or LRC is failing, as those pieces of code are stolen directly from the old library (with some optimizations to improve performance). Can you get a capture of traffic on the serial port with the old library, new library, I/O server, and whatever modscan32 is and compare them?

Thanks,
Daniel

0 Kudos
Message 53 of 527
(5,671 Views)

Hey Daniel,

On a cRIO 9082, in order to use 2 wire RS485, we need to change the physical wiring, but also configure the Serial property, Wire Node to have the enum value: RS485/Wire2-Auto.

Is there an easy way to do this with the Modbus API? Which subVI's do I need to modify?

Thanks,

Joey (AE)

Joey S.
Senior Product Manager, Software
National Instruments
0 Kudos
Message 54 of 527
(5,671 Views)

Okay, so I understand what you were talking about here now. There is no way to set that at present, but you can set it on the visa resource you wire in without much difficulty. Its feedback that I'll pass along, though.

0 Kudos
Message 55 of 527
(5,671 Views)

Known Issue [Serial slave only]:

I've received feedback that there is a performance issue with the serial slave version of the library. Specifically, the background daemon rails the CPU while waiting on messages.

Update:

1.0.10 is now posted and fixes this issue.

0 Kudos
Message 56 of 527
(5,671 Views)

Hello,

     I used Modbus API library to realize a Modbus serial master in LV2013. The master can transmit the command to the server and the server response. I also used oscilloscope to check the serial line, no error. But labview receive no data. What is the reason? Thanks.

0 Kudos
Message 57 of 527
(5,671 Views)

Going to need more information to help you.

What is the server?

What commands did you send from the LV client?

You state 'the server response' do you mean that is does indeed respond?

If it does respond, and no exceptions from modbus function blocks, do you have the response frame in bytes?

You could try to poll the server with modbus poll and capture the byte traffic on the wire. Then plug the poll and response into a modbus protocol analyser and verify the poll and response are properly formatted.

Modbus RTU Parser

Modbus TCP Parse

0 Kudos
Message 58 of 527
(5,671 Views)

Thank you for your reply.

I use arm cotex-M0 mcu as Modbus server. The Modbus poll sent read holding register command to the mcu. It can received the response from mcu. All data is correct. But when I sent data with LV used Modbus API library, mcu response. But no data received. I put a probe at the subVI register output.

0 Kudos
Message 59 of 527
(5,671 Views)

Can you post the actual data from the line? You said you saw the mcu respond with the correct information. What does that data look like? What does labview send?

0 Kudos
Message 60 of 527
(5,671 Views)