Mitsubishi QD51 Programming Manual page 580

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
Program Example
10 ' This program sets parameters for a communication channel
20 DIM TBL1%(2),TBL2%(3),TBL3%(3),B%(1)
30 A%=1
40 TBL1%(0)=4800
50 TBL1%(1)=&H107
60 TBL1%(2)=&H1
70 ZOPEN #A%,TBL1%( )
80 TBL2%(0)=16
90 TBL2%(1)=9600
100 TBL2%(2)=&H208
110 TBL2%(3)=&H1
120 ZCNTL #A%,0,TBL2%( )
130 TBL3%(0)=17
140 ZCNTL #A%,0,TBL3%( )
150 PRINT "Baudrate
160 A$=RIGHT$("0000"+HEX$(TBL3%(2)),4)
170 L$=RIGHT$(A$,2)
180 H$=LEFT$(A$,2)
190 B%(0)=VAL("&H"+L$)
200 B%(1)=VAL("&H"+L$)
210 PRINT "Character length=";B%(0)
220 PRINT "Parity bit=";B%(1)
230 PRINT "Stop bit=";TBL3%(3)
240 ZCLOSE #A%
250 END
11 - 410
=";TBL3%(1)
:
' Defines an arrays
:
' Communication channel CH1 (RS-232C)
:
' Sets the baud rate
:
' Sets the character length and parity bit
:
' Sets the stop bit
:
' Opens the communication channel
:
' Specifies to set the communication
parameters
:
' Sets the baud rate
:
' Sets the character length and parity bit
:
' Sets the stop bit
:
' Executes the setting of the communication
parameters
:
' Specifies to read the communication
parameters
:
' Executes reading the communication
parameters
:
' Displays the baud rate
:
' Converts TBL3%(2) to a character string
:
' Reads the lower byte
:
' Reads the higher byte
:
' Converts the lower byte to a numeric
value
:
' Converts the higher byte to a numeric
value
:
' Displays the character length
:
' Displays the parity bit
:
' Displays the stop bit
:
' Closes the communication channel
MELSEC-Q
11 - 410

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents