15.3 LOGICAL FUNCTIONS
15.3.1 Comparison of Values
Comparison functions are shown in Figure 215. Previous function blocks were outputs, these replace input contacts. The example shows an EQU (equal) function that compares two floating point numbers. If the numbers are equal, the output bit light is true, otherwise it is false. Other types of equality functions are also listed.
The example in Figure 216 shows the six basic comparison functions. To the right of the figure are examples of the comparison operations.
The ladder logic in Figure 216 is recreated in Figure 217 with the CMP function that allows text expressions.
Expressions can also be used to do more complex comparisons, as shown in Figure 218. The expression will determine if B is between A and C.
The LIM and MEQ functions are shown in Figure 219. The first three functions will compare a test value to high and low limits. If the high limit is above the low limit and the test value is between or equal to one limit, then it will be true. If the low limit is above the high limit then the function is only true for test values outside the range. The masked equal will compare the bits of two numbers, but only those bits that are true in the mask.
Figure 220 shows a numberline that helps determine when the LIM function will be true.
File to file comparisons are also permitted using the FSC instruction shown in Figure 221. The instruction uses the control word c_0. It will interpret the expression 10 times, doing two comparisons per logic scan (the Mode is 2). The comparisons will be f[10]<f[0], f[11]<f[0] then f[12]<f[0], f[13]<f[0] then f[14]<f[0], f[15]<f[0] then f[16]<f[0], f[17]<f[0] then f[18]<f[0], f[19]<f[0]. The function will continue until a false statement is found, or the comparison completes. If the comparison completes with no false statements the output A will then be true. The mode could have also been All to execute all the comparisons in one scan, or Increment to update when the input to the function is true  in this case the input is a plain wire, so it will always be true.
15.3.2 Boolean Functions
Figure 222 shows Boolean algebra functions. The function shown will obtain data words from bit memory, perform an and operation, and store the results in a new location in bit memory. These functions are all oriented to word level operations. The ability to perform Boolean operations allows logical operations on more than a single bit.
The use of the Boolean functions is shown in Figure 223. The first three functions require two arguments, while the last function only requires one. The AND function will only turn on bits in the result that are true in both of the source words. The OR function will turn on a bit in the result word if either of the source word bits is on. The XOR function will only turn on a bit in the result word if the bit is on in only one of the source words. The NOT function reverses all of the bits in the source word.
Search for More: 
Custom Search
