annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

Reading Modbus Holding register address not return correct values

Résolu !
Accéder à la solution
Hi all Labview developer,
 
We using DSC Modbus Master library to read holding register device modbus address from 49401 to 49415 but the return register values not as we expected compare to value we get from ModScan64 tool (correct value).
It look like we need to offset first address to 49400 to get correct register value.
Anyone can explain why we need to offset the address by 1.
 
Thanks in advance.  
 
 

Modbus read holding register.pngModScan64.PNGModbus read holding register fp.png

0 Compliments
Message 1 sur 5
4 501 Visites

Hi srh1985,

Modscan works on the concept of 1 to n while LabVIEW works on the concept of 0 to n-1.

0 Compliments
Message 2 sur 5
4 482 Visites

Sorry. Can your pls explain more.

0 Compliments
Message 3 sur 5
4 465 Visites
Solution
Accepté par l'auteur du sujet srh1985

Subtract 1 from the register address.

 

When you have an address like 449401, the first 4 indicates it is a holding register.  (It's actually rather unusual to have the rest of the digits as high are they are.)

 

You drop the initial 4, and subtract one.  It is not a "LabVIEW" thing, but an underlying part of the modbus standard.  So when you have list of holding registers, they'll start at 40001  (or in this case 400001), but that is actually address 0.

 

So 449401 is actually addressed as 49400.

 

Think of it as an array being 1st element, 2nd element, 3rd element  (1-based),  but those are index 0, index 1, index 2  (zero-based)

0 Compliments
Message 4 sur 5
4 450 Visites

Thanks.

0 Compliments
Message 5 sur 5
4 444 Visites