AND

Example

The AND logic function block can evaluate the state of two integers. If a bit is true (logic 1) in both input A and B then the output C will be true (logic 1). If input A and B is false (logic 0) - the output C will be false (logic 0). If either input A or B is false (logic 0) - the output C will be false (logic 0).

Input Operands A & B must be integer values: MI , SI or # constant integer value.

Output Operand C may be an MI or a SI.

AND can be used to mask out certain bits of an input integer not relevant to a given function.

Example:

If a clock function block uses the first bit of a 16-bit word to decide if a given time is A.M. or P.M., you can mask out the other 15 bits. This will tell you if the current time is A.M. or P.M.

 

All of the non-relevant bits will be turned off (logic 0) expect the A.M. / P.M. bit.

Related Topics

Function Blocks

Placing a Function Block

Replacing Ladder elements

OR

XOR

Logic Functions