LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use AdsSyncReadReq

Hello all,
 
I am using AdsOcx methods to communicate with a PLC. I found that methods like AdsSyncReadIntegerReq and AdsSyncReadBoolReq work fine. But when I use AdsSyncReadReq to read an entire cluster I get no data. I tested the PLC; it receives and responses the request.
 
I am not sure how to wire the data item of the method. I tried clusters, arrays, variants but it does not seem the correct way.
 
Can anyone help me out?
 
Thanks in advance,
 
Bart. 
0 Kudos
Message 1 of 4
(3,581 Views)

Hi Bart,

This datatye is not available in labview. There are two options.

1. you write a program in another language that converts the datatype to one that is known in Labview.
2. I saw that there is are .NET possibilities. Since datatypes are more defined in .NET, this connects better to a labview datatype.

Regards,

Bas van Dijke
AE, Netherlands

 

0 Kudos
Message 2 of 4
(3,534 Views)
Hello Bas,
 
.Net works fine. I also found that calling the AdsSyncReadReq function in the ads.dll gives me the correct data.
 
Still I am curious how to use the AdsSyncReadReqfrom AdsOcx. With which types does it work since it does not work with clusters?
 
Regards,
 
Bart.
0 Kudos
Message 3 of 4
(3,516 Views)
Hi Bart,
 
This is because of the way the OCX works. It comes with a type library that contains all information about the exported objects / properties / methodes that the OCX support. The client application reads this Type Library so it knows how to use the OCX.
 
Thus LabVIEW uses the type library to populate the property and invoke nodes. this is why you can just wire in the reference and select the property or method you like to use. There are some 'rules' on the Data Types that you can / sould use in this interface to ensure ease of use en compatibility. but some developers don't follow this and this then results in incompatibilities with other client applications like LabVIEW.
 
DLL are more flexable in this respect because you have more control over how LabVIEW should handle the data. This enables you to use a byte array in LabVIEW to store complex data types from DLLs. In some case (when the data structure is not contious in memory) you will need to write a wrapper dll to 'translate' this data to LabVIEW usable datatypes.
 
Hope this explains the issue your're seing.
 
Regards
Karsten
0 Kudos
Message 4 of 4
(3,496 Views)