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

The text of a manual · part 30 of 61

DL205 PLC User Manual, Volume 1 of 2: Chapter 5: RLL and Intelligent Box Instructions, pages 273 to 282

Pages 273 to 282 of 592, from DL205 PLC User Manual, Volume 1 of 2

The original document is the PDF (13 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 PLC Direct D2-08ND3 and Koyo D2-08ND3

Page 273

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

Up/Down Counter Example Using Discrete Status Bits In the following example, if X2 and X3 are off, when X1 toggles from off to on the counter will increment by one. If X1 and X3 are off the counter will decrement by one when X2 toggles from off to on. When the count value reaches the preset value of 3, the counter status bit will turn on. When the reset X3 turns on, the counter status bit will turn off and the current value will be 0. DirectSOFT X1

Counting Diagram UDC

CT2 X1

K3 X2

X2 X3 X3

Y10

CT2

OUT

CT2

B STR

1

C

$

STR

2

D

$

STR

3 U ISG

SHFT

D

D

ENT

2

1

3

0

ENT

3

ENT

$

ENT

GX OUT

SHFT C

STR

C 3

2

Handheld Programmer Keystrokes (cont)

Handheld Programmer Keystrokes $

1

Current Value

B

SHFT T MLR

2

A

ENT

2

ENT

0

1

C

C 2

2

Up/Down Counter Example Using Comparative Contacts In the following example, when X1 makes an off to on transition, counter CT2 will increment by one. Comparative contacts are used to energize Y3 and Y4 at different counts. When the reset (X3) turns on, the counter status bit will turn off, the current value will be 0, and the comparative contacts will turn off. DirectSOFT X1

Counting Diagram UDC

CT2 V2000

X1

X2 X2 X3 X3

CTA2

Y3

K1

Y3

OUT Y4 CTA2

Y4

K2

OUT

Handheld Programmer Keystrokes $

B 1

STR $

C STR

2

$

D 3

STR SHFT

U

SHFT

V AND

$ STR

D ISG

2

B 1

D

ENT

$

SHFT

A 0 2

C 2

2

2

C

3

STR C

A

4

ENT

ENT

2

3

Handheld Programmer Keystrokes (cont)

GX OUT

3

SHFT

1

ENT

C

C

Current Value

A 0

0

SHFT

T MLR

ENT

GX OUT

ENT C 2

SHFT

T MLR

C 2

ENT E 4

ENT

0

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

C 2

DL205 User Manual, 4th Edition, Rev. A

5–51

Page 274

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

Shift Register (SR)

The Shift Register instruction shifts data through a 1 predefined number of control relays. The control ranges in the shift register block must start at the beginning of an 8 2 bit boundary and use 8-bit blocks.

The Shift Register has three contacts. 3 • Data, determines the value (1 or 0) that will enter the register 4 • Clock, shifts the bits one position on each low to high transition • Reset, resets the Shift Register to all zeros. 5 With each off to on transition of the clock input, the bits which make up the shift register block are shifted by one bit position and the status of the data input is placed into the starting 6 bit position in the shift register. The direction of the shift depends on the entry in the From and To fields. From C0 to C17 would define a block of sixteen bits to be shifted from left to 7 right. From C17 to C0 would define a block of sixteen bits, to be shifted from right to left. The maximum size of the shift register block depends on the number of available control relays. The minimum block size is 8 control relays. 8 Operand Data DL230 Range DL240 Range DL250-1 Range DL260 Range Type 9 A/B aaa bbb aaa bbb aaa bbb aaa bbb 10 11 12 13 Inputs on Successive Scans Shift Register Bits 14 C0 C17 1 1 0 A 0 1 0 0 1 0 B 1 1 0 C 0 1 0 0 0 1 D Indicates Indicates 230

DATA

SR

240

From A aaa

250-1

CLOCK

260

To

Control Relay

C

0-377

0-377

0-377

0-377

DirectSOFT X1

0-1777

X3

$

Data Input

B

STR

SR

1

From

C

STR

C0

2

$

Clock Input

D

3

STR

To

SHFT

C17

Reset Input

0-3777

0-3777

Clock

ON

Reset

OFF

DL205 User Manual, 4th Edition, Rev. A

ENT ENT ENT

S RST

SHFT

R ORN

B

H

ENT

1

Data

0-1777

Handheld Programmer Keystrokes

$

X2

5–52

B bbb

RESET

DS Used HPP Used

7

SHFT

A

0

Page 275

Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data

Accumulator/Stack Load and Output Data Instructions

1 Using the Accumulator The accumulator in the DL205 series CPUs is a 32-bit register which is used as a temporary 2 storage location for data that is being copied or manipulated in some manner. For example, you have to use the accumulator to perform math operations, such as, add, subtract, multiply, 3 etc.. Since there are 32 bits, you can use up to an 8-digit BCD number, or a 32-bit 2’s compliment number. The accumulator is reset to 0 at the end of every CPU scan. 4 Copying Data to the Accumulator The Load and Out instructions and their variations are used to copy data from a V-memory 5 location to the accumulator, or to copy data from the accumulator to V-memory. The following example copies data from V-memory location V1400 to V-memory location V1410. 6 7 8 9 10 11 Since the accumulator is 32 bits and V-memory locations are 16 bits, the Load Double and Out Double (or variations thereof ) use two consecutive V-memory locations or 8-digit BCD 12 constants to copy data either to the accumulator from a V-memory address or from a Vmemory address to the accumulator. For example, if you wanted to copy data from V1400 and V1401 to V1410 and V1411 the most efficient way to perform this function would be as 13 follows: 14 A B C D X1

V1400

LD

8

9

3

5

8

9

3

5

8

9

3

5

V1400

Copy data from V1400 to the lower 16 bits of the accumulator

Unused accumulator bits are set to zero

Acc. 0

0

0

0

OUT

V1410

V1410

Copy data from the lower 16 bits of the accumulator to V1410

X1

V1401

LDD

V1400

V1400

6

7

3

9

5

0

2

6

Acc. 6

7

3

9

5

0

2

6

6

7

3

9

5

0

2

6

Copy data from V1400 and V1401 to the accumulator

OUTD

V1410

Copy data from the accumulator to V1410 and V1411

V1411

V1410

DL205 User Manual, 4th Edition, Rev. A

5–53

Page 276

Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data

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

Using the Accumulator Stack The accumulator stack is used for instructions that require more than one parameter to execute a function or for user defined functionality. The accumulator stack is used when more than one Load instruction is executed without the use of an Out instruction. The first load instruction in the scan places a value into the accumulator. Every Load instruction thereafter without the use of an Out instruction places a value into the accumulator and the value that was in the accumulator is placed onto the accumulator stack. The Out instruction nullifies the previous load instruction and does not place the value that was in the accumulator onto the accumulator stack when the next load instruction is executed. Every time a value is placed onto the accumulator stack the other values in the stack are pushed down one location. The accumulator is eight levels deep (eight 32-bit registers). If there is a value in the eighth location when a new value is placed onto the stack, the value in the eighth location is pushed off the stack and cannot be recovered. X1

Constant

LD K3245 Load the value 3245 into the accumulator

3

2

4

5

Current Acc. value Acc. 0

0

0

0

3

2

4

Acc. X

X

X

X

Constant

LD

Load the value 5151 into the accumulator, pushing the value 3245 onto the stack

Acc. 0

X X X X

X X X X

X X X X

X X X X

X X X X

5

X

1

X

5

X

Level 3

X

X

X

X

X

X

X

X

Level 4

X

X

X

X

X

X

X

X

Level 5

X

X

X

X

X

X

X

X

Level 6

X

X

X

X

X

X

X

1

X

Level 7

X

X

X

X

X

X

X

X

Level 8

X

X

X

X

X

X

X

0

0

0

55

1

5

X

Level 1

0

0

0

0

3

2

4

5

0

0

Level 2

X

X

X

X

X

X

X

X

Level 3

X

X

X

X

X

X

X

X

Level 4

X

X

X

X

X

X

X

X

Level 5

X

X

X

X

X

X

X

X

Level 6

X

X

X

X

X

X

X

X

Level 7

X

X

X

X

X

X

X

X

Level 8

X

X

X

X

X

X

X

X

X

1 Bucket

Accumulator Stack

Previous Acc. value 0

Constant

LD

33 22 44 55

6

3

6

3

Current Acc. value Acc. 0

Load the value 6363 into the accumulator, pushing the value 5151 to the 1st stack location and the value 3245 to the 2nd stack location

X X

Current Acc. value

Acc. 0

K6363

X X X X

X

Level 2

X X X X

Level 1 Previous Acc. value

K5151

Accumulator Stack

5

0

0

0

66 33 66 33

Bucket Accumulator Stack

Previous Acc. value Acc. 0

0

0

0

55

1

5

1

Level 1

0

0

0

Level 2 Level 3

0 0 X

0 0 X

0 0 3 2 4 5 0 0 X X X X X X

0

5

1

5

1

Level 4

X

X

X

X

X

X

X

X

Level 5

X

X

X

X

X

X

X

X

Level 6

X

X

X

X

X

X

X

X

Level 7

X

X

X

X

X

X

X

X

Level 8

X

X

X

X

X

X

X

X

Bucket

The POP instruction rotates values upward through the stack into the accumulator. When a POP is executed the value which was in the accumulator is cleared and the value that was on top of the stack is in the accumulator. The values in the stack are shifted up one position in the stack.

DL205 User Manual, 4th Edition, Rev. A

Page 277

Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data

X1

Previous Acc. value

POP

Acc. X POP the 1st value on the stack into the accumulator and move stack values up one location

X

X

X

X X

X X

X

X

0

44 55

4

5

Accumulator Stack

Current Acc. value Acc. 0

0

0

OUT V2000

V2000

4

5

4

5

Copy data from the accumulator to V2000

Level 1

0

0

0

0

3

7

9

2

Level 2

0

0

0

0

7

9

3

0

Level 3

X

X

X

X

X

X

X

Level 4

X ? X

X

X

X

X

X

X

X

Level 5

X

X

X

X

X

X

X

X

Level 6

X

X

X

X

X

X

X

X

Level 7

X

X

X

X

X

X

X

X

Level 8

X

X

X

X

X

X

X

X

Level 1

0

0

0

0

7

9

3

0

Level 2

X

X

X

X

X

X

X

X

Level 3

X

X

X

X

X

X

X

X

Level 4

X

X

X

X

X

X

X

X

Level 5

X

X

X

X

X

X

X

X

Level 6

X

X

X

X

X

X

X

X

Level 7

X

X

X

X

X

X

X

X

Level 8

X

X

X

X

X

X

X

X

Level 1

X

X

X

X

X

X

X

X

Level 2

X

X

X

X

X

X

X

X

Level 3

X

X

X

X

X

X

X

X

Level 4

X

X

X

X

X

X

X

X

Level 5

X

X

X

X

X

X

X

X

Level 6

X

X

X

X

X

X

X

X

Level 7

X

X

X

X

X

X

X

X

Level 8

X

X

X

X

X

X

X

X

Previous Acc. value

POP

Acc. 0 POP the 1st value on the stack into the accumulator and move stack values up one location

0

0

0

44 55 44 55

0

33 77 99 22

Accumulator Stack

Current Acc. value Acc. 0

0

OUT

0

V2001

V2001

3

7

9

2

Copy data from the accumulator to V2001. Previous Acc. value POP

Acc. 0

0

0

0

33 47 69 02

X

7

Accumulator Stack

Current Acc. value POP the 1st value on the stack into the accumulator and move stack values up one location

OUT

Acc. X

X

X

V2002 V2002

Copy data from the accumulator to V2002

7

9

9

3

3

0

0

DL205 User Manual, 4th Edition, Rev. A

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

Page 278

Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data

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

Changing the Accumulator Data Instructions that manipulate data also use the accumulator. The result of the manipulated data resides in the accumulator. The data that was being manipulated is cleared from the accumulator. The following example loads the constant value 4935 into the accumulator, shifts the data right 4 bits, and outputs the result to V1410. X1

9

3

5

K4935 Load the value 4935 into the accumulator 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

1

0

0

1

1

0

1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

0

0

1

0

0

1

0

The upper 16 bits of the accumulator will be set to 0 Shifted out of accumulator

SHFR K4

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

0

1

0

1

0

1

1

0

4

9

3

0

0

0

0

0 1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

0

0

Shift the data in the accumulator 4 bits (K4) to the right

OUT V1410 Output the lower 16 bits of the accumulator to V1410

V1410

Some of the data manipulation instructions use 32 bits. They use two consecutive V-memory locations or an 8-digit BCD constant to manipulate data in the accumulator. The following example rotates the value 67053101 two bits to the right and outputs the value to V1410 and V1411. X1

Constant 6

LDD

7

0

5

3

1

0

1

K67053101 Load the value 67053101 into the accumulator

Acc.

ROTR K2 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

1

0

0

0

0

0

0

1

1

1

0

0

1

1

1

0

0

0

0

0

1

0

1

0

0

1

1

0

0

0

8

7

6 5

4 3

2

1

0

0

0

0

1

0

0

0

0

C

4

0

1 0

0

1 0

1 0

0 1

0

1 0

1 0

1 0

9

C

1

0

0

0

0

0

1 0

0

1

0

0

1

1

0

Rotate the data in the accumulator 2 bits to the right

OUTD V1410 Output the value in the accumulator to V1410 and V1411

0

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

5

V1411

5–56

4

Constant

LD

DL205 User Manual, 4th Edition, Rev. A

8

V1410

0

0

Page 279

Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data

Using Pointers

1 2 3 NOTE: In the DL205 V-memory addressing is in octal. However the value in the pointer location which will reference a V-memory location is viewed as HEX. Use the Load Address instruction to move an address into the pointer location. This instruction performs the Octal to Hexadecimal conversion for you. 4 The following example uses a pointer operand in a Load instruction. V-memory location 5 3000 is the pointer location. V3000 contains the value 400 which is the HEX equivalent of the Octal address V-memory location V2000. The CPU copies the data from V2000 into the lower word of the accumulator. 6 7 8 9 10 The following example is similar to the one above, except for the LDA (load address) instruction which automatically converts the Octal address to the Hex equivalent. 11 12 13 14 A B C D Many of the DL205 series instructions will allow V-memory pointers as a operand. Pointers can be useful in ladder logic programming, but can be difficult to understand or implement in your application if you do not have prior experience with pointers (commonly known as indirect addressing). Pointers allow instructions to obtain data from V-memory locations referenced by the pointer value.

X1

LD

P3000

V3000 (P3000) contains the value 400 Hex. 400 Hex. = 2000 Octal which contains the value 2635.

V3000

0

4

0

0

V2000

2

6

3

5

V2001

X

X

X

X

V2002

X

X

X

X

V2003

X

X

X

X

V2004

X

X

X

X

V2005

X

X

X

X

Accumulator 2

6

3

5

OUT

V3100

Copy the data from the lower 16 bits of the accumulator to V3100.

X1

LDA

O 2000

OUT

V 3000

LD

P 3000

Load the lower 16 bits of the accumulator with Hexadecimal equivalent to Octal 2000 (400))

