July 26, 2020

Subtraction of two operands using subtract instruction in the PLC.

Subtraction of two operands using subtract instruction in the PLC.

Application:-Explain subtraction instruction in the PLC. Write PLC program for explanation using ladder diagram language.

Components:-Programmable logic controller, HMI panel, Ethernet cable, 24 V DC power source.

Diagram:-


























Explanation:-

The subtraction instruction is used for subtraction of two values for any data records. For example, we want two subtract one value from the second value in the application like weight 1 and weight 2 and we want to show the subtraction of two weight like we want to subtract weight 1 from weight 2 and show on the HMI.

So for that, we have two take two input field in the HMI system and make weight 1 input field and weight 2 input field so the user can enter a value in the input field. And also users can monitor subtraction value in the result field.

PLC program:-

Write the ladder program for subtraction instruction using ladder diagram language. Here for ladder logic, we can use any supported PLC a system like S7-1200, S7-1500 or any other PLC which can support this instruction. In our application, we have used S7-1200 PLC for reference.

M Memory:-

Weight 1:-MW10

Weight 2:-MW12

Actual value:-MW14



















PLC program Explanation:-

In-network 1 we have taken subtraction instruction for the subtraction of two weights. Weight 1(MW10) will be entered from the HMI and weight 2 (MW12) will be entered from the HMI. Instruction is executed and generates output in the MW 14 word. 

Addition of two operands using addition instruction in the PLC.

Addition of two operands using additional instruction in the PLC.

Application:-Explain addition instruction in the PLC. Write PLC program for explanation using ladder diagram language.

Components:-Programmable logic controller, 24 VDC power source.






















Explanation:-

The addition instruction is used for the addition of two values for any data records. For example, we want two add two weight in the application like weight 1 and weight 2 and we want to show the total weight on the HMI also.

So for that, we have two take two input field in the HMI system and make weight 1 input field and weight 2 input field so a user can enter the value in the input field.

PLC program:-

Write the ladder program to calculate instruction using ladder diagram language. Here for ladder logic, we can use any supported PLC a system like S7-1200, S7-1500 or any other PLC which can support this instruction.

M Memory:-

Weight 1:-MW10

Weight 2:-MW12

Total value:-MW14


















PLC program Explanation:-

In-network 1 we have taken additional instruction for the addition of two weights. Weight 1(MW10) will be entered from the HMI and weight 2 (MW12) will be entered from the HMI. Instruction is executed and generates output in the MW 14 word.

You can use addition instruction value for any application in which you can show the addition of two values or more than two values.








Explain to calculate instruction using an example.

Explain to calculate instruction using an example.

Application:-Explain to calculate instruction in the PLC. Write PLC program for explanation using ladder diagram language.

Components:-Programmable logic controller, HMI panel, 24 VDC power source.
























Explanation:-

Calculation instruction is used to define the calculation of mathematical values. Date type can be set as per the requirements. Siemens S7-1200 and S7-1500 are supporting this instruction. We can make a suitable equation by using this instruction.

For example, consider there are two values and we need to calculate the average value for these two values. In the figure, we can see 50 entered in value 1 box and enter 10 in value 2 box. Take 1 result box as shown in the figure so we can monitor the result of the instruction.

Now link these tags to calculate instruction by giving these addresses in the HMI.

PLC program:-

Write the ladder program to calculate instruction using ladder diagram language. Here for ladder logic, we can use any supported PLC a system like S7-1200, S7-1500 or any other PLC which can support this instruction.

M Memory:-

Value 1:-MW10

Value 2:-MW12

Average Value:-MW14




















PLC program Explanation:-

In-network 1 we have configured calculate instruction for the average value. In this instruction we can select data type in the box (??), here select INT for our requirement. In the box (..) we can define the equation for the calculation.

IN1 (MW10) and IN2 (MW12) are the inputs operands in which we can enter values, here these values will come from the HMI. And OUT is the output operand, here we can monitor the result of the calculation.

Here IN 1=50 and IN2 =10 so average value as per the equation (IN1+IN2/2) is 30 so in a result we will get value 30 in MW 14.