Function CMPR (
Analog Comparator function )
|
Diagram |
Pin |
Description |
|
Comparison Function
may
be selected as: “<”, “>”, “<=”,
“>=”, “!=”, “=” |
Input 1 |
Analog
Input 1, can be selected as: the value calculated from the analog
input IA through the math formula, or the preset analog value. |
|
Input 2 |
Analog Input 2, can be selected as:
the value calculated from the analog input IA through the math formula,
or the preset analog value. |
|
Output Q |
If the comparing condition between
Input 1 and Input 2 is YES, Q will be 1, and otherwise Q will be 0. |
|
Output
P |
If the property pin of the output
P is connected with the properties pin of the SLCD, the parameter of
this function block will be transferred to HMI. |
Function
Description:
Only for MiniSuperPLCs:
12MRDC, 12MTDC, 12MGDC, 22MRDC,
22MTDC, 22MGDC types have this function.
This function is used in the analogue input instructions.
Instruction of CMPR
The value of the analog input (IA),
which the CMPR compares, is valued out through math formula and is not
the actual input voltage value. And the math formula is A*IA+B.
Actually the value of A and B don’t
need for you to calculate by pen. We have put the math formula into SWRT
and the free software SUPER CAD. You only need to connect the sensor to
the related analog input (IA) then the value of A and B will be written
into SR PLC according to the related methods.
Here we explain the method in SUPER
CAD:
Connect the
MiniSuperPLC
main PLC and your PC via SR-CP. Power on the SR main PLC and
open the SUPER CAD software. Then select [Set Analog Parameters] in
[Option] to select the two values of the linear relationship as in Fig.
3.2 and Fig. 3.3. (If the sensor tests the 0℃
first and then tests a 50℃.
Through these tow times test, it will get the value of A and B. And then
put the value of A and B into the main PLC.)
Please
refer to the details of SWRT for the methods how to set the value of A
and B in SWRT.
Notes: The value of
A and B of each analog pin need to be set separately.



CMPR will compare the calculated value of the input 1 and
input 2. When the comparison function is selected as “〈”,
it means the calculated value of input 1 is smaller than that of input 2
and the output is high. Otherwise it will be low.
And the value of input 1 or input 2 can be select as the
fix value, and the other is connected to the pin of the analog input.
Thus CMPR will compare this fix value and the calculated value of the
analog pin.
Example 1:
Comparing the calculated value of input 1 and input 2.
Input 1 is connected to IA0;
Input 2 is connected to IA1;
Output is connected to QA1;
CMPR function is selected as “<=”
Then If the calculated value of IA0 is <= that of IA1,
QA1 will become 1. Otherwise QA1 will become 0.
Example 2:Comparing
the calculated value of the analog input with the fix value.
Input 1 is connected to IA01;
Input 2 is empty. And then select the property dialogue
frame of Input 2 and put in the fix value;
Output is connected to QA0;
CMPR function is selected as “<=”.
Then if the calculated value of IA0 is <= to the fix
value, QA1 will become 1. Otherwise QA1 will become 0.