Mitsubishi — 5.6 Descriptions of the Applied Instructions

AH500 Motion Control Module Manual  S 1 : Minuend; S 2 : Subtrahend; D : Subtrahend  S 1 and S 2 can be floating-point values.  S 1 and S 2 can be floating-point values, or data registers in which floating-point values are stored.  If S 1 and S 2 are data registers in which floating-point values are stored, the function of API 172 DSUBR is the same as the function of API 121 DESUB.  The floating-point value in S 2 is subtracted from the floating-point value in S 1 , and the difference is stored in D .  S 1 and S 2 can be the same register.

If the instruction DSUBR is used under the circumstances, the value in the register is subtracted from itself whenever the conditional contact is ON in a scan cycle. Generally, the pulse instruction DSUBRP is used.  If the absolute value of an oepration result is greater than the maximum floating-point value available, a carry flag will be ON.  If the absolute value of an oepration reuslt is less than the minimum floating-point value available, a borrow flag will be ON.  If an operation result is 0, a zero flag will be ON.  SM1064 is the zero flag in an Ox motion subroutine, and SM968 is the zero flag in O100.

 SM1065 is the borrow flag in an Ox motion subroutine, and SM969 is the borrow flag in O100.  SM1066 is the carry flag in an Ox motion subroutine, and SM970 is the carry flag in O100. Explanation  When X0.0 is ON, the floating-point value F1.0 is subtracted from the floating-point value F1.23456, and the difference F0.23456 is stored in (D11, D10). Example 1 X0.0  When X0.0 is ON, the floating-point value in (D3, D2) is subtracted from the floating-point value in (D1, D0), and the difference is stored in (D11, D10).

Example 2 X0.0 5-106 API Instruction code Operand Function Floating-point 173 D SUBR P S , S , D 1 2 subtraction Device Xn.n Yn.n M S K 16# F KnM KnS D W T C V Z S 1    S 2    D   Pulse instruction 16-bit instruction 32-bit instruction (9 steps)  –  0.0 DSUBR F1.23456 F1.0 D10 DSUBR D0 D2 D10