CoDeSys v2.3 on an IFM CR0403 basic controller
Still very new to codesys so bear with me. I'm trying to assign an initial value to an array of bytes. I've tried a few things but i'm clearly missing something. Ultimately, i want to bring in the 8 byte data field of a CAN message and apply a bit mask with a second array to isolate the information i'm looking for. Whenever I try to assign the initial value of the array i get an error upon building that says "Erroneous initial value". I've tried typing out the individual bits, assigning in hex values using 16#FF, and just the decimal translation of the binary or hex value i need. Nothing works.
RX65265: ARRAY [1..8] OF BYTE := [8 (11111111)];
MASK: ARRAY [1..8] OF BYTE;
PBHEX: ARRAY [1..8] OF BYTE;
( RX65265 := [16#D6, 16#5F, 6 (16#FF)]; )
( MASK := [16#0C, 7 (16#FF)]; )
PBHEX := RX65265 AND MASK
Have you tried:
RX65265: ARRAY [1..8] OF BYTE := [8(2#11111111)];
Not sure how the space is handled between the "8 (" so I removed it.
Ultimately this should work also:
RX65265: ARRAY [1..8] OF BYTE := [16#D6, 16#5F, 6 (16#FF)];
Log in to post a comment.