SlideShare a Scribd company logo
Allen Bradley Counters 
Counters 
Chapter 05 
Northampton Community College 1
Counters 
Northampton Community College 2 
 
Common applications of counters include keeping track of 
the number of items moving past a given point, or 
determining the number of times a given action occurs. 
A preset counter can control an 
external circuit when its counted 
total matches the user-entered 
preset limits.
Mechanical Counters 
Northampton Community College 3 
 
Programmed counters can serve 
the same functions as 
mechanical counters. 
 
Every time the actuating lever is 
moved or rotated, the counter 
adds one number. The actuating 
lever then returns automatically 
to its original position. Resetting 
the counter to zero is usually 
done with a pushbutton located 
on the unit.
Electronic Counters 
Northampton Community College 4 
 
Electronic counters can count up, count down, or be 
combined to count up and down. They are dependent on 
external sources such as parts traveling past a sensor or 
actuating a limit switch for counting. 
Counter 
Applications 
Rotary Encoder 
Rotary 
Encoder
Counter Counting Sequence 
Northampton Community College 5 
 
PLC counters are normally retentive. 
 Whatever count was contained in the counter at the time of a 
processor shutdown will be restored to the counter on power-up. 
 
The counter can be reset on power-up if the reset condition 
is activated at the time of power restoration. 
 
PLC counters can be designed to count up to a preset 
value or to count down to a preset value.
SLC-500/LogixPro Default Data File Types 
FILE TYPE IDENTIFIER FILE 
NUMBER 
Output O 0 
Input I 1 
Status S 2 
Bit B 3 
Timer T 4 
Counter C 5 
Control R 6 
Integer N 7 
Float Point * F 8 
* Available in SLC-5/03 OS301, OS302 & SLC-5/04 OS400, OS401 & 
SLC-5/05 processors 
Northampton Community College 6
SLC-500 User Defined Data File Types 
FILE TYPE IDENTIFIER FILE NUMBER 
Bit B 9 - 255 
Timer T 9 - 255 
Counter C 9 - 255 
Control R 9 - 255 
Integer N 9 - 255 
Float Point * F 9 - 255 
String* St 9 - 255 
ASCII * A 9 - 255 
File #9 has a special purpose. It is called the “Computer Interface File” (CIF) and is 
used when communications is required between early AB PLCs 
* Available in SLC-5/03 OS301, OS302 & SLC-5/04 OS400, OS401 & SLC-5/05 
processors 
Note: User defined files are not available in LogixPro 
Northampton Community College 7
SLC-500’s/ControlLogix & LogixPro Counters 
Northampton Community College 8 
 
The SLC-500/Micrologix series has three counters and 
ControlLogix and LogixPro Simulator has two counters: 
 CTU – Count Up (SLC500’s/Micrologix, ControlLogix & LogixPro) 
 CTD – Count Down (SLC500’s/Micrologix, ControlLogix & LogixPro) 
 HSC – High Speed Counter 
The HSC is only available in selected AB Micrologix series controllers 
 
Counter instructions are output instructions therefore they 
will always be placed against the right power rail. 
 Output instructions in the SLC500 series are always placed against the right power rail 
with multiple output instructions on the same rung being placed in branches. 
 In the ControlLogix platform output devices are also placed against the right power rail 
with multiple outputs on the same rung being branched. But the output instructions 
can be placed in series on the rung. 
 In LogixPro the output instruction should be placed against the right power rail and 
multiple outputs on the same rung should be placed in branches. Output instructions 
can be placed in series, but incorrect operation can occur.
Count Up Counters (CTU) – SLC500s & LogixPro 
 
Counters have three instruction parameters: 
Counter number 
or Address of 
the counter 
Preset – Number of 
items or events to 
count before an output 
occurs 
Accumulator – The 
current number of 
counts on the counter 
Northampton Community College 9
Counter Parameters 
Northampton Community College 10 
 
Counter 
 The address of the counter. 
 Counters are stored, by default, in data file #5 and use a file 
designator of ‘C’. The valid range of counters is 0 to 255. Therefore, 
for this example we will use C5:0, the first counter in the file. 
 
Preset Value (PRE) 
 The preset value is the number of counts that should occur before 
the counting event is done. The value range is: 
For the SLC500’s: -32,768 to 32,767. 
For the LogixPro simulator: -2,147,483,648 to 2,147,483,647 
For ControlLogix: -2,147,483,648 to 2,147,483,647 
 
Accumulator Value (ACC) 
 Stores the current count value of the counter. The value ranges are 
the same as the Preset parameter.
Counter Memory – SLC500’s & LogixPro 
Northampton Community College 11 
 
Each counter, of any type, in the SLC500’s requires three 
16-bit words in the counter memory. 
 
Each counter, of an type, in the LogixPro simulator requires 
three 32-bit words in the counter memory. 
 Word 0 – Stores the status bits of the counter 
 Word 1 – Stores the preset value 
 Word 2 – Stores the accumulator value
Counter Memory Word 0, Status Bits 
SLC500 & LogixPro 
Northampton Community College 12 
 
Counters have status bits that are stored in word 0. Some 
of these bits are unique to the type of counter being 
programmed and some of the bits are used for all counter 
types. 
 Bit 10 or Bit (UA) – Update Accumulator Bit 
Select Micrologix units only 
 Bit 11 or Bit (UN) – Underflow Bit 
Count Down counter only 
 Bit 12 or Bit (OV) – Overflow Bit 
Count Up counter only 
 Bit 13 or Bit (DN) – Done Bit 
Count Up and Count Down counter 
 Bit 14 or Bit (CD) – Count Down Bit 
Count Down counter only 
 Bit 15 or Bit (CU) – Count Up Bit 
Count Up counter only
Counter Memory – SLC500’s & LogixPro 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
Word 0 CU CD DN OV UN UA NA NA Reserved 
Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Northampton Community College 13 
 
Count Up (CU) 
 Sets to a logic ‘1’ when the rung containing the Count Up (CTU) counter is 
true, otherwise it is a logic ‘0’. 
 
Count Down (CD) 
 Sets to a logic ‘1’ when the rung containing the Count Down (CTD) counter 
is true, otherwise it is a logic ‘0’. 
 
Done (DN) 
 Sets to a logic ‘1’ when the Accumulator value is greater than or equal to the 
preset value (ACC ≥ PRE), otherwise it is a logic ‘0’.
Counter Memory – SLC500’s & LogixPro 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
Word 0 CU CD DN OV UN UA NA NA Reserved 
Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Northampton Community College 14 
 
Overflow (OV) – SLC500 
 Used with the Count Up counter (CTU). If the accumulator has reached the 
maximum positive value of +32,767 and the counter is incremented up again, 
the accumulator will wrap around to -32,768. When this “wrap around” occurs, 
the Overflow (OV) bit will set to a logic ‘1’. If the Done (DN) bit is set to a ‘1’ 
and the counter overflows the Done (DN) bit will remain a ‘1’, even if the 
accumulator is less than the preset (ACC < PRE). The counter must be reset 
with the RES instruction to reset the Overflow (OV) bit to a logic ‘0’ and to clear 
the Done (DN) bit.
Counter Memory – SLC500’s & LogixPro 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
Word 0 CU CD DN OV UN UA NA NA Reserved 
Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Northampton Community College 15 
 
Overflow (OV) – LogixPro 
 Used with the Count Up counter (CTU). If the accumulator has reached the 
maximum positive value of +32,767 and the counter is incremented up again, 
the Overflow (OV) bit will set to a logic ‘1’, the Done (DN) bit will reset to a ‘0’ 
and the accumulator will contain the value of +32,768. If the CTU counter rung 
continues to transition from false-to-true, the Overflow (OV) bit will remain on, 
the Done (DN) bit will remain off and the accumulator will continue counting up 
to a max. count of +2,147,483,647. When the max. count is achieved, the 
counter will stop counting up even if the rung continues to transition from false-to- 
true. The counter must be reset with the RES instruction to reset the 
Overflow (OV) bit to a logic ‘0’.
Counter Memory – SLC500’s & LogixPro (lower word) 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
Word 0 CU CD DN OV UN UA NA NA Reserved 
Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Northampton Community College 16 
 
Underflow (UN) – SLC500 
 Used with the Count Down (CTD) counter. If the accumulator has reached 
the minimum negative value of -32,768 and the counter is decremented 
down again, the accumulator will wrap around to +32,767. When this “wrap 
around” occurs, the Underflow (UN) bit will set to a logic ‘1’. If the Done (DN) 
bit is set to a ‘1’ and the counter underflows the Done (DN) bit will remain a 
‘1’, even if the accumulator is less than the preset (ACC < PRE). The 
counter must be reset with the RES instruction to reset the Underflow (UN) 
bit to a logic ‘0’ and Done (DN) bit to clear.
Counter Memory – SLC500’s & LogixPro (lower word) 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
Word 0 CU CD DN OV UN UA NA NA Reserved 
Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Northampton Community College 17 
 
Underflow (UN) – LogixPro 
 Used with the Count Down counter (CTD). If the accumulator has reached 
the minimum negative value of -32,768 and the counter is decremented 
down again, the Underflow (UN) bit will set to a logic ‘1’, the Done (DN) bit 
will be set to a logic ‘1’ and the accumulator will contain a value of -32,769. 
If the CTD counter rung continues to transition from false-to-true, the 
Underflow (UN) bit and the Done (DN) bit will remain on and the 
accumulator will continue counting down to a minimum count of 
-2,147,483,648. When the minimum count is achieved the counter will stop 
counting down even if the rung continues to transition from false-to-true. 
The counter must be reset with the RES instruction to reset the Underflow 
(UN) bit to a logic ‘0’ and to clear the Done (DN) bit.
Counter Memory – Select Micrologix Processors 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
Word 0 CU CD DN OV UN UA NA NA Reserved 
Word 1 Preset Value 
Word 2 Accumulator Value 
Northampton Community College 18 
 
Update Accumulator (UA) 
 This bit is only used with the High Speed Counter (HSC). This counter is 
only available in select Micrologix units. For more information on this bit, 
refer to the RSLogix 500 help file.
CTU Functionality 
Northampton Community College 19 
 
Count Up counters count false to true rung 
transitions. That is, when the rung 
containing the counter transitions from false 
to true, the accumulator increments up by 
one count. When the rung transitions from 
true to false, nothing happens at the 
counter. 
 
When the rung is true, the Count Up (CU) 
bit is set to a ‘1’. When the rung is false, the 
Count Up (CU) bit is reset to a ‘0’. 
 
When the ACC ≥ PRE, the Done (DN) is set 
to a ‘1’. An RES instruction is required to 
reset the accumulator to zero. 
Rung CU OV DN ACC 
0 0 1 
0 0 2 
0 0 59 
0 1 100 
0 1 128 
0 1 32,767 
1 1 -32,768
Counter Addressing; SLC500’s and LogixPro 
Northampton Community College 20 
 
Counters, by default, are stored in data file #5 and have a 
file designator of ‘C’. Therefore, counter number zero is 
addressed as C5:0. 
 
There are two main forms of addressing in AB; Bit level and 
Word level. To address the status bits of a counter, use bit 
level addressing as follows: 
 C5:0/11 or C5:0/UN = Underflow Bit 
 C5:0/12 or C5:0/OV = Overflow Bit 
 C5:0/13 or C5:0/DN = Done Bit 
 C5:0/14 or C5:0/CD = Count Down Bit 
 C5:0/15 or C5:0/CU = Count Up Bit
Counter Adressing; SLC500’s and LogixPro 
Northampton Community College 21 
 
Word level addresses are used to address the value of a 
16-bit word in the SLC500 series or a 32-bit word in the 
LogixPro simulator. Therefore, to read the value of the 
counter accumulator or preset use a word level address as 
follows: 
 C5:0.1 or C5:0.PRE = Value of counter zero’s preset 
 C5:0.2 or C5:0.ACC = Value of counter zero’s accumulator 
 
Almost any word in the AB memory structure can be 
addressed to bit level, here is an example: 
 C5:0.ACC/8 
This is a bit level address that is referencing bit-8 in the accumulator 
word of counter zero.
Example of Programming CTU Status Bits 
SLC500 Counter shown 
Northampton Community College 22
Count Up Counters (CTU) - ControlLogix 
Counter tag name: 
Ex. TotalCartons 
Preset – Number of 
events to count before 
an output occurs 
Accumulator – The 
current number of 
counts on the counter 
ControlLogix counters function exactly like counters in the SLC500 
series and LogixPro 
Northampton Community College 23
Count Parameters - ControlLogix 
Northampton Community College 24 
 
Counter 
 The tag name of the counter. Example: TotalCartons. The tag is 
created as a Counter Data Type. The Counter data type is a 
Structure because each counter uses more than one word. 
 
Preset Value (PRE) 
 The preset value is the number of counts the counter should 
accumulate before an output occurs. 
The valid range is: -2,147,483,648 to 2,147,483,647. 
 
Accumulator (ACC) 
 Stores the current counts of the counter.
Counter Memory - ControlLogix 
Northampton Community College 25 
 
Counters use a data type of type Counter. 
 
The Counter data type is a Structure. 
 
The counter structure consists of three, 32-bit words. 
 
The ControlLogix counters have a total of five status bits. 
Some of these bits are used only for the CTU counter, some 
are used only for the CTD counter and some are shared 
with the CTU and CTD counters. These bits function exactly 
like the SLC500 counter status bits. The only difference is 
how they are referenced.
Counter Memory - ControlLogix 
Northampton Community College 26 
 
Referencing counter status bits: 
 Done Bit – TotalCartons.DN 
 Count Up Bit – TotalCartons.CU 
 Count Down Bit – TotalCartons.DN 
 Overflow Bit – TotalCartons.OV 
 Underflow Bit – TotalCartons.UN 
The plus (+) sign is 
used to expand a 
structure. The minus 
(-) is used to 
collapse a structure 
Structure 
members 
Data types of 
the members
ControlLogix Counter 
When will the OV CU bit turn on? 
When will the DN bit turn on? 
When When the the CTU ACC rung wraps is true. from In 2,147,483,647 this example to 
for 
When the ACC ≥ PRE or ACC ≥ 10,000 
One scan because -2,147,483,648 
of the ONS instruction 
Northampton Community College 27
Count Down Counter – CTD 
Northampton Community College 28 
 
Counters have three instruction parameters (SLC500 counter 
shown): 
Counter number 
or Address of 
the counter 
Preset – Number of 
events to count before 
an output occurs 
Accumulator – 
The current 
number of counts 
on the counter
Counter Parameters 
Northampton Community College 29 
 
Counter 
 The address of the counter. 
 Counters are stored, by default, in data file #5 and use a file 
designator of ‘C’. The valid range of counters is 0 to 255. Therefore, 
for this example we will use C5:1, the second counter in the file. 
 
Preset Value (PRE) 
 The preset value is the number of counts that should occur before 
the counting event is done. The value range is: 
 For the SLC500’s: -32,768 to 32,767. 
 For the LogixPro simulator: -2,147,483,648 to 2,147,483,647 
 For ControlLogix: -2,147,483,648 to 2,147,483,647 
 
Accumulator Value (ACC) 
 Stores the current count value of the counter.
Counter Memory – SLC500 & LogixPro 
Northampton Community College 30 
 
Each counter, of any type, in the SLC500’s requires three 
16-bit words in the counter memory. 
 
Each counter, of an type, in the LogixPro simulator requires 
three 32-bit words in the counter memory. 
 Word 0 – Stores the status bits of the counter 
 Word 1 – Stores the preset value 
 Word 2 – Stores the accumulator value
Counter Memory Word 0, Status Bits – SLC500 & 
LogixPro 
Northampton Community College 31 
 
Counters have status bits that are stored in word 0. Some 
of these bits are unique to the type of counter being 
programmed and some of the bits are used for all counter 
types.. 
 Bit 10 or Bit (UA) – Update Accumulator Bit 
Select Micrologix units only 
 Bit 11 or Bit (UN) – Underflow Bit 
