Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 5 of 70

SLC 500 Instruction Set Reference Manual, pages 41 to 50

Pages 41 to 50 of 694

The original document is the PDF (7.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Allen-Bradley 1747-L514

Page 41

Basic Instructions

2-5

When enabled, the latch instruction tells the controller to turn on the addressed bit. Thereafter, the bit remains on, regardless of the rung condition, until the bit is turned off (typically by a OTU instruction in another rung).

Using OTU When you assign an address to the OTU instruction that corresponds to the address of a physical output, the output device wired to this screw terminal is de-energized when the bit is cleared (turned off or disabled). The unlatch instruction tells the controller to turn off the addressed bit. Thereafter, the bit remains off, regardless of the rung condition, until it is turned on (typically by a OTL instruction in another rung).

The OSR instruction is a retentive input instruction that triggers an event to occur one time. Use the OSR instruction when an event must start based on the change of state of the rung from false-to-true.

One-shot Rising (OSR)

[OSR]

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

•

•

Input Instruction

•

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

•

The SLC 500 and SLC 5/01 processors allow you to use one OSR instruction per output in a rung; the OSR cannot be within a branch. The SLC 5/02 and higher processors allow you to use one OSR instruction per output in a rung; putting the OSR within a branch is permitted.

Entering Parameters The address assigned to the OSR instruction is not the one-shot address referenced by your program, nor does it indicate the state of the OSR instruction. This address allows the OSR instruction to remember its previous rung state. Use a bit address from either the bit or integer data file. The addressed bit is set (1) for one scan when rung conditions preceding the OSR instruction are true (even if the OSR instruction becomes false); the bit is reset (0) when rung conditions preceding the OSR instruction are false.

Publication 1747-RM001G-EN-P - November 2008

Page 42

2-6

Basic Instructions

TIP

The bit address you use for this instruction must be unique. Do not use it elsewhere in the program.

Do not use an input or output address to program the address parameter of the OSR instruction.

Examples The following rungs illustrate the use of the OSR instruction. The first four rungs apply to SLC 500 and SLC 5/01 processors. The fifth rung involves output branching and applies to the SLC 5/02 and higher processors.

SLC 500 and SLC 5/01 Processors

O:3.0 I:1.0 B3 ( ) ] [ [OSR] 0 0 0 When the input instruction goes from false-to-true, the OSR instruction conditions the rung so that the output goes true for one program scan. The output goes false and remains false for successive scans until the input makes another false-to-true transition. I:1.0 ] [ 0

B3 [OSR] 0

TOD TO BCD Source Dest

Tf:0.ACC O:3

In this case, the accumulated value of a timer is converted to BCD and moved to an output word where an LED display is connected. When the timer is running, the accumulated value is changing rapidly. This value can be frozen and displayed for each false-to-true transition of the input condition of the rung. Using an OSR Instruction in a Branch (SLC 500 and SLC 5/01 Processors)

I:1.0 ] [ 0

B3 [OSR] 0

O:3.0 ( ) 0 O:3.0 ( ) 1

In the above rung, the OSR instruction is not permitted inside a branch.

I:1.0 ] [ 0

B3 [OSR] 0

O:3.0 ( ) 0

O:3.0 ( ) 1 In this case, the OSR instruction is not in the branch so the rung is legal.

Publication 1747-RM001G-EN-P - November 2008

Page 43

Basic Instructions

2-7

The SLC 500 and SLC 5/01 processors allow you to use only one OSR instruction per rung.

ATTENTION

When using a SLC 500 or SLC 5/01 processor, do not place input conditions after the OSR instruction in a rung. Unexpected operation may occur.

SLC 5/02 (and higher) Processors

I:1.0 ] [ 0

B3 ]/[ 1

B3 O:3.0 B3 [OSR] ] [ ( ) 0 0 4

B3 ] [ 2

B3 [OSR] 3

B3 O:3.0 ]/[ ( ) 5 1

The SLC 5/02 and higher processors allow you to use one OSR instruction per output in a rung. They also allow input conditions after the OSR instruction. Input branching around an OSR instruction is not allowed.

Timer Instructions Overview

Entering Parameters These are several parameters associated with Timer instructions. The following paragraphs detail the operation of the timer instruction.

Accumulator Value (.ACC) This is the time elapsed since the timer was last reset. When enabled, the timer updates this continually.

Preset Value (.PRE) This specifies the value which the timer must reach before the controller sets the done bit. When the accumulated value becomes equal to or greater than the preset value, the done (DN) bit is set. You can use this bit to control an output device. Preset and accumulated values for timers range from 0 to +32,767. If a timer preset or accumulated value is a negative number, a runtime error occurs.

Publication 1747-RM001G-EN-P - November 2008

Page 44

2-8

Basic Instructions

Timebase The timebase determines the duration of each timebase interval. For Fixed and SLC 5/01 processors, the timebase is set at 0.01 second.

EXAMPLE

If the timer base is set to 0.01, it would take 100 counts as the preset value (PRE) to equal 1 seconds worth of timing.

Timer Accuracy Timer accuracy refers to the length of time between the moment a timer instruction is enabled and the moment the timed interval is complete. Inaccuracy caused by the program scan can be greater than the timer timebase. You must also consider the time required to energize the output device. Timing accuracy is -0.01 to 0 seconds, with a program scan of up to 2.5 seconds. The 1-second timer maintains accuracy with a program scan of up to 1.5 seconds. If your programs can exceed 1.5 or 2.5 seconds, repeat the timer instruction rung so that the rung is scanned within these limits.

Publication 1747-RM001G-EN-P - November 2008

Page 45

Basic Instructions

2-9

Use the TON instruction to turn an output on or off after the timer has been on for a preset time interval. The TON instruction begins to count timebase intervals when rung conditions become true. As long as rung conditions remain true, the timer adjusts its accumulated value (ACC) each evaluation until it reaches the preset value (PRE). The accumulated value is reset when rung conditions go false, regardless of whether the timer has timed out.

Timer On-delay (TON)

Using Status Bits TON

(EN)

TIMER ON DELAY

T4:0 0.01 120 0

Timer Time Base Preset Accum

(DN)

Table 2.4 Setting TON Status Bits

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

•

•

•

This Bit

Is Set When

And Remains Set Until One of the Following

Timer Done Bit DN (bit 13)

accumulated value is equal to or greater than the preset value rung conditions go false

Timer Timing Bit TT (bit 14)

rung conditions are true and the accumulated value is less than the preset value rung conditions go false or when the done bit is set

Timer Enable Bit EN (bit 15)

rung conditions are true rung conditions go false

•

Output Instruction

When the processor changes from the REM Run or REM Test mode to the REM Program mode or user power is lost while the instruction is timing but has not reached its preset value, the following occur. • Timer Enable (EN) bit remains set • Timer Timing (TT) bit remains set • Accumulated value (ACC) remains the same On returning to the REM Run or REM Test mode, the following can happen. Table 2.5 Returning to REM Run or REM Test Mode Condition

Result

If the rung is true:

EN bit remains set. TT bit remains set. ACC value is reset.

If the rung is false:

EN bit is reset. TT bit is reset. ACC value is reset.

Publication 1747-RM001G-EN-P - November 2008

Page 46

2-10

Basic Instructions

Use the TOF instruction to turn an output on or off after its rung has been off for a preset time interval. The TOF instruction begins to count timebase intervals when the rung makes a true-to-false transition. As long as rung conditions remain false, the timer increments its accumulated value (ACC) based on the timebase for each scan until it reaches the preset value (PRE). The accumulated value is reset when rung conditions go true regardless of whether the timer has timed out.

Timer Off-delay (TOF)

Using Status Bits TOF TIMER OFF DELAY Timer T4:1 Time Base 0.01 Preset 120 Accum 0

(EN) (DN)

Table 2.6 Setting TOF Status Bits

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

•

•

•

•

This Bit

Is Set When

And Remains Set Until One of the Following

Timer Done Bit DN (Bit 13)

rung conditions are true rung conditions go false and the accumulated value is greater than or equal to the preset value

Timer Timing Bit TT (Bit 14)

rung conditions are false rung conditions go true or and the accumulated value when the done bit is reset is less than the preset value

Timer Enable Bit EN (Bit 15)

rung conditions are true

Output Instruction rung conditions go false

When processor operation changes from the REM Run or REM Test mode to the REM Program mode or user power is lost while a timer off-delay instruction is timing but has not reached its preset value, the following occurs. • Timer Enable (EN) bit remains set • Timer Timing (TT) bit remains set • Timer Done (DN) bit remains set • Accumulated value (ACC) remains the same On returning to the REM Run or REM Test mode, the following can happen. Table 2.7 Returning to REM Run or REM Test Mode

Publication 1747-RM001G-EN-P - November 2008

Condition

Result

If the rung is true:

TT bit is reset DN bit remains set EN bit is set ACC value is reset.

If the rung is false:

TT bit is reset DN bit is reset EN bit is reset ACC value is set equal to the preset value.

Page 47

Basic Instructions

ATTENTION

TIP

•

•

(EN) (DN)

•

The TOF timer times inside an inactive MCR Pair.

The RTO instruction retains its accumulated value when any of the following occurs.

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

The Reset (RES) instruction cannot be used with the TOF instruction because RES always clears the status bits as well as the accumulated value. (See 2-20)

Use the RTO instruction to turn an output on or off after its timer has been on for a preset time interval. The RTO instruction is a retentive instruction that begins to count timebase intervals when rung conditions become true.

Retentive Timer (RTO)

RTO RETENTIVE TIMER ON Timer T4:2 Time Base 0.01 Preset 120 Accum 0

2-11

•

•

• Rung conditions become fals. • You change processor operation from the REM Run or REM Test mode to the REM Program mode • The processor loses power (provided that battery backup is maintained) • A fault occurs

Output Instruction

When you return the processor to the REM Run or REM Test mode and/or rung conditions go true, timing continues from the retained accumulated value. By retaining its accumulated value, retentive timers measure the cumulative period during which rung conditions are true.

Publication 1747-RM001G-EN-P - November 2008

Page 48

2-12

Basic Instructions

Using Status Bits Table 2.8 Setting RTO Status Bits This Bit

Is Set When

And Remains Set Until One of the Following

Timer Done Bit DN (Bit 13)

accumulated value is equal to or greater than the preset value the appropriate RES instruction is enabled

Timer Timing Bit TT (Bit 14)

rung conditions are true and the accumulated value is less than the preset value

Rung conditions go false or when the done bit is set

Timer Enable Bit EN (Bit 15)

rung conditions are true rung conditions go false or if the timer is reset with the RES instruction

TIP

To reset the retentive timer’s accumulated value and status bits after the RTO rung goes false, you must program a reset (RES) instruction with the same address in another rung.

When the processor changes from the REM Run or REM Test mode to the REM Program or REM Fault mode, or user power is lost while the timer is timing but not yet at the preset value, the following occurs. • Timer Enable (EN) bit remains set • Timer Timing (TT) bit remains set • Accumulated value (ACC) remains the same On returning to the REM Run or REM Test mode or when power is restored, the following can happen. Table 2.9 Returning to REM Run or REM Test Mode

Publication 1747-RM001G-EN-P - November 2008

Condition

Results

If the rung is true:

TT bit remains set. EN bit remains set. ACC value remains the same and resumes incrementing.

If the rung is false:

TT bit is reset. DN bit remains in its last state. EN bit is reset. ACC value remains in its last state.

Page 49

Basic Instructions

Counter Instructions Overview

2-13

How Counters Work The figure below demonstrates how a counter works. The count value must remain in the range of − 32768 to + 32767. If the count value goes above + 32767 or below − 32768, the counter status overflow (OV) or underflow (UN) bit is set. A counter can be reset to zero using the reset (RES) instruction.

-32,768

(CTU) Count Up

+32,767

0

Counter Accumulated Value Count Down (CTD) Underflow

The CTU is an instruction that counts false-to-true rung transitions. Rung transitions can be caused by events occurring in the program (from internal logic or by external field devices) such as parts traveling past a detector or actuating a limit switch.

Count Up (CTU)

CTU COUNT UP Counter Preset Accum

When rung conditions for a CTU instruction have made a false-to-true transition, the accumulated value is incremented by one count, provided that the rung containing the CTU instruction is evaluated between these transitions. The ability of the counter to detect false-to-true transitions depends on the speed (frequency) of the incoming signal.

(CU) C5:0 120 0

Overflow

(DN)

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

•

•

Output Instruction

•

•

TIP

The on and off duration of an incoming signal must not be faster than the scan time x2 (assuming a 50% duty cycle).

The accumulated value is retained when the rung conditions again become false. The accumulated count is retained until cleared by a reset (RES) instruction that has the same address as the counter reset.

Publication 1747-RM001G-EN-P - November 2008

Page 50

2-14

Basic Instructions

Using Status Bits Table 2.10 Setting CTU Status Bits This Bit

Is Set When

And Remains Set Until One of the Following

Count Up Overflow Bit OV (Bit 12)

accumulated value wraps around to -32,768 (from +32,767) and continues counting up from there a RES instruction having the same address as the CTU instruction is executed OR the count is decremented less than or equal to +32,767 with a CTD instruction

Done Bit DN (Bit 13)

accumulated value is equal to or greater than the preset value the accumulated value becomes less than the preset value

Count Up Enable Bit CU (Bit 15)

rung conditions are true rung conditions go false OR a RES instruction having the same address as the CTU instruction is enabled

The accumulated value is retained after the CTU instruction goes false, or when power is removed from and then restored to the controller. Also, the on or off status of counter done, overflow, and underflow bits is retentive. The accumulated value and control bits are reset when the appropriate RES instruction is enabled. The CU bits are always set prior to entering the REM Run or REM Test modes.

The CTD is an instruction that counts false-to-true rung transitions. Rung transitions can be caused by events occurring in the program such as parts traveling past a detector or actuating a limit switch.

Count Down (CTD)

CTD COUNT DOWN Counter C5:1 Preset 120 Accum 0

When rung conditions for a CTD instruction have made a false-to-true transition, the accumulated value is decremented by one count, provided that the rung containing the CTD instruction is evaluated between these transitions.

(CD) (DN)

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

•

•

•

•

Output Instruction

Publication 1747-RM001G-EN-P - November 2008

The accumulated counts are retained when the rung conditions again become false. The accumulated count is retained until cleared by a reset (RES) instruction that has the same address as the counter reset.