Beckhoff / ADS

Beckhoff protocol to communicate with TwinCAT devices.
MIT License
493 stars 194 forks source link

how to know if a variable is persistent or not? #137

Closed chrisbeardy closed 1 year ago

chrisbeardy commented 3 years ago

Hi,

I have this example from the website https://infosys.beckhoff.com/english.php?content=../content/1033/tcsample_vc/html/tcadsdll_api_cpp_sample10.htm&id=1091195345805397691

which lets you read the follwing info: image

Is there a way of getting more information on the variable? I would like to know if a variable is declared as Persistent or Retentive?

e.g.

VAR PERSISTENT
   var: BOOL;
END_VAR
heppth commented 3 years ago

Hi chris,

have a look at AdsSymbolEntry.flags. You are looking for Persistent = 256u and PersistantDatatype = 2097152u, I hope this helps you.