FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
01-25-2024 10:41 AM
Hi,
I try to read a variable in my PLC program. I successfuly got created the variable in DataLayer by DeviceBridge app and see that the values reqularily change.
In PLC I execute the following sample program. For whatever reason I read only 0. Is there some fundamental issue which I have overseen or do wrong?
vars:
fbReadNodeValue: DL_ReadNodeValue;
bReadExecute: BOOL;
bReadDone: BOOL;
bReadActive: BOOL;
bReadError: BOOL;
ReadErrorID: CXA_Datalayer.ERROR_CODE;
ReadErrorIdent: CXA_Datalayer.ERROR_STRUCT;
DataRead: CXA_Datalayer.DL_NodeValue;
DataType: CXA_Datalayer.DL_DATA_TYPE;
prog:
bReadExecute := NOT(bReadExecute);
==============================
iValue is always 0.
Thank you very much for any suggestion.
Michael
Solved! Go to Solution.
01-25-2024 11:01 AM
DL_ReadNodeValue is supposed for complex data types. Please try DL_ReadNode instead for your int32.
01-25-2024 12:11 PM
Thank you very much for this proposal. I gave it a try and it looks like it works.
What do you have in mind saying "complex data types"? Are you refering e.g. to structs or something like this?
What I actually what to do is to transfer several int32 values via DeviceBridge to my PLC program. So in this case maybe the DL_ReadNodeVAlue function is the right one to read all of those int values at one time, isn't it?
What do you think?
01-25-2024 01:30 PM
I am referring to "Complex data types" in the manual using flatbuffer technology. It is not 1:1 compareable to structs, as a struct will be published via the data layer normally as single values. The Provider of the data, in your case DeviceBridge app, needs to publish the data as flatbuffer if you need to read it as complex data type.
Another possibility for you would be to use DL_BulkReadNodeValues to read several data at once.