Count Down counter only 
 Bit 12 or Bit (OV) – Overflow Bit 
Count Up counter only 
 Bit 13 or Bit (DN) – Done Bit 
Count Up and Count Down counter 
 Bit 14 or Bit (CD) – Count Down Bit 
Count Down counter only 
 Bit 15 or Bit (CU) – Count Up Bit 
Count Up counter only
Counter Memory – SLC500’s & LogixPro 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
Word 0 CU CD DN OV UN UA NA NA Reserved 
Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Northampton Community College 32 
 
Count Up (CU) 
 Sets to a logic ‘1’ when the rung containing the Count Up (CTU) counter is 
true, otherwise it is a logic ‘0’. 
 
Count Down (CD) 
 Sets a logic ‘1’ when the rung containing the Count Down (CTD) counter is 
true, otherwise it is a logic ‘0’. 
 
Done (DN) 
 Sets to a logic ‘1’ when the Accumulator value is greater than or equal to the 
preset value (ACC ≥ PRE), otherwise it is a logic ‘0’.
Counter Memory – SLC500’s & LogixPro 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
Word 0 CU CD DN OV UN UA NA NA Reserved 
Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Northampton Community College 33 
 
Overflow (OV) – SLC500 
 Used with the Count Up counter (CTU). If the accumulator has reached the 
maximum positive value of +32,767 and the counter is incremented up again, 
the accumulator will wrap around to -32,768. When this “wrap around” occurs, 
the Overflow (OV) bit will set to a logic ‘1’. If the Done (DN) bit is set to a ‘1’ 
and the counter overflows the Done (DN) bit will remain a ‘1’, even if the 
accumulator is less than the preset (ACC < PRE). The counter must be reset 
with the RES instruction to reset the Overflow (OV) bit to a logic ‘0’ and to clear 
the Done (DN) bit.
Counter Memory – SLC500’s & LogixPro 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
Word 0 CU CD DN OV UN UA NA NA Reserved 
Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Northampton Community College 34 
 
Overflow (OV) – LogixPro 
 Used with the Count Up counter (CTU). If the accumulator has reached the 
maximum positive value of +32,767 and the counter is incremented up again, 
the Overflow (OV) bit will set to a logic ‘1’, the Done (DN) bit will reset to a ‘0’ 
and the accumulator will contain the value of +32,768. If the CTU counter rung 
continues to transition from false-to-true, the Overflow (OV) bit will remain on, 
the Done (DN) bit will remain off and the accumulator will continue counting up 
to a max. count of +2,147,483,647. When the max. count is achieved, the 
counter will stop counting up even if the rung continues to transition from false-to- 
true. The counter must be reset with the RES instruction to reset the 
Overflow (OV) bit to a logic ‘0’.
Counter Memory – SLC500’s & LogixPro (lower word) 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
Word 0 CU CD DN OV UN UA NA NA Reserved 
Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Northampton Community College 35 
 
Underflow (UN) – SLC500 
 Used with the Count Down (CTD) counter. If the accumulator has reached 
the minimum negative value of -32,768 and the counter is decremented 
down again, the accumulator will wrap around to +32,767. When this “wrap 
around” occurs, the Underflow (UN) bit will set to a logic ‘1’. If the Done (DN) 
bit is set to a ‘1’ and the counter underflows the Done (DN) bit will remain a 
‘1’, even if the accumulator is less than the preset (ACC < PRE). The 
counter must be reset with the RES instruction to reset the Underflow (UN) 
bit to a logic ‘0’ and Done (DN) bit to clear.
Counter Memory – SLC500’s & LogixPro (lower word) 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
Word 0 CU CD DN OV UN UA NA NA Reserved 
Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) 
Northampton Community College 36 
 
Underflow (UN) – LogixPro 
 Used with the Count Down counter (CTD). If the accumulator has reached 
the minimum negative value of -32,768 and the counter is decremented 
down again, the Underflow (UN) bit will set to a logic ‘1’, the Done (DN) bit 
will be set to a logic ‘1’ and the accumulator will contain a value of -32,769. 
If the CTD counter rung continues to transition from false-to-true, the 
Underflow (UN) bit and the Done (DN) bit will remain on and the 
accumulator will continue counting down to a minimum count of - 
2,147,483,648. When the minimum count is achieved the counter will stop 
counting down even if the rung continues to transition from false-to-true. 
The counter must be reset with the RES instruction to reset the Underflow 
(UN) bit to a logic ‘0’ and to clear the Done (DN) bit.
Counter Memory – Select Micrologix Processors 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
Word 0 CU CD DN OV UN UA NA NA Reserved 
Word 1 Preset Value 
Word 2 Accumulator Value 
Northampton Community College 37 
 
Update Accumulator (UA) 
 This bit is only used with the High Speed Counter (HSC). This counter is 
only available select Micrologix units. For more information on this bit, refer 
to the RSLogix help file.
CTD Functionality 
Reset the CTD 
counter. 
Field device is NC 
RES_CTD_CNTR 
I:1 
10 
Count DOWN counter 
CTD_COUNTER 
C5:1 
Northampton Community College 38 
 
0006 
Count Down counters count false to true 
rung transitions. That is, when the rung 
containing the counter transitions from false 
to true, the accumulator decrements down 
by one count. When the rung transitions 
from true to false, nothing happens at the 
counter. 
 
When the rung is true, the Count Down 
(CD) bit is set to a ‘1’. When the rung is 
false, the Count Down (CD) bit is reset to a 
‘0’. 
 
When the ACC ≥ PRE, the Done (DN) is set 
to a ‘1’. An RES instruction is required to 
reset the accumulator to zero. 
RES 
Rung CD UN DN ACC 
0 1 -1 
0 1 -36 
0 1 -50 
0 0 -51 
0 0 -32,768 
1 0 32,767
Counter Addressing; SLC500’s and LogixPro 
Northampton Community College 39 
 
Counters, by default, are stored in data file #5 and the file 
designator is ‘C’. Therefore, counter number one is 
addressed as C5:1 
 
There are two main forms of addressing in AB; Bit level and 
Word level. To address the status bits of a counter use bit 
level addressing as follows: 
 C5:1/11 or C5:1/UN = Underflow Bit 
 C5:1/12 or C5:1/OV = Overflow Bit 
 C5:1/13 or C5:1/DN = Done Bit 
 C5:1/14 or C5:1/CD = Count Down Bit 
 C5:1/15 or C5:1/CU = Count Up Bit
Counter Addressing; SLC500’s and LogixPro 
Northampton Community College 40 
 
Word level addresses are used to address the value of a 
16-bit word in the SLC500’s or a 32-bit word in the LogixPro 
simulator. Therefore, to read the value of the counter 
accumulator or preset use a word level address as follows: 
 C5:1.1 or C5:1.PRE = Value of counter one’s preset 
 C5:1.2 or C5:1.ACC = Value of counter one’s accumulator 
 
Almost any word in the AB memory structure can be 
addressed to bit level, here is an example: 
 C5:1.ACC/8 
This is a bit level address that is referencing bit-8 in the accumulator 
word of counter one.
ControlLogix CTD Counter 
Northampton Community College 41 
 
The ControlLogix CTD counter functions exactly like the 
SLC500 series and LogixPro CTD counter. 
 
It uses a Counter data type. The data type is a structure.
Counter Examples 
Northampton Community College 42
Parts Counting Program 
Northampton Community College 43 
 
Counter C5:2 counts the total 
number of parts coming off an 
assembly line for final packaging. 
 
Each package must contain 10- 
parts. 
 
When 10-parts are detected, 
counter C5:1 sets bit B3:0/1 to 
initiate the box closing sequence. 
 
Counter C5:3 counts the total 
number of packages filled per 
day. 
 
A pushbutton is used to restart 
the total part and package count 
to zero, daily.
Part Counting Program 
SLC500 Counters shown 
Program continued on next slide 
Northampton Community College 44
Part Counting Program 
SLC500 Counters shown 
Northampton Community College 45
Conveyor Motor Circuit 
Northampton Community College 46 
 
