LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shared Variable not transfer correct Double data

Hi all, could someone explain to me why if a value is written to the variable in this case 3.003, in reading mode I only read 3 if all the indicators are of type Double. I tried changing the properties of the indicator as well.

0 Kudos
Message 1 of 9
(938 Views)

Hi a.,

 


@a.garciaperez wrote:

Hi all, could someone explain to me why if a value is written to the variable in this case 3.003, in reading mode I only read 3 if all the indicators are of type Double. I tried changing the properties of the indicator as well.


That could be anything from race conditions to different indicator formatting…

 

For a detailed analysis you need to attach code. Real (and complete) code!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(918 Views)

Here is an example of what I do

0 Kudos
Message 3 of 9
(907 Views)

Hi a.,

 

I asked for "real code" and all we got is an image of (parts of) code.

 

We cannot edit/debug/run images of code with LabVIEW!

 

Btw. for me this "image of code" works as expected:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(899 Views)

You are "binding" it to another shared variable with the same name. So what's that datatype of that other one?

 

altenbach_0-1687525945191.png

 

(Showing an example with a greedy loop and glaring race condition does not inspire a lot of confidence.)

Message 5 of 9
(867 Views)

Thanks for the answer, I'm sorry I didn't understand what you meant by real code, in fact the code works. But i use the Holding Register variables of the Modbus Slave and as soon as I create it, I put it at the address 40005 and give it Double data type, and still not work.

0 Kudos
Message 6 of 9
(844 Views)

Hi a.,

 


@a.garciaperez wrote:

But i use the Holding Register variables of the Modbus Slave and as soon as I create it, I put it at the address 40005 and give it Double data type, and still not work.


Does your Modbus device support float values on its holding register?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 9
(839 Views)
The modbus slave device is LabVIEW on TCP port 502 the Master is "localhost". Basically it is a virtual connection in which through the VI I send the values to the Holding Register variables on the "4000xx" addresses I put them in "read/write" mode so that I can send the values to the "4000xx" variable and read them with ModScan32 or any other software. The only problem is that first of all it doesn't send the comma and if I send a value of type double and then ModScan32 sees numbers like 1.23e-40 for example instead of 1.2345
0 Kudos
Message 8 of 9
(828 Views)

Sorry I didn't create a loop gracefully it was to show how "simple" what I try to do is that as I wrote in earlier answer basically it is a virtual connection in which through the VI I send the values to the Holding Register variables on the "4000xx" addresses I put them in "read/write" mode so that I can send the values to the "4000xx" variable and read them with ModScan32 or any other software. I created the variable using the Modbus Slave of I/O Server function and I chose the address "4000xx" and data type Double

0 Kudos
Message 9 of 9
(824 Views)