Numbers, Codes, and Data Types
Integers
An integer is a whole number.
There are a variety of ways to show an integer, and the integer types available vary with the PLC model.
As the accompanying graphic shows there are eight integer types available for SIMATIC S7-1500 PLC'S. 4 unsigned integer types and 4 signed integer types.
Both unsigned and signed integers are available to meet the requirements of various types of instructions in a PLC program.
Integer types of varying lengths are available so that only the amount of memory needed is used. In other words, why use 64 bits to store a number when only 8 or 16 bits are required.
When a signed integer is stored, bit patterns beginning with 0 are used to store 0 and all the positive values, and bit patterns beginning with 1 are used to store all the negative values.
Negative values are stored in two's complement form, which means that the pattern of bits for a negative binary number is determined by inverting all the bits in the equivalent positive binary value and then adding 1.
Two's complement is used to store negative values in PLC'S because it simplifies math processes.
The accompanying graphic shows the range of binary numbers and their equivalent decimal values that can be stored as a signed short integer.
Real Numbers
PLC'S work with real numbers, also called floating point numbers, which are expressed in scientific notation.
To convert a number to scientific notation move the decimal point to the left or right to create a mantissa that is greater than or equal to 1, but less than 10.
Then multiply the mantissa by a power often to compensate for the decimal point movement. Real numbers are often displayed as a mantissa followed by E and then the exponent.
In the 32-bit format, the first bit represents the sign associated with the mantissa, a 1 represents a negative sign.
The next 8 bits represent the exponent, which can be negative or positive. The remaining 23 bits represent the mantissa.
There is a similar 64-bit format Siemens SIMATIC PLC'S can use 32-bit real numbers.
Siemens SIMATIC S7- 1200 and S7- 1500 PLC'S can also use 64-bit long real numbers.
Data Types
Binary bits can be used independently or as a group.
When used as a group,they are used to represent numerical values as well as other types of data.
In order to know how a bit string will be interpreted by a PLC, you must know the data types of various lengths are specified for ( binary numbers, integers, floating point number , date and time , characters , parameters , system data and other types of data).
Because the number of data types has increased overtime, not all data types of data types are available for all SIMATIC PLC'S.
The accompanying graphic shows the binary number , Integer , and real number data types available for some of these PLC'S.
No comments:
Post a Comment