This circuit will use a oneshot for 
reset and another oneshot to 
prevent proximity switch chatter. 
 
Sequential task: 
 The start pushbutton is pressed 
to start the conveyor motor. 
 Cases move pass the proximity 
switch and increment the 
counters accumulated value. 
 After a count of 50, the conveyor 
motor stops automatically and 
the counter’s accumulated value 
is reset to zero. 
 The conveyor motor can be 
stopped or started manually at 
any time without loss of the 
accumulated counts. 
Proximity 
switch 
Case 
Conveyor motor 
Start/Stop station 
Count reset 
button
Conveyor Motor Program 
ControlLogix ladder shown 
Northampton Community College 47
Alarm Monitor Program 
Northampton Community College 48 
 
The alarm is triggered by the closing of liquid level switch LS1. 
 
The alarm light will flash whenever the alarm condition is triggered and 
has not been acknowledged, even if the alarm condition clears in the 
meantime. 
 
The alarm is acknowledged by closing selector switch SS1. 
 
The alarm light will operate in the steady mode when the alarm trigger 
condition exists but has been acknowledged.
Alarm Monitor Program 
LogixPro Timers & Counters shown 
Northampton Community College 49
Parking Garage Counter Program 
Northampton Community College 50 
 
As a car enters the parking garage it triggers an up counter and 
increments the accumulator by one count. 
 
As a car leaves the parking garage it triggers a down counter and 
decrements the accumulator by one count. 
 
The up and down counters will use the same address. Since the 
counters have the same address the accumulated value is the same for 
both counters. 
 
Whenever the accumulator value is equal to the preset value the counter 
output is energized to light the “Lot Full” sign.
Parking Garage Counter Program 
SLC500 Counters shown 
Northampton Community College 51
In Process Monitoring System 
Northampton Community College 52 
 
Before start-up, the system is completely empty of parts and the counter 
is reset manually to zero. 
 
When the operation begins, raw parts move through the in-feed sensor 
with each part generating an up count. 
 
After processing, finished parts appearing at the out-feed sensor 
generate down counts, so the accumulated count of the counter 
continuously indicates the number of in-process parts.
In Process Monitoring System 
ControlLogix Counters shown 
Northampton Community College 53
More Counter Information 
Northampton Community College 54
Counter Speed 
 
The maximum speed of 
transitions that can be counted is 
determined by the processor 
scan time. Any counter input 
signal must be fixed for one scan 
time to be counted reliably. 
 
If the input changes faster than 
one scan cycle, the count value 
will become unreliable because 
counts will be missed. When this 
is the case a high-speed counter 
instruction or module is required. 
Northampton Community College 55
Cascading Counters 
Northampton Community College 56 
 
Depending upon the application, 
it might be necessary to count 
events that exceed the maximum 
number allowable per counter 
instruction. One way of 
accomplishing count values that 
exceed the maximum allowed is 
by interconnection, or cascading, 
counters.
Counting Beyond the Maximum Count – SLC500 
SLC500 Counters shown 
How many counts occur before O:5/13 energizes? 
C5:1.ACC + C5:3.ACC = 32,767 + 300 = 33,067 
Northampton Community College 57
Optical Encoder 
Northampton Community College 58 
 
An optical encoder creates a 
series of square waves as its 
shaft is rotated. 
 
The encoder disk interrupts the 
light as the encoder shaft is 
rotated to produce a square 
wave output waveform.
Optical Encoder 
 
The number of square waves 
obtained from the output of the 
encoder can be made to 
correspond to the mechanical 
movement that has occurred. 
 
To divide a shaft revolution into 
1,024 parts, an encoder could be 
selected to supply at least 1,024 
pulses (square wave cycles) per 
revolution. By using a counter to 
count those cycles it can be 
determined how far the shaft has 
rotated. 
 
A special high speed counting 
module might be required for 
these types of applications 
1024 
0 
Northampton Community College 59
More Counter Examples 
Northampton Community College 60
Cutting Material to a Specific Size 
Northampton Community College 61 
 
The material is advanced for a specific distance and measured by 
encoder pulses to determine the correct length for cutting.
Counter Used for Length Measurement 
Northampton Community College 62 
 
Count input pulses are generated by the magnetic sensor mounted such 
that it detects passing teeth on a conveyor drive sprocket. If 10-teeth per 
foot of conveyor motion pass the sensor, the accumulated count of the 
counter would indicate feet in tenths. 
 
The photoelectric sensor monitors a reference point on the conveyor. 
When activated, it prevents the unit from counting thus permitting the 
counter to accumulate counts only when bar stock is moving.
Combining Counter and Timer Functions 
Automatic Stacking Process 
Northampton Community College 63 
 
When the start pushbutton is 
pressed conveyor M1 begins 
running. 
 
After 15-plates have been 
stacked, conveyor M1 stops and 
conveyor M2 begins running. 
 
After conveyor M2 has been 
operated for 5-seconds it stops 
and the sequence is repeated 
automatically. 
 
The done bit of the timer resets 
the timer and the counter and 
provides a momentary pulse to 
automatically restart conveyor 
M1 Can you see anything wrong with this process? 
If so, what is wrong? 
The biggest problem with this 
process is that timers should never 
be used for control. M2 will run for 
5-second, but what if something 
happens that the complete stack 
only moves to a point where the 
light sensors are no longer sensing 
them? There really should be a 
sensor sensing when the complete 
stack is clear of the stacker.
Automatic Stacking Program 
Northampton Community College 64
Motor Lock-Out Program 
 
Designed to prevent a machine 
operator from starting a motor 
that has tripped off more than 5- 
times in an hour. 
 
The normally open (OL) relay 
contact momentarily closes each 
time an overload current is 
sensed. 
 
Every time the motor stops due 
to an overload condition, the 
motor start circuit is locked out 
for 5-minutes. 
 
If the motor trips off more than 5- 
times in an hour, the motor start 
circuit is permanently locked out 
and cannot be started until the 
reset button is actuated. 
Northampton Community College 65
Motor Lock-Out Program 
Northampton Community College 66

More Related Content

PDF
Introducing Apple iPhone 6s
PDF
IRJET- Design and Performance Curve Generation by CFD Analysis of Centrifugal...
PPTX
Gear and bearings
PPTX
Numerical problems on spur gear (type ii)
PPTX
Bearings
DOCX
Parking Control System using PLC
PPTX
09 chapter04 timers_fa14
PPTX
ControlLogix Counters FA16
Introducing Apple iPhone 6s
IRJET- Design and Performance Curve Generation by CFD Analysis of Centrifugal...
Gear and bearings
Numerical problems on spur gear (type ii)
Bearings
Parking Control System using PLC
09 chapter04 timers_fa14
ControlLogix Counters FA16

Similar to 10 chapter05 counters_fa14 (20)

PDF
Automation and Robotics Week 02 Theory Notes 20ME51I.pdf
PPTX
Lecture_25-26_PLC_Data Comparison, Arithmatic Operations, Counters.pptx
PPT
PLC Basics programming and easy to learn by yourself
PDF
D. CHAPTER dffrtgfffffffgggfffdddFIVE.pdf
PPT
Counters ibrahem
PPTX
11 chapter06 slc_int_float_mov_mvm_fa14
PPTX
05 chapter03 03_memory_structure_slc500_fa16
PDF
PLC.pdf
PPTX
Digital Components
PPT
8254 PIT
PPT
Programmable logic controllers
PPT
Introduction to plc (s7)­
PDF
Elements of Industrial Automation Week 06 Notes.pdf
PPTX
digital electronics counters topics.pptx
PPT
PLC Processor RSLOGIX AB CPU Chapter 11.ppt
PPTX
Digital Electronics Registers and Counters.pptx
PPT
Programmable logic Controlller ppt
Automation and Robotics Week 02 Theory Notes 20ME51I.pdf
Lecture_25-26_PLC_Data Comparison, Arithmatic Operations, Counters.pptx
PLC Basics programming and easy to learn by yourself
D. CHAPTER dffrtgfffffffgggfffdddFIVE.pdf
Counters ibrahem
11 chapter06 slc_int_float_mov_mvm_fa14
05 chapter03 03_memory_structure_slc500_fa16
PLC.pdf
Digital Components
8254 PIT
Programmable logic controllers
Introduction to plc (s7)­
Elements of Industrial Automation Week 06 Notes.pdf
digital electronics counters topics.pptx
PLC Processor RSLOGIX AB CPU Chapter 11.ppt
Digital Electronics Registers and Counters.pptx
Programmable logic Controlller ppt
Ad

