Mitsubishi QD51 Programming Manual page 547

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
SHT
Function
• Returns the logically shifted value of the memory content of the specified value.
SHT(<numeric expression 1>,<numeric expression 2>)
Syntax
numeric expression 1
numeric expression 2
A%=SHT(B%,C%)
Examples
D%=SHT(E%,12)
F%=SHT(G%,-4)
• The SHT function shifts the memory content of the value specified in <numeric expression
Description
1> logically by the amount of bits specified in <numeric expression 2> and returns the
shifted value.
• Specify by how many bits the value specified in <numeric expression 1> should be logically
shifted in <numeric expression 2>.
If the value of <numeric expression 2> is positive, the bits are shifted to the left and the
least significant bit is put into OFF status (0) sequentially. Thus, if 16 is specified in
<numeric expression 2>, the function value will always be 0.
Shifted to the
left if the value
of <numeric
expression 2>
is positive.
Shifted 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 into 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 - 377
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
1
0
0
1
0
0
1
0
If the value of <numeric expression 2> is negative, the bits are shifted to the right and the value
of the most significant bit remains as is. Thus, if -16 is specified in <numeric expression 2>,
the function value will always be either -1 or 0, depending on the value of 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
1
0
0
SHifT logical
• • • •
Specify the target value of the logical shift as an
integer value.
• • • •
Specify the shift direction and the number of bits as
an integer value.
• • • •
Shifts the value of B% logically by the amount of the
value C%, and assigns it to A%.
• • • •
Shifts the value of E% logically to the left by 12 bits
and assigns it to D%.
• • • •
Shifts the value of G% logically to the right by 4 bits
and assigns it to F%.
0
0
0
0
1
1
0
0
0
0
1
1
0
1
0
0
0
0
1
1
0
1
0
0
0
0
1
1
• • • •
Bit position
1
0
0
1
1
• • • •
The value whose bits
are shifted logically
• • • •
Direction of shift (shift by
<numeric expression 2>)
• • • •
0
0
1
1
0
Function value
to be returned
• • • •
Bit position
1
0
0
1
0
• • • •
The value whose bits
are shifted logically
• • • •
Direction of shift (shift by
<numeric expression 2>)
• • • •
0
1
0
0
1
Function value
to be returned
MELSEC-Q
11 - 377

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents