This article focuses on how to write a low select logic for two input using the CMPU function block. The screenshot below illustrates just that.
Rung 1 is where the low select happens. If “Input 01” (Modbus register 40001) is greater than or equal to “Input 02” (Modbus register 40003), then “Use Input 1” (Modbus register 1) will get energized. Likewise, if “Input 01” is smaller than “Input 02”, then “Use Input 2” (Modbus register 2) will get energized.
If “Use Input 1” were to be energized, in rung 4, the value from “Input 01” will be assigned to “The Output” (Modbus register 40088) using the PUTF instruction block. Likewise, if “Use Input 2” were to be energized, the value from “Input 02” will be assigned to “The Output” (Modbus register 40088) using the PUTF instruction block.
Below are some information about the instruction blocks that were used in this article. This information is directly from the Telepace Studio help file.
The CMPU function block compares two unsigned registers or constants and stores the difference in a holding register. When enable CMPU input is energized value 1 is compared to value 2.
If value 1 is greater than value 2 the value 1 > value 2 output is energized and the difference of value 1 minus value 2 is stored in difference register.
If value 1 is less than value 2 the value 1 < value 2 output is energized and the difference of value 2 minus value 1 is stored in the difference register. Note that the difference is an absolute value
If value 1 equals value 2 the value 1 = value 2 output is energized.
The PUTF function block transfers, in one scan, the source floating-point holding register or constant into the destination floating-point holding registers. The number of floating-point destination registers is determined by size. The same value is stored in each floating-point register pair.
When the enable input is ON, the source register or constant is transferred to the destination registers. The element output is ON when the input is.