More from John Todora (20)

PPTX
04 scaling analog_datal_sp17
PPTX
03 analog control_sp17
PPTX
01 control logix_arrays_sp17
PPTX
Comparison instructions, AB, Siemens and AB CCW
PPTX
Lab02 review
PPTX
Subroutines rev01 fa16
PPTX
Move mask moves_rev01_fa16
PPTX
Math cl ccw_siemens_rev01_fa16
PPTX
Lab02 lead in
PPTX
ControlLogix Timers FA16
PPTX
02 chapter02 fa16
PPTX
01 introduction to_plc-pac_rev01_fa16
PPTX
07 chapter07 loop_diagrams
PPTX
06 chapter06 binary_logic_systems_Rev02
PPTX
04 chapter04 specification_forms
PPTX
03 chapter03 lists_indexes_databases
PPTX
02 chapter02 p&ids_and_symbols_split_animations
PPTX
01 chapter01 process_flow_diagram
PPTX
00 introduction
PPTX
EMEC130 P&ID Symbol Primer
04 scaling analog_datal_sp17
03 analog control_sp17
01 control logix_arrays_sp17
Comparison instructions, AB, Siemens and AB CCW
Lab02 review
Subroutines rev01 fa16
Move mask moves_rev01_fa16
Math cl ccw_siemens_rev01_fa16
Lab02 lead in
ControlLogix Timers FA16
02 chapter02 fa16
01 introduction to_plc-pac_rev01_fa16
07 chapter07 loop_diagrams
06 chapter06 binary_logic_systems_Rev02
04 chapter04 specification_forms
03 chapter03 lists_indexes_databases
02 chapter02 p&ids_and_symbols_split_animations
01 chapter01 process_flow_diagram
00 introduction
EMEC130 P&ID Symbol Primer
Ad

Recently uploaded (20)

PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Lesson notes of climatology university.
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
01-Introduction-to-Information-Management.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Basic Mud Logging Guide for educational purpose
PDF
Computing-Curriculum for Schools in Ghana
PDF
Insiders guide to clinical Medicine.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Classroom Observation Tools for Teachers
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Institutional Correction lecture only . . .
PDF
RMMM.pdf make it easy to upload and study
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Lesson notes of climatology university.
Microbial diseases, their pathogenesis and prophylaxis
01-Introduction-to-Information-Management.pdf
human mycosis Human fungal infections are called human mycosis..pptx
O5-L3 Freight Transport Ops (International) V1.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Basic Mud Logging Guide for educational purpose
Computing-Curriculum for Schools in Ghana
Insiders guide to clinical Medicine.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
PPH.pptx obstetrics and gynecology in nursing
O7-L3 Supply Chain Operations - ICLT Program
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Classroom Observation Tools for Teachers
Complications of Minimal Access Surgery at WLH
Institutional Correction lecture only . . .
RMMM.pdf make it easy to upload and study
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...

