Mitsubishi QD51 Programming Manual page 636

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
Program Example
10 ' This program sends data to the LM7000 (AD51H is the transmission side)
20 ON ERROR GOTO 330
30 '
40 '***** RS-232C CH.OPEN *****
50 DIM T%(10)
60 CH%=1
70 T%(0)=4800
80 T%(1)=&H8
90 T%(2)=&H1
100 ZOPEN #A%,T%( )
110 '
120 '***** PORT CNTL *****
130 DIM CNTL%(10)
140 CNTL%(0)=32
150 CNTL%(1)=&H1
160 ZCNTL #CH%,0,CNTL%( )
170 '
180 '***** DATA SENO *****
190 DIM TBL%(10)
200 TBL%(0)=30
210 TBL%(1)=0
220 TBL%(2)=100
230 SD$="SOUSIN DATA :ABCDEFGH 12345678"
240 ZSEND #CH%,0,TBL%( ),SD$
250 PRINT "SEND CHARACTER =";TBL%(1)
260 PRINT "SEND DATA =";SD$
270 '
280 '***** RS-232C CH.CLOSE *****
290 ZCLOSE #CH%
300 END
310 '
320 '***** ERROR ROUTINE *****
330 ERTYPE%=ERR:ERLINE%=ERL
340 IF ERTYPE%=17 THEN PRINT "ZOPEN ERROR!!"
350 PRINT "ERROR CODE =";ERTYPE%
360 PRINT "ERROR LINE =";ERTYPE%
370 RESUME 290
11 - 466
(Executed in BASIC on the AD51H)
:
' Branches to line 330 if an error occurs
:
' Defines an array
:
' Defines a channel number
:
' Sets the baud rate
:
' Sets the character length, parity bit,
:
' and stop bit
:
' Opens the communication channel
:
' Defines an array
:
' Controls by the RS/ER signals
:
' Controls by the RS signal
:
' Controls by signals
:
' Defines an array
:
' Sets the number of bytes requested to be
sent
:
' Assigns the number of bytes transmitted
to TBL%(1)
:
' Sets the timeout value
:
' Defines the data to be transmitted
:
' Executes the transmission
:
' Displays the number of characters
transmitted
:
' Displays the data transmitted
:
' Closes the communication channel
:
' Ends the execution
:
' Stores the error 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 290
MELSEC-Q
11 - 466

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents