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.
Example 180. Examples:
|
|
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