From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW vi communication with MODBUS

hello

and thanks for your example

i want to communicate with some autonics power meter thru modbus

but i have some error 

please check attached file and help me to solve my problem

0 Kudos
Message 21 of 32
(2,088 Views)

Well, something is wrong with that subVI.  One error says it is already running, while the other says it is broken.  That is kind of contradictory.  There really should be nothing wrong with it since it is a built-in LabVIEW subVI.  Did anyone modify it?

 

Other than that, we can't help because you didn't attach any LabVIEW code that we can open up, look at, poke around in.

0 Kudos
Message 22 of 32
(2,082 Views)

i'm using modbus libbarry and vi example that  mr Himanshu_Goyal  posted in  several previous page

 

0 Kudos
Message 23 of 32
(2,065 Views)

Something is very odd about your VI.  I am wondering if it is somewhat corrupted.  It could not find MB Serial Init, and when I tried dropping a new one in it, nothing happened.  Only after I dropped it into a different new VI, and it asked me about resolving a conflict, was I then able to copy it into your VI.

 

Try deleting MB Serial Init.  Save and close your VI.  Reopen,  See if you can add a fresh one.

 

If that fails, rebuild the VI from scratch, it's not that big.

If that fails, then try reinstalling the MB library from http://www.ni.com/example/29756/en/ or http://forums.ni.com/t5/NI-Labs-Toolkits/LabVIEW-Modbus-API/ta-p/3524019

 

 

 

0 Kudos
Message 24 of 32
(2,062 Views)

Hi all, sorry to bump an old thread but I am having a similar problem. I was hoping to get some help with modbus parameter settings for my project. Here is a link to my thread; 

 

http://forums.ni.com/t5/LabVIEW/MODBUS-parameters-for-VFD-communication-to-Labview/td-p/3586442

 

Any help is greatly appreciated, Thank you.

0 Kudos
Message 25 of 32
(2,004 Views)

I've found you need to fix the CRC vi datatype bug to get rid of the transient read error, then the next issue is the speed of the routines. The implementation of the code is a mess; It reads only a specific address of the modbus map so reading or setting 6 channels takes 6 serial transactions...where one would do one read of the entire memory map for that datatype!.

 

I am going to fix this code and update a revised usable one, as soon as I can.

 

0 Kudos
Message 26 of 32
(1,699 Views)

Hello Sir, 

Your VI is working fine. But i am not getting output for "Read input register". I am getting output only for "read holding register". Those values are coming 65535. May i know why it is not working??

 

My application reading data from Energy meter TN 8400 using RS485. 

attachments:

Error display

Modbus register for energy meter. 

Download All
0 Kudos
Message 27 of 32
(1,614 Views)


Function code 4 is for Read Input Registers.  If you want to Read Holding Registers, then use function code 3.

 

Other than that, I can' help you because you haven't attached any code and really haven't adequately explained the problem you are having.

0 Kudos
Message 28 of 32
(1,610 Views)

Thank you for response. 

 

Finally i got the solution for that problem.

Energy meter sending the data in floating format. In modbus VI, i couldn't read the floating values. Even i tried to convert the values(what i am getting) into floating, but it doesn't work. So, i have used NI OPC server to read the values from the energy meter and i have interfaced NI OPC and my VI file. there after, i got the values based on modbus address. 

0 Kudos
Message 29 of 32
(1,576 Views)

Your solution is for a completely different problem than the one you stated where you said you were getting an error on read.

 

With Modbus, if you want floating point values, they tend to be single precision (4-byte) values.  You need to read two registers that are consecutive and combine those two 16 bit integers into a SGL float.  You can do that with typecast.  You might have to do something special depending on whether the high word is first or second of those two registers.

0 Kudos
Message 30 of 32
(1,569 Views)