11 - 455 11 - 455
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
Always define an array used in <control table> by the DIM instruction, even though only three
array elements are used.
If the array is not defined using the DIM instruction, an error occurs at the execution
of the ZRECEIVE instruction (usually, an array with 10 or fewer elements can be used without
defining it using the DIM instruction).
(1) Specification of the number of bytes requested to be received • • •
%(0)
Specify the number of bytes of data to be received. How to count the number of
bytes differs depending on what is specified in <input variable>; see the
description of the <input variable> item.
Specify 2 bytes if an integer variable is specified as the input element.
Specify a value in the range from 1 to 1024 bytes if an integer array is specified
as the input element.
Specify a value in the range from 1 to 256 bytes if a character string expression is
specified as the input element.
(2) Specification of the timeout value • • • %(2)
Specify the monitoring time at reception. An error may be generated if a reception
is not completed within the time period specified by the timeout value after the
execution of the ZRECEIVE instruction. The timeout value is specified in units of
100 ms.
If a timeout error occurs, the number of bytes of data received before the timeout
error occurrence is stored in control table %(1) and the data received before the
timeout error occurrence is stored in <input element>.
The allowable specification range is from 0 to 65535. However, if a value from
32768 to 65535 is to be specified, it should be expressed in hexadecimal (a
decimal value cannot be assigned and an error occurs). Note that if 0 is specified,
it is assumed that there is no timeout.
(3) The number of bytes received • • • %(1)
The number of bytes of received data is automatically stored after the data
reception is complete. If data is normally received, this value becomes the same
as the number of bytes requested to be received; it may be used for checking the
reception status.
• The data received is stored in <input element>. Specify an integer variable, integer
array name, character variable, or character array variable.
• Store dummy data for the number of bytes requested to be received in the variable used as input
variable, before executing the ZRECEIVE instruction as shown below.
If such dummy data has not been stored, an error occurs when the ZRECEIVE instruction is executed.
Integer variable %=0
Character variable $=SPACE$(255)
• Always define an array specified as input variable using the DIM instruction, even if the number
of elements used is 10 or less. If the array is not defined with the DIM instruction, an error occurs
at the execution of the ZRECEIVE instruction.