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)

Timer On Delay (TON)

Mnemonic

.EN

.TT

.DN

.PRE

.ACC

The TON instruction is a non-retentive timer that accumulates time when the instruction is enabled (rung-condition-in is true).

This instruction is available in structured text and function block as TONR, see page 116 .

Operands:

Relay Ladder

Operand

Timer

Preset

Accum

Type

TIMER

DINT

DINT

Format Description

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

TIMER Structure

Data Type

BOOL

BOOL

BOOL

DINT

DINT

Description

The enable bit indicates that the TON instruction is enabled.

The timing bit indicates that a timing operation is in process

The done bit is set when .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

TON instruction was enabled.

Description:

The TON instruction accumulates time until:

• the TON instruction is disabled

• the .ACC

.PRE

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

104

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

When the TON instruction is disabled, the .ACC value is cleared.

rung condition in timer enable bit (.EN) timer timing bit (.TT) timer done bit (.DN)

ON delay preset timer did not reach

.PRE value timer accumulated value (.ACC)

0 16649

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

105

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

Condition

prescan rung-condition-in is false

Execution:

Relay Ladder Action

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

The .ACC value is cleared.

The rung-condition-out is set to false.

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

The .ACC value is cleared.

The rung-condition-out is set to false.

rung-condition-in is true examine .DN bit

.DN bit = 1

.DN bit = 0

.EN bit is set

.TT bit is set examine .EN bit

.EN bit = 0

.EN bit = 1

.TT bit is set

.ACC = .ACC + (current_time - last_time) examine .ACC

.ACC

.PRE

.ACC < .PRE

.DN is set

.TT bit is cleared

.ACC value rolls over yes

.ACC = 2,147,483,647 no rung-condition-out is set to

true

postscan The rung-condition-out is set to false.

end

106

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_2 is on for 180 msec (timer_1 is timing). When

timer_1.acc reaches 180, light_2 goes off and light_3 goes on. Light_3 remains on until the TON instruction is disabled. If limit_switch_1 is cleared while timer_1 is timing, light_2 goes off.

Publication 1756-RM003K-EN-P - July 2008

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

107

advertisement

Related manuals

advertisement

Table of contents