3 - 39 3 - 39
MELSEC-Q
3 LET'S CREATE AND EXECUTE A PROGRAM
3.12 Printing to the Printer
The values of constants, variables, and arrays can all be printed to the printer, just as
they can be displayed on the screen. When sending data to a printer, the ZLDV
instruction checks to see where the printer is connected. The setting is as follows.
• To use a printer connected to the console
• • • • • • • • • ZLDV 0
• To use a printer connected to CH1 (RS232C) interface
• • • • • • • • • ZLDV 1
• To use a printer connected to CH2 (RS232C) interface
• • • • • • • • • ZLDV 2
• To use a printer connected to CH3 (RS422) interface
• • • • • • • • • ZLDV 3
• To use a printer connected to CH4 (PARALLEL) interface
• • • • • • • • • ZLDV 4
Data to be sent to the printer is specified using the LPRINT instruction. The contents
that are written after the LPRINT instruction are exactly the same as when using the
PRINT instruction in Section 3.10. SPC and TAB functions can also be used. However,
the LOCATE instruction will produce no result to the printer.
Example
10 ZLDV 0
20 A=100:B=-50
30 LPRINT A;B;A+B
40 LPRINT " A" ;TAB(12); " B"
50 END
RUN
OK
12 characters
100 -
50 50
A
B
REMARK
• Other than just printing character, a printer can be used to perform various
operations by sending data referred to as control codes. For details, refer to the
manual for the printer used.
• The ZCNTL instruction can be used to read the printer status or to send a reset
signal to the printer.