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

The text of a manual · part 20 of 53

DL06 Micro PLC User Manual, Volume 1 of 2, pages 190 to 199

Pages 190 to 199 of 524

The original document is the PDF (6.4 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 AutomationDirect Direct Logic DL06 and Koyo DL06 D0-06DD1

Page 190

Chapter 5: Standard RLL Instructions - Immediate Instructions

Set Immediate (SETI)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

DS5

Used

HPP

Used

The Set Immediate instruction immediately sets, or turns on an output or a range of outputs in the image register and the corresponding output point(s) at the time the instruction is executed. Once the outputs are set it is not necessary for the input to remain on. The Reset Immediate instruction can be used to reset the outputs.

Y aaa aaa SETI

Reset Immediate (RSTI) DS5

Used

HPP

Used

5–36

The Reset Immediate instruction immediately resets, or turns off an output or a range of outputs in the image register and the output point(s) at the time the instruction is executed. Once the outputs are reset it is not necessary for the input to remain on.

Y aaa aaa RSTI

Operand Data Type

DL06 Range aaa

Ouputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y

0–777

In the following example, when X1 is on, Y2 through Y5 will be set on in the image register and on the corresponding output points.

DirectSOFT 5 DirectSOFT32 X1

Handheld Programmer Keystrokes Y2

$

Y5

B STR

SETI

X SET

1

ENT C

I

SHFT

8

F 2

5

ENT

In the following example, when X1 is on, Y5 through Y22 will be reset (off ) in the image register and on the corresponding output module(s). DirectSOFT 5 DirectSOFT32 Handheld Programmer Keystrokes X1

Y5

Y22 RSTI

$

B STR

S RST

1 SHFT

DL06 Micro PLC User Manual, 3rd Edition Rev. A

I

ENT C

F 8

5

C 2

2

ENT

Page 191

Chapter 5: Standard RLL Instructions - Immediate Instructions

Load Immediate (LDI) DS5

Used

HPP

Used

The Load Immediate instruction loads a 16-bit V-memory value into the accumulator. The valid address range includes all input point addresses on the local base. The value reflects the current status of the input points at the time the instruction is executed. This instruction may be used instead of the LDIF instruction which requires you to specify the number of input points.

1 V aaa 2 3 Operand Data Type DL06 Range aaa 4 In the following example, when C0 is on, the binary pattern of X0–X17 will be loaded into 5 the accumulator using the Load Immediate instruction. The Out Immediate instruction could be used to copy the 16 bits in the accumulator to output points, such as Y40–Y57. This 6 technique is useful to quickly copy an input pattern to output points (without waiting for a full CPU scan to occur). 7 8 9 10 11 12 13 14 A B C D Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V

LDI

40400-40437

DirectSOFT 5 DirectSOFT32 C0

Location

LDI

X17 X16 X15 X14 X13 X12 X11 X10

V40400

V40400

Load the inputs from X0 to X17 into the accumulator, immediately

X7

X6

X5

X4

X3

X2

X1

X0

ON OFF ON ON OFF ON OFF OFF ON OFF ON ON OFF ON OFF ON

Unused accumulator bits are set to zero

Acc.

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9

8

7 6 5

4 3

2

1

0

0

0

1 0

1

1 0

1

0

0

0 0

0

0

0

0 0

0

0

0

0 0

0

1

0

1

1 0

1

0

1

0

OUTI

V40502

Output the value in the accumulator to output points Y40 to Y57

Location

Y57 Y56 Y55 Y54 Y53 Y52 Y51 Y50 Y47 Y46 Y45 Y44 Y43 Y42 Y41 Y40 ON OFF ON ON OFF ON OFF OFF ON OFF ON ON OFF ON OFF ON

V40502

Handheld Programmer Keystrokes $ STR SHFT GX OUT

NEXT

NEXT

L ANDST

D

I

SHFT

I

3 8

NEXT

NEXT

A

E

A

8

0

4

NEXT

E

E

0

A

4

ENT

A

4

F

0

A

0

A

5

0

C

0

2

ENT ENT

DL06 Micro PLC User Manual, 3rd Edition Rev. A

5–37

Page 192

Chapter 5: Standard RLL Instructions - Immediate Instructions

Load Immediate Formatted (LDIF)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

DS5

Used

HPP

Used

The Load Immediate Formatted instruction loads a 1–32 bit binary value into the accumulator. The value reflects the current status of the input module(s) at the time the instruction is executed. Accumulator bits that are not used by the instruction are set to zero. Operand Data Type

X aaa

LDIF K bbb

DL06 Range

Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K aaa bbb

0-777 --

-1-32

In the following example, when C0 is on, the binary pattern of X10–X17 will be loaded into the accumulator using the Load Immediate Formatted instruction. The Out Immediate Formatted instruction could be used to copy the specified number of bits in the accumulator to the specified outputs on the output module, such as Y30–Y37. This technique is useful to quickly copy an input pattern to outputs (without waiting for the CPU scan).

DirectSOFT 5 DirectSOFT32 C0

LDIF

X10 K8

Load the value of 8 consecutive location into the accumulator starting with X10

Constant K8

X17 X16 X15 X14 X13 X12 X11 X10 ON OFF ON ON OFF ON OFF ON

Unused accumulator bits are set to zero

Acc.

OUTIF

Location X10

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9

8

7 6 5

4 3

2

1

0

0

0

1 0

1

1 0

1

0

0

0 0

0

0

0

0 0

0

0

0

0 0

0

0

0

0

0 0

0

0

1

0

Y30 K8

Copy the value of the lower 8 bits of the accumulator to Y30 - Y37

Location

Constant

Y37 Y36 Y35 Y34 Y33 Y32 Y31 Y30

Y30

K8

ON OFF ON ON OFF ON OFF ON

Handheld Programmer Keystrokes $ STR

NEXT

NEXT

NEXT

I

F

SHFT

L ANDST

D

GX OUT

SHFT

I

5–38

3

8 F

8

NEXT

0 1 A

3

ENT A

B 5 D

5

A

I 0

8 I

0

8

ENT

DL06 Micro PLC User Manual, 3rd Edition Rev. A

ENT

Page 193

Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register Instructions

Timer, Counter and Shift Register Instructions

1 Timers are used to time an event for a desired length of time. The single input timer will time 2 as long as the input is on. When the input changes from on to off the timer current value is reset to 0. There is a tenth of a second and a hundredth of a second timer available with a 3 maximum time of 999.9 and 99.99 seconds respectively. There is a discrete bit associated with each timer to indicate that the current value is equal to or greater than the preset value. The timing diagram below shows the relationship between the timer input, associated discrete bit, 4 current value and timer preset. 5 6 7 8 There are those applications that need an accumulating timer, meaning it has the ability to time, stop, and then resume from where it previously stopped. The accumulating timer works similarly to the regular timer, but two inputs are required. The enable input starts and stops 9 the timer. When the timer stops, the elapsed time is maintained. When the timer starts again, the timing continues from the elapsed time. When the reset input is turned on, the elapsed 10 time is cleared and the timer will start at 0 when it is restarted. There is a tenth of a second and a hundredth of a second timer available with a maximum time of 9999999.9 and 999999.99 seconds respectively. The timing diagram below shows the relationship between 11 the timer input, timer reset, associated discrete bit, current value and timer preset. 12 13 14 A NOTE: Decimal points are not used in these timers, but the decimal point is implied. The preset and current B value for all four timers is in BCD format. C D

Using Timers

0

1

2

3

Seconds 4

5

6

7

8

X1

TMR

X1

T1

K30

Timer Preset

T1

T1

Current Value

0

0

10

20

1

2

3

30 40 1/10 Seconds

Seconds 4

5

50

60

6

7

Y0 OUT

0

8

X1

TMRA

T0

K30

Enable

X1

X2

X2

Reset Input

T0

Current Value

0

10

10

20 30 1/10 Seconds

40

50

0

DL06 Micro PLC User Manual, 3rd Edition Rev. A

5–39

Page 194

Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register Instructions

Timer (TMR) and Timer Fast (TMRF)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

DS5

Used

HPP

Used

5–40

The Timer instruction is a 0.1 second single input timer that times to a maximum of 999.9 seconds. The Timer Fast instruction is a 0.01 second single input timer that times up to T aaa TMR a maximum of 99.99 seconds. These timers will be enabled if B bbb the input logic is true (on) and will be reset to 0 if the input logic is false (off ). Both timers use single word BCD values for Preset Timer# the preset and current value. The decimal place is implied. Instruction Specifications Timer Reference (Taaa): Specifies the timer number. Preset Value (Bbbb): Constant value (K) or a V-memory TMRF T aaa location specified in BCD. B bbb Current Value: Timer current values, in BCD format, are accessed by referencing the associated V or T memory Timer# Preset location*. For example, the timer current value for T3 physically resides in V-memory location V3. Discrete Status Bit: The discrete status bit is referenced by the associated T memory location. Operating as a “timer done bit”, it will be on if the current value is equal to or greater than the preset value. For example, the discrete status bit for Timer 2 is T2. NOTE: A V-memory preset is required only if the ladder program or an Operator Interface unit must change the preset.

Operand Data Type

DL06 Range

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A/B Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T aaa bbb

0–777

V-memory for preset values . . . . . . . . . . . . . . . V

––

–– 400-677 1200–7377 7400–7577 10000-17777

Pointers (preset only) . . . . . . . . . . . . . . . . . . . . P Constants (preset only) . . . . . . . . . . . . . . . . . . K Timer discrete status bits . . . . . . . . . . . . . . . T/V Timer current values . . . . . . . . . . . . . . . . . V /T**

400-677 1200–7377 7400–7577* 10000-17777 –– 0–9999 0–377 or V41100–41117 0–377 ––

NOTE: *May be non-volatile if MOV instruction is used. ** With the HPP, both the Timer discrete status bits and current value are accessed with the same data reference. DirectSOFT 5 uses separate references, such as “T2” for discrete status bit for Timer T2, and “TA2” for the current value of Timer T2.

You can perform functions when the timer reaches the specified preset using the discrete status bit. Or, use comparative contacts to perform functions at different time intervals, based on one timer. The examples on the following page show these two methods of programming timers. DL06 Micro PLC User Manual, 3rd Edition Rev. A

Page 195

Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register Instructions

Timer Example Using Discrete Status Bits In the following example, a single input timer is used with a preset of 3 seconds. The timer discrete status bit (T2) will turn on when the timer has timed for 3 seconds. The timer is reset when X1 turns off, turning the discrete status bit off and resetting the timer current value to 0.

1 2 3 4 5 6 7 8 Timer Example Using Comparative Contacts In the following example, a single input timer is used with a preset of 4.5 seconds. 9 Comparative contacts are used to energize Y3, Y4, and Y5 at one second intervals respectively. When X1 is turned off the timer will be reset to 0 and the comparative contacts will turn off 10 Y3, Y4, and Y5. 11 12 13 14 A B C D DirectSOFT 5 Direct SOFT32

Timing Diagram

X1

TMR

T2

0

K30

OUT

B

STR

N TMR $

C

STR

GX OUT

D

2

SHFT

T MLR

A

ENT

0

Seconds 4

5

6

7

0

10

20

30

40

50

60

C

A

3

ENT

0

ENT

2

DirectSOFT 5

Timing Diagram

X1

TMR

Seconds

T20

0

K45

Y3

K10

2

3

4

5

6

7

0

10

20

30

40

50

60

8

Y3

Y4

K20

1

X1

OUT

TA20

0

1/10th Seconds

Direct SOFT32

TA20

8

Y0

Current Value

ENT

1

3

T2

Handheld Programmer Keystrokes $

2

X1

Y0

T2

1

Y4

OUT

Y5

TA20

Y5

K30

T2

OUT

Current Value

1/10th Seconds

Handheld Programmer Keystrokes $

B

STR

1

ENT

N TMR

C

2

0

$

SHFT

T MLR

STR

GX OUT $

STR

GX OUT $

STR

GX OUT

A

D

3

SHFT

E

4

E

F

4

C

2

5

ENT

B

A

0

A

1

0

ENT

ENT

T MLR

A

C

2

C

0

A

2

0

ENT

ENT

SHFT

T MLR

F

ENT

5

0

A

C

2

A

D

0

3

0

ENT

DL06 Micro PLC User Manual, 3rd Edition Rev. A

5–41

Page 196

Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register Instructions

Accumulating Timer (TMRA) The Accumulating Timer is a 0.1 second two input timer that will time to a maximum of 9999999.9. The TMRA uses two timer Used registers in V-memory.

DS5

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

Used

HPP

Enable

T aaa TMRA B bbb

Reset

Accumulating Fast Timer (TMRAF) DS5 HPP

5–42

The Accumulating Fast Timer is a 0.01 second two-input timer Timer# Preset that will time to a maximum of 99999.99. The TMRA uses two Used timer registers in V-memory. Each timer uses two timer registers in V-memory. The preset and T aaa Enable TMRAF B bbb current values are in double word BCD format, and the decimal point is implied. These timers have two inputs, an enable and a Reset reset. The timer starts timing when the enable is on and stops when the enable is off (without resetting the count). The reset Timer# will reset the timer when on and allow the timer to time when off. Preset Timer Reference (Taaa): Specifies the timer number. Preset Value (Bbbb): Constant value (K) or V-memory. Current Value: Timer current values are accessed by referencing the associated V or T memory location*. For example, the timer current value for T3 resides in V-memory, V3. Discrete Status Bit: The discrete status bit is accessed by referencing the associated T memory location. Operating as a “timer done bit,” it will be on if the current value is equal to or greater than the preset value. For example the discrete status bit for timer 2 would be T2. Used

NOTE: The accumulating timer uses two consecutive V-memory locations for the 8-digit value, therefore two consecutive timer locations. For example, if TMRA T1 is used, the next available timer number is T3. NOTE: A V-Memory preset is required if the ladder program or an OIP must be used to change the preset.

Operand Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A/B Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T V-memory for preset values . . . . . . . . . . . . . . . V

Pointers (preset only) . . . . . . . . . . . . . . . . . . . . P Constants (preset only) . . . . . . . . . . . . . . . . . . K Timer discrete status bits . . . . . . . . . . . . . . . T/V Timer current values . . . . . . . . . . . . . . . . . V /T**

DL06 Range aaa bbb

0–777

–– 400-677 1200–7377 –– 7400–7577 10000-17777 400-677 1200–7377 –– 7400–7577* 10000-17777 –– 0–99999999 0–377 or V41100–41117 0–377

NOTE: *May be non-volatile if MOV instruction is used. ** With the HPP, both the Timer discrete status bits and current value are accessed with the same data reference. DirectSOFT 5 uses separate references, such as “T2” for discrete status bit for Timer T2, and “TA2” for the current value of Timer T2.

DL06 Micro PLC User Manual, 3rd Edition Rev. A

Page 197

Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register Instructions

Accumulating Timer Example using Discrete Status Bits In the following example, a two input timer (accumulating timer) is used with a preset of 3 seconds. The timer discrete status bit (T6) will turn on when the timer has timed for 3 seconds. Notice in this example that the timer times for 1 second , stops for one second, then resumes timing. The timer will reset when C10 turns on, turning the discrete status bit off and resetting the timer current value to 0. DirectSOFT 5

Timing Diagram

Direct SOFT32 X1

TMRA

0

T6

1

2

3

Seconds 4

5

6

7

0

10

10

20

30

40

50

8

X1

K30 C10

C10

T6

Y7

T6

OUT

Current Value

Handheld Programmer Keystrokes

Handheld Programmer Keystrokes (cont)

$

D

B 1

STR $

SHFT

A 3

C

SHFT

STR N TMR

ENT B 2

A 1

A

STR

G 0

ENT

0

$

ENT

0

GX OUT

6

0

SHFT

T MLR

G

B

A

ENT

0

1

ENT

6

Accumulator Timer Example Using Comparative Contacts In the following example, a single input timer is used with a preset of 4.5 seconds. Comparative contacts are used to energized Y3, Y4, and Y5 at one second intervals respectively. The comparative contacts will turn off when the timer is reset. DirectSOFT 5

Timing Diagram

X1 TMRA

0

T20 K45

1

2

3

0

10

10

Seconds 4

5

6

7

20

30

40

50

8

X1

C10 C10

TA20

Y3

Y3

K10

OUT Y4 TA20

Y4

K20

Y5

OUT T20 TA20

Y5

K30

Current Value

OUT

??????????

Handheld Programmer Keystrokes

Handheld Programmer Keystrokes (cont)

$

GX OUT

B STR

1

$

SHFT

STR N TMR $ STR GX OUT $ STR

SHFT

ENT C

B 2

A

A 1

C 0

SHFT D 3 SHFT

0 A

2 T MLR

C

ENT

SHFT

STR

0

2

4

$ E

A

E

F 5

4 B

0

A 1

0

ENT ENT

D

A 3

GX OUT

0

ENT T MLR

C

A 2

0

ENT F 5

ENT

ENT T MLR

C

A 2

C 0

A 2

0

0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

ENT

DL06 Micro PLC User Manual, 3rd Edition Rev. A

5–43

Page 198

Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register Instructions

Using Counters

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 5–44

Counters are used to count events . The counters available are up counters, up/down counters, and stage counters (used with RLLPLUS programming). The up counter (CNT) has two inputs, a count input and a reset input. The maximum count value is 9999. The timing diagram below shows the relationship between the counter input, counter reset, associated discrete bit, current value, and counter preset. The CNT counter preset and current value are bothe single word BCD values. X1 X1

CNT

CT1 K3

Up X2

X2

Reset CT1 Current alue

1

2

3

4

0

Counter preset

Counts

The up down counter (UDC) has three inputs, a count up input, count down input and reset input. The maximum count value is 99999999. The timing diagram below shows the relationship between the counter up and down inputs, counter reset, associated discrete bit, current value, and counter preset. The UDC counter preset and current value are bothe double word BCD values. NOTE: The UDC uses two consecutive V-memory locations for the 8-digit value, therefore two consecutive timer locations. For example, if UDC CT1 is used, the next available counter number is CT3. X1

UDC

X1 X2

X2

Down

X3

X3

CT2 Current Value

CT2 K3

Up

Reset 1

2

1 Counts

2

3

0

Counter Preset

The stage counter (SGCNT) has a count input and is reset by the RST instruction. This instruction is useful when programming using the RLLPLUS structured programming. The maximum count value is 9999. The timing diagram below shows the relationship between the counter input, associated discrete bit, current value, counter preset and reset instruction. X1

X1

SGCNT

CT2 K3

CT2 Current Value

1

2

3

4

0

Counts

RST CT2

DL06 Micro PLC User Manual, 3rd Edition Rev. A

Counter preset

Page 199

Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register Instructions

Counter (CNT) DS5

Used

HPP

Used

The Counter is a two input counter that increments when the count input logic transitions from off to on. When the counter reset input is on the counter resets to 0. When the current value equals the preset value, the counter status bit comes on and the counter continues Counter# to count up to a maximum count of 9999. The maximum value will be held until the counter is reset. Count CNT CT aaa Instruction Specifications B bbb Counter Reference (CTaaa): Specifies the counter Reset number. Preset Value (Bbbb): Constant value (K) or a V-memory location. Preset Current Values: Counter current values are accessed by referencing the associated V or CT memory locations*. The V-memory location is the counter location + 1000. For example, the counter current value for CT3 resides in V-memory location V1003. Discrete Status Bit: The discrete status bit is accessed by referencing the associated CT memory location. It will be on if the value is equal to or greater than the preset value. For example the discrete status bit for counter 2 would be CT2. NOTE: A V-memory preset is required if the ladder program or OIP must change the preset.

Operand Data Type

DL06 Range

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A/B Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CT aaa bbb

0–177

V-memory (preset only) . . . . . . . . . . . . . . . . . . V

––

–– 400-677 1200–7377 7400–7577 10000-17777

Pointers (preset only) . . . . . . . . . . . . . . . . . . . . P

1 2 3 4 5 6 7 8 9 10 11

400-677 1200–7377 –– 7400–7577* 10000-17777 –– 0–9999 0–177 or V41140–41147 1000-1177

14 A NOTE: * B ** With the HPP, both the Counter discrete status bits and current value are accessed with the same data reference. DirectSOFT 5 uses separate references, such as “CT2” for discrete status bit for Counter CT2, and C “CTA2” for the current value of Counter CT2. D Constants (preset only) . . . . . . . . . . . . . . . . . . K Counter discrete status bits . . . . . . . . . . . . CT/V Counter current values . . . . . . . . . . . . . . V /CT**

May be non-volatile if MOV instruction is used.

DL06 Micro PLC User Manual, 3rd Edition Rev. A

5–45