10 chapter05 counters_fa14

66
1 Northampton Community College Allen Bradley Counters Counters Chapter 05

Upload: john-todora

Post on 27-Jun-2015

707 views

Category:

Education


4 download

TRANSCRIPT

Page 1: 10 chapter05 counters_fa14

1Northampton Community College

Allen Bradley Counters

Counters

Chapter 05

Page 2: 10 chapter05 counters_fa14

2Northampton Community College

Counters

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. 

Page 3: 10 chapter05 counters_fa14

3Northampton Community College

Mechanical Counters

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.

Page 4: 10 chapter05 counters_fa14

4Northampton Community College

Electronic Counters

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.

CounterApplications

Rotary Encoder

Rotary Encoder

Page 5: 10 chapter05 counters_fa14

5Northampton Community College

Counter Counting Sequence

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.

Page 6: 10 chapter05 counters_fa14

6Northampton Community College

SLC-500/LogixPro Default Data File Types

FILE TYPE IDENTIFIER FILE NUMBEROutput O 0Input I 1Status S 2Bit B 3Timer T 4Counter C 5Control R 6Integer N 7Float Point * F 8

* Available in SLC-5/03 OS301, OS302 & SLC-5/04 OS400, OS401 & SLC-5/05 processors

Page 7: 10 chapter05 counters_fa14

7Northampton Community College

SLC-500 User Defined Data File Types

FILE TYPE IDENTIFIER FILE NUMBERBit B 9 - 255Timer T 9 - 255Counter C 9 - 255Control R 9 - 255Integer N 9 - 255Float Point * F 9 - 255String* St 9 - 255ASCII * 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

Page 8: 10 chapter05 counters_fa14

8Northampton Community College

SLC-500’s/ControlLogix & LogixPro Counters

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.

Page 9: 10 chapter05 counters_fa14

9Northampton Community College

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

Page 10: 10 chapter05 counters_fa14

10Northampton Community College

Counter Parameters

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,647For 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.

Page 11: 10 chapter05 counters_fa14

11Northampton Community College

Counter Memory – SLC500’s & LogixPro

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

Page 12: 10 chapter05 counters_fa14

12Northampton Community College

Counter Memory Word 0, Status Bits SLC500 & LogixPro

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

Page 13: 10 chapter05 counters_fa14

13Northampton Community College

Counter Memory – SLC500’s & LogixPro

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’.

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)

Page 14: 10 chapter05 counters_fa14

14Northampton Community College

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)

Page 15: 10 chapter05 counters_fa14

15Northampton Community College

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

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)

Page 16: 10 chapter05 counters_fa14

16Northampton Community College

Counter Memory – SLC500’s & LogixPro (lower word)

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.

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)

Page 17: 10 chapter05 counters_fa14

17Northampton Community College

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 – 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)

Page 18: 10 chapter05 counters_fa14

18Northampton Community College

Counter Memory – Select Micrologix Processors

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.

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

Page 19: 10 chapter05 counters_fa14

19Northampton Community College

CTU Functionality

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

Page 20: 10 chapter05 counters_fa14

20Northampton Community College

Counter Addressing; SLC500’s and LogixPro

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

Page 21: 10 chapter05 counters_fa14

21Northampton Community College

Counter Adressing; SLC500’s and LogixPro

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.

Page 22: 10 chapter05 counters_fa14

22Northampton Community College

Example of Programming CTU Status Bits

SLC500 Counter shown

Page 23: 10 chapter05 counters_fa14

23Northampton Community College

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

Page 24: 10 chapter05 counters_fa14

24Northampton Community College

Count Parameters - ControlLogix

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.

Page 25: 10 chapter05 counters_fa14

25Northampton Community College

Counter Memory - ControlLogix

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.

Page 26: 10 chapter05 counters_fa14

26Northampton Community College

Counter Memory - ControlLogix

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

Page 27: 10 chapter05 counters_fa14

27Northampton Community College

ControlLogix Counter

When will the DN bit turn on?

When the ACC ≥ PRE or ACC ≥ 10,000

When will the CU bit turn on?

When the CTU rung is true. In this example forOne scan because of the ONS instruction

When will the OV bit turn on?

When the ACC wraps from 2,147,483,647 to -2,147,483,648

Page 28: 10 chapter05 counters_fa14

28Northampton Community College

Count Down Counter – CTD

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

Page 29: 10 chapter05 counters_fa14

29Northampton Community College

Counter Parameters

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.

