Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual

Page 22

Advertising
background image

4Ć2

AutoMax Enhanced BASIC has variable types" just as standard

BASIC does. The variable type indicates the kind of information the

variable is representing (numeric data, characters, etc.). The

variable type is specified by a terminator or ending character.
BASIC uses five types of variables:
1. Single integer variables (values -32768 to +32767)
2. Double integer variables (values -2147483648 to

+2147483647)

3. Real variables (values 9.2233717E+18 to -9.2233717E+18).

Note that the E+(n)" is read as an exponent in BASIC.

4. Boolean variables [values TRUE (ON) or FALSE (OFF)]
5. String variables.

4.1.1.1

Single Integer Variables
A single integer variable is a named location in which an integer

value can be stored. It is called a single" integer because it requires

a single 16Ćbit word to represent its current value in the range

+32767 to -32768 (a 16Ćbit signed number). It is named using the

rules listed in section 4.1.1 are terminated with a percent sign (%).
If you include an integer variable in a program, its value can be an

integer (no fractional part) or a real (decimal) number. If you assign

a decimal number to an integer variable, the fractional part will be

truncated or ignored. For example, if the statement attempts A% =

3.6574, the value 3 will be assigned to A%.
If an attempt is made to assign a value larger than the range

+32767 to -32768 to a single integer variable, BASIC will log this

condition into the error log and will load the largest possible single

integer value into the variable. For example, if the statement

attempts A% = 43987, BASIC will log this as an error and set a A%

= 32767; if the statement attempts A% = -53667, Basic will log an

error and A% will be set to = -32768.
The following are valid single integer variables:

MOTOR_SPEED%

FREQUENCY%

ROLL_WIDTH%

VOLTAGE_REF%

The following are invalid single integer variables and the reasons

that they are invalid:

GAIN (Variable not terminated with %)

GAIN%2 (Variable not terminated with%)

55SPEED% (Variable starts with a digit rather than a letter or an

underscore.)

All internal integer calculations are in double precision, or 32 bits.

Advertising
This manual is related to the following products: