I have 2 bool arrays
key_alarms: ARRAY[0..0] OF ARRAY[0..15] OF bool;
no_alarms: ARRAY[0..0] OF ARRAY[0..15] OF bool;
no_alarms is an empty array -all false or all 0's
I would like to compare that if any bool of key_alarms is high/true/1, set another bit.
I have tried GT and NE functions with these 2 arrays as inputs and receive an error as below.
I declared as you said. Still have the same issue. In logix I think this is a file bit compare FBC function. Cannot seem to find the similar functiion for codesys.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2017-03-21
Originally created by: scott_cunningham
A BOOL is not a BIT (BOOLs in CoDeSys are byte-sized by default). So you are really trying to compare a structure (a chunk of bytes). IF Struct1 = Struct2 will not work - you cannot also do Struct1 := Struct2. You have to compare each element. Your hardware source or the system libraries should have a function (for copy, I know there is a SysMemCopy or something like that). Sorry, I am not in front of my PC, so I cannot give you the exact item.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have 2 bool arrays
key_alarms: ARRAY[0..0] OF ARRAY[0..15] OF bool;
no_alarms: ARRAY[0..0] OF ARRAY[0..15] OF bool;
no_alarms is an empty array -all false or all 0's
I would like to compare that if any bool of key_alarms is high/true/1, set another bit.
I have tried GT and NE functions with these 2 arrays as inputs and receive an error as below.
[ERROR] garagepi: key_faults Device: PLC Logic: Application: C0068: Compare not possible on objects of type 'ARRAY [0..0] OF ARRAY [0..15] OF BOOL'
What function would allow me to compare these 2 arrays of inputs within a ladder program?
Correct declaration of bool array may help.
I declared as you said. Still have the same issue. In logix I think this is a file bit compare FBC function. Cannot seem to find the similar functiion for codesys.
Originally created by: scott_cunningham
A BOOL is not a BIT (BOOLs in CoDeSys are byte-sized by default). So you are really trying to compare a structure (a chunk of bytes). IF Struct1 = Struct2 will not work - you cannot also do Struct1 := Struct2. You have to compare each element. Your hardware source or the system libraries should have a function (for copy, I know there is a SysMemCopy or something like that). Sorry, I am not in front of my PC, so I cannot give you the exact item.
Thank you. I changed array[0..15] of Bool to array[0..0] of INT. These I can compare with math operators.