Mitsubishi QD51 Programming Manual page 583

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
Program Example
1 ' This program sets and reads the communication control parameters
10 DIM TBL1%(2),TBL2%(3),TBL3%(3),B%(1)
20 CH%=1
30 TBL1%(0)=4800
40 TBL1%(1)=&H8
50 TBL1%(2)=&H2
60 ZOPEN #CH%,TBL1%( )
70 TBL1%(0)=18
80 TBL2%(1)=&HA03
90 TBL2%(3)=1024
100 ZCNTL #CH%,0,TBL2%( )
110 TBL3%(0)=19
120 ZCNTL #CH%,0,TBL3%( )
130 PRINT "Setting status of the communication control parameters" :'Displays the result of reading
140 A$=RIGHT$("0000"+HEX$(TBL3%(1)),4)
150 L$=RIGTH$(A$,2)
160 H$=LEFT$(A$,2)
170 B%(0)=VAL("&H"+L$)
180 B%(1)=VAL("&H"+H$)
190 B=RDSET(1,B%(0))
200 IF B=1 THEN PRINT "DC1/DC3 reception control enabled"
210 IF B<>1 THEN PRINT "DC1/DC3 reception control disabled"
220 C=RDSET(3,B%(0))
230 IF C=1 THEN PRINT "DC1/DC3 transmission control enabled"
240 IF C<>1 THEN PRINT "DC1/DC3 transmission control disabled"
250 FOR I=1 TO 4
260 D=RDSET(I-1,B%(1))
270 ON I GOSUB 320,350,380,410
280 D=0
290 NEXT I
300 ZCLOSE
310 END
320 IF D=1 THEN PRINT "RS control enabled"
330 IF D<>1 THEN PRINT "RS control disabled"
340 RETURN
350 IF D=1 THEN PRINT "ER control enabled"
360 IF D<>1 THEN PRINT "ER control disabled"
370 RETURN
380 IF D=1 THEN PRINT "CS control enabled"
390 IF D<>1 THEN PRINT "CS control disabled"
400 RETURN
410 IF D=1 THEN PRINT "DR control enabled"
420 IF D<>1 THEN PRINT "DR control disabled"
430 RETURN
11 - 413
:
' Defines arrays
:
' Defines a channel number
:
' Sets the baud rate
:
' Sets the character length and parity bit
:
' Sets the stop bit
:
' Opens the communication channel
:
' Specifies to set the communication control
parameters
:
' Specifies to enable DC1/DC3
transmission/reception control
:
' Sets the receive buffer size to 1024 bytes
:
' Executes the setting operation
:
' Specifies to read the communication
control parameters
:
' Executes the reading operation
:
' The value of the lower byte of TBL%(3)
:
' The value of the higher byte of TBL%(3)
:
' Checks the first bit of the lower byte
:
' Checks the 3rd bit of the lower byte
:
' Checks the 0th to 3rd bits of the higher
byte
MELSEC-Q
11 - 413

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents