Comparison Instructions perform comparison between two input value of same data type. if the comparison result true than output set to 1 otherwise output set to 0 or false. output is depends on type of comparison blocks. both input are same data type if first input is integer so you can not choose second input double or real data type. Comparison blocks are normal contact type it can be placed anywhere of the program. classification of comparison blocks is depend on data types so siemens have following comparison instructions blocks -
Compare Integer : Comparison of inputs integer
Compare Double Integer : Comparison of inputs Double Integer type
Compare Real : Comparison of inputs Real type
Compare Integer Instructions : both inputs are integer
integer comparison block compare between two input integer value and set 1 if comparison result is true otherwise output set to 0. inputs are same data type. following are parameter required for integer comparison blocks:
IN1 : integer type first input value to compare.
IN2 : integer type first input value to compare.
Output : Bool type set 1 if condition of comparison is true.
compare integer : equal
if both inputs equal to each other than output set to 1 otherwise output set to 0.
output Q0.0 is 1
if both input MW0 and MW4 are equal. input 1 = input 2
output Q0.0 is 0
if both input MW0 and MW4 are not equal. input 1 ≠ input 2
compare integer : not equal
output of not equal comparison block is 1, if both inputs in1 and IN2 are not equal to each other,output set to 0.
output Q0.1 is 1
if both input MW0 and MW4 are not equal. input 1 ≠ input 2
output Q0.1 is 0
if both input MW0 and MW4 are equal. input 1 = input 2
compare integer : greater than
output is set to 1 when the value of first inputs (IN1) is greater than second input IN2. MW0 first input and MW4 is second input values. If IN1 > IN2 than output set to 1.
output Q0.2 is 1
MW0 is greater than MW4. input 1 > input 2
output Q0.2 is 0
MW0 is less than MW4. in1 < in2
compare integer : less than
output is set to 1 when the value of first inputs (IN1) is less than second input IN2. MW0 first input and MW4 is second input values. If IN1 < IN2 than output set to 1.
output Q0.3 is 1
MW0 is less than MW4. input 1 < input 2
output Q0.3 is 0
MW0 is greater than MW4. in1 > in2
compare integer : greater than or equal to
output is set to 1 when the value of first inputs (IN1) is greater than or equal to second input IN2. MW0 first input and MW4 is second input values. If IN1 ≥ IN2 than output set to 1.
output Q0.4 is 1
MW0 is greater than MW4. input 1 ≥ input 2
output Q0.4 is 0
MW0 is less than MW4. in1 ≤ in2
compare integer : less than or equal to
output is set to 1 when the value of first inputs (IN1) is less than or equal to second input IN2. MW0 first input and MW4 is second input values. If IN1 ≤ IN2 than output set to 1.