SHR - Shift right by n bits

Introduction

Returns an integer value shifted right by n bits.

Informal Syntax:

SHR( In, N )

Formal Syntax:

SHR( In:=expression, N:=expression )

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 Second Edition.

Table 30.2 - IEC 61131-3 Third Edition.

Further Information

Bit Shift Functions

For other bit shift functions.

Glossary

For the meaning of terms used in Fernhill SCADA.