TwinCAT datatypes in .NET

When you’re working with ADS, you often need to know the size of a data type or what a data type is called in your .NET language. I couldn’t find the combined information, so I decided to make the overview myself.

IEC61131-3 System Manager .NET type C# Visual Basic Lower bound Upper bound Memory space
BOOL BIT System.Boolean bool Boolean 0 (FALSE) 1 (TRUE) 8 bit
BOOL BIT8 System.Boolean bool Boolean 0 (FALSE) 1 (TRUE) 8 bit
BYTE BITARR8 System.Byte byte Byte 0 255 8 bit
WORD BITARR16 System.UInt16 ushort - 0 65535 16 bit
DWORD BITARR32 System.UInt32 uint - 0 4.29·109 32 bit
SINT INT8 System.SByte sbyte - -128 127 8 bit
INT INT16 System.Int16 short Short -32768 32767 16 bit
DINT INT32 System.Int32 int Integer -2.15·109 2.15·109 32 bit
LINT INT64 System.Int64 long Long -263 -263-1 64 bit
USINT UINT8 System.Byte byte Byte 0 255 8 bit
UINT UINT16 System.UInt16 ushort - 0 65535 16 bit
UDINT UINT32 System.UInt32 uint - 0 4.29·109 32 bit
ULINT UINT64 System.UInt64 ulong - 0 264-1 64 bit
REAL FLOAT System.Single float Single -3.40·1038 3.40·1038 32 bit
LREAL DOUBLE System.Double double Double -1.798·10308 1.798·10308 64 bit

Sources

❮ Why am I getting a page fault in TwinCAT?
How to use MC_TorqueControl? ❯
Like my work? Consider a donation!