Arithmetic instructions perform mathematical operation on numerical value. inputs and output of these instructions is same data type for example if we use a add instructions than inputs of this instruction is same data type and out is also same data type. if input and output theses differ from each other than plc shows error. in this article we discuss only normal arithmetic instructions like addition, subtraction etc. REAL, INT, DINT, UINT, UDINT data types are allowed in arithmetic instruction input and output. maximum 28 input allowed in Panasonic PLC Arithmetic instructions.
Panasonic PLC ADD Instruction
Panasonic PLC ADD Instructions perform addition of it's input and return addition result in output. more than two input allowed in add instruction, but data type of these input is same.
in above example of Panasonic PLC ADD Instruction all input is real data type and output is also a real data type. result of this instruction is input_1+input_2+input_3+input_4=output_add.
Panasonic PLC SUB Instruction
Panasonic PLC SUB Instruction or Subtract instruction it perform subtraction of input and return result to output. it allowed only two same data type input variable.
above example of Panasonic PLC SUB Instruction it subtract input_1 - input_2 = output_sub.
Panasonic PLC MUL Instruction
Panasonic PLC MUL Instruction multiplies the values of the input variables with each other and writes the result into the output variable.
above example of Panasonic PLC MUL Instruction it subtract input_1 x input_2 x input_3 x input_4 = output_mul.
Panasonic PLC DIV Instruction
Panasonic PLC DIV Instruction divides the first input variable by the second input variable and write result into the output variable. DIV instruction allowed only two same data type input variables and a single output variable.
above example of Panasonic PLC DIV Instruction it subtract input_1 / input_2 = output_div.
Panasonic PLC SQRT Instruction
Panasonic PLC SQRT Instruction is a single input variable and single output variable that caluclate square root of input variable and return result into output variable. SQRT instruction only allowed REAL data type as input and output. Input value is ≥ 0.0.
above example of Panasonic PLC SQRT Instruction √ input_1 = output.
Panasonic PLC MOD Instruction
Panasonic PLC MOD Instruction write The remainder of the division into the output variable. first input this instruction is a dividend
second input is a divisor and output is a remainder result. MOD instruction not allowed real data type only allowed INT, DINT, UINT, UDINT
data type or you can use a constant value as input.
above example of Panasonic PLC MOD Instruction in this example value of the first input variable is divided by second input variable. The remainder of this division is return into the output variable.
Panasonic PLC ABS Instruction
Panasonic PLC ABS Instruction convert input variable into an absolute value. output of this instruction is always a positive number or zero, regardless of whether the original number is positive or negative. it have only single input variable and single output variable. data type is DINT, INT, REAL.
above example of Panasonic PLC ABS Instruction output=|input_1|