6F3B0253
7. Instructions
FUN 028
−
Subtraction
Expression
Input − [ A − B → C ]− Output
Function
When the input is ON, the data of B is subtracted from the data of A, and the result is stored in C. If the result is greater than 32767, the upper limit value 32767 is stored in C, and the output is turned ON. If the result is smaller than
Execution condition
Input | Operation | Output |
OFF | No execution | OFF |
ON | Execution (normal) | OFF |
| Execution (overflow or underflow occurred) | ON |
Operand
| Name |
|
| Device |
|
|
|
|
|
|
|
|
| Register |
|
|
|
|
| Constant | Index | ||
|
| X | Y | R | S | T. | C. | XW | YW | RW | SW | T | C | D | I |
| J | K |
|
| |||
A | Minuend |
|
|
|
|
|
| √ | √ |
| √ | √ |
| √ | √ | √ | √ | √ | √ |
| √ | √ |
|
B | Subtrahend |
|
|
|
|
|
| √ | √ |
| √ | √ |
| √ | √ | √ | √ | √ | √ |
| √ | √ |
|
C | Difference |
|
|
|
|
|
|
|
| √ |
| √ | √ | √ | √ | √ | √ | √ | √ |
|
| √ |
|
Example
When R005 is ON, the constant data 2500 is subtracted from the data of D0200, and the result is stored in RW50.
If the data of D0200 is 15000, the result 12500 is stored in RW50, and R010 is turned OFF.
D0200
Constant
15000
− RW50
2500
12500
R010 is OFF
If the data of D0200 is
D0100
Constant
2500
Underflow
− RW50
R010 is ON
144