Sei sulla pagina 1di 2

Data Types

Pgina 1 de 2

Data Types
The controller data types follow the IEC 1131-3 defined data types. The predefined, atomic data types are: Data type BOOL SINT INT DINT REAL Description 1-bit boolean 1-byte integer 2-byte integer 4-byte integer 4-byte floating-point number Range 0 = cleared 1 = set -128 to 127 -32,768 to 32,767 -2,147,483,648 to 2,147,483,647 38 -38 -3.402823E to -1.1754944E (negative values) and 0 and -38 38 1.1754944E to 3.402823E (positive values) The controller handles all immediate values as DINT data types The REAL data type also stores infinity and NAN, but the software display differs based on the display format. Data type AXIS_CONSUMED Structure AXIS_VIRTUAL Structure AXIS_SERVO Structure AXIS_SERVO_DRIVE Structure CONTROL Structure COUNTER_Structure MESSAGE Structure MOTION_GROUP Structure MOTION_INSTRUCTION Structure PID Structure TIMER Structure Data type conversions If you mix data types for operands within an instruction, some instructions automatically convert data to an optimal data type for that instruction. In some cases, the controller converts data to fit a new data type; in some cases the controller just fits the data as best it can. Conversion larger integer to smaller integer SINT or INT toREAL DINT Result The controller truncates the upper portion of the larger integer and generates an overflow. For example: Decimal DINT INT SINT 65,665 129 -127 Binary 0000_0000_0000_0001_0000_0000_1000_0001 0000_0000_1000_0001 1000_0001 control structure for array (file) instruction control structure for counter instructions control structure for the MSG instruction control structure for a motion group control structure for motion instructions control structure for the PID instruction control structure for timer instructions Description control structure for an axis

No data precision is lost Data precision could be lost. Both data types store data in 32 bits, but the REAL type uses some of its 32 bits to store the exponent value. If precision is lost, the controller takes it from the least-significant portion of the DINT. The controller rounds the fractional part and truncates the upper portion of the non-fractional part. If data is lost, the controller sets the overflow status flag. Rounding is to the nearest whole number: less than 0.5, round down; equal to 0.5, round to nearest even integer; greater than 0.5, round up For example: REAL DINT (result)

REAL to integer

mk:@MSITStore:C:\Archivos%20de%20programa\Rockwell%20Software\RSLogix...

02/09/2013

Data Types

Pgina 2 de 2

(source) 1.6 -1.6 1.5 -1.5 1.4 -1.4 2.5 -2.5 2 -2 2 -2 1 -1 2 -2

You cannot convert data to or from the BOOL data type. Important: The arithmetic status flags are set based on the value being stored. Instructions that normally do not affect arithmetic status keywords might appear to do so if type conversion occurs because of mixed data types for the instruction parameters. The type conversion process sets the arithmetic status keywords. Safety Data Types RSLogix 5000 software prevents the modification of a User Defined or Add-On Defined type that would cause an invalid data type for User Defined or Add-On Defined types that are referenced directly or indirectly by a Safety tag. (This includes nested structures.) The invalid data types are as follows. REAL - Only invalid on GuardLogix(L6S) and Compact GuardLogix(L4S) controllers LINT ALARM-ANALOG ALARM DIGITAL Related Topics Keywords Arithmetic Status Flags

mk:@MSITStore:C:\Archivos%20de%20programa\Rockwell%20Software\RSLogix...

02/09/2013

Potrebbero piacerti anche