AKD BASIC User Guide | 3 AKDBASICLanguage
String assignment is checked at run-time. An attempt to copy a string to a destination too small
results in a run-time error. String indexing is 1-origin. For example, mid$(“abc”,1,1) returns the
string, a.
STRING variables have a firmware-imposed maximum length of 230 characters and a default
maximum length of 32 characters. They may be assigned a different maximum length by
declaring them to be of type STRING*n where n is a positive integer between 1 and 230 (inclu-
sive).
Declare arrays of the pre-defined types. Arrays have a maximum rank of four dimensions. The
upper-bound of each dimension has no compiler-defined limit. However, because of the limited
data space of the controller, there is a logical upper-bound that depends on the controller model.
Array indexing is 1-origin. The indices in each dimension range from 1 to the upper-bound of the
dimension. Every reference to an array element is checked at run-time. Any attempt to ref-
erence beyond the bounds of the array causes a run-time error. New types cannot be defined.
3.4.4 Literal Constants
String constants begin and end with the double-quotes (‘"’). They cannot extend past the end of
the input line. Any printable ASCII character appears in a string constant. An attempt to gen-
erate a string literal with non-ASCII characters causes a compile-time error. No check is made
to verify that non-ASCII strings are not created at run-time, so avoid doing so.
3.4.5 Decimal Integer Constants
Decimal integer constants are a string of decimal digits with no decimal point. A leading ‘-’ sign
is optional and is parsed as a unary minus. For example:
1
-1
314159
are all valid decimal constants.
3.4.6 Hexadecimal Constants
Hexadecimal constants are denoted by a leading &H or &h, and cannot have a sign or decimal
point. Hexadecimal constants are composed from the set [0-9A-Fa-f]. Upper- and lower-case
may be mixed.
For example:
&h00ff
&HFF00
&H1234abcd
are all valid hexadecimal constants. Octal and binary constants are not supported.
3.4.7 Floating-Point Constants
Floating-point constants are specified in fixed-point or mantissa-exponent notation. A floating-
point constant consists of one of the following.
digit [0-9]
optsign ‘+’ | ‘-’ | /* nothing */
fixed optsign {digit}+ ‘.’ {digit}*optsign ‘.’ {digit}+
exp fixed ‘e’ optsign {digit}+
float fixed | exp
For example:
27 Kollmorgen™ | March 30, 2012