Typed Literals
With the exception of REAL/LREAL constants (where LREAL is always used), TwinCAT uses the smallest possible data type for calculations involving IEC constants. If you want to use a different data type, you can do this by using typed literals (typed constants), without having to declare the constant explicitly. Assign a prefix to the constant that specifies the type.
Syntax: <Type>#<Literal>
<Type> specifies the desired data type; possible entries are: BOOL, SINT, USINT, BYTE, INT, UINT, WORD, DINT, UDINT, DWORD, REAL, LREAL. You have to capitalize the type.
<Literal> specifies the constant. The input must match the data type specified under <Type>.
Example:
var1:=DINT#34;
If TwinCAT cannot transfer the constant to the target type without losing data, an error message is issued.
You can use typed constants wherever you can use normal constants.