BOOL array to USINT

Oh for the love of god, that explains alot.
Since i havent used CCW i looked quickly at the Codesys help for reference of the AND operator and they support bitwise operation on WORD data type.


Maybe try this instead pasbra:
Code:
FOR i := 0 TO 15 DO
  Input[i] := (ANY_TO_DINT(INT_InputLogix) AND SHL(1, i)) > 0;
END_FOR;

or

FOR i := 0 TO 15 DO
  Input[i] := FALSE;
  IF (ANY_TO_DINT(INT_InputLogix) AND SHL(1, i)) > 0 THEN
    Input[i] := TRUE;
  END_IF;
END_FOR;

That operator ought to be overloaded... everywhere. It's nearly 2022 FFS.

To any platform that requires a separate instruction or user-made code: GFY.
 

Similar Topics

I received the following message via PM, and am posting here publicly to help others. ============================================ I had a...
Replies
10
Views
1,025
I need to move a large Bool array to Word array in Schneider Control Expert. Is there an easier way to do this? For example: Bool[128] array to...
Replies
4
Views
1,353
I am trying to make a function that count the number of True BOOL inn a specific Array and return the count to an INT AlarmArrayActiveAlarms. I...
Replies
8
Views
4,442
Hi out there is it possible to Compare a bool array to a bool, in studio 5000. I'm think that if One of the bool's in my array is true, then i...
Replies
10
Views
6,376
We are using an array of bools for our fault code logic, and I need to reset all the bits in the array when the operator presses the fault reset...
Replies
2
Views
2,146
Back
Top Bottom