3 - 32 3 - 32
MELSEC-Q
3 LET'S CREATE AND EXECUTE A PROGRAM
3.10 Displaying Characters on the Screen
The PRINT instruction is used to display text on the screen. Since this instruction is
mostly used, '?' is read as PRINT in BASIC.
Example
OK
PRINT " ABC"
ABC
OK
OK
?"ABC"
ABC
OK
Using '?' for 'PRINT'
is really convenient.
The text to be printed on the screen is specified after the PRINT instruction.
Items that can be displayed are constants, contents of variables, contents of arrays,
values of functions, and all these items combined with the operands.
Example
PRINT "ABC" The character constant "ABC" will be displayed.
PRINT A% The contents of the integer variable A% will be displayed.
PRINT A$+C$ The contents of character variable A$ plus the contents of
character variable C$ will be displayed.
Also, the texts can be displayed continuously by separating them by "," (comma) and
";" (semicolon) with the PRINT instruction.
Examples of using ";" (semicolon) are shown below.
Example
OK
A=100
OK
B=-50
OK
PRINT A;B;A+B
00 -50 50
Contents
of A
Contents of B
Contents
of A+B
OK
A$= " ABCD"
OK
B$= " EFGH"
OK
PRINT A$;B$;A$+B$
Contents
of A$
Contents of B$
Contents
of A$+B$
ABCDEFGHABCDEFGH
As shown above, when a ";" (semicolon) is used, one data is displayed, then the next
data is displayed immediately after it. The only thing to be careful is that the display
method for numeric values and characters are different.
• When numeric values are being displayed, a sign is always shown in front.
When the value is negative, "-"
When the value is positive, " " (A space is displayed.)
• When a numeric value is displayed, a space is automatically inserted after the
value. ( Example above may be easier to understand after this is said.)
Because of this, a space is inserted even if ";" is used to display data
continuously. Text display doesn't have the same characteristics, so they are
displayed continuously without spaces.
Содержание 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...