10 chapter05 counters_fa14

  • 1. Allen Bradley Counters Counters Chapter 05 Northampton Community College 1
  • 2. Counters Northampton Community College 2  Common applications of counters include keeping track of the number of items moving past a given point, or determining the number of times a given action occurs. A preset counter can control an external circuit when its counted total matches the user-entered preset limits.
  • 3. Mechanical Counters Northampton Community College 3  Programmed counters can serve the same functions as mechanical counters.  Every time the actuating lever is moved or rotated, the counter adds one number. The actuating lever then returns automatically to its original position. Resetting the counter to zero is usually done with a pushbutton located on the unit.
  • 4. Electronic Counters Northampton Community College 4  Electronic counters can count up, count down, or be combined to count up and down. They are dependent on external sources such as parts traveling past a sensor or actuating a limit switch for counting. Counter Applications Rotary Encoder Rotary Encoder
  • 5. Counter Counting Sequence Northampton Community College 5  PLC counters are normally retentive.  Whatever count was contained in the counter at the time of a processor shutdown will be restored to the counter on power-up.  The counter can be reset on power-up if the reset condition is activated at the time of power restoration.  PLC counters can be designed to count up to a preset value or to count down to a preset value.
  • 6. SLC-500/LogixPro Default Data File Types FILE TYPE IDENTIFIER FILE NUMBER Output O 0 Input I 1 Status S 2 Bit B 3 Timer T 4 Counter C 5 Control R 6 Integer N 7 Float Point * F 8 * Available in SLC-5/03 OS301, OS302 & SLC-5/04 OS400, OS401 & SLC-5/05 processors Northampton Community College 6
  • 7. SLC-500 User Defined Data File Types FILE TYPE IDENTIFIER FILE NUMBER Bit B 9 - 255 Timer T 9 - 255 Counter C 9 - 255 Control R 9 - 255 Integer N 9 - 255 Float Point * F 9 - 255 String* St 9 - 255 ASCII * A 9 - 255 File #9 has a special purpose. It is called the “Computer Interface File” (CIF) and is used when communications is required between early AB PLCs * Available in SLC-5/03 OS301, OS302 & SLC-5/04 OS400, OS401 & SLC-5/05 processors Note: User defined files are not available in LogixPro Northampton Community College 7
  • 8. SLC-500’s/ControlLogix & LogixPro Counters Northampton Community College 8  The SLC-500/Micrologix series has three counters and ControlLogix and LogixPro Simulator has two counters:  CTU – Count Up (SLC500’s/Micrologix, ControlLogix & LogixPro)  CTD – Count Down (SLC500’s/Micrologix, ControlLogix & LogixPro)  HSC – High Speed Counter The HSC is only available in selected AB Micrologix series controllers  Counter instructions are output instructions therefore they will always be placed against the right power rail.  Output instructions in the SLC500 series are always placed against the right power rail with multiple output instructions on the same rung being placed in branches.  In the ControlLogix platform output devices are also placed against the right power rail with multiple outputs on the same rung being branched. But the output instructions can be placed in series on the rung.  In LogixPro the output instruction should be placed against the right power rail and multiple outputs on the same rung should be placed in branches. Output instructions can be placed in series, but incorrect operation can occur.
  • 9. Count Up Counters (CTU) – SLC500s & LogixPro  Counters have three instruction parameters: Counter number or Address of the counter Preset – Number of items or events to count before an output occurs Accumulator – The current number of counts on the counter Northampton Community College 9
  • 10. Counter Parameters Northampton Community College 10  Counter  The address of the counter.  Counters are stored, by default, in data file #5 and use a file designator of ‘C’. The valid range of counters is 0 to 255. Therefore, for this example we will use C5:0, the first counter in the file.  Preset Value (PRE)  The preset value is the number of counts that should occur before the counting event is done. The value range is: For the SLC500’s: -32,768 to 32,767. For the LogixPro simulator: -2,147,483,648 to 2,147,483,647 For ControlLogix: -2,147,483,648 to 2,147,483,647  Accumulator Value (ACC)  Stores the current count value of the counter. The value ranges are the same as the Preset parameter.
  • 11. Counter Memory – SLC500’s & LogixPro Northampton Community College 11  Each counter, of any type, in the SLC500’s requires three 16-bit words in the counter memory.  Each counter, of an type, in the LogixPro simulator requires three 32-bit words in the counter memory.  Word 0 – Stores the status bits of the counter  Word 1 – Stores the preset value  Word 2 – Stores the accumulator value
  • 12. Counter Memory Word 0, Status Bits SLC500 & LogixPro Northampton Community College 12  Counters have status bits that are stored in word 0. Some of these bits are unique to the type of counter being programmed and some of the bits are used for all counter types.  Bit 10 or Bit (UA) – Update Accumulator Bit Select Micrologix units only  Bit 11 or Bit (UN) – Underflow Bit Count Down counter only  Bit 12 or Bit (OV) – Overflow Bit Count Up counter only  Bit 13 or Bit (DN) – Done Bit Count Up and Count Down counter  Bit 14 or Bit (CD) – Count Down Bit Count Down counter only  Bit 15 or Bit (CU) – Count Up Bit Count Up counter only
  • 13. Counter Memory – SLC500’s & LogixPro 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Word 0 CU CD DN OV UN UA NA NA Reserved Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) Northampton Community College 13  Count Up (CU)  Sets to a logic ‘1’ when the rung containing the Count Up (CTU) counter is true, otherwise it is a logic ‘0’.  Count Down (CD)  Sets to a logic ‘1’ when the rung containing the Count Down (CTD) counter is true, otherwise it is a logic ‘0’.  Done (DN)  Sets to a logic ‘1’ when the Accumulator value is greater than or equal to the preset value (ACC ≥ PRE), otherwise it is a logic ‘0’.
  • 14. Counter Memory – SLC500’s & LogixPro 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Word 0 CU CD DN OV UN UA NA NA Reserved Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) Northampton Community College 14  Overflow (OV) – SLC500  Used with the Count Up counter (CTU). If the accumulator has reached the maximum positive value of +32,767 and the counter is incremented up again, the accumulator will wrap around to -32,768. When this “wrap around” occurs, the Overflow (OV) bit will set to a logic ‘1’. If the Done (DN) bit is set to a ‘1’ and the counter overflows the Done (DN) bit will remain a ‘1’, even if the accumulator is less than the preset (ACC < PRE). The counter must be reset with the RES instruction to reset the Overflow (OV) bit to a logic ‘0’ and to clear the Done (DN) bit.
  • 15. Counter Memory – SLC500’s & LogixPro 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Word 0 CU CD DN OV UN UA NA NA Reserved Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) Northampton Community College 15  Overflow (OV) – LogixPro  Used with the Count Up counter (CTU). If the accumulator has reached the maximum positive value of +32,767 and the counter is incremented up again, the Overflow (OV) bit will set to a logic ‘1’, the Done (DN) bit will reset to a ‘0’ and the accumulator will contain the value of +32,768. If the CTU counter rung continues to transition from false-to-true, the Overflow (OV) bit will remain on, the Done (DN) bit will remain off and the accumulator will continue counting up to a max. count of +2,147,483,647. When the max. count is achieved, the counter will stop counting up even if the rung continues to transition from false-to- true. The counter must be reset with the RES instruction to reset the Overflow (OV) bit to a logic ‘0’.
  • 16. Counter Memory – SLC500’s & LogixPro (lower word) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Word 0 CU CD DN OV UN UA NA NA Reserved Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) Northampton Community College 16  Underflow (UN) – SLC500  Used with the Count Down (CTD) counter. If the accumulator has reached the minimum negative value of -32,768 and the counter is decremented down again, the accumulator will wrap around to +32,767. When this “wrap around” occurs, the Underflow (UN) bit will set to a logic ‘1’. If the Done (DN) bit is set to a ‘1’ and the counter underflows the Done (DN) bit will remain a ‘1’, even if the accumulator is less than the preset (ACC < PRE). The counter must be reset with the RES instruction to reset the Underflow (UN) bit to a logic ‘0’ and Done (DN) bit to clear.
  • 17. Counter Memory – SLC500’s & LogixPro (lower word) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Word 0 CU CD DN OV UN UA NA NA Reserved Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) Northampton Community College 17  Underflow (UN) – LogixPro  Used with the Count Down counter (CTD). If the accumulator has reached the minimum negative value of -32,768 and the counter is decremented down again, the Underflow (UN) bit will set to a logic ‘1’, the Done (DN) bit will be set to a logic ‘1’ and the accumulator will contain a value of -32,769. If the CTD counter rung continues to transition from false-to-true, the Underflow (UN) bit and the Done (DN) bit will remain on and the accumulator will continue counting down to a minimum count of -2,147,483,648. When the minimum count is achieved the counter will stop counting down even if the rung continues to transition from false-to-true. The counter must be reset with the RES instruction to reset the Underflow (UN) bit to a logic ‘0’ and to clear the Done (DN) bit.
  • 18. Counter Memory – Select Micrologix Processors 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Word 0 CU CD DN OV UN UA NA NA Reserved Word 1 Preset Value Word 2 Accumulator Value Northampton Community College 18  Update Accumulator (UA)  This bit is only used with the High Speed Counter (HSC). This counter is only available in select Micrologix units. For more information on this bit, refer to the RSLogix 500 help file.
  • 19. CTU Functionality Northampton Community College 19  Count Up counters count false to true rung transitions. That is, when the rung containing the counter transitions from false to true, the accumulator increments up by one count. When the rung transitions from true to false, nothing happens at the counter.  When the rung is true, the Count Up (CU) bit is set to a ‘1’. When the rung is false, the Count Up (CU) bit is reset to a ‘0’.  When the ACC ≥ PRE, the Done (DN) is set to a ‘1’. An RES instruction is required to reset the accumulator to zero. Rung CU OV DN ACC 0 0 1 0 0 2 0 0 59 0 1 100 0 1 128 0 1 32,767 1 1 -32,768
  • 20. Counter Addressing; SLC500’s and LogixPro Northampton Community College 20  Counters, by default, are stored in data file #5 and have a file designator of ‘C’. Therefore, counter number zero is addressed as C5:0.  There are two main forms of addressing in AB; Bit level and Word level. To address the status bits of a counter, use bit level addressing as follows:  C5:0/11 or C5:0/UN = Underflow Bit  C5:0/12 or C5:0/OV = Overflow Bit  C5:0/13 or C5:0/DN = Done Bit  C5:0/14 or C5:0/CD = Count Down Bit  C5:0/15 or C5:0/CU = Count Up Bit
  • 21. Counter Adressing; SLC500’s and LogixPro Northampton Community College 21  Word level addresses are used to address the value of a 16-bit word in the SLC500 series or a 32-bit word in the LogixPro simulator. Therefore, to read the value of the counter accumulator or preset use a word level address as follows:  C5:0.1 or C5:0.PRE = Value of counter zero’s preset  C5:0.2 or C5:0.ACC = Value of counter zero’s accumulator  Almost any word in the AB memory structure can be addressed to bit level, here is an example:  C5:0.ACC/8 This is a bit level address that is referencing bit-8 in the accumulator word of counter zero.
  • 22. Example of Programming CTU Status Bits SLC500 Counter shown Northampton Community College 22
  • 23. Count Up Counters (CTU) - ControlLogix Counter tag name: Ex. TotalCartons Preset – Number of events to count before an output occurs Accumulator – The current number of counts on the counter ControlLogix counters function exactly like counters in the SLC500 series and LogixPro Northampton Community College 23
  • 24. Count Parameters - ControlLogix Northampton Community College 24  Counter  The tag name of the counter. Example: TotalCartons. The tag is created as a Counter Data Type. The Counter data type is a Structure because each counter uses more than one word.  Preset Value (PRE)  The preset value is the number of counts the counter should accumulate before an output occurs. The valid range is: -2,147,483,648 to 2,147,483,647.  Accumulator (ACC)  Stores the current counts of the counter.
  • 25. Counter Memory - ControlLogix Northampton Community College 25  Counters use a data type of type Counter.  The Counter data type is a Structure.  The counter structure consists of three, 32-bit words.  The ControlLogix counters have a total of five status bits. Some of these bits are used only for the CTU counter, some are used only for the CTD counter and some are shared with the CTU and CTD counters. These bits function exactly like the SLC500 counter status bits. The only difference is how they are referenced.
  • 26. Counter Memory - ControlLogix Northampton Community College 26  Referencing counter status bits:  Done Bit – TotalCartons.DN  Count Up Bit – TotalCartons.CU  Count Down Bit – TotalCartons.DN  Overflow Bit – TotalCartons.OV  Underflow Bit – TotalCartons.UN The plus (+) sign is used to expand a structure. The minus (-) is used to collapse a structure Structure members Data types of the members
  • 27. ControlLogix Counter When will the OV CU bit turn on? When will the DN bit turn on? When When the the CTU ACC rung wraps is true. from In 2,147,483,647 this example to for When the ACC ≥ PRE or ACC ≥ 10,000 One scan because -2,147,483,648 of the ONS instruction Northampton Community College 27
  • 28. Count Down Counter – CTD Northampton Community College 28  Counters have three instruction parameters (SLC500 counter shown): Counter number or Address of the counter Preset – Number of events to count before an output occurs Accumulator – The current number of counts on the counter
  • 29. Counter Parameters Northampton Community College 29  Counter  The address of the counter.  Counters are stored, by default, in data file #5 and use a file designator of ‘C’. The valid range of counters is 0 to 255. Therefore, for this example we will use C5:1, the second counter in the file.  Preset Value (PRE)  The preset value is the number of counts that should occur before the counting event is done. The value range is:  For the SLC500’s: -32,768 to 32,767.  For the LogixPro simulator: -2,147,483,648 to 2,147,483,647  For ControlLogix: -2,147,483,648 to 2,147,483,647  Accumulator Value (ACC)  Stores the current count value of the counter.
  • 30. Counter Memory – SLC500 & LogixPro Northampton Community College 30  Each counter, of any type, in the SLC500’s requires three 16-bit words in the counter memory.  Each counter, of an type, in the LogixPro simulator requires three 32-bit words in the counter memory.  Word 0 – Stores the status bits of the counter  Word 1 – Stores the preset value  Word 2 – Stores the accumulator value
  • 31. Counter Memory Word 0, Status Bits – SLC500 & LogixPro Northampton Community College 31  Counters have status bits that are stored in word 0. Some of these bits are unique to the type of counter being programmed and some of the bits are used for all counter types..  Bit 10 or Bit (UA) – Update Accumulator Bit Select Micrologix units only  Bit 11 or Bit (UN) – Underflow Bit Count Down counter only  Bit 12 or Bit (OV) – Overflow Bit Count Up counter only  Bit 13 or Bit (DN) – Done Bit Count Up and Count Down counter  Bit 14 or Bit (CD) – Count Down Bit Count Down counter only  Bit 15 or Bit (CU) – Count Up Bit Count Up counter only
  • 32. Counter Memory – SLC500’s & LogixPro 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Word 0 CU CD DN OV UN UA NA NA Reserved Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) Northampton Community College 32  Count Up (CU)  Sets to a logic ‘1’ when the rung containing the Count Up (CTU) counter is true, otherwise it is a logic ‘0’.  Count Down (CD)  Sets a logic ‘1’ when the rung containing the Count Down (CTD) counter is true, otherwise it is a logic ‘0’.  Done (DN)  Sets to a logic ‘1’ when the Accumulator value is greater than or equal to the preset value (ACC ≥ PRE), otherwise it is a logic ‘0’.
  • 33. Counter Memory – SLC500’s & LogixPro 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Word 0 CU CD DN OV UN UA NA NA Reserved Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) Northampton Community College 33  Overflow (OV) – SLC500  Used with the Count Up counter (CTU). If the accumulator has reached the maximum positive value of +32,767 and the counter is incremented up again, the accumulator will wrap around to -32,768. When this “wrap around” occurs, the Overflow (OV) bit will set to a logic ‘1’. If the Done (DN) bit is set to a ‘1’ and the counter overflows the Done (DN) bit will remain a ‘1’, even if the accumulator is less than the preset (ACC < PRE). The counter must be reset with the RES instruction to reset the Overflow (OV) bit to a logic ‘0’ and to clear the Done (DN) bit.
  • 34. Counter Memory – SLC500’s & LogixPro 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Word 0 CU CD DN OV UN UA NA NA Reserved Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) Northampton Community College 34  Overflow (OV) – LogixPro  Used with the Count Up counter (CTU). If the accumulator has reached the maximum positive value of +32,767 and the counter is incremented up again, the Overflow (OV) bit will set to a logic ‘1’, the Done (DN) bit will reset to a ‘0’ and the accumulator will contain the value of +32,768. If the CTU counter rung continues to transition from false-to-true, the Overflow (OV) bit will remain on, the Done (DN) bit will remain off and the accumulator will continue counting up to a max. count of +2,147,483,647. When the max. count is achieved, the counter will stop counting up even if the rung continues to transition from false-to- true. The counter must be reset with the RES instruction to reset the Overflow (OV) bit to a logic ‘0’.
  • 35. Counter Memory – SLC500’s & LogixPro (lower word) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Word 0 CU CD DN OV UN UA NA NA Reserved Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) Northampton Community College 35  Underflow (UN) – SLC500  Used with the Count Down (CTD) counter. If the accumulator has reached the minimum negative value of -32,768 and the counter is decremented down again, the accumulator will wrap around to +32,767. When this “wrap around” occurs, the Underflow (UN) bit will set to a logic ‘1’. If the Done (DN) bit is set to a ‘1’ and the counter underflows the Done (DN) bit will remain a ‘1’, even if the accumulator is less than the preset (ACC < PRE). The counter must be reset with the RES instruction to reset the Underflow (UN) bit to a logic ‘0’ and Done (DN) bit to clear.
  • 36. Counter Memory – SLC500’s & LogixPro (lower word) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Word 0 CU CD DN OV UN UA NA NA Reserved Word 1 Preset Value (16-bit in SLC500’s, 32-bit in LogixPro) Word 2 Accumulator Value (16-bit in SLC500’s, 32-bit in LogixPro) Northampton Community College 36  Underflow (UN) – LogixPro  Used with the Count Down counter (CTD). If the accumulator has reached the minimum negative value of -32,768 and the counter is decremented down again, the Underflow (UN) bit will set to a logic ‘1’, the Done (DN) bit will be set to a logic ‘1’ and the accumulator will contain a value of -32,769. If the CTD counter rung continues to transition from false-to-true, the Underflow (UN) bit and the Done (DN) bit will remain on and the accumulator will continue counting down to a minimum count of - 2,147,483,648. When the minimum count is achieved the counter will stop counting down even if the rung continues to transition from false-to-true. The counter must be reset with the RES instruction to reset the Underflow (UN) bit to a logic ‘0’ and to clear the Done (DN) bit.
  • 37. Counter Memory – Select Micrologix Processors 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Word 0 CU CD DN OV UN UA NA NA Reserved Word 1 Preset Value Word 2 Accumulator Value Northampton Community College 37  Update Accumulator (UA)  This bit is only used with the High Speed Counter (HSC). This counter is only available select Micrologix units. For more information on this bit, refer to the RSLogix help file.
  • 38. CTD Functionality Reset the CTD counter. Field device is NC RES_CTD_CNTR I:1 10 Count DOWN counter CTD_COUNTER C5:1 Northampton Community College 38  0006 Count Down counters count false to true rung transitions. That is, when the rung containing the counter transitions from false to true, the accumulator decrements down by one count. When the rung transitions from true to false, nothing happens at the counter.  When the rung is true, the Count Down (CD) bit is set to a ‘1’. When the rung is false, the Count Down (CD) bit is reset to a ‘0’.  When the ACC ≥ PRE, the Done (DN) is set to a ‘1’. An RES instruction is required to reset the accumulator to zero. RES Rung CD UN DN ACC 0 1 -1 0 1 -36 0 1 -50 0 0 -51 0 0 -32,768 1 0 32,767
  • 39. Counter Addressing; SLC500’s and LogixPro Northampton Community College 39  Counters, by default, are stored in data file #5 and the file designator is ‘C’. Therefore, counter number one is addressed as C5:1  There are two main forms of addressing in AB; Bit level and Word level. To address the status bits of a counter use bit level addressing as follows:  C5:1/11 or C5:1/UN = Underflow Bit  C5:1/12 or C5:1/OV = Overflow Bit  C5:1/13 or C5:1/DN = Done Bit  C5:1/14 or C5:1/CD = Count Down Bit  C5:1/15 or C5:1/CU = Count Up Bit
  • 40. Counter Addressing; SLC500’s and LogixPro Northampton Community College 40  Word level addresses are used to address the value of a 16-bit word in the SLC500’s or a 32-bit word in the LogixPro simulator. Therefore, to read the value of the counter accumulator or preset use a word level address as follows:  C5:1.1 or C5:1.PRE = Value of counter one’s preset  C5:1.2 or C5:1.ACC = Value of counter one’s accumulator  Almost any word in the AB memory structure can be addressed to bit level, here is an example:  C5:1.ACC/8 This is a bit level address that is referencing bit-8 in the accumulator word of counter one.
  • 41. ControlLogix CTD Counter Northampton Community College 41  The ControlLogix CTD counter functions exactly like the SLC500 series and LogixPro CTD counter.  It uses a Counter data type. The data type is a structure.
  • 42. Counter Examples Northampton Community College 42
  • 43. Parts Counting Program Northampton Community College 43  Counter C5:2 counts the total number of parts coming off an assembly line for final packaging.  Each package must contain 10- parts.  When 10-parts are detected, counter C5:1 sets bit B3:0/1 to initiate the box closing sequence.  Counter C5:3 counts the total number of packages filled per day.  A pushbutton is used to restart the total part and package count to zero, daily.
  • 44. Part Counting Program SLC500 Counters shown Program continued on next slide Northampton Community College 44
  • 45. Part Counting Program SLC500 Counters shown Northampton Community College 45
  • 46. Conveyor Motor Circuit Northampton Community College 46  This circuit will use a oneshot for reset and another oneshot to prevent proximity switch chatter.  Sequential task:  The start pushbutton is pressed to start the conveyor motor.  Cases move pass the proximity switch and increment the counters accumulated value.  After a count of 50, the conveyor motor stops automatically and the counter’s accumulated value is reset to zero.  The conveyor motor can be stopped or started manually at any time without loss of the accumulated counts. Proximity switch Case Conveyor motor Start/Stop station Count reset button
  • 47. Conveyor Motor Program ControlLogix ladder shown Northampton Community College 47
  • 48. Alarm Monitor Program Northampton Community College 48  The alarm is triggered by the closing of liquid level switch LS1.  The alarm light will flash whenever the alarm condition is triggered and has not been acknowledged, even if the alarm condition clears in the meantime.  The alarm is acknowledged by closing selector switch SS1.  The alarm light will operate in the steady mode when the alarm trigger condition exists but has been acknowledged.
  • 49. Alarm Monitor Program LogixPro Timers & Counters shown Northampton Community College 49
  • 50. Parking Garage Counter Program Northampton Community College 50  As a car enters the parking garage it triggers an up counter and increments the accumulator by one count.  As a car leaves the parking garage it triggers a down counter and decrements the accumulator by one count.  The up and down counters will use the same address. Since the counters have the same address the accumulated value is the same for both counters.  Whenever the accumulator value is equal to the preset value the counter output is energized to light the “Lot Full” sign.
  • 51. Parking Garage Counter Program SLC500 Counters shown Northampton Community College 51
  • 52. In Process Monitoring System Northampton Community College 52  Before start-up, the system is completely empty of parts and the counter is reset manually to zero.  When the operation begins, raw parts move through the in-feed sensor with each part generating an up count.  After processing, finished parts appearing at the out-feed sensor generate down counts, so the accumulated count of the counter continuously indicates the number of in-process parts.
  • 53. In Process Monitoring System ControlLogix Counters shown Northampton Community College 53
  • 54. More Counter Information Northampton Community College 54
  • 55. Counter Speed  The maximum speed of transitions that can be counted is determined by the processor scan time. Any counter input signal must be fixed for one scan time to be counted reliably.  If the input changes faster than one scan cycle, the count value will become unreliable because counts will be missed. When this is the case a high-speed counter instruction or module is required. Northampton Community College 55
  • 56. Cascading Counters Northampton Community College 56  Depending upon the application, it might be necessary to count events that exceed the maximum number allowable per counter instruction. One way of accomplishing count values that exceed the maximum allowed is by interconnection, or cascading, counters.
  • 57. Counting Beyond the Maximum Count – SLC500 SLC500 Counters shown How many counts occur before O:5/13 energizes? C5:1.ACC + C5:3.ACC = 32,767 + 300 = 33,067 Northampton Community College 57
  • 58. Optical Encoder Northampton Community College 58  An optical encoder creates a series of square waves as its shaft is rotated.  The encoder disk interrupts the light as the encoder shaft is rotated to produce a square wave output waveform.
  • 59. Optical Encoder  The number of square waves obtained from the output of the encoder can be made to correspond to the mechanical movement that has occurred.  To divide a shaft revolution into 1,024 parts, an encoder could be selected to supply at least 1,024 pulses (square wave cycles) per revolution. By using a counter to count those cycles it can be determined how far the shaft has rotated.  A special high speed counting module might be required for these types of applications 1024 0 Northampton Community College 59
  • 60. More Counter Examples Northampton Community College 60
  • 61. Cutting Material to a Specific Size Northampton Community College 61  The material is advanced for a specific distance and measured by encoder pulses to determine the correct length for cutting.
  • 62. Counter Used for Length Measurement Northampton Community College 62  Count input pulses are generated by the magnetic sensor mounted such that it detects passing teeth on a conveyor drive sprocket. If 10-teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths.  The photoelectric sensor monitors a reference point on the conveyor. When activated, it prevents the unit from counting thus permitting the counter to accumulate counts only when bar stock is moving.
  • 63. Combining Counter and Timer Functions Automatic Stacking Process Northampton Community College 63  When the start pushbutton is pressed conveyor M1 begins running.  After 15-plates have been stacked, conveyor M1 stops and conveyor M2 begins running.  After conveyor M2 has been operated for 5-seconds it stops and the sequence is repeated automatically.  The done bit of the timer resets the timer and the counter and provides a momentary pulse to automatically restart conveyor M1 Can you see anything wrong with this process? If so, what is wrong? The biggest problem with this process is that timers should never be used for control. M2 will run for 5-second, but what if something happens that the complete stack only moves to a point where the light sensors are no longer sensing them? There really should be a sensor sensing when the complete stack is clear of the stacker.
  • 64. Automatic Stacking Program Northampton Community College 64
  • 65. Motor Lock-Out Program  Designed to prevent a machine operator from starting a motor that has tripped off more than 5- times in an hour.  The normally open (OL) relay contact momentarily closes each time an overload current is sensed.  Every time the motor stops due to an overload condition, the motor start circuit is locked out for 5-minutes.  If the motor trips off more than 5- times in an hour, the motor start circuit is permanently locked out and cannot be started until the reset button is actuated. Northampton Community College 65
  • 66. Motor Lock-Out Program Northampton Community College 66

