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

The text of a manual · part 42 of 60

DL205 PLC User Manual, Volume 1 of 2, pages 411 to 420

Pages 411 to 420 of 598

The original document is the PDF (12 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 D2-04TD1, AutomationDirect D2-08TD2, AutomationDirect D2-16ND3-2, AutomationDirect D2-32ND3, Konnect-It D2-04TD1, Koyo D2-04TD1, Konnect-It D2-08TD2, Koyo D2-08TD2, and 5 more models

Page 411

Chapter 5: Standard RLL Instructions

Interrupt Instructions

1 The Interrupt instruction allows a section of ladder logic to 2 be placed outside the main body of the program and executed when needed. Interrupts can be called from the program or by external interrupts via the counter interface module (D2– 3 CTRINT), which provides 4 interrupts. 4 The software interrupt uses interrupt #00 which means the hardware interrupt #0 and the software interrupt cannot be used together. 5 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 6 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 7 designated interrupt routine. Interrupt module interrupts are labeled in octal to correspond with the hardware input signal (X1 will initiate interrupt INT1). There is only one software 8 interrupt, and it is labeled INT 0. The program execution will continue from the point it was before the interrupt occurred once the interrupt is serviced. 9 The software interrupt is set up by programming the interrupt time in V7634. The valid range is 3 to 999 ms. The value must be a BCD value. The interrupt will not execute if the value is 10 out of range. NOTE: See the example program of a software interrupt. 11 Operand Data Type DL240 Range DL250-1 Range DL260 Range 12 aaa aaa aaa 13 DL240/250-1/260 Software DL240/250-1/260 Hardware 14 Interrupt Input Interrupt Routine Interrupt Input Interrupt Routine A B C D

Interrupt (INT)

230 240 250-1 260 DS Used HPP Used

O aaa

INT

Constant

0

0-3

0-3

0-3

V7634 sets interrupt time

INT 0

INT 0

-

-

X0 (cannot be used along with s/w interrupt) X1 X2 X3

INT 1 INT 2 INT 3

DL205 User Manual, 4th Edition, Rev. D

5-187

Page 412

Chapter 5: Standard RLL Instructions

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

Interrupt Return (IRT) When an Interrupt Return is executed in the interrupt routine, the

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

IRT

Interrupt Return Conditional (IRTC) The Interrupt Return Conditional instruction is a optional instruction with an input contact to implement a conditional return from the 240 used interrupt routine. The Interrupt Return is required to terminate the 250-1 interrupt routine. 260 230

IRTC

Enable Interrupts (ENI)

230 The Enable Interrupt instruction is programmed in the main body of 240 the application program (before the End instruction) to enable hardware software interrupts. Once the coil has been energized, interrupts will 250-1 or be enabled until they are disabled by the Disable Interrupt instruction. 260

ENI

Disable Interrupts (DISI)

The Disable Interrupt instruction is programmed in the main body of

230 the application program (before the End instruction) to disable both 240 hardware or software interrupts. Once the coil has been energized, 250-1 interrupts will be disabled until they are enabled by the Enable Interrupt 260 instruction.

5-188

DL205 User Manual, 4th Edition, Rev. D

DISI

DS Used HPP Used

Page 413

Chapter 5: Standard RLL Instructions

Interrupt Example for Interrupt Module In the following example, when X40 is on, the interrupts will be enabled. When X40 is off, the interrupts will be disabled. When an 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. The CPU will return to the main body of the program after the IRT instruction is executed. DirectSOFT

Handheld Programmer Keystrokes $

X40 ENI

E

STR

SHFT

E

4

SP STRN X40 DISI

. . . END

INT

O1

X20

Y5 SETI

X21

Y10

4

N TMR

I

E

A

D

SHFT

E

SHFT

I

$

SHFT

I

X SET

SHFT

I

$

SHFT

I

X SET

SHFT

I

SHFT

I

R ORN

STR

STR

I

4

SHFT

3

A

8

ENT

8

ENT

0

S RST

4

N TMR

D

8

N TMR

T MLR

8

ENT

0

3

I

8

ENT B C

8

F

8

C

8

B

8 T MLR

ENT

2 5 2 1

A

1 0

ENT ENT

ENT B A

1 0

ENT

SETI

IRT

DL205 User Manual, 4th Edition, Rev. D

ENT ENT

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

5-189

Page 414

Chapter 5: Standard RLL Instructions

In the following example, when X1 is on, the value 10 is copied to V7634. This value sets the software interrupt to 10ms. When X20 turns on, the interrupt will be enabled. When X20 turns off, the interrupt will be disabled. Every 10ms the CPU will jump to the interrupt label INT O 0. The application ladder logic in the interrupt routine will be performed. 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 SP0

$

LD K40

V7633 X1

SHFT GX OUT $

ENI

X20 DISI

. . . END

O0

L ANDST

STR

SHFT

X20

INT

B

STR

E

4

SP STRN

D

0

SHFT

B

H

G

D

7

SHFT

K JMP

B

SHFT

H

G

D

C

A

ENT

2

N TMR

I

C

A

I

2

E

SHFT

I

$

SHFT

I

X SET

SHFT

I

SP STRN

SHFT

I

S RST

SHFT

I

SHFT

I

R ORN

8

0

3

A D

0 3

ENT ENT

4

D

8

N TMR

T MLR

3

I

8

D

8

A

8 T MLR

0 4

E

4

ENT

ENT

ENT

A

F

8

E

ENT

C

8

3

A

ENT

0

N TMR

6

1

ENT

8

S RST

7

2 5 3 0

A

0 0

ENT ENT

ENT F

5

ENT B

1

H

7

ENT

ENT

Y5 SETI

Y0

Y17 RSTI

5-190

6

4

* The value entered, 3-999, must be followed by the digit 4 to complete the instruction.

X20

X35

ENT K JMP

V AND

SHFT

8

A

ENT

3

SHFT

STR

V

1

D

3

SP STRN

3

$ K104*

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

D

SHFT

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

V7634

L ANDST

GX OUT

LD

OUT

SHFT

STR

SHFT OUT

Standard RLL Instructions

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

Interrupt Example for Software Interrupt

IRT

NOTE: Only one software interrupt is allowed and it must be Int0.

DL205 User Manual, 4th Edition, Rev. D

Page 415

Chapter 5: Standard RLL Instructions

Intelligent I/O Instructions

1 The Read from Intelligent Module instruction reads a block of data 2 (1 to 128 bytes maximum) from an intelligent I/O 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 3 additional instructions. Listed below are the steps to program the Read from Intelligent module function. 4 Step 1: L oad the base number (0 to 3) into the first byte and the slot number (0 to 7) into the second byte of the second level of the accumulator stack. 5 Step 2: L oad the number of bytes to be transferred into the first level of the accumulator stack (maximum of 128 bytes). 6 Step 3: L oad the address from which the data will be read into the accumulator. This parameter must be a HEX value. Step the RD instruction that specifies the starting V-memory location (Vaaa) into which the 7 data will be read. Helpful hint: Use the LDA instruction to convert an octal address to its HEX equivalent and 8 load it into the accumulator when the hex format is required. 9 Operand Data Type DL230 Range DL240 Range DL250-1 Range DL260 Range aaa aaa aaa aaa 10 Discrete Bit Flags Description 11 NOTE: Status flags are valid only until another instruction uses the same flag. 12 In the following example, when X1 is on, the RD instruction will read six bytes of data from an intelligent module in base 1, slot 2 starting at address 0 in the intelligent module and copy 13 the information into V-memory locations V1400–V1402. 14 A B C D

Read from Intelligent Module (RD)

230 240 250-1 260 DS Used HPP Used

RD

V aaa

V-memory

V

All (See page 3-53)

SP54

All (See page 3-54)

All (See page 3-55)

All (See page 3-56)

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

DirectSOFT X1

CPU

LD

K0102

LD

K6

The constant value K0102 specifies the base number (01) and the base slot number (02) The constant value K6 specifies the number of bytes to be read

K0

RD

V1400

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 stored

Data 12

Address 0

34

Address 1

56 90

Address 2 Address 3 Address 4

01

Address 5

V1402 0 1 9 0

V1403 X X X X

78

V1404 X X X X

Handheld Programmer Keystrokes $

LD

Intelligent Module

V1400 3 4 1 2 V1401 7 8 5 6

B

STR

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

R ORN

D

1

3 3 3

3

ENT

PREV

A

PREV

G

PREV

A

B

E

1

0

6

0

4

B

1

A

0

C

2

ENT

ENT

ENT

A

0

A

0

DL205 User Manual, 4th Edition, Rev. D

ENT

5-191

Page 416

Chapter 5: Standard RLL Instructions

Write to Intelligent Module instruction writes a block of data (1 WT 230 The V aaa to 128 bytes maximum) to an intelligent I/O module from a block 240 of V-memory in the CPU. The function parameters are loaded into 250-1 the first and second level of the accumulator stack and the accumulator by three additional 260 instructions. Listed below are the steps necessary to program the Read from Intelligent module function.

DS Used HPP Used

5-192

Step the base number (0 to 3) into the first byte and the slot number (0 to 7) into the second byte of the second level of the accumulator stack. Step the number of bytes to be transferred into the first level of the accumulator stack (maximum of 128 bytes). Step the intelligent module address which will receive the data into the accumulator. This parameter must be a HEX value. Step 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

DL230 Range

DL240 Range

DL250-1 Range aaa aaa aaa aaa

All (See page 3-53)

All (See page 3-54)

All (See page 3-55)

All (See page 3-56)

Discrete Bit Flags SP54

DL260 Range

Description 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 V-memory locations V1400–V1402. Standard

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

Write to Intelligent Module (WT)

DirectSOFT X1

LD K0102

LD K6

LD K0

CPU

The constant value K0102 specifies the base number (01) and the base slot number (02) 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

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

DL205 User Manual, 4th Edition, Rev. D

Data

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 $

WT

Intelligent Module

B

STR

1

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

W ANDN

T MLR

3 3 3

ENT PREV

A

PREV

G

PREV

A

B

E

1

0 6 0 4

B

1

A

0

C

2

ENT ENT A

0

A

0

ENT

ENT

Page 417

Chapter 5: Standard RLL Instructions

Network Instructions

1 The Read from Network instruction is used by the master device 2 on a network to read a block of data from another CPU. The function parameters are loaded into the first and second levels of the accumulator stack and the accumulator by three additional 3 instructions. Listed below are the steps necessary to program the Read from Network function. 4 Step 1: L oad the slave address (0 to 90 BCD) into the first byte, and load the PLC internal port (KF1) or slot number of the master DCM or ECOM (0 to 7) into the second byte of the 5 second level of the accumulator stack. Step the number of bytes (0 to 128 BCD, multiple of 2) to be transferred into the first level of the accumulator stack. 6 Step the address of the data to be read into the accumulator. This parameter requires a HEX value. 7 Step the RX instruction which specifies the starting V-memory location (Aaaa) where the data will be read from in the slave. 8 Helpful hint: For parameters that require HEX values, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator. 9 Operand Data Type DL240 Range DL250-1 Range DL260 Range A aaa aaa aaa 10 11 12 13 14 A B C D

Read from Network (RX)

230 240 250-1 260 DS Used HPP Used

RX

A aaa

V-memory

V

Pointer

P

Inputs Outputs Control Relays Stage Timer Counter Global I/O Special Relay

X Y C S T CT GX/GY SP

All (See page 3 - 54) All V-memory (See page 3 - 54) 0-477 0-477 0-377 0-777 0-177 0-177 0-137 540-617

All (See page 3 - 55) All V-memory (See page 3 - 55) 0-777 0-777 0-1777 0-1777 0-377 0-177 0-777

All (See page 3 - 56) All V-memory (See page 3 - 56) 0-1777 0-1777 0-3777 0-1777 0-377 0-377 0-3777 0-777

DL205 User Manual, 4th Edition, Rev. D

5-193

Page 418

Chapter 5: Standard RLL Instructions

DirectSOFT X1

SP124

LD

5-194

LD

–or–

K0205

The constant value K0205 specifies the ECOM/DCM slot number (2) and the slave address (5) LD

KF105 The constant value KF105 specifies the bottom port and the slave address (5) (DL250–1 and DL260 only)

K10 The constant value K10 specifies the number of bytes to be read LDA O 2300 Octal address 2300 is converted to 4C0 HEX and loaded into the accumulator. V2300 is the starting location for the Master CPU where the specified data will be read into

Master CPU

Slave CPU

V2277

X

X

X

X

X

X

X

X V1777

V2300

3

4

5

7

3

4

5

7

V2000

V2301

8

5

3

4

8

5

3

4

V2001

V2302

1

9

3

6

1

9

3

6

V2002

V2303

9

5

7

1

9

5

7

1

V2003

V2304

1

4

2

3

1

4

2

3

V2004

V2305

X

X

X

X

X

X

X

X V2005

RX V2000 V2000 is the starting location in the Slave CPU where the specified data will be read from

Handheld Programmer Keystrokes $

B

STR

W ANDN

1

SHFT

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

R ORN

X SET

ENT SP STRN

3 3 3

A

B

1

C

2

E

SHFT

K JMP

C

SHFT

K JMP

B

C

D

0 C

Instructions

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

In the following example, when X1 is on and the module busy relay SP124 (see special relays) is not on, the RX instruction will access an ECOM or DCM operating as a master in slot 2. Ten consecutive bytes of data (V2000 – V2004) will be read from a CPU at station address 5 and copied into V-memory locations V2300–V2304 in the CPU with the master DCM or ECOM.

DL205 User Manual, 4th Edition, Rev. D

2

A

2 0

A

4 2 1 3 0

ENT A A A A

0 0 0 0

F

5

ENT

ENT A

0

ENT

ENT

Page 419

Chapter 5: Standard RLL Instructions

Write to Network (WX)

1 2 Write to Network function. 3 Step 1: L oad the slave address (0 to 90 BCD) into the first byte and the PLC internal port (KF1) or slot number of the master DCM or ECOM (0 to 7) into the second byte of the second level 4 of the accumulator stack. Step 2: L oad the number of bytes (0 to 128 BCD, multiple of 2) to be transferred into the first level of the accumulator stack. 5 Step 3: L oad the address of the data in the master that is to be written to the network into the accumulator. This parameter requires a HEX value. 6 Step 4: nsert the WX instruction which specifies the starting V-memory location (Aaaa) where the data will be written to the slave. 7 Helpful hint:, For parameters that require HEX values, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator. 8 Operand Data Type DL240 Range DL250-1 Range DL260 Range A aaa aaa aaa 9 10 11 12 13 14 A B C D

Write to Network instruction is used to write a block of data 230 The from the master device to a slave device on the same network. The 240 function parameters are loaded into the first and second levels of 250-1 the accumulator stack and the accumulator by three additional 260 instructions. Listed below are the steps necessary to program the DS Used HPP Used

V-memory

V

Pointer

P

Inputs Outputs Control Relays Stage Timer Counter Global I/O Special Relay

X Y C S T CT GX/GY SP

All (See page 3 - 54) All V-memory (See page 3 - 54) 0-477 0-477 0-377 0-777 0-177 0-177 0-137 540-617

All (See page 3 - 55) All V-memory (See page 3 - 55) 0-777 0-777 0-1777 0-1777 0-377 0-177 0-777

WX

A aaa

All (See page 3 - 56) All V-memory (See page 3 - 56) 0-1777 0-1777 0-3777 0-1777 0-377 0-377 0-3777 0-777

DL205 User Manual, 4th Edition, Rev. D

5-195

Page 420

Chapter 5: Standard RLL Instructions

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

In the following example when X1 is on and the module busy relay SP124 (see special relays) is not on, the WX instruction will access a DCM or ECOM operating as a master in slot 2. Ten consecutive bytes of data is read from the CPU at station address 5 and copied to V-memory locations V2000–V2004 in the slave CPU. DirectSOFT X1

SP124

LD

LD

–or–

K0205

KF105

The constant value K0205 specifies the ECOM/DCM slot number (2) and the slave address (5)

The constant value KF105 specifies the bottom port and the slave address (5) (DL250–1 and DL260 only)

LD K10 The constant value K10 specifies the number of bytes to write LDA

Master CPU

Slave CPU

O 2300

V2277

X

X

X

X

X

X

X

X V1777

Octal address 2300 is converted to 4C0 HEX and loaded into the accumulator. V2300 is the starting location for the Master CPU where the specified data will be written from.

V2300

3

4

5

7

3

4

5

7

V2000

V2301

8

5

3

4

8

5

3

4

V2001

V2302

1

9

3

6

1

9

3

6

V2002

V2303

9

5

7

1

9

5

7

1

V2003

V2304

1

4

2

3

1

4

2

3

V2004

V2305

X

X

X

X

X

X

X

X V2005

WX V2000 V2000 is the starting location in the Slave CPU where the specified data will be written to.

Handheld Programmer Keystrokes $

B

STR

W ANDN

1

SHFT

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

W ANDN

X SET

ENT SP STRN

3 3 3

A

B

1

C

2

E

4

ENT

SHFT

K JMP

C

SHFT

K JMP

B

SHFT

O INST#

C

V AND

C

A

0 SHFT

2 1

2

DL205 User Manual, 4th Edition, Rev. D

A A

0 0 2 0

F

5

ENT

ENT D A

3 0

A A

0 0

A

0

ENT

ENT