You are on page 1of 5

Software Objects

Section 4.4
Shift Bit Register (%SBR)

Shift Bit Register (%SBR)


Using Shift Bit Register Function Blocks
This section provides descriptions and programming guidelines for using Shift Bit Register
function blocks.
What Is in This Section?
This section contains the following topics:
Topic

148

Page

Description

149

Configuration

150

Programming Example

152

EIO0000001474 11/2014

Software Objects

Description
Introduction
The Shift Bit Register function block
or 1).

provides a left or right shift of binary data bits (0

Illustration
This illustration is the Shift Bit Register function block:

The current value of the Shift Bit Register is displayed in the centre of the function block:
Decimal value eg 7
Binary value eg 111
Hex value eg 16#7

Inputs
The Shift Bit Register function block has the following inputs:
Label

Description

Value

Reset input (or instruction)

When function parameter R is 1, this sets register bits 0 to 15


%SBRi.j to 0.

CU

Shift to left input (or instruction) On a rising edge, shifts a register bit to the left.

CD

Shift to right input (or


instruction)

EIO0000001474 11/2014

On a rising edge, shifts a register bit to the right.

149

Software Objects

Configuration
Parameters
To configure parameters, follow the Configuring a Function Block procedure (see page 133) and
read the description of Memory Allocation Modes in the SoMachine Basic Operating Guide.
The Shift Bit Register function block has the following parameters:
Parameter

Description

Value

Used

Address used

If selected, this address is currently in use in a program.

Address

Shift Bit Register object


address

A program can contain only a limited number of Shift Bit


Register objects. Refer to the Programming Guide of the
hardware platform for the maximum number of registers.

Symbol

Symbol

The symbol associated with this object. Refer to the SoMachine


Basic Operating Guide, Defining and Using Symbols for details.

Comment

Comment

A comment can be associated with this object.

Objects
The Shift Bit Register function block has the following objects:
Object

Description

Value

%SBRi

Register number

0 to 7
It can be modified in an animation table.

%SBRi.j Register bit

Bits 0 to 15 (j = 0 to 15) of the shift register can be tested by a test


instruction and written using an Assignment instruction.

Operation
This illustration shows a bit pattern before and after a shift operation:

This is also true of a request to shift a bit to the right (bit 15 to bit 0) using the CD instruction. Bit 0
is lost.
If a 16-bit register is not adequate, it is possible to use the program to cascade several Register.
150

EIO0000001474 11/2014

Software Objects

Special Cases
This table contains a list of special cases for programming the Shift Bit Register function
block:
Special Case

Description

Effect of a cold restart (%S0=1)

Sets all the bits of the register word to 0.

Effect of a warm restart (%S1=1)

Has no effect on the bits of the register word.

EIO0000001474 11/2014

151

Software Objects

Programming Example
Introduction
The Shift Bit Register function block provides a left or right shift of binary data bits (0 or 1).
Programming
In this example, a bit is shifted to the left every second while bit 0 assumes the state to bit 15.
In reversible instructions:
Rung

Reversible Instruction

BLK %SBR0
LD
%S6
CU
END_BLK

LD
ST

%SBR0.15
%SBR0.0

In non-reversible instructions:
Rung

Non-Reversible Instruction

LD
CU

LD
ST

%S6
%SBR0
%SBR0.15
%SBR0.0

NOTE: Refer to the reversibility procedure (see page 14) to obtain the equivalent Ladder Diagram.

152

EIO0000001474 11/2014

You might also like