LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TwinCAt labview integration - error 1172

Solved!
Go to solution

Hi 

I encountering an error (1172) when I try to read / write values to a Twincat PLC program. 
The program I'm using is a sample program developed by beckhoff (attached in link below).

 

I have marked where the error occurs. 

I have accomplished to read / write string variables to the PLC, so the connection works

I hope some of have have an solution 🙂

 

 

Link: https://infosys.beckhoff.com/english.php?content=../content/1033/tcsample_labview/html/tcatadsnet_lv...

Download All
0 Kudos
Message 1 of 8
(3,828 Views)

I assume that you have loaded the correct TwinCAT project, i.e., the one that is included in the Sample07.pro file. Do not have access to TwinCAT currently to open and check the contents of the .pro file.

 

However, the error that you get seems to be coming from one/many missing variable(s) in TwinCAT. Check whether MAIN in the PLC project that you are running has variables Bool1, dint1, usint1, lreal1, str1, str2, and complexStruct1. 

 

BR
0 Kudos
Message 2 of 8
(3,803 Views)
Solution
Accepted by topic author mkstech

OK, the problem it seems, is due to a missing task containing MAIN in the Sample07 TwinCAT PLC project. 

 

As you can see, without any modification if I compile the project, MAIN is grayed out as it is not referenced by any task. 

Original without referenced taskOriginal without referenced task

After adding a new task (Task3) and creating a corresponding reference task (Task_3) in the Sample07 PLC project to which MAIN is assigned, everything works ( or sort of, the complex cluster doesn't work 100% but that you should be able to debug 😄 )...

Sample07_withTasks_LV.PNG

BR
0 Kudos
Message 3 of 8
(3,793 Views)

Thank you for the answer.. 

I completely failed to see the sample.pro file (I did make my own TwinCAT PLC program)..

But I tried your suggestions, and if I compile without any modifications it works fine.. I did not need to add a new task.

0 Kudos
Message 4 of 8
(3,782 Views)

Hi there,

 

I'm trying to read/write values to a twincat PLC program and I'm searching for samples in order to develop the communication.

 

I would like to analyze your TcatADS_LVSample07.vi ‏119 KB to learn how it's done, but I can't open it because I only have the LV17 and  the VI you provided is a LV18 . I cannot downgrade the version.

 

 

Can you please downgrade me the version to analyze the example please?

 

Appreciate the attention. TY  

0 Kudos
Message 5 of 8
(1,836 Views)

LV2018 version attached
and create new post next time. you are posting in an old thread. There is separate group for version conversion.


bp
Message 6 of 8
(1,817 Views)

Hi bharathp10
I'm trying to read/write variables on a Twincat PLC and looking for insight into how I work with structs.

 

In your TcatADS_LVSample07.vi there are two missing files which look very attractive to learn, could you please share the two files TcatADS_LVSample07_WriteComplexStruct.vi and TcatADS_LVSample07_ReadComplexStruct.vi?

 

Thanks!

Asper

0 Kudos
Message 7 of 8
(1,608 Views)

 Hi asper,

I don's have those vi's with me. And even they are removed from Beckhoff info site. But you can create one by yourself

-- right click on Reg event callback>>select Create callback vi. 

Use the event data for accessing the prop/methods.

 

Thanks

bp
0 Kudos
Message 8 of 8
(1,464 Views)