2 - 12 2 - 12
MELSEC-Q
2 THE BASICS OF AD51H-BASIC
2.8 Variables
Variables are names that are used to represent values used within BASIC programs.
Values of variables can be defined by the programmer or assigned as calculation
results. The values of numeric variables are 0 and values of character string variables
are empty character strings until their proper values are defined.
2.8.1 Variable names and type declaration characters
Variable names are subject to the following restrictions:
• The length of variable names within BASIC is restricted to a maximum of 15
characters.
• Variable names must be comprised of alphanumeric characters. Periods are also
valid.
• The first character of a variable name must be an alphabet character.
• Special characters (%, !, #, $) may be used as a type declaration character.
• Reserved words cannot be used for variable names, but reserved words may be
used as a portion of a variable name.
Reserved words include all instruction, function, and operator names.
• If a variable name begins with FN, it is considered to be a call to a user-defined
function.
• Variables represent either numeric values or character strings.
• The last character of a character string variable name must be a dollar sign ($).
For example, in A$=”SALESREPORT”, the dollar sign is a variable declaration
character, and “declares” that the variable represents a character string.
• Numeric variable names can be declared as single-precision, double-precision, or as
integers.
• There are the following types of declaration characters for variable names.
%
Integer variables
!
Single-precision variables
#
Double-precision variables
$
Character string variables
If a declaration character is omitted in a numeric variable name, it is assumed that the
variable represents a single-precision numeric value.
The following are some examples of variable names.
Example
PI#
• • • • •
Declares a double-precision variable.
MINIMUM!
• • • • •
Declares a single-precision variable.
LIMIT%
• • • • •
Declares an integer variable.
N$
• • • • •
Declares a character string variable.
ABC
• • • • •
Declares a single-precision variable.
The variable type can also be declared using DEFINT, DEFSTR, DEFSNG, and
DEFDBL within programs.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...