DINT
Formula Explanation
Converts two integer values (16-bit) into a double integer value (32-bit).
Formula Syntax
Enter in the result column: dint(code, code)
Parameter Description
Note: A 16-bit integer consists of 16 binary bits (16#7FFF), with a maximum integer value of 32767.
In PLC, signed numbers are represented using binary two's complement notation, with the highest bit being the sign bit.
When the highest bit is 0, the number is positive; when the highest bit is 1, the number is negative. So, after conversion, it becomes -701.
(Two's complement is a representation where positive numbers remain the same, and for negative numbers, you take the bitwise NOT of the positive number and add 1.)
Similarly, 32-bit double integer numbers follow the same principles.
Usage Example
Convert the values in columns CQ2 and CQ3 to double integer values, and write the results into column CQ4.
CQ4 = dint(CQ2, CQ3)