Numeric ConstantsΒΆ

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:

14 decimal number
2#1001_0011 binary number
8#67 octal number
16#A hexadecimal number
DINT#16#A1 typed data type DINT# and base 16# combined

This type of numeric value can be BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, or LREAL.

Note

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

Note

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.