I have a little problem with property. (I use CODESYS V3.5 SP14)
I writted an objet FB1
FB1 Function blockVARErrorFB1: Struct1;END_VAR
I use MyFB1 :
Struct1 is a structure, declared like this :
I can write 3 properties to get the value of each variable ErrorFB1.ErrorBit1, ErrorFB1.ErrorBit2, .... wtih properties like this :
Property Read1 : Bool;GETRead1:= ErrorFB1.ErrorBit1;
It works well.
But I try to write only one property to get the entire structure ErrorFB1 :
Property ReadAll : ErrorFB1;
but It don't work.
I read somewhere, that I have to declare a REFERENCE, so I wrote :
Property ReadAll : REFERENCE TO ErrorFB1;GETReadAll :=ErrorFB1;
In my programme I use :
And I get an exception when I run the simulation mode.
I am a beginner in the use of OOP. I looked for examples but I founded only "simple" one.
I have certainly made a monstrous mistake somewhere, but I do not see it
Thank you in advance for any help.
I found my error;
As the property is a REFERENCE, I have to write "REF=" instead of "=" in the GET acces :
Property ReadAll : REFERENCE TO ErrorFB1;
Log in to post a comment.