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 53

DL06 Micro PLC User Manual, Volume 1 of 2, pages 290 to 299

Pages 290 to 299 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 290

Chapter 5: Standard RLL Instructions - Number Conversion Operand Data Type

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

DL06 Range aaa

V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V

See memory map

Discrete Bit Flags

Description

SP53

On when the value of the operand is larger than the accumulator can work with.

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. Direct SOFT32 DirectSOFT 5 X1

Hexadecimal Equivalents

LD

ASCII T ABLE

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 SHFT

3 A 3

K JMP

E

B

F

0 A

4

1 B

0

A 5

E 1

ENT A 0 A

4

0 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

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

Page 291

Chapter 5: Standard RLL Instructions - Number Conversion

Segment (SEG) DS5

Used

HPP

Used

SEG The BCD / Segment instruction converts a four digit HEX value in the accumulator to seven segment display format. The result resides in the accumulator. 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 HEX value in the accumulator is converted to seven segment format using the Segment instruction. The bit pattern in the accumulator is copied to Y20–Y57 using the Out Formatted instruction.

DirectSOFT 5 DirectSOFT32 Display X1

V1400 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

1 D

ENT B

3

SHFT

S RST

GX OUT

SHFT

E 1

SHFT F

A 4

G

E

6

4 C

5

A 0

ENT

ENT D

A 2

0

0

C 3

2

ENT

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

Segment Labels

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

5–137

Page 292

Chapter 5: Standard RLL Instructions - Number Conversion

Gray Code (GRAY)

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

DS5

Used

HPP

Used

The Gray code instruction converts a 16 bit gray code value GRAY to a BCD value. The BCD conversion requires 10 bits of the accumulator. The upper 22 bits are set to “0”. This instruction is designed for use with devices (typically encoders) that use the grey code numbering scheme. The Gray Code instruction will directly convert a gray code number to a BCD number for devices having a resolution of 512 or 1024 counts per revolution. If a device having a resolution of 360 counts per 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 must subtract a BCD value of 152. In the following example, when X1 is ON the binary value represented by X10–X27 is loaded 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 bits of the accumulator is copied to V2010. Description

Discrete Bit Flags SP63 SP70

On when the result of the instruction causes the value in the accumulator to be zero. On anytime the value in the accumulator is negative.

Direct SOFT32 DirectSOFT 5 X1

LDF

K16

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.

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

0

1

0

1

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

GRAY

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

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

Gray Code

BCD

0000000000

0000

0000000001

0001

0000000011

0002

0000000010

0003

0000000110

0004

0000000111

0005

ENT

0000000101

0006

A

0000000100

0007

1000000001

1022

1000000000

1023

Handheld Programmer Keystrokes $

B STR

SHFT SHFT GX OUT

5–138

1 L ANDST

D

G

R ORN

6

ENT F

3

SHFT

B 5

A 0 V AND

1 Y MLS C 2

B

A 0

B 0

1

A 1

G

0

ENT

6

ENT

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

V2010

0

0

Page 293

Chapter 5: Standard RLL Instructions - Number Conversion

Shuffle Digits (SFLDGT) DS5

Used

HPP

Used

The Shuffle Digits instruction shuffles a maximum of 8 SFLDGT digits rearranging them in a specified order. This function requires parameters to be loaded into the first level of the accumulator stack and the accumulator with two additional instructions. Listed below are the steps necessary to use the shuffle digit 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. 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. Discrete Bit Flags SP63 SP70

Description On when the result of the instruction causes the value in the accumulator to be zero. On anytime the value in the accumulator is negative.

Shuffle Digits Block Diagram There are a maximum of 8 digits that can be shuffled. The bit positions in the first level of the accumulator stack defines the digits to be shuffled. They correspond to the bit positions in the accumulator that define the order the digits will be shuffled. The digits are shuffled and the result resides in the accumulator.

Digits to be shuffled (first stack location) 9

A

B

C

D

E

F

0

1

2

8

7

3

6

5

4

Specified order (accumulator)

Bit Positions

8

7

6

5

4

3

2

1

B

C

E

F

0

D A

9

Result (accumulator)

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

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

5–139

Page 294

