LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write INT into struct on Twincat PLC

Hi,

  I've made a struct with BOOL and INT TYPE inside on Twincat PLC. Now I am trying to write these global variables (reading works well) 

and I cannot write INT (in LabVIEW I am using 16bit integer, besides writing boolean type works without problems). I do not use these

variables in PLC source code, I thought that it would be enough to change lenght of variable. I still do not know what does it mean hVar

in invoke node for writing, maybe there is my problem.

 

Thanks in advance for all answers

 

 

Karol 

0 Kudos
Message 1 of 4
(5,740 Views)

Hi

 

The "hvar" is simply the handle to a variable. In your example you invoke "AdsCreateVarHandle" for the boolean variable ("flag"). Here you get the handle (hvar) to your boolean variable, which is ok. The problem is that you try to use the same variable handle to a different variable - integer type. This is why I suppose your problem comes from. You need to invoke "AdsCreateVaHandle" once again, this time for integer variable, wire the correct hvar to the invoke node when you write it, and it should work fine.

 

Let us know if it helps.

 

Best regards

Best regards,
Maciej Antonik
National Instruments Poland
0 Kudos
Message 2 of 4
(5,706 Views)

hi,

I'm facing with kinda same problem. but mine is bigger. I can't reach any of variables and my plc.I am using a beckhoff touch panel. In my VI Property nodes work well(i can get server status,id,port) so i think i connect to Plc however any kind of invoke nodes don't work and give error named (-2146826489)(Exception occured in AdsOcx Control: ADS ERROR: device is not in a ready state in Sample1) i just set up your vi but gaves same error. what i am doing wrong.

LabVIEW 2009, Windows 7
0 Kudos
Message 3 of 4
(5,514 Views)

You may be interested to ask TwinCAT related questions at the LinkedIn TwinCAT Developers Group: http://www.linkedin.com/groups?gid=1860933

 

0 Kudos
Message 4 of 4
(5,434 Views)