Hello
How to convert double word to bit in Siemens plc s7؟
PCS7 V 8.1
Thank you
[?]: Convert Double Word To Bool
-
- Posts: 199
- Joined: Wed Dec 24, 2008 4:37 pm
- Location: Europe
Re: [?]: Convert Double Word To Bool
Here you go.
Code: Select all
FUNCTION FC2 : VOID
VAR_INPUT
IN: DWORD;
END_VAR
VAR_OUTPUT
OUT: INT;
END_VAR
VAR_TEMP
s,i: INT;
END_VAR
s:=0;
FOR i:= 0 TO 31 DO
s:=s+DWORD_TO_INT(ROR(IN:=IN,N:=i) AND dw#16#1);
END_FOR;
OUT:=s;
END_FUNCTION