V3100

2

6

3

5

V3101

X

X

X

X

0

0

2

0

2000 Octal is converted to Hexadecimal 400 and loaded into the accumulator

Unused accumulator bits are set to zero

Copy the data from the lower 16 bits of the accumulator to V3000

Acc. 0

0

0

0

V3000 (P3000) contains the value 400 HEX = 2000 Octal which contains the value 2635

0

4

0

0

0

4

0

0

V3000

OUT

V 3100

Copy the data from the lower 16 bits of the accumulator to V3100

V3000

0

4

0

0

V2000

2

6

3

5

V2001

X

X

X

X

V2002

X

X

X

X

V2003

X

X

X

X

V2004

X

X

X

X

V2005

X

X

X

X

V3100

2

6

3

5

V3101

X

X

X

X

Accumulator

0

0

0

0

DL205 User Manual, 4th Edition, Rev. A

2

6

3

5

5–57

Page 280

Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data

Load (LD)

1 The Load instruction is a 16-bit instruction that loads the value LD (Aaaa), which is either a V-memory location or a 4-digit

A aaa into the lower 16 bits of the accumulator. The upper 2 constant, 16 bits of the accumulator are set to 0.

3 Operand Data DL230 Range DL240 Range DL250-1 Range DL260 Range Type 4 A aaa aaa aaa aaa bbb 5 6 Discrete Bit Flags Description SP76 7 NOTE: Two consecutive Load instructions will place the value of the first load instruction onto the accumulator stack. 8 In the following example, when X1 is on, the value in V2000 will be loaded into the 9 accumulator and output to V2010. 10 11 12 13 14 A B C D 230 240

250-1 260

V-memory

V

All. See Memory map

Pointer

P

–

Constant

K

0-FFFF

All. See Memory map All V-memory See Memory map 0-FFFF

All See Memory map All V-memory See Memory map 0-FFFF

All See Memory map All V-memory See Memory map 0-FFFF

On when the value loaded into the accumulator by any instruction is zero.

DS Used HPP Used

DirectSOFT

V2000

X1

LD

8

9

3

5

V2000

The unused accumulator bits are set to zero

Load the value in V2000 into the lower 16 bits of the accumulator

Acc. 0

0

0

0

88 99 33 55

OUT

V2010

8

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

B

STR

SHFT

D

C

A

A

2

GX OUT

5–58

1

L ANDST 0

ENT

3

A

0

0

SHFT

V AND

ENT

C

A

2

3

V2010

Handheld Programmer Keystrokes $

9

B

0

DL205 User Manual, 4th Edition, Rev. A

A

1

0

ENT

5

Page 281

Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data

230 240 250-1 260

Load Double (LDD) The Load Double instruction is a 32-bit instruction that loads the value (Aaaa), which is either two consecutive V-memory locations or an 8-digit constant value, into the accumulator.

Operand Data Type

DL230 Range

DL240 Range

LDD A aaa

DL250-1 Range

DL260 Range

A aaa aaa aaa

V-memory

V

All. See Memory map

Pointer

P

–

Constant

K

0-FFFFFFFF

All. See Memory map All V-memory See Memory map 0-FFFFFFFF

All See Memory map All V-memory See Memory map 0-FFFFFFFF

Discrete Bit Flags aaa bbb

All See Memory map All V-memory See Memory map 0-FFFFFFFF

Description

SP76

On when the value loaded into the accumulator by any instruction is zero.

NOTE: Two consecutive Load instructions will place the value of the first load instruction onto the accumulator stack. DS Used HPP Used

In the following example, when X1 is on, the 32-bit value in V2000 and V2001 will be loaded into the accumulator and output to V2010 and V2011. DirectSOFT V2001

X1

LDD

7 ?

3

9

5

Acc. 6

7

3

9

2 66 65 00 2?

6

7

3

9

5

V2000 Load the value in V2000 and V2001 into the 32 bit accumulator

V2000

6

0

0

2

2

6

6

OUTD V2011

V2010

V2010

Copy the value in the 32 bit accumulator to V2010 and V2011 Handheld Programmer Keystrokes $

B STR

1

SHFT

L ANDST

D

C

A

A 0

GX OUT

SHFT

D

C

A

B 0

D 3

2

