AH500 Programming Manual When the values in D0 and D10 are 16#FFFF and 16#1 respectively, D0 plus D10 equals 16#10000. Since the operation result exceeds 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).
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 exceeds the range of 32-bit binary values, SM602 is ON, and the value stored in (D51, D50) is 16#7FFFFFFF. Flag: The 16-bit instruction: 1. If the operation result is zero, SM600 will be set to ON. 2. If the operation result exceeds 65,535, SM602 will be set to ON. The 32-bit instruction: 1. If the operation result is zero, SM600 will be set to ON. 2.
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 6-38