Integer To Real; Dint To Sint Or Int - Allen-Bradley Logix5000 Reference Manual

1756 controllogix, 1768 compactlogix, 1769 compactlogix, 1789 softlogix, 1794 flexlogix, powerflex 700s with drivelogix
Hide thumbs Also See for Logix5000:
Table of Contents

Advertisement

Appendix A
Common Attributes
652
EXAMPLE
2#1111_1111_1111_1111
MOV
Move
Source
2#1111_1111_1111_1111
Dest
2#1111_1111_1111_1111

Integer to REAL

The controller stores REAL values in IEEE single-precision, floating-point
number format. It uses one bit for the sign of the value, 23 bits for the base value,
and eight bits for the exponent (32 bits total). If you mix an integer tag (SINT,
INT, or DINT) and a REAL tag as inputs in the same instruction, the controller
converts the integer value to a REAL value before the instruction executes.
• A SINT or INT value always converts to the same REAL value.
• A DINT value may not convert to the same REAL value:
– A REAL value uses up to 24 bits for the base value (23 stored bits plus a
'hidden' bit).
– A DINT value uses up to 32 bits for the value (one for the sign and 31
for the value).
– If the DINT value requires more than 24 significant bits, it may not
convert to the same REAL value. If it will not, the controller rounds to
the nearest REAL value by using 24 significant bits.

DINT to SINT or INT

To convert a DINT value to a SINT or INT value, the controller truncates the
upper portion of the DINT and sets the overflow status flag, if necessary. The
following example shows the result of a DINT to SINT or INT conversion.
EXAMPLE
This DINT value
16#0001_0081 (65,665)
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Mixing an INT tag with an immediate value
Since remote_rack_1:I.Data[0] is an INT tag, the value to
check it against first moves into int_0, also an INT tag. The
EQU instruction then compares both tags.
Equal
Source A
remote_rack_1:I.Data[0]
2#1111_1111_1111_1111
int_0
Source B
2#1111_1111_1111_1111
Conversion of a DINT to an INT and a SINT
Converts to this smaller value
INT:
16#0081 (129)
SINT: 16
#81 (-127)
EQU
int_0
42093

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Logix5000 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF