Comparison of data blocks
Compares the contents of data block specified by s2_Start with the contents of data block specified by s3_Start according to the contents specified by s1_Control if the trigger EN is in the ON-state.
Input
control code specifying byte positions and number of bytes to be compared
starting 16-bit area to be compared to s3_Start
starting 16-bit area to be compared to s2_Start
Specifying the control code s1_Control
Number of bytes to be compared
range: 16#01–16#99 (BCD)
Starting byte position of data block specified by s2_Start
1: starting from higher byte
0: starting from lower byte
Starting byte position of data block specified by s3_Start
1: starting from higher byte
0: starting from lower byte
The compare operation result is stored in the special internal flag R900B. When s2_Start=s3_Start, the special internal flag is in the ON-state.
The flag sys_bIsEqual used for the compare instruction is renewed each time a compare instruction is executed. Therefore the program that uses R900B should be just after F64_BCMP .
The variables s1 and s2 have to be of the same data type.
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
start: BOOL:=FALSE;
(*activates the function*)
ControlCode: WORD:=16#1106;
(*s2 starting from upper byte
s3 starting from upper byte
compare 6 bytes*)
DataBlock1: ARRAY [0..5] OF INT:=[6(1234)];
DataBlock2: ARRAY [0..5] OF INT:=[6(1234)];
equal_block: BOOL:=FALSE;
END_VAR
When the variable start is set to TRUE, the function is carried out.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 6 ;
NETWORK_BODY
B(B_CONTACT,,start,4,1,6,3,);
B(B_F,F64_BCMP!,Instance,10,0,18,6,,?DEN?Ds1_Control?Ds2_Start?Ds3_Start?AENO);
B(B_VARIN,,ControlCode,8,2,10,4,);
B(B_VARIN,,DataBlock1[0],8,3,10,5,);
B(B_VARIN,,DataBlock2[0],8,4,10,6,);
L(1,2,4,2);
L(6,2,10,2);
L(1,0,1,6);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF start then
F64_BCMP( s1_Control:= ControlCode,
s2_Start:= DataBlock1[0],
s3_Start:= DataBlock2[0]);
END_IF;