16-bit data bit reset
Turns OFF the bit specified by the bit position at n of the 16-bit data specified by d if the trigger EN is in the ON-state. Bits other than the bit specified do not change. The range of n is 0 to 15.
Input
Specifies bit position to be reset
Output
16-bit area
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
bReset: BOOL:=FALSE;
(*activates the function*)
iValue: INT:=2;
(*bit position*)
wWord: WORD:=2#10101;
(*result after a 0->1 leading
edge from start: 2#10001*)
END_VAR
When the variable bReset is set to TRUE, the function is carried out. The bit on position 2 is reset to 0.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_CONTACT,,bReset,3,1,5,3,);
B(B_F,F131_BTR!,,9,0,15,4,,?DEN?Dn?AENO?Cd);
B(B_VARIN,,iValue,7,2,9,4,);
B(B_VAROUT,,wWord,15,2,17,4,);
L(1,0,1,5);
L(1,2,3,2);
L(5,2,9,2);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF bReset then
F131_BTR( n:= iValue,
d=> wWord);
END_IF;