The text of a manual ยท part 38 of 59
Mini-PLC-2/02, -2/16, -2/17 Processor (cat. no. 1772-LZ, LZP, LX, LXP, LW, LWP) User Manual: 20 - Bit Shift Registers
Pages 311 to 324 of 490, from Mini-PLC-2/02, -2/16, -2/17 Processor (cat. no. 1772-LZ, LZP, LX, LXP, LW, LWP) User Manual
The original document is the PDF (2.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Allen-Bradley 1772-LX / LXP
Page 311
Chapter
20
Bit Shift Registers
Chapter Objectives
This chapter describes bit shift instructions. The bit shift instructions are: The Bit Shift Left or Right instructions move one bit to the left or right upon the false-true transition of a rung. They are output instructions that construct and manipulate a synchronous bit shift register from 1-999 bits in length. You can perform these operations only in the complete mode. The Examine Off or Examine On Bit Shift instructions are condition instructions that examine bits in a shift register. You can specify the bit number to be examined and the starting address of the shift register. Bit Shift Set and Reset Bit Shift are output instructions that set or reset a specified bit in a bit shift register. You can specify the bit number to be manipulated and the starting address of the shift register.
Bit Shift Left
The Bit Shift Left output instruction constructs a synchronous bit shift register from 1-999 bits in length. Figure 20.1 shows a 128-bit register starting and ending at words 400 and 407.
20-1
Page 312
Chapter 20 Bit Shift Registers
Figure 20.1 How the Processor Shifts a Bit to the Left Word Address Input BIt A
Bit Address 17 16 15 14 13 12 11 10 07 06 05 04 03 02 01 00 16 15 14 13 12 11 10 9
8
7
6
5
4
3
2
1
400
L L 32
17
401
Bit one of Bit Shift Register
L L 48
33
402
L L 64
49
403
L L 80
67 66 65
404
L L 96
81
405
L L 112
97
406
L L
Output Bit B 128 127
123
113 407
L 10386-I
Upon false-true-rung transition, input bit A from a particular input word shifts into the first bit of the bit shift register. Bit 1 moves to the left and displaces bit 2; bit 2 displaces bit 3; and so on. Each bit displaces the one to its left until the last bit in the word (bit 16) is reached. Bit 16 displaces bit 17, which is really bit 1 of the next word (in this example, bit 401/00). Bumping continues throughout the file until last bit is ejected from the queue into output bit B.
20-2
Page 313
Chapter 20 Bit Shift Registers
If the bit shift register of Figure 20.1 is 123 bits long, shifting ends at bit 12 of word 407. In this case, bits to the left of bit 12 in word 407 are not used for the bit shift register. However, they cannot be used for any other purpose. The value in bit 123 is shifted directly into output bit B when a bit shift occurs as shown by the dotted line in Figure 20.1. The instruction operates in the complete mode. The status of the input bit is shifted into the first bit in the register and the status of the last bit in the register is shifted into the output bit in one scan. Here are some characteristics of the Bit Shift Left instruction: Programmed as an output instruction Key sequence [Shift] [Reg] [1] [2] The counter is internally indexed and externally controlled by the ladder diagram logic in your program. Operates in complete mode
Programming a Bit Shift Left Instruction ATTENTION: The counter address specified for the Bit Shift Left instruction should be reserved for that instruction only. Do not manipulate the counter preset or accumulated values. Inadvertent changes to these values could result in hazardous or unpredictable machine operation or a run time error. Damage to equipment and/or personal injury could result.
To program a Bit Shift Left instruction:
The prompt SHIFT REGISTER 12 appears in the lower left hand corner of the screen. 12
020 10
BIT SHIFT LEFT COUNTER ADDR: 030 NUMBER OF BITS: 001 FILE: 110-110 INPUT: 010/00 OUTPUT: 010/00
030 EN 17 030 DN 15
20-3
Page 314
Chapter 20 Bit Shift Registers
A display represented by Figure 20.2 shows the format of a Bit Shift Left. Figure 20.2 Bit Shift Left Format 020
BIT SHIFT LEFT COUNTER ADDR: 030 NUMBER OF BITS: 001 FILE: 110-110 INPUT: 010/00 OUTPUT: 010/00
10
030 EN 17 030 DN 15
Numbers shown are default values. The number of default address digits initially displayed, 3, 4, or 5 will depend on the size of the data table. Initially displayed default values are governed by the I/O rack configuration. This Value:
Stores This:
Counter Address
Address of the instruction in the timer/counter area of the data table. It represents the accumulated value of the instruction.
Number of Bits
Number of bits in the file.
File
Starting address of the file.
Input
Address of the input bit.
Output
Address of the output bit.
After you enter the following data, the instruction should look like Figure 20.3. COUNTER ADDR NUMBER OF BITS FILE INPUT OUTPUT
200 128 The bit shift register starts and ends at words 400 and 407 respectively. The input bit is bit 17 of word 130. The output bit is bit 00 of word 420.
Figure 20.3 Bit Shift Left Example Rung 020 10
BIT SHIFT LEFT COUNTER ADDR: 200 NUMBER OF BITS: 128 FILE: 400-407 INPUT: 130/17 OUTPUT: 420/00
200 EN 17 200 DN 15
See chapter 19 for the procedure for using the data monitor. Note that bit 00 is the right side bit on the file display and bit 17 is on the left.
20-4
Page 315
Chapter 20 Bit Shift Registers
Bit Shift Right
The Bit Shift Right output instruction constructs a synchronous bit shift register from 1 to 999 bits in length. Figure 20.4 shows a 128 bit register starting and ending at words 400 and 407. Figure 20.4 How the Processor Shifts a Bit to the Right Word Address Output Bit A
Bit Address 17 16 15 14 13 12 11 10 07 06 05 04 03 02 01 00 16 15 14 13 12 11 10 9
8
7
6
5
4
3
2
1
400
17
401
33
402
49
403
67 66 65
404
81
405
97
406
R
R 32
Bit one of Bit Shift Register
R
R 48
R
R 64
R
R 80
R
R 96
R
R 112
R
R Input Bit B 128 127
123
113 407 R 10387-I
20-5
Page 316
Chapter 20 Bit Shift Registers
Upon false-to-true rung transition, input bit B from a particular input word will be inserted into the last bit of the bit shift register. In Figure 20.4, bit 128 moves right and displaces bit 127; bit 127 displaces bit 126. Each bit displaces the one on its right until the first bit in the word, 113, is reached. Bit 113 then displaces bit 112 in the previous word (in this example, bit 406/17). This bumping procedure continues throughout the queue until bit 1 is ejected from the file into output bit A. If the bit shift register of Figure 20.4 had been 123 bits long it would have input data into bit 12 of word 407. In this case the bits to the left of bit 12 in word 407 would be unused and cannot be used for any other purpose. A Bit Shift Right will shift the on or off status of input bit B directly into bit 123 as shown by the dotted line. The instruction operates in the complete mode. The status of the input bit is shifted into the last bit in the register and the status of the first bit in the register is shifted into the output bit in one scan. Here are some characteristics of the Bit Shift Right instruction: Programmed as an output instruction Key sequence [Shift] [Reg] [1] [3] The counter is internally indexed and externally controlled by the ladder diagram logic in your program. Operates in complete mode Requires 6 words of your program
Programming Bit Shift Right Instruction ATTENTION: The counter address specified for the Bit Shift Right instruction should be reserved for that instruction only. Do not manipulate the counter preset or accumulated values. Inadvertent change to these values could result in hazardous or unpredictable machine operation or a run time error. Damage to equipment and/or personal injury could result.
20-6
Page 317
Chapter 20 Bit Shift Registers
To program a Bit Shift Right instruction:
The prompt SHIFT REGISTER 12 appears in the lower left hand corner of the screen. 13
020 10
BIT SHIFT LEFT COUNTER ADDR: 030 NUMBER OF BITS: 001 FILE: 110-110 INPUT: 010/00 OUTPUT: 010/00
030 EN 17 030 DN 15
The format that appears and the technique for insertion of numbers, will be identical to that for Bit Shift Left except that the title will read Bit Shift Right. The instruction should look like Figure 20.5: Figure 20.5 Bit Shift Right Example Rung 020 10
BIT SHIFT LEFT COUNTER ADDR: 030 NUMBER OF BITS: 001 FILE: 110-110 INPUT: 010/00 OUTPUT: 010/00
030 EN 17 030 DN 15
See chapter 19 for the procedure for using the data monitor. Note that bit 00 is the right side bit on the file display and bit 17 is on the left.
Examine Off Bit Shift
This is a condition instruction that examines a user bit in a bit shift register, such as shown in Figure 20.1 or Figure 20.4, for an Off (0) condition. The instruction can be used alone or in conjunction with other condition instructions to affect the rung decision.
20-7
Page 318
Chapter 20 Bit Shift Registers
Here are some characteristics of an Examine Off Bit Shift instruction: Program as an input instruction Key sequence [Shift] [Reg] [1] [8] Requires 3 words of your program Programming an Examine Off Bit Shift Instruction To program an Examine Off Bit Shift:
The prompt SHIFT REGISTER 12 appears in the lower left hand corner of the screen. 070
EXAMINE OFF SHIFT BIT
18 FILE: BIT NO.
00 110 001
A display represented by Figure 20.6 shows the format of an Examine Off Bit Shift. Figure 20.6 Examine Off Bit Shift Format EXAMINE OFF SHIFT BIT FILE: BIT NO.
110 001
Numbers shown are default values. The number of default address digits initially displayed, 3, 4, or 5 will depend on the size of the data table. Initially displayed default values are governed by the I/O rack configuration.
20-8
This Value:
Stores This:
File
Starting address of the file (file of bit shift instruction).
Bit number
Decimal number of the bit to be examined (1-999).
Page 319
Chapter 20 Bit Shift Registers
After you have entered the following conditions: The file starts at word 400 Bit number 67 is for an off (0) condition The instruction should look like Figure 20.7. Figure 20.7 Examine Off Bit Shift Example Rung 070
EXAMINE OFF SHIFT BIT FILE: BIT NO.
Examine On Bit Shift
00 400 067
This condition instruction examines a user specified bit in a bit shift register, such as shown in Figure 20.1 or Figure 20.4, for an On (1) condition. The instruction can be used alone or in conjunction with other input instructions to affect the rung decision. Here are some characteristics of an Examine On Bit Shift instruction: Programmed as an input instruction Key sequence [Shift] [Reg] [1] [9] Requires 3 words of your program.
20-9
Page 320
Chapter 20 Bit Shift Registers
Programming an Examine On Bit Shift Instruction To program an Examine On Bit Shift Instruction:
The prompt SHIFT REGISTER 12 appears in the lower left hand corner of the screen. 070
EXAMINE ON SHIFT BIT
19
00
FILE: BIT NO.
110 001
A display represented by Figure 20.8 shows the format of an Examine On Bit Shift. Figure 20.8 Examine On Bit Shift Format EXAMINE ON SHIFT BIT FILE: BIT NO.
110 001
Numbers shown are default values. The number of default address digits initially displayed, 3, 4, or 5 will depend on the size of the data table. Initially displayed default values are governed by the I/O rack configuration. This Value:
Stores This:
File
Starting address of the file (file of bit shift instruction).
Bit number
Decimal number of the bit to be examined (1-999).
After you have entered the following conditions: The file starts at word 400 Bit number 67 is for an on (1) condition.
20-10
Page 321
Chapter 20 Bit Shift Registers
The instruction should look like Figure 20.9: Figure 20.9 Examine On Bit Shift Example Rung 070
EXAMINE ON SHIFT BIT FILE: BIT NO.
Set Bit Shift
00 400 067
The Set Bit Shift output instruction sets a specified bit in a bit shift register. You specify the bit number of the bit to be set and the starting address of the file. The instruction executes upon a true rung condition. Important: If file is shifted and the Set Bit Shift rung is still true, new data in the same bit position will be set. Here are some characteristics of the Set Bit Shift instruction: Programmed as an output instruction Key sequence [Shift] [Reg] [1] [6] Requires 3 words of your program.
Programming a Set Bit Shift Instruction To program a Set Bit Shift instruction:
The prompt SHIFT REGISTER 12 appears in the lower left hand corner of the screen.
16
020 10
SET SHIFT BIT FILE: BIT NUMBER:
110 001
20-11
Page 322
Chapter 20 Bit Shift Registers
A display represented by Figure 20.10 shows the format of a Set Bit Shift. Figure 20.10 Set Bit Shift Format SET SHIFT BIT FILE: BIT NO.
110 001
Numbers shown are default values. The number of default address digits initially displayed, 3, 4, or 5 will depend on the size of the data table. Initially displayed default values are governed by the I/O rack configuration. This Value:
Stores This:
File
Starting address of the file (file of bit shift instruction).
Bit number
Decimal number of the bit to be examined (1-999).
After entering the following conditions: The file starts at word 400 Bit number 67 (Figure 20.1 or Figure 20.4) is on (1). The instruction should look like Figure 20.11: Figure 20.11 Set Bit Shift Example Rung 020 10
SET SHIFT BIT FILE: BIT NUMBER:
20-12
400 067
Page 323
Chapter 20 Bit Shift Registers
Reset Bit Shift
The Reset Shift Bit output instruction turns off a specified bit in a bit shift register. You specify the bit number of the bit to be turned off and the starting address of the file. The instruction executes upon a true rung condition. Important: If file is shifted, new data in the same bit position will be reset if the Reset Shift Bit rung is still true. Here are some characteristics of a reset shift bit instruction: Programmed as an output instruction Requires 3 words of your program Key sequence [Shift] [Reg] [1] [7]
Programming a Reset Bit Shift Instruction To program a Reset Bit Shift instruction:
The prompt SHIFT REGISTER 12 appears in the lower left hand corner of the screen. 17
020 10
RESET SHIFT BIT FILE: BIT NUMBER:
110 001
20-13
Page 324
Chapter 20 Bit Shift Registers
A display represented by Figure 20.12 shows the format of a Reset Bit Shift. Figure 20.12 Reset Bit Shift Format RESET SHIFT BIT FILE: BIT NO.
110 001
Numbers shown are default values. The number of default address digits initially displayed, 3, 4, or 5 will depend on the size of the data table. Initially displayed default values are governed by the I/O rack configuration. This Value:
Stores This:
File
Starting address of the file (file of bit shift instruction).
Bit number
Decimal number of the bit to be examined (1-999).
After you have entered the following conditions: The file starts at word 4008. Bit number 67 (Figure 20.1 or Figure 20.4 ) is off (0). The instruction should look like Figure 20.13: Figure 20.13 Reset Shift Bit Example Rung 020 10
RESET SHIFT BIT FILE: BIT NUMBER:
20-14
400 067