Variables; Variable Names And Type Declaration Characters - Mitsubishi QD51 Programming Manual

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

2 THE BASICS OF AD51H-BASIC

2.8 Variables

2.8.1 Variable names and type declaration characters

2 - 12
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.
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#
• • • • •
MINIMUM!
• • • • •
LIMIT%
• • • • •
N$
• • • • •
ABC
• • • • •
The variable type can also be declared using DEFINT, DEFSTR, DEFSNG, and
DEFDBL within programs.
Declares a double-precision variable.
Declares a single-precision variable.
Declares an integer variable.
Declares a character string variable.
Declares a single-precision variable.
MELSEC-Q
2 - 12

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents