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

The text of a manual · part 40 of 68

DL405 User Manual: Chapter 5: Standard RLL Instructions, pages 353 to 362

Pages 353 to 362 of 608, from DL405 User Manual

The original document is the PDF (8.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 AutomationDirect D4-08B-1, AutomationDirect D4-08ND3S, AutomationDirect D4-16TA, PLC Direct D4-16TD2, AutomationDirect D4-32ND3-1, Konnect-It D4-08B-1, Koyo D4-08B-1, Konnect-It D4-08ND3S, and 6 more models

Page 353

Standard RLL Instructions Program Control Instructions

Goto Subroutine (GTS)

430 440 450

DS

HPP

The Goto Subroutine instruction allows a section of ladder logic to be placed outside the main body of the program execute only when needed. There can be a maximum of 192 (DL440) and an unlimited amount for DL450 GTS instructions.

5--181

K aaa GTS

Upon completion of executing the subroutine, program execution returns to the main program immediately after the GTS instruction. GTS instructions can be nested up to 8 levels. An error E412 will occur if the maximum limits are exceeded. Typically this will be used in an application where a block of program logic may be slow to execute and is not required to execute every scan. Operand Data Type

Constant

Subroutine (SBR)

430 440 450

DS

HPP

DL440 Range

K

DL450 Range aaa aaa

1--FFFF

1--FFFF

The subroutine label and all associated logic is placed after the End statement in the program. There can be a maximum of 64 (DL440) and 256 (DL450) SBR instructions used in a program. When the subroutine is called from the main program, the CPU will execute the subroutine (SBR) with the same constant number (K) as the GTS instruction which called the subroutine.

K aaa

SBR

By placing code in a subroutine it is only scanned and executed when needed since it resides after the End instruction. Code which is not scanned does not impact the overall scan time of the program. Operand Data Type

Constant

Subroutine Return (RT)

430 440 450

DS

HPP

430 440 450

DS

HPP

K

DL450 Range aaa aaa

1--FFFF

1--FFFF

When a Subroutine Return is executed in the subroutine the CPU will return to the point in the main body of the program from which it was called. The Subroutine Return is used as termination of the subroutine which must be the last instruction in the subroutine and is a stand alone instruction (no input contact on the rung). The Subroutine Return Conditional instruction is a optional instruction used with a input contact to implement a conditional return from the subroutine. The Subroutine Return (RT) is still required for termination of the Subroutine.

RT

RTC

DL405 User Manual, 4th Edition

Standard RLL Instructions

Subroutine Return Conditional (RTC)

DL440 Range

Page 354

5--182

Standard RLL Instructions Program Control Instructions In the following example, when X1 is on, Subroutine K3 will be called. The CPU will jump to the Subroutine Label K3 and the ladder logic in the subroutine will be executed. If X35 is on the CPU will return to the main program at the RTC instruction. If X35 is not on Y0--Y17 will be reset to off and then the CPU will return to the main body of the program. DirectSOFT

X1

K3 GTS

C0 LD K10

S S S END

SBR

K3

X20

Y5 OUTI

X21

Y10 OUTI

X35 RTC

X35

Y0

Y17 RSTI

RT

Handheld Programmer Keystrokes STR

X(IN)

1

SHFT

G

T

SHFT

S

STR

SHFT

OUT

S

SHFT

K(CON)

3

B

R

SHFT

K(CON) 1

3

I

SHFT

X(IN)

2

0

SHFT

I

SHFT

Y(OUT)

5

S S

Standard RLL Instructions

END

DL405 User Manual, 4th Edition

STR

SHFT

I

SHFT

X(IN)

2

1

OUT

SHFT

I

SHFT

Y(OUT)

1

0

X(IN)

3

5

STR

SHFT

I

SHFT

SHFT

R

T

C

STR

NOT

SHFT

I

SHFT

X(IN)

3

5

RST

SHFT

I

SHFT

Y(OUT)

0

Y(OUT)

1

SHFT

R

T

7

Page 355

Standard RLL Instructions Program Control Instructions

Master Line Set (MLS)

430 440 450

DS

HPP

The Master Line Set instruction allows the program to control sections of ladder logic by forming a new power rail controlled by the main left power rail. The main left rail is always master line 0. When a MLS K1 instruction is used, a new power rail is created at level 1. Master Line Sets and Master Line Resets can be used to nest power rails up to seven levels deep. Operand Data Type

Constant

Master Line Reset (MLR)

430 440 450

DS

HPP

K aaa MLS

DL430 Range

DL440 Range

DL450 Range aaa aaa aaa

1--7

1--7

1--7

The Master Line Reset instruction marks the end of control for the corresponding MLS instruction. The MLR reference is one less than the corresponding MLS. Operand Data Type

Constant

Understanding Master Control Relays

K

K

5--183

K aaa MLR

DL430 Range

DL440 Range

DL450 Range aaa aaa aaa

0--6

0--6

1--6

The Master Line Set (MLS) and Master Line Reset (MLR) instructions allow you to quickly control the power flow for sections of the RLL program. This provides program control flexibility. The following example shows how the MLS and MLR instructions operate by creating a sub power rail for control logic.

430 440 450

DS

HPP

In the following MLS/MLR example, logic between the first MLS K1 (A) and MLR K0 (B) will only have power flow present at the power rail if input X0 is on. (Note, if X0 is MLS/MLR Example off the logic will still be scanned, but there is no power flow.) The logic between the MLS K2 (C) and MLR K1 (D) will only have power flow present at the power rail if input X10 and X0 are on. The last rung is not controlled by either of the MLS coils and always has power flow present at the beginning of the rung. Remember, the MLS / MLR instructions control the power flow between the power rails. It does not control the execution of the instructions. The instructions are still executed, but since there is no power flow, the logic cannot turn on the output coils. Consider the following case for our example.

DL405 User Manual, 4th Edition

Standard RLL Instructions

1. X0 is off, which means that there is no power flow at the second rung. 2. You use a programming device to turn on C0. Since there is no power flow at the second rung (STR X1, OUT C0), then you would expect that C0 would remain on, since you turned it on with the programming device. However, the MLS instruction does not mean that the instructions within the zone of control are not executed. They are in fact executed, but with no power flow. So in our case, C0 would be turned off when the rung was executed. This is because the CPU sees that there is no power flow present at the rung. When it executes this rung, it will turn off C0.

Page 356

5--184

Standard RLL Instructions Program Control Instructions

DirectSOFT X0

K1 MLS

X1

When contact X0 is on, logic under the first MLS will be executed.

Y7 OUT K2

X2

MLS X3

When contact X0 and X2 are ON, logic under the second MLS will be executed.

Y10 OUT K1 MLR The MLR instructions note the end of the Master Control area.

K0 MLR Y11

X10

OUT

DirectSOFT X0

Handheld Programmer Keystrokes K1 MLS

X1

A

C0 OUT

X2

C1

X5

X4

X(IN)

1

C(CR)

0

STR

X(IN)

3

OUT

Y(OUT)

0

STR

X(IN)

1

MLS

MSL

K(CON)

2

Y1

STR

X(IN)

5

OUT

OUT

Y(OUT)

1

Y0

K2

C

Y2

D

C2

Y3 OUT

Standard RLL Instructions

STR OUT

1

OUT

K0 MLR Y22 OUT

DL405 User Manual, 4th Edition

1

2

MLR

X7

K(CON)

X(IN)

K1

X6

MLS

C(CR)

OUT

X5

0

STR

OUT X10

X(IN)

OUT

OUT X3

STR

B

STR

X(IN)

4

OUT

Y(OUT)

2

MLR

K(CON)

1

STR

X(IN)

5

OUT

C(CR)

2

STR

X(IN)

6

OUT

Y(OUT)

3

MLR

K(CON)

0

STR

X(IN)

7

OUT

Y(OUT)

2

0

2

Page 357

5--185

Standard RLL Instructions Interrupt Instructions

Interrupt Instructions The Interrupt instruction allows a section of ladder logic to be placed outside the main body of the program and executed when O aaa INT needed. Interrupts can be called from the program or an interrupt module can be installed in slot 0 to provide 8 interrupt inputs. One interrupt module can be installed in a DL430 system (X0--X7) and two interrupt modules can be installed in a DL440 or DL450 System (X0--X7, and X20--X27). Remember, the interrupt modules consume 16 points. The two software interrupts use interrupt #16 and #17 which means the hardware interrupts #16 and #17 and the software interrupt cannot be used together. Typically, interrupts will be used in an application where a fast response to an input is needed or a program section needs to execute faster than the normal CPU scan. The interrupt label and all associated logic must be placed after the End statement in the program. When the interrupt routine is called from the interrupt module or software interrupt, the CPU will complete execution of the instruction it is currently processing in ladder logic, then execute the designated interrupt routine. There are two software interrupts and INT 16 and INT 17. Once the interrupt is serviced, the program execution will continue from where it was before the interrupt occurred. The software interrupts are setup by programming the interrupt times in V736 and V737. The valid range is 3--999ms. The value must be a BCD value. The interrupt will not execute if the value is out of range. See the example program of a software interrupt.

Interrupt (INT)

430 440 450

DS

HPP

Operand Data Type

Constant

DL430 Range

DL440 Range aaa aaa aaa

0--7

0--17

0--17

O Software

DL430

DL440/450

Interrupt Input

Interrupt Routine

Interrupt Input

Interrupt Routine

Interrupt Input

Interrupt Routine

----

----

X0

INT 0

X0

INT 0

----

----

X1

INT 1

X1

INT 1

----

----

X2

INT 2

X2

INT 2

----

----

X3

INT 3

X3

INT 3

----

----

X4

INT 4

X4

INT 4

----

----

X5

INT 5

X5

INT 5

----

----

X6

INT 6

X6

INT 6

----

----

X7

INT 7

X7

INT 7

----

----

----

----

X20

INT 10

----

----

----

----

X21

INT 11

----

----

----

----

X22

INT 12

----

----

----

----

X23

INT 13

----

----

----

----

X24

INT 14

----

----

----

----

X25

INT 15

V736 sets interrupt time

INT 16

----

----

X26(cannot be used along with s/w interrupt)

INT 16

V737 sets interrupt time

INT 17

----

----

X27 (cannot be used along with s/w interrupt)

INT 17

DL405 User Manual, 4th Edition

Standard RLL Instructions

2nd Module

DL450 Range

Page 358

5--186

Standard RLL Instructions Interrupt Instructions

Interrupt Return (IRT)

430 440 450

DS

HPP

Interrupt Return Conditional (IRTC)

430 440 450

DS

HPP

Enable Interrupts (ENI)

430 440 450

DS

HPP

Disable Interrupts (DISI)

430 440 450

DS

HPP

The Interrupt Return Conditional instruction is a optional instruction used with an input contact to implement a conditional return from the interrupt routine. The Interrupt Return is still required to terminate the interrupt routine

IRT

IRTC

The Enable Interrupt instruction is programmed in the main body of the application program (before the End instruction) to enable hardware or software interrupts. Once the coil has been energized interrupts will be enabled until the interrupt is disabled by the Disable Interrupt instruction.

ENI

The Disable Interrupt instruction is programmed in the main body of the application program (before the End instruction) to disable both hardware or software interrupts. Once the coil has been energized interrupts will be disabled until the interrupt is enabled by the Enable Interrupt instruction.

DISI

Standard RLL Instructions

When an Interrupt Return is executed in the interrupt routine the CPU will return to the point in the main body of the program from which it was called. The Interrupt Return is programmed as the last instruction in an interrupt routine and is a stand alone instruction (no input contact on the rung).

DL405 User Manual, 4th Edition

Page 359

Standard RLL Instructions Interrupt Instructions Interrupt Example for Interrupt Module

5--187

In the following example, when X40 is on, the interrupts will be enabled. When X40 is off the interrupts will be disabled. When a interrupt signal X1 is received the CPU will jump to the interrupt label INT O 1. The application ladder logic in the interrupt routine will be performed. If X35 is on the CPU will return to the main program with the IRTC instruction. If X35 is not on Y0--Y17 will be reset to off and then the CPU will return to the main body of the program.

DirectSOFT

Handheld Programmer Keystrokes STR

X40 ENI

X40

X(IN)

4

0

SHFT

E

N

I

STR

NOT

X(IN)

1

7

SHFT

D

I

S

I

SHFT

I

N

T

OCT

1

STR

SHFT

I

SHFT

X(IN)

2

OUT

SHFT

I

SHFT

Y(OUT)

5

STR

SHFT

I

SHFT

X(IN)

2

1

OUT

SHFT

I

SHFT

Y(OUT)

1

0

STR

SHFT

I

SHFT

X(IN)

3

5

S DISI

S END

S S S END S S S INT

O1

X20

Y5 OUTI

X21

0

SHFT

I

R

T

C

STR

NOT

SHFT

I

SHFT

X(IN)

3

5

RST

SHFT

I

SHFT

Y(OUT)

0

Y(OUT)

1

SHFT

I

R

T

7

Y10 OUTI

X35 IRTC

X35

Y0

Y17 RSTI

IRT

Standard RLL Instructions

DL405 User Manual, 4th Edition

Page 360

5--188

Standard RLL Instructions Interrupt Instructions In the following example, when X1 is on, the value 10 is copied to V737. This value sets the software interrupt to 10 ms. When X20 turns on, the interrupt will be enabled. When X20 turns off, the interrupts will be disabled. Every 10 ms the CPU will jump to the interrupt label INT O 17. The application ladder logic in the interrupt routine will be performed. If X35 is on the CPU will return to the main program with the IRTC instruction. If X35 is not on Y0--Y17 will be reset to off and then the CPU will return to the main body of the program when the IRT instruction is executed. The software interrupt is limited to the range 3 -- 999 milliseconds. Entering a 0, 1, or 2 will yield an interrupt time of 3 milliseconds.

Interrupt Example for Software Interrupt

DirectSOFT

Handheld Programmer Keystrokes X1

LD K10 Load the constant value (K10) into the lower 16 bits of the accumulator

STR

X(IN)

1

LD

K(CON)

1

0

OUT

V

7

3

7

STR

X(IN)

2

0

V737

SHFT

E

N

I

Copy the value in the lower 16 bits of the accumulator to V737

STR

NOT

X(IN)

2

0

SHFT

D

I

S

I

SHFT

I

N

T

OCT

1

7

STR

SHFT

I

SHFT

X(IN)

2

0

OUT

S X20

S END

ENI

X20 DISI

S S

OUT

SHFT

I

SHFT

Y(OUT)

5

STR

SHFT

I

SHFT

X(IN)

2

1

OUT

SHFT

I

SHFT

Y(OUT)

1

0

STR

SHFT

I

SHFT

X(IN)

3

5

SHFT

I

R

T

C

STR

NOT

SHFT

I

SHFT

X(IN)

3

5

RST

SHFT

I

SHFT

Y(OUT)

0

Y(OUT)

1

SHFT

I

R

T

S END

INT

O 17

X20

Y5 OUTI

X21

Y10 OUTI

X35

Standard RLL Instructions

IRTC

X35

Y0

Y17 RSTI

IRT

DL405 User Manual, 4th Edition

7

Page 361

Standard RLL Instructions Intelligent I/O Instructions

5--189

Intelligent I/O Instructions Read from Intelligent Module (RD)

430 440 450

DS

HPP

The Read from Intelligent Module instruction reads a block of data (1--128 RD bytes maximum) from an intelligent I/O V aaa module into the CPU’s V--memory. It loads the function parameters into the first and second level of the accumulator stack, and the accumulator by three additional instructions. Listed below are the steps to program the Read from Intelligent module function. Step 1:, Load the base number (0--3) into the first byte and the slot number (0--7) into the second byte of the second level of the accumulator stack. Step 2:, Load the number of bytes to be transferred into the first level of the accumulator stack. (maximum of 128 bytes) Step 3:, Load the address from which the data will be read into the accumulator. This parameter must be a HEX value. Step 4:, Insert the RD instruction which specifies the starting V memory location (Vaaa) where the data will be read into. Helpful Hint:, Use the LDA instruction to convert an octal address to its HEX equivalent and load it into the accumulator when the hex format is required. Operand Data Type

V--memory

V

DL430 Range

DL440 Range

DL450 Range aaa aaa aaa

All (See p. 3--40)

All (See p. 3--41)

All (See p. 3--42)

Discrete Bit Flags

Description

SP54 on when RX, WX, RD, WT instructions are executed with the wrong parameters.

NOTE: Status flags are valid only until another instruction uses the same flag. In the following example when X1 is on, the RD instruction will read six bytes of data from a intelligent module in base 1, slot 2 starting at address 0 in the intelligent module and copy the information into V-memory locations V1400--V1402. CPU

DirectSOFT X1

LD K0102

LD K6

The constant value K0 specifies the starting address in the intelligent module

V1400

V1400 is the starting location in the CPU where the specified data will be stored

RD

V1400

3

4

1

2

V1401

7

8

5

6

V1402

0

1

9

0

V1403

X

X

X

X

V1404

X

X

X

X

12

Address 0

34

Address 1

56

Address 2

78

Address 3

90

Address 4

01

Address 5

Standard RLL Instructions

The constant value K6 specifies the number of bytes to be read

K0

LD

Intelligent Module Data

The constant value K0102 specifies the base number (01) and the base slot number (02)

Handheld Programmer Keystrokes STR

X(IN)

1

LD

K(CON)

0

LD

K(CON)

6

LD

K(CON)

0

V

1

4

1

0

0

2

SHFT

R

D

SHFT

0

DL405 User Manual, 4th Edition

Page 362

5--190

Standard RLL Instructions Intelligent I/O Instructions

Write to Intelligent Module (WT)

430 440 450

DS

HPP

The Write to Intelligent Module instruction writes a block of data (1--128 bytes maximum) to an intelligent I/O module from WT a block of V--memory in the CPU. The V aaa function parameters are loaded into the first and second level of the accumulator stack, and the accumulator by three additional instructions. Listed below are the steps necessary to program the Read from Intelligent module function. Step 1:, Load the base number (0--3) into the first byte and the slot number (0--7) into the second byte of the second level of the accumulator stack. Step 2:, Load the number of bytes to be transferred into the first level of the accumulator stack. (maximum of 128 bytes) Step 3:, Load the intelligent module address which will receive the data into the accumulator. This parameter must be a HEX value. Step 4:, Insert the WT instruction which specifies the starting V memory location (Vaaa) where the data will be written from in the CPU. Helpful Hint:, Use the LDA instruction to convert an octal address to its HEX equivalent and load it into the accumulator when the hex format is required. Operand Data Type

V--memory

V

DL430 Range

DL440 Range aaa aaa

DL450 Range aaa

All (See p. 3--40)

All (See p. 3--41)

All (See p. 3--42)

Discrete Bit Flags

Description

SP54 on when RX, WX, RD, WT instructions are executed with the wrong parameters.

NOTE: Status flags are valid only until another instruction uses the same flag. In the following example, when X1 is on, the WT instruction will write six bytes of data to an intelligent module in base 1, slot 2 starting at address 0 in the intelligent module and copy the information from Vmemory locations V1400--V1402. DirectSOFT X1

CPU LD K0102

LD

Standard RLL Instructions

K6

LD K0

WT V1400

The constant value K0102 specifies the base number (01) and the base slot number (02)

Data

The constant value K6 specifies the number of bytes to be written

The constant value K0 specifies the starting address in the intelligent module

V1400 is the starting location in the CPU where the specified data will be written from

DL405 User Manual, 4th Edition

Intelligent Module

V1377

X

X

X

X

V1400

3

4

1

2

V1401

7

8

5

6

V1402

0

1

9

0

V1403

X

X

X

X

V1404

X

X

X

X

12

Address 0

34

Address 1

56

Address 2

78

Address 3

90

Address 4

01

Address 5

Handheld Programmer Keystrokes STR

X(IN)

1

LD

K(CON)

0

LD

K(CON)

6

LD

K(CON)

0

V

1

4

1

0

0

2

SHFT

W

0

T

SHFT