Siemens PLC-- Subtract Function in the STEP7 Software.

Опубликовано: 01 Ноябрь 2024
на канале: PLC
573
29

In this video, you will see the functions of subtraction of 16-bit integers, subtraction of 32-bit integers, and subtraction of real numbers by Step7 software.
Follow me to the end of this video and subscribe and like PLC channels.

To subtract two 16-bit integers from the integer function folder, double-click the Sub_I command.
I type MW0 in front of input 1, and MW2 in front of input 2.
Also, in front of the output, I type the address MW4.
I save, download and monitor the program.
In the simulation window, this is how I create inputs and outputs.
In input one, I put the value 12 and in input two, I put the value 5.
As you can see, the output value is equal to the subtraction of the first number from the second number, that is, the number 7.
FBD language This program is very similar to LAD language.
The largest value in 16-bit integers is 32767.
To subtract larger numbers, we use the 32-bit integer subtraction function, or Sub_D.
like this:
In this example, the product of the number 500000000 divided by 200000000 becomes 300000000.
Look at the STL language of this function.
To subtract 32-bit integers, we use the -D command.
To subtract 16-bit integers, we use the -I command.
The input and output memory size of this command is 16 bits. Therefore, the inputs and output addresses are in Word.
To subtract Floating point numbers , or 32-bit, real numbers, we use the -R command.
To subtract Floating point numbers, we use the Sub_R function.
In the simulator, the inputs and outputs must be real.
For example, the sum of 8.5 by 2.5 is equal to 6.