LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus adresses not available from Labview but works with Python

Hi,

 

I have created a Modbus I/O server and i have created bounded variables to have access to the modbus registers.

 

In Python, i did the same and can communicate with the same equipement through modbus too.

 

However, in Labview, some adresses (reading mode) do not give me back the right value but other work fine. I am pretty sure the way I did it in Labview is good because I can have access to some adresses with Labview and it works good. In Labview, some adresses, the values returned are 32768 whereas I have the right value in Python.

 

For instance, the adresse 3060 and 3061 works good and are updated sometimes (give me the current power of the building) in Python and in Labview. However, the adress 30827 and 30828 should return the maximum power of the building in the last month and it does work good in Python but not in Labview, it returns 32768. They are all float32, encoded with 2 registers.

 

 

You can see error code and values in the picture attached.

 

Any advice ? The equipment is PM8000 (Schneider)

 

Thank you !

0 Kudos
Message 1 of 8
(2,399 Views)

The PNG you attached is basically useless.  It just shows you reading from 4 network variables.

 

Can you actually post the setup for how those variables have been configured?  Like, what puts values into them?

0 Kudos
Message 2 of 8
(2,363 Views)

Bonjour, j'espère que ces caputes vous seront utiles. N'hésitez pas à me dire s'il vous manque de l'information.

 

Merci beaucoup

Download All
0 Kudos
Message 3 of 8
(2,352 Views)

Bonjour, je n'ai pas résolu ce problème. C'est étrange que j'ai un fonctionnement correct pour certains registres mais pas d'autres. Et que j'ai accès à tous les registres correctement en dehors de Labview en Python. 

 

Merci pour votre aide

 

Yohann

 

0 Kudos
Message 4 of 8
(2,298 Views)

Hi,

 

In picture 2 I see a address range of 400001 - 4655535.

This is a DCS notation of a ModBus address.

400001 in DCS is in ModBus function code 3 and address 0000

 

The data item in the picture should be read with function code 3 at address 3059

 

Kees

0 Kudos
Message 5 of 8
(2,288 Views)

Hello Kees, thank you for your answer.

 

Yes, exactly. In the 2nd picture, it should read a 16 bits data for register 3059. That is exactly what I want to do and it works good. But if I try exactly the same thing with the register 30827, it returns an error (value 32768).

 

However, I think I found why I have this behaviour. I think you can help me finding a solution : 

 

The power meter i am connected to respond with 32768 if you try to read the two registers with 16 bits separately instead of the 32 bits at once.

 

In python, I pass the first adress, then another input to say it is register oflength 32 bits and then I do not know what it really does but it works good. If i ask the same adress and tells the lenght is 16 bits, it returns the same value error 32768 than what I get in Labview (instead of the first 16 bits of the answer i get when I asked the 32 bits at once)

 

In Labview, I call register by register so 30827 and 30828 separately. And then only when I have the values in each register I convert them from haxadecimal to float32. 

What is weird in the equipment behaviour is that does work good with this method on some "32 bits". register but returned  an error 32768 for other "32 bits" register.

 

So what I have to do to fix the problem is to ask the 32 bits "all in once" and not 16 bits twice. Is there a way to do this in Labview ?

 

My connection is TCP  / Modbus with an ethernet cable.

 

Thank you

0 Kudos
Message 6 of 8
(2,228 Views)

Use Read Multiple Registers with a starting address of 30827 with a length of 2 if you are using an NI Modbus toolkit library.

 

Or if using the modbus server features, read the first register address and designate it as a U32 rather than U16.

0 Kudos
Message 7 of 8
(2,222 Views)

Hi,

 

I have tried using the adress in the range : F400001–F465534 to create 32-bit float variables (I have created one after one all adresses between 30823 and 30828 to be sure the adress was not shifted). It still does not work. I really do not understand what is happening. I have now the error -32768 written in 32 bit float (-4,59177E-41) . 

 

Probably i am doing something wrong when I try to access these registers but I totally ignore what and why it is working with some registers and not others.

 

Maybe I should try another method to read those registers because I feel like I have tried everything I could.

 

regards,

 

Yohann

0 Kudos
Message 8 of 8
(2,203 Views)