Chapter 5: Standard RLL Instructions - Number Conversion

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

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. DirectSOFT 5 Direct SOFT32 X1

A

B

V2001

LDD 9

V2000 Load the value in V2000 and V2001 into the accumulator

Original bit Positions

A

B

V2000 C

D

E

8

7

6

5

4

3

2

1

A

B

C

D

E

F

0

1

2

7

3

6

V2007

Load the value in V2006 and V2007 into the accumulator

Specified order

New bit Positions

SFLDGT

0

9

LDD V2006

F

8

0

Acc.

F

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 5

C

V2001

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 2

V2006

8

7

6

5

4

3

2

1

8

7

6

5

4

3

2

1

Acc.

0

0

4

3

0

0

2

1

Acc.

4

3

2

1

4

3

2

1

8 7 6 5 0 0 0 0

4 E

3 D

2 A

1 9

8

7

6

5

4

3

2

1

Acc.

Acc.

0

0

0

0

9

A

B

C

0

E

D

A

9

0

0

0

0

9

A

B

C

Shuf fle the digits in the first level of the accumulator stack based on the pattern in the accumulator. The result is in the accumulator . OUTD

0

0

0

V2010 V2010

V2011

V2011

Copy the value in the accumulator to V2010 and V2011

Handheld Programmer Keystrokes $

B STR

1

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

S

SHFT

GX OUT

RST SHFT

ENT D

3

C 3

D 3

D 3

A 2

C 3

F 5

A 2

L ANDST

D

C

A 2

A 0 A

G 0

6

6

T MLR

ENT

A

ENT

B 0

0

0 G

3

A 0

1

0

ENT ENT

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

V2010

V2011

Acc.

V2010

Acc.

Acc.

Page 295

Chapter 5: Standard RLL Instructions - Table Instructions

Table Instructions

1 The Move instruction moves the values from a V-memory table to 2 another V-memory table the same length (a table being a consecutive group of V-memory locations). The function 3 parameters are loaded into the first level of the accumulator stack and the accumulator by two additional instructions. The MOV instruction can be used to write data to non-volatile V-memory (see Appendix F). Listed below are the steps necessary to 4 program the MOV function. • Step 1 Load the number of V-memory locations to be moved into the first level of the accumulator 5 stack. This parameter is a HEX value (KFFF max, 7777 octal, 4096 decimal). • Step 2 Load the starting V-memory location for the locations to be moved into the accumulator. This parameter is a HEX value. 6 • Step 3 Insert the MOV instruction which specifies starting V-memory location (Vaaa) for the destination table. 7 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 8 and load the value into the accumulator. Operand Data Type DL06 Range 9 aaa 10 Discrete Bit Flags Description 11 In the following example, when X1 is on, the constant value (K6) is loaded into the 12 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 13 accumulator. The destination table location (V2030) is specified in the Move instruction. 14 A B C D

Move (MOV) DS5

Used

HPP

Used

MOV

V aaa

V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P

SP53

See memory map See memory map

On when the value of the operand is larger than the accumulator can work with.

DirectSOFT 5 Direct SOFT32 X1

K6

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

O 2000

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

V2030

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

LD

LDA

MOV

Handheld Programmer Keystrokes $

B

STR

1

ENT

SHFT

L ANDST

D

SHFT

L ANDST

D

3

0

SHFT

M ORST

O INST#

V AND

SHFT

3

A

K JMP

G

C

A

6

2

C 2

0

A

0

D 0

X

X

X V2026

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

ENT

A

A

X

0

A 3

0

ENT

ENT

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

5–141

Page 296

Chapter 5: Standard RLL Instructions - Table Instructions

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

Move Memory Cartridge (MOVMC) Load Label (LDLBL) DS5

Used

HPP

Used

5–142

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 MOVMC and LDLBL functions.

MOVMC V aaa

LDLBL K aaa

• Step 1: Load the number of words to be copied into the second level of the accumulator stack. • Step 2: Load the offset for the data label area in ladder memory and the beginning of the V-memory block into the first level of the stack. • Step 3: Load the source data label (LDLBL Kaaa) into the accumulator when copying data from 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. • Step 4: Insert the MOVMC instruction which specifies destination in V-memory (Vaaa). This is the copy destination.

Operand Data Type

DL06 Range

....................................A aaa

V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V

See memory map

NOTE: Refer to page 5-188 for an example. 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.

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

Page 297

Chapter 5: Standard RLL Instructions - Table Instructions

Copy Data From a Data Label Area to V-memory In the example below, 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 (LD) 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, specifying the offset for the source and destination data. It 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 Direct SOFT32 5 X1

. .

Data label area programmed after the END instruction

LD K4

DLBL

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

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

K1

N

C

O

N

K

1

2

3

N

C

O

N

K

4

5

3

N

C

O

N

K

6

1

5

N

C

O

N

K 8

8

4

4

2

1

5

LDLBL 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

ENT

1

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

L ANDST

D 3

SHFT

M ORST

O INST#

SHFT

K JMP

E

SHFT

K JMP

A

L ANDST

B

L ANDST

B

V AND

M ORST

C

C

3 3

1

2

4 0

ENT ENT

1

ENT A

2

A 0

A 0

0

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

ENT

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

5–143

Page 298

Chapter 5: Standard RLL Instructions - Table Instructions

SETBIT

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

DS5

Used

HPP

Used

SETBIT A aaa

The Set Bit instruction sets a single bit to one within a range of V-memory locations.

RSTBIT DS5

Used

HPP

Used

5–144

RSTBIT

The Reset Bit instruction resets a single bit to zero A aaa within a range of V-memory locations. The following description applies to both the Set Bit and Reset Bit table instructions. Step 1: Load the length of the table (number of V-memory locations) into the first level of the accumulator stack. This parameter must be a HEX value, 0 to FF. Step 2: Load the starting V-memory location for the table into the accumulator. This parameter must be a HEX value. You can use the LDA instruction to convert an octal address to hex. Step 3: Insert the Set Bit or Reset Bit instruction. This specifies the reference for the bit number of the bit you want to set or reset. The bit number is in octal, and the first bit in the table is number “0”. Helpful hint:, Remember that each V-memory location contains 16 bits. So, the bits of the first word of the table are numbered from 0 to 17 octal. For example, if the table length is six words, then 6 words = (6 x 16) bits, = 96 bits (decimal), or 140 octal. The permissible range of bit reference numbers would be 0 to 137 octal. SP 53 will be set if the bit specified is outside the range of the table. Operand Data Type

DL06 Range aaa

V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V

Discrete Bit Flags SP53

See memory map

Description On when the specified bit is outside the range of the table.

NOTE: Status flags are only valid until the end of the scan or until another instruction that uses the same flag is executed.

For example, suppose we have a table starting at V3000 that is two words long, as shown to the right. Each word in the table V3000 contains 16 bits, or 0 to 17 in octal. To MSB LSB set bit 12 in the second word, we use its octal reference (bit 14). Then we compute the bit’s octal address from 16 bits the start of the table, so 17 + 14 = 34 octal. The following program shows V3001 how to set the bit as shown to a “1”. MSB LSB 1 1 1 1 11 1 1 7 6 5 4 3 2 1 0 7 6 5 4 32 1 0

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

Page 299

Chapter 5: Standard RLL Instructions - Table Instructions In this ladder example, we will use input X0 to trigger the Set Bit operation. First, we will load the table length (2 words) into the accumulator stack. Next, we load the starting address into the accumulator. Since V3000 is an octal number we have to convert it to hex by using the LDA command. Finally, we use the Set Bit (or Reset Bit) instruction and specify the octal address of the bit (bit 34), referenced from the table. SOFT Display32 Direct DirectSOFT 5 X0

Load the constant value 2 (Hex.) into the lower 16 bits of the accumulator.

LD K2

Convert octal 3000 to HEX and load the value into the accumulator. This is the table beginning.

LDA O 3000

Set bit 34 (octal) in the table to a ”1”.

SETBIT O 34

Handheld Programmer Keystrokes $

A

ENT

0

STR SHFT

L ANDST

D

SHFT

L ANDST

D

X SET

SHFT

PREV

3 A 3 B

2 D

8

ENT

T MLR

A

A 3

0 I

1

C

NEXT

0 D

A 0

E 3

4

0

ENT

ENT

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

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

5–145