Delta Electronics AH — 3.4 Arithmetic Instructions

AH Motion Controller – Standard Instructions Manual  When the values in D0 and D10 are 100 and 10 respectively, D0 plus D10 equals 110, and 110 is stored in D20.  When the values in D0 and D10 are 16#7FFF and 16#1 respectively, D0 plus D10 equals 16#8000, and 16#8000 is stored in D20.  When the values in D0 and D10 are 16#FFFF and 16#1 respectively, D0 plus D10 equals 16#10000. Since the operation result is out of the range of 16-bit binary values, SM602 is ON, and the value stored in D20 is 16#0. Besides, since the operation result is 16#0, SM600 is ON. Example 2: The addition of 32-bit binary values:

When X0.0 is ON, the addend in (D41, D40) is added to the augend in (D31, D30), and sum is stored in (D51, D50). (The data in D30, D40, and D50 is the lower 16-bit data, whereas the data in D31, D41, and D51 is the higher 16-bit data). _3  When the values in (D31, D30) and (D41, D40) are 11111111 and 44444444 respectively, (D31, D30) plus (D41, D40) equals 55555555, and 55555555 is stored in (D51, D50).  When the values in (D31, D30) and (D41, D40) are 16#80000000 and 16#FFFFFFFF respectively, (D31, D30) plus (D41, D40) equals 16#17FFFFFFF. Since the operation result is out of the range of 32-bit binary values, Additional remarks:

SM602 is ON, and the value stored in (D51, D50) is 16#7FFFFFFF. Operation of flags: 1. The 16-bit instruction  If the operation result is zero, SM600 will be set to ON.  If the operation result exceeds 65,535, SM602 will be set to ON. 2. The 32-bit instruction  If the operation result is zero, SM600 will be set to ON.  If the operation result exceeds 4,294,967,295, SM602 will be set to ON. The 16-bit instruction: Zero flag Zero flag Zero flag 65,535 0 1 、、 、、 0 1 65,535 65,535 0 1 2 、、、 Borrow flag Carry flag The 32-bit instruction: Zero flag Zero flag Zero flag 4,294,967,295 0 1 、、 4,294,967,295 0 1 、、 4,294,967,295 0 1 2 、、、 Borrow flag Carry flag 3-72