Page 30: 10 chapter05 counters_fa14

30Northampton Community College

Counter Memory – SLC500 & LogixPro

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

Page 31: 10 chapter05 counters_fa14

31Northampton Community College

Counter Memory Word 0, Status Bits – SLC500 & LogixPro

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

Page 32: 10 chapter05 counters_fa14

32Northampton Community College

Counter Memory – SLC500’s & LogixPro

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’.

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)

Page 33: 10 chapter05 counters_fa14

33Northampton Community College

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)

Page 34: 10 chapter05 counters_fa14

34Northampton Community College

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

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)

Page 35: 10 chapter05 counters_fa14

35Northampton Community College

Counter Memory – SLC500’s & LogixPro (lower word)

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.

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)

Page 36: 10 chapter05 counters_fa14

36Northampton Community College

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 – 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)

Page 37: 10 chapter05 counters_fa14

37Northampton Community College

Counter Memory – Select Micrologix Processors

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.

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

Page 38: 10 chapter05 counters_fa14

38Northampton Community College

CTD Functionality

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.

0006I:1

10

Reset the CTDcounter.Field device is NCRES_CTD_CNTR

RESC5:1

Count DOWN counterCTD_COUNTER

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

Page 39: 10 chapter05 counters_fa14

39Northampton Community College

Counter Addressing; SLC500’s and LogixPro

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

Page 40: 10 chapter05 counters_fa14

40Northampton Community College

Counter Addressing; SLC500’s and LogixPro

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.

Page 41: 10 chapter05 counters_fa14

41Northampton Community College

ControlLogix CTD Counter

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.

Page 42: 10 chapter05 counters_fa14

42Northampton Community College

Counter Examples

Page 43: 10 chapter05 counters_fa14

43Northampton Community College

Parts Counting Program

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.

Page 44: 10 chapter05 counters_fa14

44Northampton Community College

Part Counting Program

Program continued on next slide

SLC500 Counters shown

Page 45: 10 chapter05 counters_fa14

45Northampton Community College

Part Counting Program

SLC500 Counters shown

Page 46: 10 chapter05 counters_fa14

46Northampton Community College

Conveyor Motor Circuit

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.

Proximityswitch

Case

Conveyor motorStart/Stop station

Count reset button

Page 47: 10 chapter05 counters_fa14

47Northampton Community College

Conveyor Motor Program

ControlLogix ladder shown

Page 48: 10 chapter05 counters_fa14

48Northampton Community College

Alarm Monitor Program

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.

Page 49: 10 chapter05 counters_fa14

49Northampton Community College

Alarm Monitor Program

LogixPro Timers & Counters shown

Page 50: 10 chapter05 counters_fa14

50Northampton Community College

Parking Garage Counter Program

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.

Page 51: 10 chapter05 counters_fa14

51Northampton Community College

Parking Garage Counter Program

SLC500 Counters shown

Page 52: 10 chapter05 counters_fa14

52Northampton Community College

In Process Monitoring System

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.

Page 53: 10 chapter05 counters_fa14

53Northampton Community College

In Process Monitoring System

ControlLogix Counters shown

Page 54: 10 chapter05 counters_fa14

54Northampton Community College

More Counter Information

Page 55: 10 chapter05 counters_fa14

55Northampton Community College

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.

Page 56: 10 chapter05 counters_fa14

56Northampton Community College

Cascading Counters

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.

Page 57: 10 chapter05 counters_fa14

57Northampton Community College

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

Page 58: 10 chapter05 counters_fa14

58Northampton Community College

Optical Encoder

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.

Page 59: 10 chapter05 counters_fa14

59Northampton Community College

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

Page 60: 10 chapter05 counters_fa14

60Northampton Community College

More Counter Examples

Page 61: 10 chapter05 counters_fa14

61Northampton Community College

Cutting Material to a Specific Size

The material is advanced for a specific distance and measured by encoder pulses to determine the correct length for cutting.

Page 62: 10 chapter05 counters_fa14

62Northampton Community College

Counter Used for Length Measurement

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.

Page 63: 10 chapter05 counters_fa14

63Northampton Community College

Combining Counter and Timer Functions

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?

Automatic Stacking Process

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.

Page 64: 10 chapter05 counters_fa14

64Northampton Community College

Automatic Stacking Program

Page 65: 10 chapter05 counters_fa14

65Northampton Community College

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.

Page 66: 10 chapter05 counters_fa14

66Northampton Community College

Motor Lock-Out Program