Allen Bradley PLC Tutorial PDF
Allen Bradley PLC Tutorial PDF
Allen Bradley PLC Tutorial PDF
Allen-Bradley
Memory Location Function
Addressing Before we jump into ladder logic programming, let’s take a moment to review and
Conventions compare the addressing conventions used by PLCDirect and Allen-Bradley.
L205,DL350 or DL405
Not Used 24 23 22 21 20 19 18 17 lamp Number
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit
V40601
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 lamp Number
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 bit
R17 R16
DL330/340
24 23 22 21 20 19 18 17 lamp Number
7 6 5 4 3 2 1 0 bit
R20
Allen-Bradley Memory–A typical address for Allen-Bradley might be N7:0/0 or N27:0/0. The
OP-1124 will allow you to define your starting address for mapping purposes using either
Allen-Bradley’s integer (N7) file type or user-defined integer file types (N9–N255). If you plan
to use an integer file between N9 and N255, you must define these in the Allen-Bradley
memory map before configuring the panel. Below we have shown you how 16-bit integer files
could be used to control the ON/OFF function of the individual lamps.
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 lamp Number
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit
N7: 0/0–0/15
Integer File Type Not Used 24 23 22 21 20 19 18 17 lamp Number
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit
N7: 1/0–1/15
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 lamp Number
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit
User-Defined N27: 0/0–0/15
Integer File Type Not Used 24 23 22 21 20 19 18 17 lamp Number
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit
N27: 1/0–1/15
22
Applying Ladder Logic
DL330/340 Family
Example Memory Locations Function
PLCDirect You control multiple lamps just as you do individual lamps. Each lamp is controlled
Internal Relays by an individual internal control relay. The example below shows how to control
Controlling Multiple Lamps 3, 4 and 23.
Lamps
Function
Example showing how to turn Example Memory Locations
ON Lamp Nos. 3, 4 and 23 with V40600 (C0 to C17) Lamps 1-16 ON/OFF
PLCDirect PLC
V40601 (C20 to C37) Lamps 17-24 ON/OFF
DL205,DL V40602 (C40 to C57) Lamps 1-16 flash
350 or
X12 DL405 V40603 (C60 to C77) Lamps 17-24 flash
Light Lamp 3 C2
OUT
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 lamp Number
X13 Light Lamp 4 C3 17 16 15 14 13 12 11 10 7 6 5 4 3 2 1 0 internal relay number
OUT 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 V40600
DL330/340 Family
Example Memory Locations Function
R16 (C160 to C167) Lamps 1-8 ON/OFF
R17 (C170 to C177) Lamps 9–16 ON/OFF
DL330/340
IO12 C162
Light Lamp 3
OUT 8 7 6 5 4 3 2 1 lamp Number
IO13 Light Lamp 4 C163 7 6 5 4 3 2 1 0 internal relay number
OUT 0 0 0 0 1 01 0 0 R16
PLCDirect In the examples below, we are causing Lamp 4 to flash. Notice we go through two
Internal Relays Used steps to accomplish this. We first turn ON the lamp with C3 or C163 (depending on
to Add Flashing PLC used), and then we add the flashing with C43 or C213. Which control relay you
use in each case, depends on which lamp you are trying to illuminate and the
particular PLC you are using.
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 lamp number
57 56 55 54 53 52 51 50 47 46 45 44 43 42 41 40 internal relay number
0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 V40602
DL330/340 Family
8 7 6 5 4 3 2 1 lamp Number
7 6 5 4 3 2 1 0 internal relay number
0 0 0 0 1 0 0 0 R21 21x
PLCDirect If you do not want to use internal control relays, the next six pages show examples of
Controlling a Lamp controlling the lamps with user memory locations. In all the examples that follow, we
with User Memory have chosen V2000 to be our base address. The 16-bits belonging to V2000 control
(DL205/DL350/DL405 the ON/OFF state of the first two rows of lamps. The next three consecutive memory
Only) words control the bottom row, and the flashing feature. Notice that the hexadecimal
number formed is the sum of all the weights in the 16–bit register that are set to
logical 1. For example, the value 0008 hexadecimal stored at V2000 will turn ON bit 3
controlling Lamp No. 4. The ladder logic shown below demonstrates how this takes
place.
DL205,DL350 or DL405 Families
Example showing how to
turn ON Lamp No. 4 with a Example Memory Locations Function
PLCDirect PLC.
PLCDirect The DL450 has the additional advantage of allowing “bit-of-word” operations. This
Controlling a Lamp allows you to turn on individual bits without the the 2-step process of loading
with Bit-of-Word hexadecimal values into an accumulator and then outputting it to memory. With the
(DL250/350/450 Only) DL450, you merely use the starting number of the 16-bit memory boundary (i.e.
V2000) and then use a decimal point followed by the particular number of the bit you
want to turn ON. In this example, we want to turn ON bit number 3 because it controls
Lamp No. 4. Remember that bits number right to left starting with 0. You can trigger
this output using the usual data types or nicknames for open and closed contacts.
Here we have used X12 for example.
DL250/350/450 Only
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 lamp number
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 V2000
27
27
Applying Ladder Logic
PLCDirect The same process is used for turning ON several lamps as for turning on one lamp.
Controlling Multiple Notice that here we are using both words of memory reserved for ON/OFF control,
Lamps with User because we are turning ON lamps in both the top row and the bottom row.
Memory
(DL205/DL350/DL405
Only)
DL205,DL350 or DL405 Families
Example showing how to
turn ON Lamp Nos. 3, 4 and
Example Memory Locations Function
23 with PLCDirect PLC
V2000 Lamps 1-16 ON/OFF
X12 V2001 Lamps 17-24 ON/OFF
LD V2002 Lamps 1-16 flash
KC
V2003 Lamps 17-24 flash
PLCDirect Turning ON more than one lamp when using the DL450 greatly simplifies matters.
Controlling Multiple Because it allows you to use “bit-of-word” opeations, you do not have to calculate a
Lamps with hexadecimal value that will turn on the correct bits. With the DL450, you merely use
Bit-of-Word the starting number of the 16-bit memory boundary (i.e. V2000) and then use a
(DL250/350/450 Only) decimal point followed by the particular number of the bit you want to turn ON. In this
example, we want to turn ON bit numbers 2, and 3 of V2000; and bit number 4 of
V2001 because they control Lamp Nos. 3, 4 and 23. Remember that bits number
right to left starting with 0. You can trigger this output using the usual data types or
nicknames for open and closed contacts. Here we have used X12 for example.
DL250/350/450 Only
Example showing how to turn
ON Lamp Nos. 3, 4 and 23
Example Memory Locations Function
with PLCDirect DL450 PLC
V2000 Lamps 1-16 ON/OFF
X12 V2000.2 V2001 Lamps 17-24 ON/OFF
OUT V2002 Lamps 1-16 flash
V2003 Lamps 17-24 flash
V2000.3
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 lamp Number
OUT
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit
0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 V2000
V2001.6
OUT
Not Used 24 23 22 21 20 19 18 17 lamp Number
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 V2001
29
29
Applying Ladder Logic
PLCDirect Remember from our table on the previous page that bits in V2002 and V2003 control
Adding the Flashing the flashing feature. Notice that you must first turn ON a lamp before you can also
with User Memory make it flash. In other words, in this example, it would not be enough to just turn ON
(DL205/DL350/DL405 bit 3 in V2002 in order to have the 4th lamp flash. You have to turn ON the bit in V2000
Only) also.
0 0 0 8
V2002=0008
30
Applying Ladder Logic
PLCDirect To add flashing when using the DL450, you can use the “bit-of-word” operation. This
Adding Flashing with precludes you from having to load a hexadecimal number in the accumulator
Bit-of-Word followed by an output to memory. Instead, you merely use the decimal point
(DL250/350/450 Only) convention coupled with the V-memory location to designate the bit you want turned
ON. In this example, we want to turn ON bit number 3 of V2000 and bit number 3 of
V2002. One memory location controls turning ON the lamp, and the other controls
adding the flashing feature.
V2002.3
OUT
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 lamp Number
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit
0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 V2002
31
31
Applying Ladder Logic
10 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 lamp Number
3
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 N7: 0/0–0/15
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 lamp Number
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit
Add flashing 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 N7: 0/0-0/15
I:2 N7:2
12
3
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 lamp Number
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit
0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 N7: 2/0-2/15
33
33
Applying Ladder Logic
Test Routine for This is a simple test routine for checking the lamp operation for your OP-1124 panel.
Checking Lamp Notice for PLCDirect we have chosen to use the starting address V40600 which is
Operation the starting address for internal control relays (C0–C17). By using the internal
control relays, you can avoid having to load hexadecimal values into an accumulator
and outputting to V-memory. When the shift register is turned ON, each lamp should
turn ON sequentially starting with Lamp 1 and proceeding to Lamp 24. When the
Shift Register finally turns ON C27 (Lamp 24), it resets to zero.
For the Allen-Bradley, we are using a starting address of N7:0/0. We have created a Bit Shift
Left Register with 25 bits. We are sequentially turning ON bits from left to right in the shift
register. This turns on Lamps 1 through 24 one at a time. When the 25th bit is reached, the
shift register is reset by loading 0’s in each of the bit positions.
I:1 C5:0 B3
X0 Turn ON C100 internal relay C100
SET 0 DN 0
SR C0
0
C27 BSL
SP4 Clock Shift Register B3 S:4
Bit Shift Left EN
File #N7:0
0 5 Control R6:0
C100 Shift Register Reset Bit Address B3/0 DN
Length 25
MOV
C27 Start 1 Second Timer C5:0
TMR T0
MOVE
Source 0
K10
DN Dest N7:0
0
TO Reset C100 when Timer times out C100
MOV
RST
MOVE
Source 0
Dest N7:1
0
C5:0
RES
CTU
R6:0
Count UP
Counter C5:0 CU
EN Preset 25
END Accum 0 DN
END