Trying to figure out how to initialize an array of FB, where the FB itself is initialized with a STRUCT (through the FB_Init).
This works:
bar: STRUCT_BAR := (b1:=val1, b2:=val2); foo: FB_FOO(bar);
This does not:
bar1: STRUCT_BAR := (b1:=val1, b2:=val2); bar2: STRUCT_BAR := (b1:=val1, b2:=val2); foo: ARRAY[1 .. 2] OF FB_FOO[(bar1),(bar2)]; // or like FB_FOO[(bar1,bar2)] and other variations I could think of
The compile error would look something like: [ERROR] C0032: Cannot convert type STRUCT_BAR to type POINTER TO FB_FOO
Thanks!
Figured it out ...
METHOD FB_Init //of FB_FOO VAR_INPUT Β Β bInitRetains: BOOL; Β Β bInCopyCode: BOOL; Β Β var: STRUCT_BAR; END_VAR foo: ARRAY[1 .. 2] OF FB_FOO[(var:=bar1),(var:=bar2)];
It seems that is not possible to pass diferent parameters to the array fb initialization.
You can, but, initiqlize internal variables as in structures. ( An fb is an structure too).
Se the post
l viewtopic.php?p=16838#p16838 (forum.codesys.com) l
Be healty!
Log in to post a comment.
Trying to figure out how to initialize an array of FB, where the FB itself is initialized with a STRUCT (through the FB_Init).
This works:
This does not:
The compile error would look something like:
[ERROR] C0032: Cannot convert type STRUCT_BAR to type POINTER TO FB_FOO
Thanks!
Figured it out ...
It seems that is not possible to pass diferent parameters to the array fb initialization.
You can, but, initiqlize internal variables as in structures. ( An fb is an structure too).
Se the post
l viewtopic.php?p=16838#p16838 (forum.codesys.com) l
Be healty!