Data Types

advertisement
Data Types
Type
BIT
BYTE
WORD
Description
The smallest unit of memory. Has two states, 1 or 0.
Has an 8-bit value. The valid range is 0 to 255 (0 to FF in hexadecimal).
Uses 16 consecutive bits of data memory; but instead of the bits in the data
location representing a number, the bits are independent of each other.
Each bit represents its own binary state (1 or 0). The valid range of word
values is 0 to 65,535 (0 to FFFF).
DWORD
Double Word. Has the same characteristics as a single word data type,
except that it uses 32 consecutive bits in data memory instead of 16 bits.
INT
Signed Integer. Uses 16-bit memory data locations, and are represented in
2's complement notation. Bit 16 is the sign bit (0=positive, 1=negative).
The valid range of an INT data type is –32,768 to +32,767.
DINT
Double Precision Signed Integer. Stored in two consecutive 16-bit
memory locations and represented in 2's complement notation. Bit 32 is
the sign bit (0=positive, 1=negative). The valid range of a DINT data type
is –2,147,483,648 to +2,147,483,647.
UINT
Unsigned Integer. Uses 16-bit memory data locations. Valid range is 0 to
+65,535 (0 to FFFF)
BCD-4
Uses 16-bit data memory locations. Each BCD digit uses four bits and can
represent numbers between 0 and 9. This BCD coding of the 16 bits has a valid range of
0 to 9999.
BCD-8
Uses two consecutive 16-bit data memory locations. Each BCD digit uses
four bits and can represent numbers between 0 and 9. This BCD coding of
the 16 bits has a valid range of 0 to 99,999,999.
REAL Floating Point. Uses two consecutive 16-bit memory locations. The range of
numbers that can be stored in this format is from ± 1.401298E-45 to ±
3.402823E+38.
MIXED
Available only with the MUL and DIV functions. The MUL function takes
two integer inputs and produces a double integer result. The DIV function
takes a double integer dividend and an integer divisor to produce and
integer result.
ASCII Eight-bit encoded characters. A single reference is required to make up two
(packed) ASCII characters. The first character of the pair corresponds to
the low byte of the reference word. The remaining 7 bits in each section
are converted.
Download