Mitsubishi QD51 Programming Manual page 628

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

Advertisement

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

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents