11 - 429 11 - 429
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
Program Example
10 ' This program outputs Kanji code to a printer connected to CH1
20 DIM TBL%(15)
:
' Defines an array
30 CH%=1
40 TBL%(0)=9600
50 TBL%(1)=&H108
60 TBL%(2)=&H1
70 ZOPEN #CH%,TBL%( )
:
' Opens the communication channel
80 TBL%(0)=18
:
' Specifies to set the communication control
parameters
90 TBL%(1)=0
100 TBL%(3)=1024
110 ZCNTL #CH%,0,TBL%( )
:
' Executes the setting
120 TBL%(0)=32
:
' Specifies to set the RS and ER control
signals to ON/OFF
130 TBL%(1)=&H101
140 ZCNTL #CH%,0,TBL%( )
:
' Executes the setting
150 TBL%(0)=100
:
' Specifies to set Kanji shift in/shift out
codes
160 TBL%(1)=1
:
' Specifies to change the codes
170 TBL%(2)=3
:
' Specifies the number of characters for
shift in codes
180 TBL%(3)=3
:
' Specifies the number of characters for
shift out codes
190 TBL%(4)=&H241B:TBL%(5)=&H40
:
' Specifies the shift in codes
200 TBL%(9)=&H481C:TBL%(10)=&H18
:
' Specifies the shift out codes
210 ZCNTL #CH%,0,TBL%( )
:
' Executes the setting
220 TBL%(0)=96
:
' Specifies to set Kanji code conversion
230 TBL%(1)=1
:
' Enables the Kanji code conversion
240 ZCNTL #CH%,0,TBL%( )
:
' Executes the setting
250 KMODE 1
:
' Kanji code conversion
260 ZLDV 1
270 SD$="Kanji"+CHR$(13)
:
' Defines data
280 PRINT SD$
290 LPRINT SD$
:
' Outputs to the printer
300 ZCLOSE #CH%
:
' Closes the communication channel
310 END