|
Data Types |
These are the 5 standard Data Types in ACMEBasic and their syntax.
These data types can be changed or more data types can be added like double precision floating point or 32-bit integers for a specific port.
Variable Datatypes:
All variables are 'Demand Defined' meaning that they do not need to be defined before usage. There is a DEFINE statment and this is use to define arrays of the basic data types or define string variables of an arbitrary size.
All variable names must start with a letter and may be of any length but only the first 16 characters are siginificant. To specifiy different data types the varaible name is followed by a data type specifier character. Array indexing is done by following the variable name with the array index surrounded by square brackets.
Variable names followed by
' (accent grave) or no specifier are 16 bit signed integers
Here are examples of array variable names and array indexing
Literal Data:
Strings are enclosed in double quotes like
Numbers always start with a number but can take several forms.
Integer Decimal numbers just have decimal digits like 1234.
Floating point numbers have a . (period) in them and
The syntax for the DEFINE statment is very straight forward.
DEFINE Variablename[sizeofarray]
Here are some examples of the DEFINE statment
DEFINE Names$[25],60 This defines a 25 element string array with 60 character longs strings.
@ (at sign) are 8 bit unsinged integers
_ (underscore) are 32 bit signed integers
# (number sign) are 32 bit single precision floating point values
$ (dollar sign) are strings with a maximum length of 80 characters
UserName$ is string varaible
Counter is an integer variable
Reals#[23] is the 23'd element of a floting point array
There are two type of literal data, strings and numbers.
"This is a literal string".
Integer Octal numbers start with a leading 0
and are followd by octal digits like 0777.
Integer Hexadecimal numbers start with a leading 0x
and are followed by hexadecimal digits like 0x789ABC.
Integer values have a maximum range of
+2147483647 to - 2147483647 (a 32 bit long)
look like this 1.234 or 0.00056
The may also be represented in scientific notation and
look like this 0.4e7
Floating point values have 6 significant digits
DEFINE StringVariableName,sizeofstring
DEFINE StringVariableName[sizeofarray],sizeofstring
DEFINE BigString$,500 This defines a 500 character string
DEFINE RawData@[256] This defines a 256 element byte array