×

Subscribe to newsletter

subscribe to our weekly newsletter to get notified with latest story and article Subscribe now!




PLC BLOG | Siemens Math Instructions
Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


Siemens Math Instructions

Arithmetic Instruction such as Addition, Subtraction, Multiplication, Division etc., These Instruction Have Two Input Variable And One Output Variable. Data Type allowed In Arithmetic Instruction INT, double INT (DINT), real AND constant value. These data type in permissible range if input value above the range overflow bit set to 1 and if input value below the range underflow status bit are set to 1. for more information about Siemens data types refer to Siemens data type
    in Siemens following math's instructions are available
  • Integer Math Instructions.
  • double Integer Math Instructions.
  • real Math Instructions.


Integer Math Instructions

Integer Math Instructions allowed data type is int 16 bit only. all inputs and outputs are int data type. block is activated if enable bit(EN) set to 1, EN is bool data type. IN 1 is first input, IN 2 second input ,OUT output of Instructions. the data type for inputs and output is INT. EN is enable bit, ENO is enable output both are Boolean type. following operation are allowed in Siemens.
    important parameter of Math Instructions.
  • IN1 : integer type first input.
  • IN2 : integer type second input value.
  • Output : integer type second input value.

Integer Math Instructions

Integer Math Instructions: ADD

if EN is set to 1 , this instruction execute addition operation of two input variable and store the result in out. Following figure shows the example of addition operation.

Integer Math Instructions : ADD

    above example MW1 and MW 4 data type int are inputs of addition block and MW 6 is int type output address where result stored after addition, if EN bit set to 1 than block is activated and operation of addition block executed.


Integer Math Instructions: SUB

if EN is set to 1 , this instruction execute subtract operation of two input variable and store the result in out. Following figure shows the example of subtraction of input integer operation.

Integer Math Instructions : sub

    Above example MW1 and MW 4 data type int are inputs of subtraction block and MW 8 is int type output address where result stored after subtraction, if EN bit set to 1 than block is activated and operation of subtraction block executed.


Integer Math Instructions : MUL

if EN is set to 1 , this instruction execute multiplication operation of two input variable and store the result in out. Following figure shows the example of multiplication of input integer operation.

Integer Math Instructions : mul

    above example MW1 and MW 4 data type int are inputs of multiplication block and MW 12 is int type output address where result stored after multiplication, if EN bit set to 1 than block is activated and operation of multiplication block executed.


Integer Math Instructions : DIV

if EN is set to 1 , this instruction execute division operation of two input variable and store the result in out. following figure shows the example of division of input integer operation.

Integer Math Instructions : div

    above example MW1 and MW 4 data type int are inputs of division block and MW 16 is int type output address where result stored after division, if EN bit set to 1 than block is activated and operation of multiplication block executed.


if all inputs value are negative

    if all inputs value of block is negative so math instruction block have no effect and perform normal operation. for example if you are using addition block and input1 is -34 and input2 is -12 than output is -46.

if all inputs are negative value

if inputs or output are real value

    if inputs or output are real value than output store value before the decimal. Suppose if inputs of division blocks are input1 = 10 and input2 = 3 than output is 3 but actually output 3.333333333. so value store before the decimal.

if inputs or output are real value
 
Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


Suggested Post


 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

comment


Julius
julius.ogwang15@gmail.com 2021-06-30
Thanks very much,I would like to know if you offer a hands on training with a simulated training software especially for Siemens soft wares.