Defsng - Mitsubishi QD51 Programming Manual

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS

DEFSNG

Instruction
• Defines variables that start with a character of the specified range as the single precision
real number type.
DEFSNG
Syntax
character> [- <alphabetical character> ], ...
DEFSNG C, X-Z
Examples
• The DEFSNG instruction defines variables that start with a character of the specified range
Description
as the single precision real number type. It defines the type of all variables starting with a
character specified by <alphabetical character> or with a character within the range
specified by <alphabetical character-alphabetical character> as the single precision real
number type.
• Specification by the type declaration statement has priority for specifying the variable type,
and the result will be as follows:
Example
• Variables defined as single precision real number type by the DEFSNG instruction and
variables with the single precision real number type declaration character '!' are regarded
as the same.
Example
11 - 52
DEFine SiNGle
<alphabetical character> [- <alphabetical character> ] [, <alphabetical
• • • •
10 DEFSNG A
(Single precision)
20 A=10/3
(Integer)
30 A%=10/3
(Double precision)
40 A#=10/3
50 PRINT A, A%, A#
60 END
10 DEFSNG A
20 A=10/3 • • • Assigns
10/3=3.333 • • •
30 A!=5/3 • • • Assigns
5/3=1.666 • • •
40 PRINT A
50 END
It is not permitted to spell as DEF SNG with a space between
DEF and SNG.
Be sure to spell DEFSNG in one word.
REMARK
See the DEFDBL, DEFINT and DEFSTR instructions, and Section 2.9.
Defines variables starting with C and variables
starting with X, Y, Z as single precision real number
type variables.
RUN
3.3333
3
OK
RUN
• • • Attempted to display A,
1.6666
but the value of A! in line 30
is displayed, i.e., A=A!.
OK
MELSEC-Q
3.333333333333333
11 - 52

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents