XPY (X To The Power Of Y) Ladder Logic Instruction

The XPY instruction is a ladder logic rung output instruction that takes the Source X to the power of Source Y and places the result in the destination. The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.


X to the power of  Y Where X = 2 and Y = 4

= X * X * X * X

= 2 * 2 * 2 * 2

= 16

List of possible arguments

SOURCE X,Y and the DESTINATION can be any combination of the following data types.

  • CONSTANT             Can’t be the DESTINATION obviously
  • SINT              
  • INT
  • DINT
  • REAL

Note: Arithmetic status flags are affected (S:V, S:Z, S:N, S:C). Overflow, Zero, Negative, and Carry. If Source X is negative and Source Y is not an integer value a minor fault will occur.

Leave a Comment