beautypg.com

Shl function, Shr function, Shr( a, n ) – Delta RMC151 User Manual

Page 379: Shl( a, n )

background image

5 Programming

Parameters

cond (BOOL)
The condition to be evaluated.
a (REAL or DINT)
The value to return if cond is true.
b (REAL or DINT)
The value to return if cond is false.

The a and b input parameters must be of the same data type.

Return Value

Returns the same data type as the a and b input parameters.

Examples

SEL(_Axis[0].ActPos > 10, 100, SQRT(2)) returns 100 if the Axis 0 Actual Position is

greater than 10, otherwise it returns the square root of 2.

5.14.2.37. SHL Function

SHL(a, n)
Shifts the bits in a to the left n times. Zeros are shifted in.

Parameters

a (DINT or DWORD)
The value to shift.
n (DINT)
The number of times to shift a. n must be between 0 and 31.

Return Value

Returns the same data type as a.

Remarks

The result of an invalid n is undefined.

Examples

SHL(16#00000008, 2) returns 16#00000020

5.14.2.38. SHR Function

SHR(a, n)
Shifts the bits in a to the right n times. Zeros are shifted in.

Parameters

a (DINT or DWORD)
The value to shift.

deltamotion.com

359

This manual is related to the following products: