Bit reset
This FP instruction turns OFF the bit specified by the bit position at n_Pos of the 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_Pos is 0–15.
Input
Bit position to be reset (permissible range: 0–15)
Input/output
16-bit data 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 ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_CONTACT,,bSet,3,1,5,3,);
B(B_VARIN,,iValue,7,2,9,4,);
B(B_VAROUT,,wWord,15,2,17,4,);
B(B_F,FP_RESET_BIT!,,9,0,15,4,,?DEN?Dn?AENO?Cd);
L(5,2,9,2);
L(1,2,3,2);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF bReset then
FP_RESET_BIT( n:= iValue,
d=> wWord);
END_IF;