Introduction

Add to My manuals
704 Pages

advertisement

Introduction | Manualzz

Chapter 3 Timer and Counter Instructions (TON, TOF, RTO, TONR, TOFR, RTOR, CTU, CTD, CTUD, RES)

Retentive Timer On (RTO)

The RTO instruction is a retentive timer that accumulates time when the instruction is enabled.

This instruction is available in structured text and function block as RTOR, see page 124 .

Operands:

Relay Ladder

Operand

Timer

Preset

Accum

Type

TIMER

DINT

DINT

Format Description

tag timer structure immediate how long to delay (accumulate time) immediate number of msec the timer has counted initial value is typically 0

TIMER Structure

Mnemonic

.EN

.TT

.DN

.PRE

.ACC

Data Type

BOOL

BOOL

BOOL

DINT

DINT

Description

The enable bit indicates that the RTO instruction is enabled.

The timing bit indicates that a timing operation is in process

The done bit indicates that .ACC

.PRE.

The preset value specifies the value (1 msec units) which the accumulated value must reach before the instruction sets the .DN bit.

The accumulated value specifies the number of milliseconds that have elapsed since the RTO instruction was enabled.

Description:

The RTO instruction accumulates time until it is disabled. When the RTO instruction is disabled, it retains its .ACC value. You must clear the .ACC value, typically with a RES instruction referencing the same TIMER structure.

112

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

Timer and Counter Instructions (TON, TOF, RTO, TONR, TOFR, RTOR, CTU, CTD, CTUD, RES) Chapter 3

The time base is always 1 msec. For example, for a 2-second timer, enter 2000 for the .PRE value.

rung condition in timer enable bit (.EN) rung condition that controls RES instruction timer timing bit (.TT) timer done bit (.DN) preset

16651 timer accumulated value (.ACC)

0 timer did not reach .PRE value

A timer runs by subtracting the time of its last scan from the time now:

ACC = ACC + (current_time - last_time_scanned)

After it updates the ACC, the timer sets last_time_scanned =

current_time. This gets the timer ready for the next scan.

IMPORTANT

Make sure to scan the timer at least every 69 minutes while it runs. Otherwise, the ACC value won’t be correct.

The

last_time_scanned value has a range of up to 69 minutes. The timer’s calculation rolls over if you don’t scan the timer within 69 minutes. The ACC value won’t be correct if this happens.

While a timer runs, scan it within 69 minutes if you put it in a:

• subroutine

• section of code that is between JMP and LBL instructions

• sequential function chart (SFC)

• event or periodic task

• state routine of a phase

Arithmetic Status Flags:

not affected

Fault Conditions:

A Major Fault Will Occur If Fault Type

.PRE < 0 4

.ACC < 0 4

Fault Code

34

34

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

113

Chapter 3 Timer and Counter Instructions (TON, TOF, RTO, TONR, TOFR, RTOR, CTU, CTD, CTUD, RES)

Execution:

Condition

prescan rung-condition-in is false

Relay Ladder Action

The .EN, .TT, and .DN bits are cleared.

The .ACC value is not modified.

The rung-condition-out is set to false.

The .EN and .TT bits are cleared.

The .DN bit is not modified.

The .ACC value is not modified.

The rung-condition-out is set to false.

rung-condition-in is true postscan examine .DN bit

.DN bit = 1

.DN bit = 0 examine .EN bit

.EN bit = 0

.EN bit = 1

.TT bit is set

.ACC = .ACC + (current_time - last_time)

.EN bit is set

.TT bit is set examine .ACC

.ACC

.PRE

.ACC < .PRE

.DN is set

.TT bit is cleared

.ACC value rolls over no yes

.ACC = 2,147,483,647

The rung-condition-out is set to false.

rung-condition-out is set to

true

end

114

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

Timer and Counter Instructions (TON, TOF, RTO, TONR, TOFR, RTOR, CTU, CTD, CTUD, RES) Chapter 3

Example:

When limit_switch_1 is set, light_1 is on for 180 msec (timer_2 is timing). When

timer_3.acc reaches 180, light_1 goes off and light_2 goes on. Light_2 remains until timer_3 is reset. If limit_switch_2 is cleared while timer_3 is timing, light_1 remains on. When limit_switch_2 is set, the RES instruction resets timer_3

(clears status bits and .ACC value).

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

115

advertisement

Related manuals

advertisement

Table of contents