11 - 160 11 - 160
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
(Executed in BASIC on the LM7000)
10 ' This program sends data to the console (transmission from the LM7000)
20 ON ERROR GOTO 380
:
'Branches to line 360 if an error occurs
30 '
40 '***** RS-232C CH.OPEN *****
50 DIM T%(8)
:
' Defines the array
60 CH%=18
:
' Defines the channel number
70 T%(0)=4800
:
' Specifies the baud rate
80 T%(1)=&H8
:
' Specifies the character length, parity bit,
90 T%(2)=&H1
:
' Stop bit, and DC control
100 T%(3)=0
:
' Specifies control by the DC signal
110 T%(5)=0
:
' Specifies the DC1 and DC codes
120 T%(4)=0
:
' Specifies the receive buffer
130 T%(6)=0
:
' Specifies the DC2 and DC3 codes
140 T%(7)=0
:
' Specifies the DC4 code
150 ZOPEN #CH%,T%( )
:
' Opens the communication channel
160 '
170 '***** RS CNTL *****
180 DIM CNTL%(1)
:
' Defines the array
190 CNTL%(0)=32
:
' Specifies control by the RS and ER
signals
200 CNTL%(1)=&H1
:
' Turns the RS control signal on
210 ZCNTL #CH%,0,CNTL%( )
:
' Executes control by the signals
220 '
230 '***** DATA SEND *****
240 DIM TBL%(2)
:
' Defines the array
250 TBL%(0)=12
:
' Specifies the request characters
260 TBL%(1)=0
:
' Stores the characters to be transmitted
270 TBL%(2)=100
:
' Specifies the timeout value
280 SD$="AD51H-BASIC "
:
' Defines the transmission data
290 ZSEND #CH%,0,TBL%( ),SD$
:
' Executes the transmission
300 PRINT "SEND CHARACTER =";TBL%(1)
:
' Displays the number of transmitted
characters
310 PRINT "SEND DATA =";SD$
:
' Displays the transmitted data
320 '
330 '***** RS-232C CH.CLOSE *****
340 ZCLOSE #CH%
:
' Closes the communication channel
350 END
:
' Ends the execution
360 '
370 '***** ERROR ROUTINE *****
380 ERTYPE%=ERR:ERLINE%=ERL
:
' Stores the error occurred, and the line
390 IF ERTYPE%=94 THEN ERTYPE%=ZERROR(1) :
' Notifies if it is a Z-related error
400 PRINT "ERROR CODE =";ERTYPE%
:
' Displays the error code
410 PRINT "ERROR LINE =";ERLINE%
:
' Displays the line where the error occurred
420 RESUME 340
:
' Returns the operation to line 320
Содержание 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...