Mitsubishi QD51 Programming Manual page 637

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
10 ' This program sends data from a console (LM7000 is the reception side)
20 ON ERROR GOTO 390
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%(4)=0
120 T%(5)=0
130 T%(6)=0
140 T%(7)=0
150 ZOPEN #CH%,T%( )
160 '
170 '***** DATA RECEIVE *****
180 DIM TBL%(6)
190 TBL%(0)=30
200 TBL%(1)=0
210 TBL%(2)=300
220 TBL%(3)=0
230 TBL%(4)=0
240 TBL%(5)=0
250 TBL%(6)=0
260 WOR%=TBL%(0)/2
270 DIM CT%(WOR%-1)
280 ZRECEIVE #CH%,0,TBL%( ),CT%( )
290 PRINT "RECEIVE CHARACTER =";TBL%(1)
300 FOR I%=0 TO WOR%-1
310 PRINT "RECEIVE DATA =&H";HEX$(CT%(I%))
320 NEXT I%
330 '
340 '***** RS-232C CH.CLOSE *****
350 ZCLOSE #CH%
360 END
370 '
380 '***** ERROR ROUTIME *****
390 ERTYPE%=ERR:ERLINE%=ERL
400 IF ERTYPE%=94 THEN ERTYPE%=ZERROR(1) :
410 PRINT "ERROR CODE =";ERTYPE%
420 PRINT "ERROR LINE =";ERTYPE%
430 RESUME 350
11 - 467
(Executed in BASIC on the LM7000)
:
'Branches to line 360 if 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 the receive buffer
:
' Sets DC1 code and DC code
:
' Sets DC3 code and DC2 code
:
' Sets DC4 code
:
' Opens the communication channel
:
' Defines an array
:
' Sets the number of characters requested
to be received
:
' Stores the number of characters received
:
' Sets the timeout value
:
' Sets the number of break characters
:
' Sets break characters 1 and 2
:
' Sets break characters 3 and 4
:
' Sets break character 5
:
' Reads 2 bytes
:
' Defines an array
:
' Executes the reception
:
' Displays the number of characters
received
:
' Displays the data received
:
' Closes the communication channel
:
' Ends the execution
:
' Stores the error occurred and the line
where 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 350
MELSEC-Q
11 - 467

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents