LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

modbus slave - Read Coils after register addres 16.

I am using LV9 and modbus library from NI.

 

About this problem i have read some post but it is about master only.

 

My exact setup is as follows:

 

 I have a third party modbus master software and want to poll 200 coils of data from labview modbus slave.

 

I am getting values upto register address - 16, but after that the values are'nt changing.

 

please suggest.

 

Regards,

 

Shrek

 

 

 

 

 

Message 1 of 11
(4,469 Views)

Hi,

 

Did you made the slave VI yourself ?

 

How does the master access the registers ? One by one are through multiple registers reads ? How many registers ?

 

Kees

0 Kudos
Message 2 of 11
(4,433 Views)

Third Party Modbus Master querying LV Slave : Slave Address : 1

Function : Read Coils

Start Address: 1

Length : 200.

 

values till address 16 for coils are read perfectly, but 17 onwards are not read by modbus master.

 

Regards,

 

Shrek.

0 Kudos
Message 3 of 11
(4,425 Views)

Maybe the device is only capable of returning up to 16 values in one request.  In order to do 200, you might have to break it down to multiple requests in groups of 16.  Are any modbus error messages being raised?  If you put some indicators or probes on the string that is coming out of the modbus read, you can see what the raw serial data looks like.  If you are familiar with a modbus data packet, you can decode the binary to see how many bytes of data are being returned.

0 Kudos
Message 4 of 11
(4,422 Views)

The single bit coil data is bit packed, so status of 200 coils would come in 25 bytes. I would question the addressing and make sure that address 17 of the slave is bit access and not register access which would demand a different function code.

0 Kudos
Message 5 of 11
(4,411 Views)

The slave is LV program only, Modbus Slave example provided by NI.

 

and surely i will check the string what it returns for the 17 register.

 

 

Regards,

 

Shrenik

0 Kudos
Message 6 of 11
(4,403 Views)

Your third party master - What is it?

 

It *may* have limitiations on how it assembles querys, and you may have to attempt a two reads less that 200 bits, one starting at the 17th register.

 

Then again perhaps the NI has the limitation. If so I would expect some exception code seen at the master (invalid address etc...).

 

 

Clarification:

You say you are reading 200 coils (bits). And getting up to 16 registers. 16X16 = 256. This is more than 200 coils. Or am I missing something?

 

0 Kudos
Message 7 of 11
(4,388 Views)

third party master is also having its own slave, when i communicate between those master and slave then it works fine.

 

i am not reading analog registers, reading coils i.e. bits.

0 Kudos
Message 8 of 11
(4,385 Views)

Please be more specific about what you are communicating with and how. From what I can gather, you have a third party Modbus RTU master and you are trying to communicate with two different types of slave devices:

  1. A LabVIEW program acting as slave (which doesn't work after address 17) and
  2. A physical modbus slave device that does work.

Some code would help.

0 Kudos
Message 9 of 11
(4,368 Views)

please find the attached file

0 Kudos
Message 10 of 11
(4,362 Views)