Mitsubishi QD51 Programming Manual page 328

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
Program Example
(Executed in BASIC on the AD51H)
10 ' This program receives data continually and ends only when an interrupt occurs from CH2
20 ON ERROR GOTO 500
30 CLS
40 ON COM(2) GOSUB 340
50 COM(2) ON
60 DIM TBL1%(2),CNT%(10),TBL2%(2)
70 '***** RS-232C CH.OPEN *****
80 CH%=2
90 TBL1%(0)=4800
100 TBL1%(1)=&H8
110 TBL1%(2)=&H1
120 ZOPEN #CH%,TBL1%( )
130 '
140 '***** PORT CNTL *****
150 CNT%(0)=32
160 CNT%(1)=&H1
170 ZCNTL #CH%,0,CNT%( )
180 '
190 '***** MAIN PROGRAM *****
200 J=0
210 LOCATE 0,J
220 PRINT "MAIN PROGRAM"
230 J=J+1
240 IF J=10 THEN J=0
250 FOR I=0 TO 100
260 NEXT I
270 CLS
280 GOTO 210
290 '
300 '***** RS-232C CH.CLOSE *****
310 ZCLOSE #CH%
320 END
330 '
340 '***** DATA RECEIVE *****
350 TBL2%(0)=12
360 TBL2%(1)=0
370 TBL2%(2)=300
380 WOR%=TBL2%(0)/2
390 DIM CTBL%(WOR%-1)
11 - 158
:
' Branches to line 500 if an error occurs
:
' Branches to line 340 when there is an
interrupt from CH2
:
' Allows an interrupt
:
' Defines a communication channel
:
' Sets the baud rate
:
' Sets character length, parity bit,
:
' and stop bit
:
' Opens the communication channel
:
' Specifies control by the RS and ER
signals
:
' Turns the RS control signal on
:
' Executes
:
' Displays on the screen
:
' Specifies the number of transmission
request bytes
:
' Stores the number of bytes transmitted
:
' Specifies the timeout value
MELSEC-Q
11 - 158

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents