Hello all,
Thanks in advance for any help you can offer. I am pretty new to structured text. Is there any way that you can create a structure, and within that structure define some of the elements as PERSISTENT and RETAIN and some as just regular?
Lets say that I am defining a structure like this...
TYPE MyStruct :
STRUCT
//definition of my structure
element1 : DINT; //i want to define this as PERSISTENT
element2 : INT; //i want to define this as PERSISTENT and RETAIN
element3 : INT; //i don't want to define this as PERSISTENT or RETAIN
element4 : REAL; //i don't want to define this as PERSISTENT or RETAIN
END_STRUCT
END_TYPE
So, when I go to declare my variable as the type "MyStruct" that I just made, I have the option to designate the whole variable as just a VAR or VAR PERSISTENT RETAIN, or any combination of those, but I obviously can't specify those attributes for specific elements within the variable at that point.
Is there some syntax within the structure that I can use to designate specific elements for retention and others for no retention? I have tried a couple different stabs in the dark, but they always result in errors. Thank you.
Thanks in advance for any help you can offer. I am pretty new to structured text. Is there any way that you can create a structure, and within that structure define some of the elements as PERSISTENT and RETAIN and some as just regular?
Lets say that I am defining a structure like this...
TYPE MyStruct :
STRUCT
//definition of my structure
element1 : DINT; //i want to define this as PERSISTENT
element2 : INT; //i want to define this as PERSISTENT and RETAIN
element3 : INT; //i don't want to define this as PERSISTENT or RETAIN
element4 : REAL; //i don't want to define this as PERSISTENT or RETAIN
END_STRUCT
END_TYPE
So, when I go to declare my variable as the type "MyStruct" that I just made, I have the option to designate the whole variable as just a VAR or VAR PERSISTENT RETAIN, or any combination of those, but I obviously can't specify those attributes for specific elements within the variable at that point.
Is there some syntax within the structure that I can use to designate specific elements for retention and others for no retention? I have tried a couple different stabs in the dark, but they always result in errors. Thank you.
Last edited: