PLUS+1 User Forum
PLUS+1 Tools => PLUS+1 GUIDE => Topic started by: LBee11 on February 21, 2017, 08:19:34 AM
-
I've been trying to convert some of my CoDeSys Structured Text functions in to Danfoss Plus+1 Structured Text files and ran into an issue.
CoDeSys allows the following Declaration:
Errors : ARRAY[0..7] OF ARRAY[0..7] OF BOOL;
But Plus+1 does not. Is there a way of achieving the same result?
Thanks
-
I found a method to achieve a similar result by using the Data Type feature.
I created a structure of 8 Arrays of 8 Booleans, and then created a function block to turn each Array inside the structure into a Byte value and put that byte value into a new Array of 8 Bytes. After doing this to all Boolean Arrays, I end up with an "Array [0..7] of Array [0..7] Of Boolean". Using another function block to Unpack the bytes back into the new structure I can use the "Array inside the Array" as intended.
Got there in the end!
-
Hi LBee11!
The syntax ”Errors : ARRAY[0..7] OF ARRAY[0..7] OF BOOL;” is currently not supported in GUIDE.
There are 2 main possibilities to achieve similar results:
1) Multi-dimensional array:
“Errors1 : ARRAY[0..7,0..7] OF BOOL;”
See picture example1.
2) Type alias:
First define: “TBoolArray7 : ARRAY[0..7] OF BOOL;”
Then use it like: “Errors2 : ARRAY[0..7] OF TBoolArray7;”
See picture example2.
I hope this helps!
Best regards
Nilla
PLUS+1 Helpdesk
-
Thanks for that,
I've done something very similar to your second example using Type Struct, but ultimately I want to be able to use "Errors1[0][0]" format, which your example does nicely.
Thanks!