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

The text of a manual · part 37 of 60

DL205 PLC User Manual, Volume 1 of 2, pages 361 to 370

Pages 361 to 370 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 361

Chapter 5: Standard RLL Instructions

ASCII to HEX (ATH)

1 2 This means an ASCII table of four V-memory locations would only require two V-memory locations for the equivalent HEX table. The function parameters are loaded into the 3 accumulator stack and the accumulator by two additional instructions. Listed below are the steps necessary to program an ASCII to HEX table function. The example on the following 4 page shows a program for the ASCII to HEX table function. Step 1: L oad the number of V-memory locations for the ASCII table into the first level of the 5 accumulator stack. Step the starting V-memory location for the ASCII table into the accumulator. This 6 parameter must be a HEX value. Step the starting V-memory location (Vaaa) for the HEX table in the ATH instruction. Helpful hint:, For parameters that require HEX values when referencing memory locations, 7 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 DL250-1 Range DL260 Range aaa aaa 9 In the example on the following page, when X1 is ON, the constant (K4) is loaded into the 10 accumulator using the Load instruction and will be placed in the first level of the accumulator stack when the next Load instruction is executed. The starting location for the ASCII table 11 (V1400) is loaded into the accumulator using the Load Address instruction. The starting location for the HEX table (V1600) is specified in the ASCII to HEX instruction. The table 12 below lists valid ASCII values for ATH conversion. 13 ASCII Values Valid for ATH Conversion ASCII Hex Value ASCII Value Hex Value 14 A B C D

ASCII TO HEX instruction converts a table of ASCII 230 The values to a specified table of HEX values. ASCII values are 240 two digits and their HEX equivalents are one digit. 250-1 260 DS Used HPP N/A

V-memory

30 31 32 33 34 35 36 37

V

All (See page 3-55)

0 1 2 3 4 5 6 7

38 39 41 42 43 44 45 46

ATH

V aaa

All (See page 3-56)

8 9 A B C D E F

DL205 User Manual, 4th Edition, Rev. D

5-137

Page 362

Chapter 5: Standard RLL Instructions

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

DirectSOFT X1

K4

V1400

Convert octal 1400 to HEX 300 and load the value into the accumulator

LDA O 1400

V1600

33 34

V1401

31 32

V1402

37 38

V1600 is the starting location for the HEX table

ATH

Hexadecimal Equivalents

ASCII TABLE

Load the constant value into the lower 16 bits of the accumulator. This value defines the number of V memory locations in the ASCII table

LD

1234

V1600

5678

V1601

Handheld Programmer Keystrokes $

B

STR

1

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

A

T MLR

0

ENT PREV

3 3

A H

0 7

E B B

4 1 1

ENT E G

4 6

A A

A

0

A

0

0 0

ENT

V1403

35 36

ENT

HEX to ASCII (HTA) The HEX to ASCII instruction converts a table of HEX

HTA

230 values to a specified table of ASCII values. HEX values are V aaa 240 one digit and their ASCII equivalents are two digits. 250-1 This means a HEX table of two V-memory locations would 260 require four V-memory locations for the equivalent ASCII table. The function parameters are loaded into the accumulator stack and the accumulator by two additional instructions. Listed below are the steps necessary to program a HEX to ASCII table function. The example on the following page shows a program for the HEX to ASCII table function.

DS Used HPP N/A

5-138

Step 1: L oad the number of V-memory locations in the HEX table into the first level of the accumulator stack. Step 2: L oad the starting V-memory location for the HEX table into the accumulator. This parameter must be a HEX value. Step 3: pecify the starting V-memory location (Vaaa) for the ASCII table in the HTA instruction.

Helpful hint:, For parameters that require HEX values when referencing memory locations, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator. Operand Data Type V-memory

V

DL250-1 Range

DL260 Range aaa aaa

All (See page 3-55)

All (See page 3-56)

DL205 User Manual, 4th Edition, Rev. D

Page 363

Chapter 5: Standard RLL Instructions In the following example, when X1 is ON, the constant (K2) is loaded into the accumulator using the Load instruction. The starting location for the HEX table (V1500) is loaded into the accumulator using the Load Address instruction. The starting location for the ASCII table (V1400) is specified in the HEX to ASCII instruction. DirectSOFT X1

Hexadecimal Equivalents

LD

ASCII TABLE

K2 Load the constant value into the lower 16 bits of the accumulator. This value defines the number of V locations in the HEX table.

33 34

V1400

31 32

V1401

37 38

V1402

35 36

V1403

1234

V1500 LDA O 1500 Convert octal 1500 to HEX 340 and load the value into the accumulator

HTA V1400

5678

V1501

V1400 is the starting location for the ASCII table. The conversion is executed by this instruction.

Handheld Programmer Keystrokes $

B

STR

1

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

H

T MLR

7

ENT PREV

3 3

A A

0 0

C B B

2 1 1

ENT F E

5 4

A A

0 0

A A

0 0

ENT ENT

The table below lists valid ASCII values for HTA conversion. ASCII Values Valid for HTA Conversion Hex Value

ASCII Value

Hex Value

ASCII Value

0 1 2 3 4 5 6 7

30 31 32 33 34 35 36 37

8 9 A B C D E F

38 39 41 42 43 44 45 46

DL205 User Manual, 4th Edition, Rev. D

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

5-139

Page 364

Chapter 5: Standard RLL Instructions

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

Segment (SEG) BCD / Segment instruction converts a 4digit HEX value 230 The in the accumulator to a 7-segment display format. The result 240 resides in the accumulator. 250-1 260 DS Used HPP Used

In the following example, when X1 is on, the value in V1400 is loaded into the lower 16 bits of the accumulator using the Load instruction. The binary (HEX) value in the accumulator is converted to 7-segment format using the Segment instruction. The bit pattern in the accumulator is copied to Y20–Y57 using the Out Formatted instruction.

DirectSOFT

5-140

SEG

V1400

X1

6

LD

F

7

1

V1400 Load the value in V1400 nto the lower 16 bits of 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

1

1

0

1 1

1

0

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

1

1

1

1 1

0

1

0

1 1

1

0

0

0 1

0

0

0

0

0 1

1

1

0

0 0

0

0

1

1 0

- g f e d c b a

- g f e d c b a

- g f e d c b a

- g f e d c b a

0

0

0

0 0

0

0

0

0 0

0

0

0

0 0

0

1

1

0

1 1

0

0

0 1

SEG

Convert the binary (HEX) value in the accumulator to seven segment display format

OUTF

Y20 K32

Copy the value in the accumulator to Y20- Y57

Acc.

0 a f b

Segment Labels g e

Y57 Y56 Y55 Y54 Y53

Y24 Y23 Y22 Y21 Y20

OFF ON ON

OFF OFF ON ON OFF

ON ON c d

Handheld Programmer Keystrokes $

B

STR

L ANDST

D

1

3

SHFT

S RST

GX OUT

SHFT

ENT B

SHFT F

5

E

1 4

E G C

4 6 2

A

0

A

0

ENT

ENT A

0

D

3

C

DL205 User Manual, 4th Edition, Rev. D

2

ENT

Segment Labels

Page 365

Chapter 5: Standard RLL Instructions

Gray Code (GRAY)

1 2 will directly convert a gray code number to a BCD number 3 for devices having a resolution of 512 or 1024 counts per revolution. If a device having a resolution of 360 counts per 4 revolution is to be used, you must subtract a BCD value of 76 from the converted value to obtain the proper result. For a device having a resolution of 720 counts per revolution, you 5 must subtract a BCD value of 152. In the following example, when X1 is ON the binary value represented by X10–X27 is loaded 6 into the accumulator using the Load Formatted instruction. The gray code value in the accumulator is converted to BCD using the Gray Code instruction. The value in the lower 16 7 bits of the accumulator is copied to V2010. 8 9 10 11 12 13 14 A B C D

Gray code instruction converts a 16-bit gray code value 230 The to a BCD value. The BCD conversion requires 10 bits of the 240 accumulator. The upper 22 bits are set to “0.” This instruction 250-1 is designed for use with devices (typically encoders) that use 260 the grey code numbering scheme. The Gray Code instruction DS Used HPP Used

DirectSOFT X1

LDF

K16

GRAY

X27 X26 X25

X12 X11 X10

OFF OFF OFF

ON OFF ON

X10

Load the value represented by X10–X27 into the lower 16 bits of the accumulator

Acc.

GRAY

Convert the 16 bit grey code value in the accumulator to a BCD value

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

0

0

0

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

0

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

0

0

0

6

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

OUT

V2010

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

Handheld Programmer Keystrokes $

B

STR

SHFT

L ANDST

SHFT

G

GX OUT

6

D

1

3

ENT

F

B

5

R ORN

A

SHFT

V AND

0

1

Y MLS

ENT

C

A

2

0

A

B

B

0

1

A

0

1

ENT

G

6

ENT

Gray Code

BCD

0000000000

0000

0000000001

0001

0000000011

0002

0000000010

0003

0000000110

0004

0000000111

0005

0000000101

0006

0000000100

0007

• • •

• • •

1000000001

1022

1000000000

1023

V2010

DL205 User Manual, 4th Edition, Rev. D

5-141

Page 366

Chapter 5: Standard RLL Instructions

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

Shuffle Digits (SFLDGT) Shuffle Digits instruction shuffles a maximum of 8 digits 230 The rearranging them in a specified order. This function requires 240 parameters to be loaded into the first level of the accumulator 250-1 stack and the accumulator with two additional instructions. 260 Listed below are the steps necessary to use the Shuffle Digit

SFLDGT function. The example on the following page shows a program for the Shuffle Digits function. Step 1: Load the value (digits) to be shuffled into the first level of the accumulator stack.

DS Used HPP Used

5-142

Step 2: Load the order that the digits will be shuffled to into the accumulator. Step 3: Insert the SFLDGT instruction. NOTE: If the number used to specify the order contains a 0 or 9–F, the corresponding position will be set to 0.

See example on the next page. NOTE: If the number used to specify the order contains duplicate numbers, the most significant duplicate number is valid. The result resides in the accumulator.

Shuffle Digits Block Diagram

Digits to be shuffled (first stack location)

A maximum of 8 digits can be shuffled. The bit positions in the first level of the accumulator stack define the digits to be shuffled. They correspond to the bit positions in the accumulator that define the order in which the digits will be shuffled. The digits are shuffled and the result resides in the accumulator.

9

A

B

C D

E

F

0

1

2

8

7

6

5

4

3

Specified order (accumulator) Bit Positions

8

7

6

5

4

3

2

1

B

C

E

F

0

D

A

9

Result (accumulator)

DL205 User Manual, 4th Edition, Rev. D

Page 367

Chapter 5: Standard RLL Instructions In the following example, when X1 is on, the value in the first level of the accumulator stack will be reorganized in the order specified by the value in the accumulator. Example A shows how the shuffle digits works when 0 or 9 –F is not used when specifying the order the digits are to be shuffled. Also, there are no duplicate numbers in the specified order. Example B shows how the shuffle digits works when a 0 or 9–F is used when specifying the order the digits are to be shuffled. Notice when the Shuffle Digits instruction is executed, the bit positions in the first stack location that had a corresponding 0 or 9–F in the accumulator (order specified) are set to “0”. Example C shows how the shuffle digits works when duplicate numbers are used specifying the order the digits are to be shuffled. Notice when the Shuffle Digits instruction is executed, the most significant duplicate number in the order specified is used in the result. Direct SOFT X1

A V2001

LDD 9

Load the value in V2000 and V2001 into the accumulator

B

D

Original 8 7 6 5 bit Positions 9 A B C

4

3

2

1

D

E

F

0

3

6

V2007

LDD

1

V2006 Load the value in V2006 and V2007 into the accumulator

SFLDGT

Specified order

New bit Positions

2

8

E

F

0

0

Acc.

F

5

E

V2000 C

B

A

9

8 7 6 5 0 F E D

4 C

3 B

2 A

1 9

3

0

0

2

1

V2007 4

8

7

6

5

4

3

2

1

1

2

8

7

3

6

5

4

8

7

6

5

4

3

2

1

B

C

E

F

0

D

A

9

B

C

E

F

0

D

A

9

V2001

D

V2006 7

C

V2001

C

V2000

A

B V2000

0

0

4

9

Acc.

A

B

V2000 C

D

E

F

0

8

7

6

5

4

3

2

1

9

A

B

C

D

E

F

0

4

3

1

4

3

2

1

V2006

V2007

8

7

6

5

4

3

2

1

Acc.

0

0

4

3

0

0

2

1

Acc.

8 7 6 5 0 0 0 0

4 E

3 D

2 A

1 9

0

E

D

A

9

Acc.

Acc.

2

V2006

8

7

6

5

4

3

2

1

4

3

2

1

4

3

2

1

8

7

6

5

4

3

2

1

0

0

0

0

9

A

B

C

0

0

0

0

9

A

B

C

Shuffle the digits in the first level of the accumulator stack based on the pattern in the accumulator. The result is in the accumulator. OUTD V2010 Copy the value in the accumulator to V2010 and V2011

0

V2010

V2011

0

0

V2011

V2011

V2010

V2010

Handheld Programmer Keystrokes $

B

STR

1

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

S RST

SHFT

GX OUT

SHFT

D

3 3

3

ENT D D F

C

3

C

3 5

L ANDST

D

C

A

2

2 2 3 0

A A G B

0 0 6 1

A A

0 0

A G

0 6

T MLR

ENT

A

ENT

0

Acc.

ENT ENT

DL205 User Manual, 4th Edition, Rev. D

Acc.

Acc.

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

5-143

Page 368

Chapter 5: Standard RLL Instructions

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

Table Instructions Move (MOV) The Move instruction moves the values from a V-memory

230 table to another V-memory table the same length. The 240 function parameters are loaded into the first level of the stack and the accumulator by two additional 250-1 accumulator instructions. Listed below are the steps necessary to program 260 the Move function. DS Used HPP Used

MOV V aaa

Step 1: L oad the number of V-memory locations to be moved into the first level of the accumulator stack. This parameter is a HEX value (KFFF max, 7777 octal). Step 2: L oad the starting V-memory location for the locations to be moved into the accumulator. This parameter must be a HEX value. Step 3: nsert the MOVE instruction which specifies starting V-memory location (Vaaa) for the destination table.

Helpful hint:, For parameters that require HEX values when referencing memory locations, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator. Operand Data Type V-memory Pointer

5-144

V P

DL230 Range

DL240 Range

DL250-1 Range aaa aaa aaa

DL260 Range aaa

All (See page 3-53) All (See page 3-53)

All (See page 3-54) All (See page 3-54)

All (See page 3-55) All (See page 3-55)

All (See page 3-56) All (See page 3-56)

In the following example, when X1 is on, the constant value (K6) is loaded into the accumulator using the Load instruction. This value specifies the length of the table and is placed in the first stack location after the Load Address instruction is executed. The octal address 2000 (V2000), the starting location for the source table is loaded into the accumulator. The destination table location (V2030) is specified in the Move instruction. X1

LD

Load the constant value 6 (HEX) into the lower 16 bits of the accumulator

K6

LDA

Convert octal 2000 to HEX 400 and load the value into the accumulator

O 2000

Copy the specified table locations to a table beginning at location V2030

MOV V2030 Handheld Programmer Keystrokes SR

1

SH

L A DS

D

SH

L A DS

D

SH

M ORS

O IS

E SH

3 3

A

0

V AD

K C C

MP 2 2

6 A A

0 0

E A D

0 3

A A

DL205 User Manual, 4th Edition, Rev. D

0 0

E E

X

X

X

X V1776

X

X

X

X V2026

X

X

X

X V1777

X

X

X

X V2027

0

1

2

3 V2000

0

1

2

3 V2030

0

5

0

0 V2001

0

5

0

0 V2031

9

9

9

9 V2002

9

9

9

9 V2032

3

0

7

4 V2003

3

0

7

4 V2033

8

9

8

9 V2004

8

9

8

9 V2034

1

0

1

0 V2005

1

0

1

0 V2035

X

X

X

X V2006

X

X

X

X V2036

X

X

X

X V2007

X

X

X

X V2037

Page 369

Chapter 5: Standard RLL Instructions

Move Memory Cartridge (MOVMC) Load Label (LDLBL)

1 MOVMC

2 V aaa

3

LDLBL 4 K aaa 5 Step 1: L oad the number of words to be copied into the second level of the accumulator stack. Step 2: L oad the offset for the data label area in the program ladder memory and the beginning of the 6 V-memory block into the first level of the accumulator stack. Step 3: L oad the source data label (LDLBL Kaaa) into the accumulator when copying data from 7 ladder memory to V-memory. Load the source address into the accumulator when copying data from V-memory to ladder memory. This is where the value will be copied from. If the source address is a V-memory location, the value must be entered in HEX. 8 Step 4: nsert the MOVMC instruction which specifies destination (Aaaa). This is where the value will be copied to. 9 Operand Data Type DL230 Range DL240 Range DL250-1 Range DL260 Range 10 aaa aaa aaa aaa 11 WARNING: The offset for this usage of the instruction starts at 0, but may be any number that does not 12 result in data outside of the source data area being copied into the destination table. When an offset is outside of the source information boundaries, then unknown data values will be transferred into the 13 destination table. 14 A B C D 230 240

250-1 260

DS Used HPP Used

V-memory Constant

The Move Memory Cartridge instruction is used to copy data between V-memory and program ladder memory. The Load Label instruction is only used with the MOVMC instruction when copying data from program ladder memory to V-memory. To copy data between V-memory and program ladder memory, the function parameters are loaded into the first two levels of the accumulator stack and the accumulator by two additional instructions. Listed below are the steps necessary to program the Move Memory Cartridge and Load Label functions.

V K

All (See page 3-53) K1-KFFFF

All (See page 3-54) K1-KFFFF

All (See page 3-55) K1-KFFFF

All (See page 3-56) K1-KFFFF

DL205 User Manual, 4th Edition, Rev. D

5-145

Page 370

Chapter 5: Standard RLL Instructions

Copy Data From a Data Label Area to V-Memory

1 2

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

230 240 250-1 260

DS Used HPP Used

5-146

In the following example, data is copied from a Data Label Area to V-memory. When X1 is on, the constant value (K4) is loaded into the accumulator using the Load instruction. This value specifies the length of the table and is placed in the second stack location after the next Load and Load Label (LDLBL) instructions are executed. The constant value (K0) is loaded into the accumulator using the Load instruction. This value specifies the offset for the source and destination data, and is placed in the first stack location after the LDLBL instruction is executed. The source address where data is being copied from is loaded into the accumulator using the LDLBL instruction. The MOVMC instruction specifies the destination starting location and executes the copying of data from the Data Label Area to V-memory. DirectSOFT X1

Data Label Area Programmed After the END Instruction

LD K4

DLBL K1

Load the value 4 into the accumulator specifying the number of locations to be copied. LD K0 Load the value 0 into the accumulator specifying the offset for source and destination locations LDLBL

N

C O N

K

1

N

C O N

K

4

N

C O N

K

6

N

C O N

K

8

2

3

5

3

1

5

8

4

X

X

X

X V1777

1

2

3

4

V2000

4

5

3

2

V2001

6

1

5

1

V2002

8

8

4

5

V2003

X

X

X

X V2004

4 2 1 5

K1 Load the value 1 into the accumulator specifying the Data Label Area K1 as the starting address of the data to be copied. MOVMC V2000 V2000 is the destination starting address for the data to be copied. Handheld Programmer Keystrokes $

B

STR

1

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

L ANDST

D

3

SHFT

M ORST

O INST#

ENT SHFT

K JMP

E

SHFT

K JMP

A

L ANDST

B

L ANDST

B

V AND

M ORST

C

C

3 3

1

4 0

2

ENT ENT 1 2

ENT A

0

A

0

A

0

ENT

WARNING: The offset for this usage of the instruction starts at 0, but may be any number that does not result in data outside of the source data area being copied into the destination table. When an offset is outside of the source information boundaries, then unknown data values will be transferred into the destination table.

DL205 User Manual, 4th Edition, Rev. D