From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write real variables from Labview 8.2 to Twincat embeded application

Solved!
Go to solution

Hi,

 

I am currently using Labview to write and read some variables defined through an embedded Twincat application.

I have defined the following variables in Twincat :

 


    Lab_lecture_real AT %MW100 : REAL;
    Lab_ecriture_real AT %MW102 : REAL;

    Lab_lecture_bool AT %MB1 : BOOL;
    Lab_ecriture_bool AT %MB2 : BOOL;

 

Based on the VI given by Beckhoff for Twincat ADS/OCX (http://infosys.beckhoff.com/english.php?content=../content/1033/tcsample_labview/html/tcsample_labvi...😃 , I succeed to read the variables "Lab_ecriture_real" and "Lab_ecriture_bool" and write through "Lab_lecture_bool".

Nevertheless, i failed to write in "Lab_lecture_real", which is a real.

 

I have enclosed my VI, everything seems to be correctly connected. Though, I don't understand why it works for a Boolean variable rather than a real one. Maybe the method used for writing a real is different from Boolean.

Could you highlight me on this subject, please?

 

Regards,

Stephane

0 Kudos
Message 1 of 4
(2,788 Views)
Solution
Accepted by topic author Steffff

Why are you setting the length for the REAL number as 8 in the VI?

Is it in the documentation for the OCX somewhere else?

0 Kudos
Message 2 of 4
(2,778 Views)

I have just tried with the length for the real as 4 and it seems to work.

 

Thanks a lot for your answer !

0 Kudos
Message 3 of 4
(2,771 Views)

Since a Boolean is a 1, and a Real is a 4, it would indicate that the length is in terms of bytes.

 

 

0 Kudos
Message 4 of 4
(2,767 Views)