Numeric values can be binary, octal, decimal, and hexadecimal numbers. If an integer value is not a decimal number, then you must write its base followed by the number sign (#) before the integer constant. You enter the hexadecimal digit values for the numbers 10 to 15 as usual with the letters A-F.
You can use an underscore within a numeric value.
Examples:
|
decimal number |
|
binary number |
|
octal number |
|
hexadecimal number |
|
typed data type |
This type of numeric value can be BYTE
, WORD
, DWORD
, SINT
, USINT
, INT
, UINT
, DINT
, UDINT
, REAL
, or LREAL
.
Implicit conversions from "larger" to "smaller" types are not permitted. You cannot simply use a DINT variable as an INT variable. For this, you have to use a type conversion function.
See also
As number constants basically are treated as integers, in divisions you must enter
a constant in the format of a floating-point number in order not to loose the remainder.
For example: Division 1/10
results in 0
, division 1.0/10
results in 0.1
.