11 - 403 11 - 403
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
WTSET
Instruction
WriTe SET
• Writes 0 or 1 to the specified bit of an integer array variable.
WTSET <integer expression 1>,<integer expression 2>,<array variable>
Syntax
integer expression 1
• • • •
Specify which bit of the specified integer array is to
be written to, using an integer from 0 to 65535.
integer expression 2
• • • •
Specify the data to be written (0 or 1).
array variable
• • • •
Specify a one-dimensional integer array variable to
which data is written.
Examples
WTSET 12,1, A%(0)
• • • •
Writes "1" to the 12th bit counting from the 0th bit of
A%(0).
b15
to
b0
to
A%(0)
Write "1" to the 12th bit.
1
b8 b7
WTSET 40,0,A%(0)
• • • •
Writes "0" to the 40th bit counting from the 0th bit of
A%(0).
b15
to
b0
to
b8 b7
b31
to
b16
to
b24 b23
b47
to
b32
to
0
b40 b39
A%(1)
A%(0)
A%(2)
The 40th bit counting from the 0th bit of A%(0).
Description
• The WTSET function writes data (1 or 0) specified in <integer expression 2> to the bit
specified in <integer expression 1> in the one-dimensional integer array variable specified
by <array variable>.
• In the bit specification by <integer expression 1>, it is possible to specify any bit in any
array variables relative to the 0th bit of the specified array variable.
An "Illegal function call" error occurs if the specified value indicates a bit position that
exceeds the total number of bits contained in an array variable defined by the DIM
instruction.
• Specify the data to be written in <integer expression 2>.
The only data that can be specified is "0" or "1."
An "Illegal function call" error occurs if data other than 0 or 1 is specified.
• Only a one-dimensional integer array variable can be specified in <array variable>.
If a variable other than an element of a one-dimensional integer array variable is specified,
an "Illegal function call" error occurs.