Mitsubishi QD51 Programming Manual page 536

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
ROT
Function
• Returns the bit-rotated value of the memory representation of the specified value.
ROT (<numeric expression 1>,<numeric expression 2>)
Syntax
numeric expression 1
numeric expression 2
A%=ROT(B%,C%)
Examples
D%=ROT(E%,12)
F%=ROT(G%,-4)
• The ROT function rotates the memory representation of the value specified in <numeric
Description
expression 1> by the number of bits specified in <numeric expression 2> and returns the
rotated value.
• Specify by how many bits the value specified in <numeric expression 1> should be rotated
in <numeric expression 2>.
If the value of <numeric expression 2> is positive, the bits are rotated to the left; the value
of the most significant bit (sign bit) is shifted to the least significant bit.
Rotated to the
left if the value
of <numeric
expression 2>
is positive.
Rotated to the
right if the value
of <numeric
expression 2>
is negative.
• If either <numeric expression 1> or <numeric expression 2> is specified as a value other
than an integer, the type of the value is converted to integer data and then processed.
• An error occurs if <numeric expression 1> is not within the range from -32768 to 32767.
• An error occurs if <numeric expression 2> is not within the range from -16 to 16.
11 - 366
ROTation
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
1
0
0
1
0
0
0
1
0
0
If the value of <numeric expression 2> is negative, the bits are rotated to the right;
the value of the least significant bit is shifted to the most significant bit.
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
1
0
0
1
0
0
0
0
1
1
• • • •
Specify the value whose bits are rotated, as an
integer value.
• • • •
Specify the shift direction and the number of bits, as
an integer value.
• • • •
Bit-rotates the value of B% by the value of C% and
assigns it to A%.
• • • •
Rotates the value of E% to the left by 12 bits and
assigns it to D%.
• • • •
Rotates the value of G% to the right by 4 bits and
assigns it to F%.
0
0
0
1
1
0
1
0
0
1
1
0
1
0
0
0
0
1
1
0
1
0
0
0
0
0
1
1
MELSEC-Q
Bit position
• • • • •
0
0
1
0
The value whose
• • • • •
bits are rotated
• • • • • •
Direction of rotation
(rotate by <numeric
0
1
0
1
• •
expression 2>)
The function value
• • •
returned
Bit position
• • • • •
• • • • •
The value whose
0
0
1
0
bits are rotated
• • • • • • • • •
Direction of rotation
(rotate by <numeric
• •
expression 2>)
0
0
1
1
The function value
• • •
returned
11 - 366

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents