Data Types

Every variable in the PLC automatically gets the correct data type. The conversion only needs to be set in the interface. This chapter explains the individual types of Antcas Control.

Boolean Value BOOL

This type can only have two states. True or false. In the application, instead of a variable, the value can be defined with TRUE (true) or FALSE (false).

Additionally, the special type NULL is used. This state is set during the initialization of a variable, i.e., an unwritten one. Additionally, special functions are possible with NULL. For example, if no value may be communicated to the interface.

Integer INT (Integer)

An integer is a whole number, such as 0 or 26. Additionally, the value can also be negative. Antcas Control works with a 64-bit PLC, which enables the calculation of very large numbers. The largest number is defined by the constant INT_MAX (9223372036854775807). The smallest number is in INT_MIN or INT_MAX+1, as the sign uses one bit. All numbers outside this range are applied with a float and an exponent. The calculation is then imprecise.

An integer can receive the value -0, which is not equal to FALSE. However, checking with the function EQ(-0,0) results in TRUE. -0 can only be defined as a string '-0'.

You can also define a hex value directly. This starts with 0x or 0X. For example, from 0xFF, it becomes 255.

Floating-Point Numbers REAL (Float)

A float or real value is a floating-point number, such as 0.1 or 22.005 (with a dot). Exponents are also supported. For example, 10E2 for 1'000 or 10e-2 for 0.1. The case does not matter. It is attempted to convert the number into an integer, as the calculation is simpler for the PLC. It can happen that calculations with large numbers become imprecise. The maximum number of decimal places is fixed at 14 to increase the performance of the PLC.

Floating-point numbers have limited precision. Although this depends on the system, Antcas Control typically uses the IEEE 754 Double Precision Format, which results in a maximum relative rounding error in the order of 1.11e-16. Non-elementary arithmetic operations can, however, cause larger errors and naturally, the propagation of the error must be considered if multiple operations are composed.

Additionally, there are rational numbers that can be exactly represented as floating-point numbers to base 10, for example 0.1 or 0.7, but there is no exact representation as floating-point numbers to base 2, which is used internally regardless of the size of the mantissa. Therefore, they cannot be converted into their internal binary representation without a slight loss of precision. This can lead to confusing results: FLOOR((0.1+0.7)*10) will typically result in 7 instead of the expected result of 8, as the internal representation is something like 7.9999999999999991118.

Therefore, you should never rely on floating-point numbers to the last decimal place and never check floating-point numbers directly for equality.

String STRING

A string or string is defined with a single quote ' ' or double quote " ". For example, 'Text 1' or . With the function block CONCAT, multiple strings can be combined.

A line feed or new line can be created with CTRL+Enter. This is then represented by an arrow ↵.

An escape character for specifying a ' or " within the string itself is not necessary. The string can be specified directly with "There is a \" character".

It is possible to declare special characters directly. For this purpose, the following sequence is specified within the string using double quotation marks:

Escape Sequence ASCII Abbreviation
\\ Escaped \
\n LF
\r CR
\r\n CRLF
\0 NUL
\t TAB
\e ESC
\f FORMFEED
\x## Arbitrary Byte

For example, to declare an arbitrary byte 126 or 7E as a hex number, the following expression is used: "\x7E". This string then corresponds to "~".

Here, 7E serves as a placeholder value. All values within the hex range 00 to FF can be specified. Note that the UTF-8 BOM "\xEF\xBB\xBF" is automatically removed by most browsers. It is possible to mask the string. For this purpose, a leading backslash is used: "\\x7E", which then corresponds to '\x7E'.

Note: All strings outside the UTF-8 range cannot be stored remanently. In the live view, these are displayed in dark violet.

Also see the article String Conversion to Numbers.

Date and Time DT (Date and Time)

Defines a date and time with DT#, for example, DT#2016-03-25-22:12:00. The times are converted into an integer in ms from the date 01.01.1970 (this value is in the UTC/GMT time zone).

Date D (Date)

Defines a date from midnight with D#, for example, D#2016-03-25. The times are converted into an integer in ms from the date 01.01.1970 (this value is in the UTC/GMT time zone).

Time T (Time)

Defines a time in milliseconds with T#, for example, T#5d3h5m11s500ms. The times are converted into an integer in ms.

Array

An array cannot be defined directly. However, assignments to a variable with a dot can be made. See Variables.

VERY IMPORTANT: Never define a value below in an array. For example, set and set.p - The PLC will crash here. And therefore not run. Additionally, this can lead to unexpected errors.