The Comparator LIM Block, or CLB, is an intra-procedural control structure that can be used in Ladder Logic to compare two values and do something if one value is greater than the other.
The following is a sample Ladder Logic program with a CLB:
int BinOp(int x, int y) {
CLB comp = x > y ? y : x;
return BinOp((int)(comp), 9);
}
If the result of the comparison is true, anything before it will be executed. If the result of the comparison is false, anything after it will be executed.
Share a personalized message with your friends.