7-54
7.4 Bit Processing Instructions
7.4.2 Bit test
TEST, DTEST
(3) The position specified for
specifies the position of each bit in a 1-word data block (0 to
15). When 16 or higher value is specified for
, the target is the bit data at the position
indicated by the remainder of n divided by 16. For example, when n 18, the remainder of
18/16 1 is 2, thus the target is the data of b2.
DTEST(P)
(1) Fetches bit data from the location specified for
within the 2-word device specified for
,
and writes it to the bit device specified for
.
(2) The bit device specified for
is turned OFF when the corresponding bit is 0 and ON when
it is 1.
(3) The position specified for
specifies the position of each bit in a 2-word data block (0 to
31). When 32 or higher value is specified for
, the target is the bit data at the position
indicated by the remainder of n divided by 32. For example, when n 34, the remainder of
34 / 32 1 is 2, thus the target is the data of b2.
O
peration Error
No operation error occurs in the execution of the TEST(P) and DTEST(P) instructions.
Program Example
(1) In the following program, Var_M0 is turned ON or OFF depending on the status of the 10th
bit of the 1-word data block (Var_D0).
[Structured ladder]
s
2
s
2
bi
t
b15
b0
b5
s
1
d
s
2
s
2
(W
hen
=5)
s
2
s
1
d
d
s
2
s
2
s
1
d
b15
b0
b31
b16
b21
bi
t
s
2
s
2
(W
hen
=21)
Summary of Contents for MELSEC Q Series
Page 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Page 2: ......
Page 14: ...A 12 MEMO ...
Page 340: ...6 178 MEMO MTR ...
Page 708: ...7 368 MEMO ...
Page 776: ...8 68 MEMO ...
Page 796: ...9 20 MEMO ...
Page 804: ...App 8 MEMO ...
Page 812: ...Index 8 MEMO ...
Page 815: ......