Shift bits right (shr), C.5.6 shift bits right (shr) – Nematron Pointe Controller User Manual

Page 399

Advertising
background image

Pointe Controller User Guide

Appendix C: Ladder Diagram Block Reference

397

Param

Name

Config

Var Type

Description

IN

Input
Value

req

any integer*

T_DONE

T_VALUE

T_PREVAL

The input value.

N

Number
of Places

req

unsigned**

T_DONE

T_VALUE

T_PREVAL

Numeric

The number of places to be shifted.

OUT

Output
Value

req

any integer*

The result of shifting the input
value n places to the left.

* Any Input, Output, or Memory tag except 32-bit Real (F) or Bit (X). For more information, see

Defining Input, Output, Memory tags

” on page 114

.

** Any unsigned (UB, UW, UD, X) Input, Output, or Memory tag. For more information, see “

Defining

Input, Output, Memory tags

” on page 114

.

NOTE: If the function result is larger than the output variable (for example, a 16-
bit result to be placed in an 8-bit output variable), then the high-order bits of the
result are discarded and the low-order bits are placed in the output. No overflow
error is generated.

C.5.6 Shift bits Right (SHR)

When used in a Ladder Diagram, the SHR block shifts the bits of the input a
specified number of places to the right and sends the result to output.

Select the

tool (from the

Logical and Bit Shift Blocks

toolbar) and click on a

ladder rung to insert the following block:

Once the block is inserted, you can double-click on it to

configure

it.

Functional Description

This block always passes the Enable input state (EN) through to the Enable Out
output state (ENO) without change; when EN becomes on, ENO is turned on, and
when EN becomes off, ENO is turned off.

When EN becomes on, the block function is executed: the Input Value (IN) is shifted the specified
Number of Places (N) to the right and zeroes are placed in the vacated registers. The resulting bit
pattern is placed in the Output Value (OUT).

Advertising