Editor's Notes

  • #16: The memory block depicted on this slide shows 16-bits. The counter memory in the LogixPro simulator is 32-bit. The upper 16-bits (bits 16 to 31) of word 0 are not used. The entire 32-bits of the preset and accumulator words are used, this is why the preset and accumulator numeric range is: -2,147,483,648 to 2,147,483,647.
  • #18: The memory block depicted on this slide shows 16-bits. The counter memory in the LogixPro simulator is 32-bit. The upper 16-bits (bits 16 to 31) of word 0 are not used. The entire 32-bits of the preset and accumulator words are used, this is why the preset and accumulator numeric range is: -2,147,483,648 to 2,147,483,647.
  • #35: The memory block depicted on this slide shows 16-bits. The counter memory in the LogixPro simulator is 32-bit. The upper 16-bits (bits 16 to 31) of word 0 are not used. The entire 32-bits of the preset and accumulator words are used, this is why the preset and accumulator numeric range is: -2,147,483,648 to 2,147,483,647.
  • #37: The memory block depicted on this slide shows 16-bits. The counter memory in the LogixPro simulator is 32-bit. The upper 16-bits (bits 16 to 31) of word 0 are not used. The entire 32-bits of the preset and accumulator words are used, this is why the preset and accumulator numeric range is: -2,147,483,648 to 2,147,483,647.