Constant: Numeric
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.
| Decimal number |
| Binary number |
| Octal number |
| Hexadecimal number |
| Typed data type |
Possible data types for a numerical literal:
BYTE
, WORD
, DWORD
, LWORD
, SINT
, USINT
, INT
, UINT
, DINT
, UDINT
, LINT
, ULINT
Tip
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.
For more information, see: Constant: Typed Literal
Tip
Because number constants are basically handled as integer values, in divisions you have to specify the constant in floating point number format to avoid losing the remainder.
Examples: Division of 1/10
yields 0
and division of 1.0/10
yields 0.1