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: 

How to read more than 125 Modbus Holding Registers?

Anmerkung 2020-08-13 142221.png

 

Is this the correct way to read register values if they are located separated by more than 125 registers? Some values that I want to read are in the first 125 registers but some start from 600.

 

This seems to work but sometimes I get the error 528193 and then I have to restart the VI for it to work again, so I am not sure if this is right or wrong.

 

Anmerkung 2020-08-13 151244.png

https://github.com/LabVIEW-DCAF/ModbusModules/issues/68

 

This is how the register table looks:

Anmerkung 2020-08-13 142332.png

0 Kudos
Message 1 of 13
(3,300 Views)

Break it down into 2 different reads.

0 Kudos
Message 2 of 13
(3,288 Views)

@RavensFan wrote:

Break it down into 2 different reads.


Could you please elaborate? Two different reads in the sense that I create new TCP Master and read the values or?

0 Kudos
Message 3 of 13
(3,280 Views)

Actually, looking more closely at the image you attached, they appear so small that sometimes it is hard to see, you already did exactly what you should do.

 

I'm not familiar with that error code 538193  (or 528193 which you stated in your message).  So I don't know what would cause that.

 

If you get that error, then you can do some error handling.  No need to stop and restart the VI.  Put your light blue reference wire on a shift register.  In the error case of a case structure, close the existing reference and open a new Modbus Master.  The new reference number will be carried to later iterations of the while loop via the shift register.

Message 4 of 13
(3,225 Views)

If you get that error, then you can do some error handling.  No need to stop and restart the VI.  Put your light blue reference wire on a shift register.  In the error case of a case structure, close the existing reference and open a new Modbus Master.  The new reference number will be carried to later iterations of the while loop via the shift register.


girish_jadhav_0-1597671423941.png

I don't see any option to close reference in NI Modbus library.

girish_jadhav_1-1597672050064.png

Do you mean something like this? I tried this way, but I am getting some errors.

 

TCP: Connect in TCP Master.lvclass:Initialize Master.vi->Modbus Master.lvclass:Initialize.vi->API Main.lvlib:Create TCP Master.vi->Unnamed 1.vi

 

0 Kudos
Message 5 of 13
(3,098 Views)

Yes.  That is what I was thinking.

 

Are you getting the same errors or different errors?

 

Have you figured out what your original error means?

 

 

0 Kudos
Message 6 of 13
(3,085 Views)

You can do as per this. Multiple read

 

T.png

PBP
Labview 6.1 - 2019
0 Kudos
Message 7 of 13
(3,025 Views)

@PBP wrote:

You can do as per this. Multiple read

 

T.png


I will try this out today. What is the function of Set Unit ID.vi? I thought entering starting address and number of inputs would be enough to read the register values. 

(oops replied from my other account that i created recently)

0 Kudos
Message 8 of 13
(3,021 Views)

Set Unit ID is more commonly used for serial based Modbus.  You use that to set tell LabVIEW what is the slave address of the device you want to communicate with.  It really should have a constant wired into it.

 

For Modbus TCP/IP, it usually isn't used because the IP address defines the device you are talking with.  Occasionally you might need to use it.  For example, an ethernet Modbus to serial modbus converter might have several different serial devices that are connected to the device and would thus all share the same IP address, but would have different "Unit ID's" or slave addresses on them.

 

For your situation, I don't think you'll need to use that function.

 

That said, I don't see how PBP's message adds anything to this message thread.  It just reiterates previous messages.

0 Kudos
Message 9 of 13
(3,015 Views)

Set Unit ID is only applicable if you have multiple device connected or you can omit it. I have intentionally Unit ID is not wired as i don't know what is your MODBUS network configuration.

 

Check attached VI where connection is reopened if error is generated.

 

 

PBP
Labview 6.1 - 2019
0 Kudos
Message 10 of 13
(3,011 Views)