You are on page 1of 23

# Programmable Logic Controllers

## Bit Shifts (BSL) in PLCs

Sensors are provided to detect the presence of a new bottle, the bottle size, and whether the bottle is fully intact. Essentially 3 Boolean states describing the properties of each bottle that enters the line. A single BSL instruction can be used to track a single Boolean state (0 or 1) which in-turn can describe a unique property of a product. 2

## Bit Shifts (BSL) in PLCs

In the initial exercise we will track the 3 Boolean values describing each bottle entering our process line. The Boolean states will be referred to as

## "Exists", "Large", and "Broken"

and these states are to be tracked, utilizing 3 separate BSL (bit shift left) instructions.
3

## Bit Shifts (BSL) in PLCs

Tracking the bottles When the process is running, the main conveyor should be energized, and bottles should continuously enter and exit the line. Utilizing LS1 (Exists), we will strobe 3 BSL instructions to shift 3 separate bit arrays consisting of two 16 bit words each. We will use files #B3:2, #B3:4, and #B3:6 for this purpose.

## Bit Shifts (BSL) in PLCs

Files: Bit Array #B3:2 #B3:3
0 0 0 0 1 0 1 0 2 0 2 0 3 0 3 0 4 0 4 0 5 0 5 0 6 0 6 0 7 0 7 0 8 0 8 0 9 0 9 0 10 11 12 13 14 15 0 0 0 0 0 0

10 11 12 13 14 15 0 0 0 0 0 0

#B3:4 #B3:5

0 0 0 0

1 0 1 0

2 0 2 0

3 0 3 0

4 0 4 0

5 0 5 0

6 0 6 0

7 0 7 0

8 0 8 0

9 0 9 0

10 11 12 13 14 15 0 0 0 0 0 0

10 11 12 13 14 15 0 0 0 0 0 0
6

## On each false-to-true transition, this output instruction

a bit of data into a bit array, shifts the pattern of data through the array to the left, and unloads the end bit of data.
Programmable Logic controller 7

## Bit Shifts (BSL) in PLCs

File is the address of the bit array you want to shift. You must use the file indicator (#) in the bit array address.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

#B3:2 #B3:3

0
15

0
14

0
13

0
12

0
11

0
10

0
9

0
8

0
7

0
6

0
5

0
4

0
3

0
2

0
1

0
0

0
8

## Bit Shifts (BSL) in PLCs

Control is the unique address of the control structure (48 bits, 3 16-bit words) in the control area of memory that stores the instructions status bits, the size of the array (in number of bits), and the bit pointer (currently not used).
Programmable Logic controller 9

## Bit Shifts (BSL) in PLCs

Control is the unique address of the control structure (48 bits, 3 16-bit words) in the control area of memory that stores the
15
EN

Word 0

14

13
DN

12

11
ER

10
UL

Word 1

15

14

13

12

11

10

Word 2

15

14

13

12

11

10

10

## Bit Shifts (BSL) in PLCs

Control is the unique address of the control structure (48 bits, 3 16-bit words) in the control area of memory that stores the
15
EN

Word 0

14

13
DN

12

11
ER

10
UL

11

## Bit Shifts (BSL) in PLCs

Bit Address is the location of the bit which will be added to the array. Length is the total number of bits to be shifted by the BSL. Bits located to the left of the last bit in the array, up to the next word boundary cannot be used.
Programmable Logic controller 12

## Imagine an ice-cream cone machine. We have 4 steps.

First we verify the cone is not broken. Next we put ice cream inside the cone.(turn on output 1) Next we add peanuts.(turn on output 2), and Finally we add sprinkles.(turn on output 3)
Inspection

Conveyor
13

## Bit Shifts (BSL) in PLCs

If the cone is broken we obviously don't want to add ice cream and the other items. Therefore we have to track the bad cone down our process line so that we can tell the machine not to add each item. We use a Optical Sensor to look at the bottom of the cone. (input I:0.0/0) If its on then the cone is perfect and if its off then the cone is broken. An encoder tracks the cone going down the conveyor. (input I:0.0/1). It generate pulse at station locations. Implement using BSL

14

## Bit Shifts (BSL) in PLCs

O:0.0/0 I:0.0/0 Inspection O:0.0/1 O:0.0/2

I:0.0/1

Conveyor

15

16

## Bit Shifts (BSL) in PLCs

Case 1:

A good cone comes in front of the sensor (input I:0.0/0). The sensor (data input) turns on. Encoder generates a pulse and the status of the data input (cone sensor input I:0.0/0) is transferred to bit B3:2/0. The register now looks like:

#B3:2

15

14

13

12

11

10

17

## Bit Shifts (BSL) in PLCs

Case 2:

As the conveying system moves on, another cone comes in front of the sensor. This time it's a broken cone and the sensor remains off. Now the encoder generates another pulse. The old status of bit B3:2/0 is transferred to bit B3:2/1. The old status of B3:2/1 shifts to B3:2/2. The old status of B3:2/2 shifts to B3:2/3 and so on. The new status of the data input (cone sensor) is transferred to bit B3:2/0. The register now looks like:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

#B3:2

0
18

## Bit Shifts (BSL) in PLCs

Since the register shows that B3:2/1 is now 1, the ladder says that output O:0.0/0 will turn on and ice cream is put in the cone.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

#B3:2

0 I:0.0/0

O:0.0/0 Inspection

O:0.0/1

O:0.0/2

I:0.0/1

Conveyor

19

## Bit Shifts (BSL) in PLCs

As conveyor moves, the register shows that B3:2/1 is now 0, the ladder says that output O:0.0/0 will turn Off and ice cream will not be dispensed. B3:2/2 is now 1, Peanut dispensed.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

#B3:2

0 I:0.0/0

O:0.0/0 Inspection

O:0.0/1

O:0.0/2

I:0.0/1

Conveyor

20

## Bit Shifts (BSL) in PLCs

As conveyor moves, the register shows that B3:2/1 is now 1, the ladder says that output O:0.0/0 will turn ON and ice cream will be dispensed. B3:2/2 is now 0, Peanut not dispensed. B3:2/3 is 1.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

#B3:2

0 I:0.0/0

O:0.0/0 Inspection

O:0.0/1

O:0.0/2

I:0.0/1

Conveyor

21

## Bit Shifts (BSL) in PLCs

#B3:2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

O:0.0/1

O:0.0/2

I:0.0/1

Conveyor

22

## Bit Shifts (BSL) in PLCs

The shift registers BSL and BSR are most commonly used in
conveyor

23