09 chapter04 timers_fa14

45
1 Northampton Community College Allen Bradley Timers Timers Chapter 04 Sections: 4-4 through 4-13 Covered in class

Transcript of 09 chapter04 timers_fa14

Page 1: 09 chapter04 timers_fa14

1Northampton Community College

Allen Bradley Timers

Timers

Chapter 04

Sections: 4-4 through 4-13

Covered in class

Page 2: 09 chapter04 timers_fa14

2Northampton Community College

Programmed Timer Instructions PLC timers are output instructions. They provide the same function as

electromechanical and solid state timers. Output instructions in the SLC500 series and the LogixPro simulator are always placed against the right power rail. In the ControlLogix platform output device can be placed against the right power rail or in series on the rung.

Some advantages to PLC timers: Their settings can be easily altered and can

also be altered on-the-fly. The number of PLC timers used can be

increased or decreased by programming changes without making any wiring changes.

The accuracy of PLC timers is extremely high and repeatable.

Nola PLC Programming http://nolaplcprogramming.com/

Page 3: 09 chapter04 timers_fa14

3Northampton Community College

SLC-500/LogixPro Default 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

*Not available in LogixPro

Page 4: 09 chapter04 timers_fa14

4Northampton Community College

SLC-500 User Defined 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 5: 09 chapter04 timers_fa14

5Northampton Community College

Allen Bradley Timer Instructions

Allen Bradley SLC-500’s, ControlLogix and LogixPro have three timers available: TON – Timer On-Delay TOF – Timer Off-Delay RTO – Retentive TON

Page 6: 09 chapter04 timers_fa14

6Northampton Community College

Timer On-Delay Timer (TON) – SLC500s & LogixPro

AB timers have four instruction parameters:

Timer number or Address of the timer

Time Base: in the SLC-500 the choice is: 1.0S or 0.01SLogixPro Time Base is fixed at 0.1S

Preset – How long the timer should time.TotalTime = Preset * TB

Accumulator – The current time value of the timer

Page 7: 09 chapter04 timers_fa14

7Northampton Community College

Timer Parameters – SLC500s & LogixPro

Timer The address of the timer. Timers are stored in data file #4 and use a

file designator of ‘T’. Valid range of timers is: 0 to 255. Therefore, for this example we’ll use: T4:0, the first timer in the file.

Time Base The number of “ticks” on the clock. The SLC-500 series can be set

to 1.0-second or 0.01-seconds, meaning that each “tick” is either 1-second in duration or 0.01-second in duration. LogixPro timers are fixed at 0.1 seconds.

Preset Value (PRE) The preset value is the length of time the timer should time before its

contacts change state. The valid range is: 0 to 32,767. The total time of the timer is determined by:

Total_Time = Preset_Value * Time_Base Accumulator Value (ACC)

Stores the current time of the timer.

Page 8: 09 chapter04 timers_fa14

8Northampton Community College

Timer Memory – SLC500s & LogixPro

Each timer, of any type, requires three, 16-bit words in timer memory. Word 0 – Stores the status bits of the timer Word 1 – Stores the preset value Word 2 – Stores the accumulator value

Timers have three status bits that are stored in word 0: Bit 13 or Bit (DN) – Done Bit Bit 14 or Bit (TT) – Timer Timing Bit Bit 15 or Bit (EN) – Timer Enable Bit

Page 9: 09 chapter04 timers_fa14

9Northampton Community College

Timer On-Delay, TON, Timer Memory Map – SLC500s & LogixPro

Enable Bit (EN) Sets to a logic ‘1’ when the rung containing the timer is true, otherwise it is a

logic ‘0’. Timer Timing Bit (TT)

Sets to a logic ‘1’ when the rung containing the timer is true and the timer is timing; ACC < PRE. Sets to a logic ‘0’ when the timer is not timing; ACC = PRE or the rung containing the timer is false.

Done Bit (DN) Sets to a logic ‘1’ when the rung containing the timer is true and the ACC =

PRE. Sets to a logic ‘0’ when the rung containing the timer is false or when the rung is true and the ACC ≠ PRE.

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

Word 0 EN TT DN NA NA NA NA NA Reserved

Word 1 Preset Value

Word 2 Accumulator Value

Page 10: 09 chapter04 timers_fa14

10Northampton Community College

Timer On-Delay, (TON), Functionality – SLC500s & LogixPro

When the rung containing the timer becomes true, the timer starts timing. The EN and TT bits will set to a ‘1’ and the ACC will start counting up at the rate of the time base.

When the ACC = PRE the timer is done. The TT bit resets to a ‘0’ and the DN bit sets to a ‘1’.

When the ACC = PRE the timer is done. When the rung containing the timer becomes false, the timer ACC will reset to zero even if has not reached the PRE value and the EN, TT and DN bits will reset to ‘0’.

Rung EN TT DN ACC

0 0 0 0 0

1 1 1 0 2

1 1 1 0 5

1 1 0 1 10

0 0 0 0 0

1 1 1 0 3

0 0 0 0 0

Page 11: 09 chapter04 timers_fa14

11Northampton Community College

Timer Addressing

Timers, by default, are stored in data file #4 and has a file designator of ‘T’. Therefore, timer number zero is addressed as T4:0

There are two main forms of addressing in AB; Bit level and Word level. To address the status bits of a timer use bit level addressing as follows: T4:0/13 or T4:0/DN = Done Bit T4:0/14 or T4:0/TT = Timer Timing Bit T4:0/15 or T4:0/EN = Enable Bit

Page 12: 09 chapter04 timers_fa14

12Northampton Community College

Timer Adressing

Word level addresses are used to address the value of a 16-bit word. Therefore, to read the value of the timer accumulator or preset use a word level address as follows: T4:0.1 or T4:0.PRE = Value of timer zero’s preset T4:0.2 or T4:0.ACC = Value of timer zero’s accumulator

Almost any word in the AB memory structure can be addressed to bit level, here is an example: T4:0.ACC/8

This is a bit level address that is referencing bit-8 in the accumulator word of timer zero.

Page 13: 09 chapter04 timers_fa14

13Northampton Community College

Example of Programming TON Status Bits – SLC500s & LogixPro

Page 14: 09 chapter04 timers_fa14

14Northampton Community College

Timer Status Bits and Timing Diagram – SLC500s & LogixPro

Page 15: 09 chapter04 timers_fa14

15Northampton Community College

Timer On-Delay Timer (TON) – ControlLogix

Timer tag name:Ex. Pump_Timer

Time Base: The TB is fixed at 0.001 sec. (1mS)Therefore there is no parameter field

Preset – How long the timer should time.TotalTime = Preset * TB

Accumulator – The current time value of the timer

ControlLogix timers function exactly like timers in the SLC500 series and LogixPro

Page 16: 09 chapter04 timers_fa14

16Northampton Community College

Timer Parameters – ControlLogix

Timer The tag name of the timer. Example: Pump_Timer. The tag is

created as a Timer Data Type. The Timer data type is a Structure because each timer uses more than one word.

Time Base The number of “ticks” on the clock. The ControlLogix timers are fixed

at 0.001 sec. or 1mS therefore there is no parameter field for the time base.

Preset Value (PRE) The preset value is the length of time the timer should time before its

contacts change state. The valid range is: 231 - 1 (0 to 2,147,483,647). The total time of the timer is determined by:

Total_Time = Preset_Value * Time_Base Accumulator Value (ACC)

Stores the current time of the timer.

Page 17: 09 chapter04 timers_fa14

17Northampton Community College

Timer Memory – ControlLogix

Timers use a timer data type called a Timer Structure. The timer structure consists of three, 32-bit words.

The ControlLogix timers have three status bits. These bits function exactly like the SLC500 and LogixPro timer status bits. The only difference is how they are referenced. Done Bit – Timer_Tag.DN Timer Timing Bit – Timer_Tag.TT Timer Enable Bit – Timer_Tag.EN

Structure members

The plus (+) sign is used to expand a structure. The minus (-) is used to collapse a structure

Data types of the members of the structure.

Page 18: 09 chapter04 timers_fa14

18Northampton Community College

ControlLogix Timer

What is the length of time for the DN bit to turn on?

0.001 Seconds * 30,000 = 30 Seconds

Page 19: 09 chapter04 timers_fa14

19Northampton Community College

Timer Off-Delay Timer (TOF) – SLC500s & LogixPro

AB timers have four instruction parameters:

Timer number or Address of the timer

Time Base: in the SLC-500 the choice is: 1.0S or 0.01SLogixPro Time Base is fixed at 0.1S

Preset – How long the timer should time.TotalTime = Preset * TB

Accumulator – The current time value of the timer

Page 20: 09 chapter04 timers_fa14

20Northampton Community College

Timer Parameters – SLC500s & LogixPro

Timer The address of the timer. Timers are stored in data file #4 and use a

file designator of ‘T’. Valid range of timers is: 0 to 255. Therefore, for this example we’ll use: T4:1, the second timer in the file.

Time Base The number of “ticks” on the clock. The SLC-500 series can be set

to 1.0-seconds or 0.01-seconds, meaning that each “tick” is either 1-second in duration or 0.01-second in duration. LogixPro is fixed at 0.1 seconds.

Preset Value (PRE) The preset value is the length of time the timer should time before its

contacts change state. The valid range is: 0 to 32,767. The total time of the timer is determined by:

Total_Time = Preset_Value * Time_Base Accumulator Value (ACC)

Stores the current time of the timer.

Page 21: 09 chapter04 timers_fa14

21Northampton Community College

Timer Memory – SLC500s & LogixPro

Each timer, of any type, requires three, 16-bit words in timer memory. Word 0 – Stores the status bits of the timer Word 1 – Stores the preset value Word 2 – Stores the accumulator value

Timers have three status bits that are stored in word 0: Bit 13 or Bit (DN) – Done Bit Bit 14 or Bit (TT) – Timer Timing Bit Bit 15 or Bit (EN) – Timer Enable Bit

Page 22: 09 chapter04 timers_fa14

22Northampton Community College

Timer Off-Delay, TOF, Timer Memory Map – SLC500s & LogixPro

Enable Bit (EN) Sets to a logic ‘1’ when the rung containing the timer is true, otherwise it is a

logic ‘0’. Timer Timing Bit (TT)

Sets to a logic ‘1’ when the rung containing the timer is false and the timer is timing; ACC < PRE. Sets to a logic ‘0’ when the timer is not timing; ACC = PRE, or the rung containing the timer is true.

Done Bit (DN) Sets to a logic ‘1’ when the rung containing the timer is true and not timing.

When the rung becomes false the timer starts timing. When the ACC = PRE the DN bit resets to a logic ‘0’ until the rung becomes true again.

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

Word 0 EN TT DN NA NA NA NA NA Reserved

Word 1 Preset Value

Word 2 Accumulator Value

Page 23: 09 chapter04 timers_fa14

23Northampton Community College

Timer Off-Delay, (TOF), Functionality – SLC500s & LogixPro

When the rung containing the timer becomes false, the timer starts timing. The EN bit will reset to a ‘0’ and the TT and DN bits will be set to a ‘1’. The ACC starts timing at the rate of the TB.

When the ACC = PRE the timer is done. The TT bit and the DN bit reset to a ‘0’.

When the rung containing the timer becomes true, the timer ACC will reset to zero, even if it has not reached the PRE value. The EN and DN bit will set to a ‘1’ and the TT bit will reset to a ‘0’.

Rung EN TT DN ACC

1 1 0 1 0

0 0 1 1 150

0 0 1 1 375

0 0 0 0 500

1 1 0 1 0

0 0 1 1 356

1 1 0 1 0

Page 24: 09 chapter04 timers_fa14

24Northampton Community College

Example of Programming a TOF Status Bits – SLC500s & LogixPro

Page 25: 09 chapter04 timers_fa14

25Northampton Community College

TOF Status Bits and Timing Diagram

