11 - 454 11 - 454
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
ZRECEIVE
Instruction
Z RECEIVE
• Receives data from a communication port.
ZRECEIVE #<channel number>,0,<control table>,<input element>
Syntax
channel number
• • • •
Specify the communication port that receives data.
control table
• • • •
Specify various parameters for receiving data.
input element
• • • •
Stores the variable or array in which received data is
stored.
Examples
ZRECEIVE #1,0,A%( ),DA$
• • • •
Receives data from CH1 (RS-232C) under the
conditions specified by integer arrays A%(0) and
A%(2), stores it in DA$, and then stores the number
of received bytes in A%(1).
Description
• The ZRECEIVE instruction receives data from the communication port specified in
<channel number> according to the parameters specified in <control table> and stores it in
<input element>.
• Specify which communication port of the communication module should be used in
<channel number>. The correspondence between channel numbers and communication
ports are as follows.
Channel number
Communication port
1
2
3
• • • •
• • • •
• • • •
CH1 (RS-232C)
CH2 (RS-232C)
CH3 (RS-422/485)
Note that it is always necessary to open the communication port that receives data by the
ZRECEIVE instruction in advance using the ZOPEN instruction. An error occurs if it is not
opened.
• <control table> specifies the number of bytes of data to be received and a timeout value. In
addition, the number of bytes of data actually received is stored at the completion of the
reception.
<control table> uses the following integer array variables:
%(0)
• • • •
Specifies the number of bytes requested to be received.
%(1)
• • • •
Stores the number of bytes received after the completion of the
reception.
%(2)
• • • •
Specifies the timeout value.