2

ENT

3 A

0

0

ENT

3 A 1

0

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

ENT

DL205 User Manual, 4th Edition, Rev. A

5–59

Page 282

Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data

Load Formatted (LDF)

The Load Formatted instruction loads 1 to 32 1 consecutive bits from discrete memory locations into the accumulator. The instruction requires a starting location 2 (Aaaa) and the number of bits (Kbbb) to be loaded.

Unused accumulator bit locations are set to zero. 3 Operand Data Type DL240 Range DL250-1 Range DL260 Range A aaa bbb aaa bbb aaa bbb 4 5 6 7 Discrete Bit Flags Description 8 SP76 9 NOTE: Two consecutive Load instructions will place the value of the first load instruction onto the accumulator stack. 10 In the following example, when C0 is on, the binary pattern of C10–C16 (7 bits) will be loaded into the accumulator using the Load Formatted instruction. The lower 7 bits of the 11 accumulator are output to Y0–Y6 using the Out Formatted instruction. 12 13 14 A B C D 230

LDF

240

A aaa

K bbb

250-1 260

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

X 0–477 Y 0–477 C 0–377 S 0–777 T 0–177 CT 0–177 SP 0-137, 540-617 GX/GY – K –

– – – – – – – – 1–32

0–777 0–777 0–1777 0–1777 0–377 0–177 0–777 – –

– – – – – – – – 1–32

0–1777 0–1777 0–3777 0–1777 0–377 0–377 0–777 0–3777 –

– – – – – – – – 1–32

On when the value loaded into the accumulator by any instruction is zero.

DS Used HPP Used DirectSOFT C0

LDF

C10

K7

Load the status of 7 consecutive bits (C10–C16) into the accumulator

Constant K7

C16 C15 C14 C13 C12 C11 C10 OFF OFF OFF ON ON ON OFF

The unused accumulator bits are set to zero

Acc.

OUTF

Location

C10

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

0

0

0

0

1

1

0

Y4 ?

Y3 ?

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

Y0

K7

Copy the value from the specified number of bits in the accumulator to Y0 – Y6

Handheld Programmer Keystrokes $

SHFT

C

SHFT

L ANDST

D

F

SHFT

C

B

STR

GX OUT A

1

SHFT

0

ENT

5

A

H

0

7

ENT

F

5

H 0

5–60

3

2

A

2

7

ENT

DL205 User Manual, 4th Edition, Rev. A

Location

Constant

Y6 Y5 ?

Y0

K7

OFF OFF OFF ON ON ON OFF

? Y2 Y1 ?

Y0