Page 26: 09 chapter04 timers_fa14

26Northampton Community College

ControlLogix TOF Timer

The ControlLogix TOF timer functions exactly like the SLC500 series and LogixPro TOF timer.

It uses a Timer Structure. The Time Base is fixed at 0.001 sec. (1mS).

Page 27: 09 chapter04 timers_fa14

27Northampton Community College

RTO Functionality – SLC500s, LogixPro and ControlLogix

An RTO timer works exactly like a TON timer with one exception. When the rung containing the RTO timer becomes false, the ACC will retain the timed value. When the rung returns to true, the timer will start timing from where it left off.

To reset the ACC of an RTO timer a reset (RES) instruction with the same address as the RTO timer is required. When the RES rung is true, the timer ACC resets to zero. If the RES rung remains true and the timer rung is also true, the timer will time, but will immediately be reset to zero.

Rung RES EN TT DN ACC

1 0 1 1 0 1

1 0 1 1 0 3

0 0 0 0 0 3

1 0 1 0 1 5

X 1 0 0 0 0

1 1 0 0 0 0

0 1 0 0 0 0

SLC500 Timer shown

Page 28: 09 chapter04 timers_fa14

28Northampton Community College

Example of Programming an RTO with Status Bits – SLC500s and LogixPro

SLC500 Timer shown

Page 29: 09 chapter04 timers_fa14

29Northampton Community College

Example of Programming an RTO with Status Bits – ControlLogix

What is the length of time for the DN bit to turn on?0.001 Seconds * 47,000 = 47 Seconds

Page 30: 09 chapter04 timers_fa14

30Northampton Community College

RTO Status Bits and Timing Diagram

Page 31: 09 chapter04 timers_fa14

31Northampton Community College

Maximum Amount of Time a Timer can Time To

What is the maximum amount of time that a SLC500 and LogixPro timer can time to? SLC500 Timers

1.0 Second * [(215 – 1) or 32,767] = 32,767 SecondsWhich is: 9-hours 6-minutes 7-seconds

LogixPro TimersLogixPro instructions can be a-bit tricky because LogixPro is actually 32-

bits, in some instructions. Timers are one of these.0.1 Seconds * [(231 – 1) or 2,147,583,647] = 214,748,364.7 Seconds

Which is:6-years 295-days 12-hours 19-minutes 24.7-seconds OR

6-years 9-(30 day months) 25-days 12-hours 19-minutes 24.7-seconds

What is the maximum amount of time that a ControlLogix timer can time to? 0.001 Seconds * [(231 – 1) or 2,147,583,647] = 2,147,483.647 Seconds Which is: 24-Days 20-Hours 31-Minutes 23.647 Seconds

Page 32: 09 chapter04 timers_fa14

32Northampton Community College

Cascading Timers If longer timing periods are required that are beyond the

maximum time of a single timer, timers can be cascaded as shown here.

What is the total time when T4:11 is done?

32,767 Seconds + 23,000 Seconds = 55,757 Seconds or 15 hours 12 minutes 47 seconds

Page 33: 09 chapter04 timers_fa14

33Northampton Community College

Self Resetting Timer

If a timer needs to reset and start over at the end of a timing event, its own DN bit can be used to accomplish an automatic reset as shown here.

Page 34: 09 chapter04 timers_fa14

34Northampton Community College

Oscillator Circuit

Two timers can be used to create an oscillator that oscillates at almost any frequency and duty cycle within the range of the timers. An oscillator circuit is shown here.

Coil O:2/8 will be:ON for ½ second and OFF for a ½ second

Page 35: 09 chapter04 timers_fa14

35Northampton Community College

Oscillator Circuit Timing Diagram

This is the timing diagram for the oscillator circuit shown on the previous slide.

Page 36: 09 chapter04 timers_fa14

36Northampton Community College

Startup Warning Signal Circuit

When the startup PB is pressed, the horn will sound for 10-seconds alerting bystanders that the machine or process is about to start.

Page 37: 09 chapter04 timers_fa14

37Northampton Community College

Sequential Startup Circuit

