11 - 464 11 - 464
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 sent • • •
%(0)
Specify the number of bytes of data to be sent. How to count the number of bytes
differs depending on what is specified in <output element>; see the description of
the <output element> item.
Specify 2 bytes if an integer variable is specified as the output element.
Specify a value in the range from 1 to 1024 bytes if an integer array is specified
as the output element.
Specify a value in the range from 1 to 256 bytes if a character string expression
is specified as the output element.
(2) Specification of the timeout value • • • %(2)
Specify the monitoring time at transmission. It is possible to generate an error if a
transmission is not completed within the time specified by the timeout value after
the execution of the ZSEND instruction. The timeout value is specified in units of
100 ms.
If a timeout error occurs, the number of bytes of data sent before the timeout
error occurrence is assigned to control table %(1).
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 actual number of bytes transmitted • • • %(1)
The number of bytes of transmitted data is automatically stored after the data
transmission is complete. If data is normally received, this value becomes the
same as the number of bytes requested to be sent; it can thus be used for
checking the transmission status.
• Specify the data to be output as an integer variable, integer array name, or character
string expression in <output element>.
(1) When an integer variable is specified, one integer data value is treated as 2 bytes;
therefore specify 2 bytes for the number of bytes requested to be sent.
[Request to send 2 bytes]
2 bytes
Transmits
760
%
F8
H
(760)
02
H
(2) When an integer array name is specified, one element of the array is treated as 2
bytes and the elements corresponding to the number of bytes requested to be sent
are transmitted. Make sure to store transmitted data from element number 0
because individual element numbers cannot be specified by the integer array
name.
[Request to send 6 bytes]
Transmits
1654
3238
16
(Integer data)
2 bytes
%(0)
76
H
(1654)
06
H
A6
H
0C
H
16
H
00
H
89
H
00
H
(3238)
(16)
(137)
%(1)
%(2)
%(3)
2 bytes
2 bytes
2 bytes