11 - 410 11 - 410
MELSEC-Q
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)
:
' Defines an arrays
30 A%=1
:
' Communication channel CH1 (RS-232C)
40 TBL1%(0)=4800
:
' Sets the baud rate
50 TBL1%(1)=&H107
:
' Sets the character length and parity bit
60 TBL1%(2)=&H1
:
' Sets the stop bit
70 ZOPEN #A%,TBL1%( )
:
' Opens the communication channel
80 TBL2%(0)=16
:
' Specifies to set the communication
parameters
90 TBL2%(1)=9600
:
' Sets the baud rate
100 TBL2%(2)=&H208
:
' Sets the character length and parity bit
110 TBL2%(3)=&H1
:
' Sets the stop bit
120 ZCNTL #A%,0,TBL2%( )
:
' Executes the setting of the communication
parameters
130 TBL3%(0)=17
:
' Specifies to read the communication
parameters
140 ZCNTL #A%,0,TBL3%( )
:
' Executes reading the communication
parameters
150 PRINT "Baudrate =";TBL3%(1)
:
' Displays the baud rate
160 A$=RIGHT$("0000"+HEX$(TBL3%(2)),4)
:
' Converts TBL3%(2) to a character string
170 L$=RIGHT$(A$,2)
:
' Reads the lower byte
180 H$=LEFT$(A$,2)
:
' Reads the higher byte
190 B%(0)=VAL("&H"+L$)
:
' Converts the lower byte to a numeric
value
200 B%(1)=VAL("&H"+L$)
:
' Converts the higher byte to a numeric
value
210 PRINT "Character length=";B%(0)
:
' Displays the character length
220 PRINT "Parity bit=";B%(1)
:
' Displays the parity bit
230 PRINT "Stop bit=";TBL3%(3)
:
' Displays the stop bit
240 ZCLOSE #A%
:
' Closes the communication channel
250 END
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...