LabWindows/CVI

取消
显示结果 
搜索替代 
您的意思是: 

passing a variable type to a function

greetings,

 

i'm addressing an Ethercat device using the Beckhoff Twincat ADS dotnet library, that is linked into my project as an instrument i created.

 

The function in question reads an analog input into the variable whos handle i pass to it (&valueHandle1) , but also requires the variable type, of the type System_Type.

 

err = TwinCAT_Ads_TcAdsClient_ReadAny_1 (tc_handle, Var_handle1, UINT16,  &valueHandle1, &exception);

 

 

in C# the variable type is easily passed by e.g.     typeof(Uint16)  

but i'm having difficulty in Labwindows.  i tried passing the variable type directly, without success.

 

This is the function proto:

 

int CVIFUNC TwinCAT_Ads_TcAdsClient_ReadAny_1(

                TwinCAT_Ads_TcAdsClient __instance,

                int variableHandle,

                System_Type type,

                CDotNetHandle * __returnValue,

                CDotNetHandle * __exception);

 

 

and my code is attached below.

 

Any help will be appreciated

 

Thys

 

0 项奖励
1 条消息(共 2 条)
4,478 次查看
0 项奖励
2 条消息(共 2 条)
4,450 次查看