Shl And Shr; Ny-Series Instructions Reference Manual (W560 - Omron NY532-5400 Reference Manual

Ny-series
Hide thumbs Also See for NY532-5400:
Table of Contents

Advertisement

2 Instruction Descriptions

SHL and SHR

These instructions shift a bit string by one or more bits.
SHL:
Shifts the bit string to the left (toward the higher bits).
SHR:
Shifts the bit string to the right (toward the lower bits).
Instruction
SHL
N-bit Left Shift
SHR
N-bit Right Shift
Variables
Name
Meaning
In
Data to
shift
*2
Number to
Num
shift
Out
Processing
result
*1 If you omit the input parameter, the default value is not applied. A building error will occur.
*2 On Sysmac Studio version 1.03, you can use "N" instead of "Num" to more clearly show the correspondence between the
variables and the parameter names in ST expressions. For example, you can use the following notation:
Out:=SHL(In:=BYTE#16#89, N:=ULINT#2);.
Bit strings
In
OK OK OK OK
Num
Out
* With a CPU Unit with unit version 1.02 or later and Sysmac Studio version 1.03 or higher, use a ULINT variable. With a CPU
Unit with unit version 1.01 or earlier and Sysmac Studio version 1.02 or lower, use a USINT variable.
Function
These instructions shift data to shift In (bit string data) by the number of bits specified in number to shift
Num. The bits that are shifted out of the register are discarded and zeros are inserted into the other end
of the register.
2-396
Name
FB/FUN
FUN
FUN
I/O
Description
Data to shift
Input
Number of bits to shift
Output
Processing result
OK
*
Must be same data type as In
Graphic expression
(@)SHL
EN
ENO
In
Out
Num
(@)SHR
EN
ENO
In
Out
Num
Valid range
Depends on data type.
0 to No. of bits in In
Depends on data type.
Integers
OK
*

NY-series Instructions Reference Manual (W560)

ST expression
Out:=SHL(In, Num);
Out:=SHR(In, Num);
Unit
Default
---
*1
Bits
1
---
---
Times, durations,
dates, and text strings

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents