SHR - Shift right by n bits

Introduction

Returns an integer value shifted right by n bits.

Informal Syntax:

SHR( InValue, NValue )

Formal Syntax:

SHR( In:=InValue, N:=NValue )

Parameters

ParameterTypeDescription
InANY_INTEGRALThe value to shift.
NANY_NUMThe number of bits to shift the value.

Return value

The function SHR returns In shifted right N places.

If N is negative, the function shifts the value to the left.

Examples

ExampleReturn Value
SHR( 16, 4 )1
SHR( 16, -1 )32

Standards Compliance

Table 25.2 - IEC 61131-3 2nd Edition.

Table 30.2 - IEC 61131-3 3rd Edition.

Further Information

Bit Shift Functions

For other bit shift functions.

Glossary

For definitions of the terms used in Fernhill SCADA.