SHR - Shift right by n bits

Help Contents

Introduction

Returns an integer value shifted right by n bits.

Syntax

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 type of the return value is the same as the type of the In parameter.

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

IEC 61131-3 Second Edition: Table 25.2.

IEC 61131-3 Third Edition: Table 30.2.

Further Information

Bit Shift Functions

For other bit shift functions.

Glossary

For the meaning of terms used in Fernhill SCADA.