11 - 461 11 - 461
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
Available only in execution mode
ZRESERVE
Instruction
Z RESERVE
• Prohibits other programs from using a resource to which a resource number is assigned.
ZRESERVE <resource number>[,<timeout value>]
Syntax
resource number
• • • •
Specify the number (0 to 31) allocated among the
programmers and assigned to a resource used in a
program.
timeout value
• • • •
Specify the maximum time that is allowed to wait
before prohibiting other programs to use a resource,
in the format "HH:MM:SS:R."
HH: Hours
MM: Minutes
SS: Seconds
R: 100 ms
(0 to 23)
(0 to 59)
(0 to 59)
(express 0 to 900 ms using the
numbers from 0 to 9)
Examples
ZRESERVE 1, "0:0:5:0"
• • • •
Prohibit other programs from using the resource to
which resource number 1 is assigned. A timeout
error is generated if it cannot be prohibited within 5
seconds.
Description
• The ZRESERVE instruction prohibits other programs from using a resource to which a
resource number allocated among the programmers is assigned when the resource is
shared by multiple programs executed at once. A program that executes the ZRESERVE
instruction can obtain the exclusive use of the resource.
• In order to terminate the exclusive use, specify the same resource number as in the
ZRESERVE instruction that prohibited the use, and execute the ZRELEASE instruction.
• The ZRESERVE and ZRELEASE instructions are used as a pair so that other programs
cannot use the resource for a specified time or while the processing involving the resource
is performed.
• The programmers should reach an arrangement in advance for the resources to which
resource numbers are to be assigned. Then they should create programs in such a way
that the ZRESERVE instruction is executed immediately before using the resources and
the ZRELEASE instruction is executed immediately after using it.
• Specify the number assigned to the resource whose use should be prohibited for other
programs in <resource number>.
• If another program has executed the ZRESERVE instruction specifying the same resource
number before a program executes the ZRESERVE instruction, it must wait before
prohibiting the use of the resource from other programs. Specify the maximum time that
the program waits in this case in <timeout value>. The specification should be made in the
following format. (The program execution is stopped while waiting.)
"HH:MM:SS:R"
HH
• • • •
Hours ("0" to "23")
MM
• • • •
Minutes ("0" to "59")
SS
• • • •
Seconds ("0" to "59")
R
• • • •
ms (express 0 to 900 ms
using numbers from "0" to "9")