Page 38: 09 chapter04 timers_fa14

38Northampton Community College

Oneshot or Transitional Instructions

The transitional or oneshot instruction is a retentive input instruction that triggers an event to occur one time. It is triggered on a false to true rung transition.

Some PLC manufacturers also provide a oneshot that triggers on a true to false rung transition.

PLC manufacturers use different methods to produce a oneshot event. The following slides show some examples.

Page 39: 09 chapter04 timers_fa14

39Northampton Community College

Oneshot or Transitional Contact Program

I:1/11I:1.0

I:1.0

11

11

OnshotContact

OnshotCoil

OnshotOutput

I:1/11I:1.0

I:1.0

11

11

OnshotContact

OnshotCoil

OnshotOutput

I:1/11I:1.0

I:1.0

11

11

OnshotContact

OnshotCoil

OnshotOutput

I:1/11I:1.0

I:1.0

11

11

OnshotContact

OnshotCoil

OnshotOutput

I:1/11I:1.0

I:1.0

11

11

OnshotContact

OnshotCoil

OnshotOutput

This transitional or oneshot contact program uses standard contacts and coils to produce a oneshot. The program is designed to generate an output pulse that, when triggered, turns ON for the duration of one program scan and then turns OFF. The order of the rungs in this program is important. Try reversing the rung order and running the program.

The oneshot can be triggered from a momentary signal or from a signal that comes on and stays on for a length of time.

Click anywhere to start the animation

Page 40: 09 chapter04 timers_fa14

40Northampton Community College

Types of Transitional Contacts

Off-to-On Transitional Contact Programmed to provide a

oneshot pulse when the referenced trigger signal makes a positive (false-to-true) transition.

Symbol

Off

Off

On

On

Onescan

Symbol

Onescan

Off

Off

On

On

On-to-Off Transitional Contact Programmed to provide a

oneshot pulse when the referenced trigger signal makes a (true-to-false) transition.

Page 41: 09 chapter04 timers_fa14

41Northampton Community College

Types of Transitional Contacts – SLC500s, LogixPro and ControlLogix

Allen Bradley uses a “Oneshot Rising” (OSR) instruction. The SLC500 and LogixPro instruction requires a bit level address from either the Bit file, file #3 or the Integer file, file #7. (We did not talk about the Integer file, file #7 yet.)

ControlLogix uses an instruction named (ONS) that can be assigned a tag of data type BOOL or a bit from a tag of type DINT, INT or SINT.

Page 42: 09 chapter04 timers_fa14

42Northampton Community College

Types of Transitional Contacts – SLC500s, LogixPro and ControlLogix

When the rung conditions preceding the OSR or ONS instruction transition from false-to-true, the OSR or ONS instruction will be true for one scan. After one scan is complete, the OSR or ONS instruction becomes false, even if the rung conditions preceding it remain true. The OSR or ONS instruction will only become true again if the rung conditions preceding it transition from false-to-true.

ONS using a tag of type BOOL

ONS using bit 3 of a tag of type DINT

Page 43: 09 chapter04 timers_fa14

43Northampton Community College

OSR Instruction – SLC500s & LogixPro

The controller allows the use of one OSR instruction per output on a rung.

The address used for the OSR instruction must be unique. Do not use it anywhere else in the program. Do not use an input or output address on an OSR instruction.

Page 44: 09 chapter04 timers_fa14

44Northampton Community College

OSR Instructions with the SLC-5/01 and SLC-5/02

In the top rung, the OSR instruction is not permitted inside a branch. An error will occur when the OSR is in this position.

In the bottom rung, the OSR is not in the branch, so the rung is legal. These two processors allow only one OSR instruction per rung.

Important note: When using these two processors, do not place input conditions after the OSR instruction on a rung. Unexpected operation may occur.

Page 45: 09 chapter04 timers_fa14

45Northampton Community College

OSR Instruction, SLC-5/03 or Higher

When using the SLC-5/03 processor and higher, including the MicroLogix controllers, more than one OSR instruction can be used on a rung, but only one per output instruction as shown this ladder rung.