LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus Array Size Error

You are definitley missing a byte at the end.  Whether it is a timeout issue, or the device failing to return all of the bytes, I'm not sure.

 

You get a 1h, which is the slave address.

 

Then you get 3h and 12h.  That is the command code for read holding registers, and 12 bytes (which is 6 16 bit registers).  All is good.

Then you get 12 zeroes.  I assume all 6 16-bit registers are zero.

 Then you get 93h 70h on a successful read.  That is your CRC-16 checksum.  On your error read, you only get the 93h.  Your last byte of 70h has been dropped.

 

I don't know why you wouldn't be getting some sort of error from the Modbus drivers when this happens, or that you would be getting 5 valid readings as you stated in your earlier messges.

0 Kudos
Message 11 of 14
(729 Views)

D Reck,

 

Thanks for posting the screenshots as requested.  They have been helpful.  Do you mind posting your code as well? 

Ben

National Instruments
Certified LabVIEW Associate Developer
Certified TestStand Developer
0 Kudos
Message 12 of 14
(708 Views)

Attached is a simple modbus master VI, along with my NI Modbus library.  The library has one small modification to the MB Serial Master Query so that it displays the bytes sent and bytes received, otherwise it should be unmodified.

 

Dan

Download All
0 Kudos
Message 13 of 14
(698 Views)
One approach would be to make your vi recalculate the checksum based on the data values received. If this calculated checksum does not match the actual modbus data checksum, throw away this data packet.
0 Kudos
Message 14 of 14
(686 Views)