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

The text of a manual · part 32 of 53

DL06 Micro PLC User Manual, Volume 1 of 2, pages 310 to 319

Pages 310 to 319 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 310

Chapter 5: Standard RLL Instructions - Table Instructions

Source to Table (STT)

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

DS5

Used

HPP

Used

5–156

The Source To Table instruction moves a value from a Vmemory location into a V-memory table and increments a table pointer by 1. When the table pointer reaches the end STT of the table, it resets to 1. The first V-memory location in V aaa the table contains the table pointer which indicates the next location in the table to store a value. The instruction will be executed once per scan provided the input remains on. The function parameters are loaded into the first level of the accumulator stack and the accumulator with two additional instructions. Listed below are the steps necessary to program the Source To Table function. 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. (Remember, the starting location of the table is used as the table pointer.) This parameter must be a HEX value. Step 3: Insert the STT instruction which specifies the source V-memory location (Vaaa). This is where the value will be moved from. 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. Helpful Hint: - The instruction will be executed every scan if the input logic is on. If you do not want the instruction to execute for more than one scan, a one shot (PD) should be used in the input logic. Helpful Hint:, The table counter value should be set to indicate the starting point for the operation. Also, it must be set to a value that is within the length of the table. For example, if the table is 6 words long, then the allowable range of values that could be in the pointer should be between 0 and 6. If the value is outside of this range, the data will not be moved. Also, a one shot (PD) should be used so the value will only be set in one scan and will not affect the instruction operation. Operand Data Type

DL06 Range aaa

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

Discrete Bit Flags SP56

See memory map

Description On when the table pointer equals the table length.

NOTE: Status flags (SPs) are only valid until:, another instruction that uses the same flag is executed, or, the end of the scan The pointer for this instruction starts at 0 and resets to 1 automatically when the table length is reached.

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

Page 311

Chapter 5: Standard RLL Instructions -Table Instructions 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 1400 (V1400), which is the starting location for the destination table and table pointer, is loaded into the accumulator. The data source location (V1500) is specified in the Source to Table instruction. The table pointer will be increased by “1” after each time the instruction is executed. DirectS T 325 DirectSOFT X1

LD K6 Load the constant value 6 (HEX) into the the lower 16 bits of the accumulator LDA 0 1400 Convert octal 1400 to HEX 300 and load the value into the accumulator STT V1500 Copy the specified value from the source location (V1500) to the table

Handheld Programmer Keystrokes B

$

1

STR SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

S RST

ENT PREV

3 A

G 6 B

3

0

SHFT

T MLR

ENT E

1 T MLR

A 4

B

A 0

F 1

0 A

5

ENT A

0

0

ENT

Table Table Pointer It is important to understand how the table locations 0 0 0 0 V1400 V1401 X X X X 0 6 are numbered. If you examine the example table, 1 V1402 X X X X you’ll notice that the first data storage location, Data S ource 2 V1403 X X X X V1401, will be used when the pointer is equal to 0 5 0 0 V1500 3 V1404 X X X X zero, and again when the pointer is equal to six. V1405 X X X X 4 Why? Because the pointer is only equal to zero before 5 V1406 X X X X the very first execution. From then on, it increments X X X X V1407 from one to six, and then resets to one. S S Also, our example uses a normal input contact (X1) DirectSOFT32 (optional one-shot method) DirectSOFT 5 to control the execution. Since the CPU scan is C0 X1 PD extremely fast, and the pointer increments C0 LD automatically, the source data would be moved into K6 all the table locations very quickly. If this is a problem Load the constant value 6 (HEX) into the lower 16 bits for your application, you have an option of using a of the accumulator one-shot (PD) to move one value each time the input LDA O 1400 contact transitions from low to high. Convert octal 1400 to HEX 300 and load the value into the accumulator. This is the starting table location.

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–157

Page 312

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

The following diagram shows the scan-by-scan results of the execution for our example program. Notice how the pointer automatically cycles from 0 – 6, and then starts over at 1 instead of 0. Also, notice how SP56 is affected by the execution. Although our example does not show it, we are assuming that there is another part of the program that changes the value in V1500 (data source) prior to the execution of the STT instruction. This is not required, but it makes it easier to see how the data source is copied into the table. Scan N

Before STT Execution

After STT Execution

Table

Table

Table Pointer

V1401

X

X

X

X

0 6

V1402

X

X

X

X

1

V1403

X

X

X

X

2

V1404

X

X

X

X

3

V1405

X

X

X

X

4

V1406

X

X

X

X

5

V1407

X

X

X

X

0

0

0

0 V1400

Source 0

5

0

0 V1500

SP56 SP56 = OFF

0

5

0

0

0 6

V1402

X

X

X

X

1

V1403

X

X

X

X

2

V1404

X

X

X

X

3

V1405

X

X

X

X

4

V1406

X

X

X

X

5

V1407

X

X

X

X

S S

Scan N+1

Table Pointer (Automatically Incremented)

V1401

0

0

0

1 V1400

Source 0

5

0

0

V1500

SP56 SP56 = OFF

S S

Before STT Execution

After STT Execution

Table

Table Pointer

V1401

0

5

0

0

0 6

V1402

X

X

X

X

1

V1403

X

X

X

X

2

V1404

X

X

X

X

3

V1405

X

X

X

X

4

V1406

X

X

X

X

5

V1407

X

X

X

X

0

0

0

Table

1 V1400

Source 9

9

9

9 V1500

SP56 SP56 = OFF

Table Pointer (Automatically Incremented)

V1401

0

5

0

0

0 6

V1402

9

9

9

9

1

V1403

X

X

X

X

2

V1404

X

X

X

X

3

V1405

X

X

X

X

4

V1406

X

X

X

X

5

V1407

X

X

X

X

S S

0

0

0

2 V1400

Source 9

9

9

9 V1500

SP56 SP56 = OFF

S S S S S

Scan N+5

Before STT Execution

After STT Execution

Table

Table Pointer

V1401

0

5

0

0

0 6

V1402

9

9

9

9

1

V1403

3

0

7

4

2

V1404

8

9

8

9

3

V1405

1

0

1

0

4

V1406

X

X X

X

5

V1407

X

X X

X

0

0

0

Table

5 V1400

Source 2

0

4

6 V1500

SP56 SP56 = OFF

0

5

0

0

0 6

V1402

9

9

9

9

1

V1403

3

0

7

4

2

V1404

8

9

8

9

3

V1405

1

0

1

0

4

V1406

2

0

4

6

5

V1407

X

X

X

X

S S

Scan N+6

0

0

0

Before STT Execution

6 V1400

Source 2

0

4

6 V1500

SP56 SP56 = ON until end of scan or next instruction that uses SP56

S S After STT Execution

Table

Table Pointer

V1401

0

5

0

0

0 6

V1402

9

9

9

9

1

V1403

3

0

7

4

2

V1404

8

9

8

9

3

V1405

1

0

1

0

4

V1406

2

0

4

6

5

V1407

X

X X

X

0

0

0

Table

6 V1400

Source 1

2

3

4 V1500

SP56 SP56 = OFF

Table Pointer (Resets to 1, not 0)

V1401

1

2

3

4

0 6

V1402

9

9

9

9

1

V1403

3

0

7

4

2

V1404

8

9

8

9

3

V1405

1

0

1

0

4

V1406

2

0

4

6

5

V1407

X

X

X

X

S S

5–158

Table Pointer (Automatically Incremented)

V1401

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

S S

0

0

0

1 V1400

Source 1

2

3

4 V1500

SP56 SP56 = OFF

Page 313

Chapter 5: Standard RLL Instructions - Table Instructions

Remove from Table (RFT) DS5

Used

HPP

Used

The Remove From Table instruction pops a value off of a table and stores it in a V-memory location. When a value is removed from the table all other values are shifted up 1 location. The first VRFT memory location in the table contains the table length counter. The V aaa table counter decrements by 1 each time the instruction is executed. If the length counter is zero or greater than the maximum table length (specified in the first level of the accumulator stack) the instruction will not execute and SP56 will be on. The instruction will be executed once per scan provided the input remains on. The function parameters are loaded into the first level of the accumulator stack and the accumulator by two additional instructions. Listed below are the steps necessary to program the Remove From Table function. 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. (Remember, the starting location of the table is used as the table length counter.) This parameter must be a HEX value. Step 3: Insert the RFT instructions which specifies destination V-memory location (Vaaa). This is where the value will be moved to. 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. Helpful Hint: - The instruction will be executed every scan if the input logic is on. If you do not want the instruction to execute for more than one scan, a one shot (PD) should be used in the input logic. Helpful Hint:, The table counter value should be set to indicate the starting point for the operation. Also, it must be set to a value that is within the length of the table. For example, if the table is 6 words long, then the allowable range of values that could be in the table counter should be between 1 and 6. If the value is outside of this range or zero, the data will not be moved from the table. Also, a one shot (PD) should be used so the value will only be set in one scan and will not affect the instruction operation. Operand Data Type

DL06 Range aaa

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

Discrete Bit Flags SP56

See memory map

Description On when the table pointer equals zero.

NOTE: Status flags (SPs) are only valid until another instruction that uses the same flag is executed, or the end of the scan The pointer for this instruction can be set to start anywhere in the table. It is not set automatically. You have to load a value into the pointer somewhere in your program.

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–159

Page 314

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 5–160

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 1400 (V1400) is the starting location for the source table and is loaded into the accumulator. The destination location (V1500) is specified in the Remove from Table instruction. The table counter will be decreased by “1” after the instruction is executed. DirectSOFT 5 DirectSOFT32 Display X1

K6

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

O 1400

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

V1500

Copy the specified value from the table to the specified location (V1500)

LD

LDA

RFT

Handheld Programmer Keystrokes $

B 1

STR SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

R ORN

F

ENT PREV

3 A

G 6 B

3

0

5

T MLR

ENT E

1 B

A 4

F 1

A 0

A 5

Since the table counter specifies the range of data that will be removed from the table, it is important to understand how the table locations are numbered. If you examine the example table, you’ll notice that the data locations are numbered from the top of the table. For example, if the table counter started at 6, then all six of the locations would be affected during the instruction execution.

ENT

0 A

0

ENT

0

Table

Table C ounter

V1401

0

5

0

0

1

V1402

9

9

9

9

2

V1403

3

0

7

4

3

V1404

8

9

8

9

4

V1405

1

0

1

0

5

V1406

2

0

4

6

6

V1407

X

X

X

X

0

0

0

Des tination X

X

X

S S

DirectSOFT32 Display (optional one-shot method)

Also, our example uses a normal input contact (X1) to control the execution. Since the CPU scan is extremely fast, and the pointer decrements automatically, the data would be removed from the table very quickly. If this is a problem for your application, you have an option of using a one-shot (PD) to remove one value each time the input contact transitions from low to high.

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

X1

C0

6 V1400

C0 PD LD K6 Load the constant value 6 (HEX) into the lower 16 bits of the accumulator LDA O 1400 Convert octal 1400 to HEX 300 and load the value into the accumulator. This is the table pointer location.

X V1500

Page 315

Chapter 5: Standard RLL Instructions - Table Instructions The following diagram shows the scan-by-scan results of the execution for our example program. In our example we’re showing the table counter set to 4 initially. (Remember, you can set the table counter to any value that is within the range of the table.) The table counter automatically decrements from 4–0 as the instruction is executed. Notice how the last two table positions, 5 and 6, are not moved up through the table. Also, notice how SP56, which comes on when the table counter is zero, is only on until the end of the scan.

Scan N

Table Counter

Table Table Counter indicates that these 4 positions will be used

After RFT Execution

Before RFT Execution

V1401

0

5

0

0

1

V1402

9

9

9

9

2

V1403

3

0

7

4

3

V1404

8

9

8

9

4

V1405

1

0

1

0

5

V1406

2

0

4

6

6

V1407

X

X X

X

Scan N+1

0

0

0

4 V1400

X X

X V1500

Start here

SP56 SP56 = OFF

9

9

9

1

4

0

7

9

2

V1403

8

9

8

9

3

V1404

8

9

8

9

4

V1405

1

0

1

0

5

V1406

2

0

4

6

6

V1407

X

X

X

X

Table Counter

Table V1401

9

9

9

9

1

V1402

4

0

7

9

2

V1403

8

9

8

9

3

V1404

8

9

8

9

4

V1405

1

0

1

0

5

V1406

2

0

4

6

6

V1407

X

X

X

X

0

0

0

3 V1400

V1401

4

0

7

9

1

V1402

8

9

8

9

2

V1403

8

9

8

9

3

V1404

8

9

8

9

4

V1405

1

0

1

0

5

V1406

2

0

4

6

6

V1407

X

X X

X

Destination 0

5

0

Start here 0 V1500

SP56 SP56 = OFF

0

0

0

V1401

4

0

7

9

1

8

9

8

9

2

V1403

8

9

8

9

3

V1404

8

9

8

9

4

V1405

1

0

1

0

5

V1406

2

0

4

6

6

V1407

X

X

X

X

Start here

8 8

9

8

9

2

V1403

8

9

8

9

3

1

V1404

8

9

8

9

4

V1405

1

0

1

0

5

V1406

2

0

4

6

6

V1407

X

X

X

X

0

0

3 V1400

Destination 5

0

0

V1500

SP56 SP56 = OFF

9

9

0 9

9

0

0

2 V1400

Destination 9

9

9

9 V1500

SP56 SP56 = OFF

Destination 9

9

9

Table Counter (Automatically decremented)

9 V1500

SP56

V1401

8

9

8

9

1

V1402

8

9

8

9

2

V1403

8

9

8

9

3

V1404

8

9

8

9

4

V1405

1

0

1

0

5

V1406

2

0

4

6

6

V1407

X

X

X

X

4

0 0

7

0

0

0

1 V1400

Destinatio 4

0

7

9 V1500

SP56 SP56 = OFF

Start here

9

0

0

1 V1400

Destination 4

0

7

9 V1500

SP56 SP56 = OFF

After RFT Execution Table Counter

V1402

0

0

Table

2 V1400

Before RFT Execution

V1401

0

After RFT Execution

SP56 = OFF

Table 9 8 9

0 5

Table Counter (Automatically decremented)

V1402

Table Counter

Table

0

Table

Before RFT Execution

Scan N+3

9

After RFT Execution

Before RFT Execution

Scan N+2

V1401 V1402

Destination X

Table Counter (Automatically d ecremented)

Table

Table Counter (Automatically decremented)

V1401

Table 8 9 8

9

1

V1402

8

9

8

9

2

V1403

8

9

8

9

3

V1404

8

9

8

9

4

V1405

1

0

1

0

5

V1406

2

0

4

6

6

V1407

X

X

X

X

8

0 9

8

9

0

0

0 V1400

Destination 8 9 8 9 V1500

SP56 SP56 = ON until end of scan or next instruction that uses SP56

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–161

Page 316

Chapter 5: Standard RLL Instructions - Table Instructions

Add to Top (ATT)

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

DS5

Used

HPP

Used

5–162

The Add To Top instruction pushes a value on to a VAT T memory table from a V-memory location. When the V aaa value is added to the table all other values are pushed down 1 location. The instruction will be executed once per scan provided the input remains on. The function parameters are loaded into the first level of the accumulator stack and the accumulator by two additional instructions. Listed below are the steps necessary to program the Add To Top function. 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. (Remember, the starting location of the table is used as the table length counter.) This parameter must be a HEX value. Step 3: Insert the ATT instructions which specifies source V-memory location (Vaaa). This is where the value will be moved from. Helpful Hint: - The instruction will be executed every scan if the input logic is on. If you do not want the instruction to execute for more than one scan, a one shot (PD) should be used in the input logic. 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. Helpful Hint:, The table counter value should be set to indicate the starting point for the operation. Also, it must be set to a value that is within the length of the table. For example, if the table is 6 words long, then the allowable range of values that could be in the table counter should be between 1 and 6. If the value is outside of this range or zero, the data will not be moved into the table. Also, a one shot (PD) should be used so the value will only be set in one scan and will not affect the instruction operation. Operand Data Type

DL06 Range aaa

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

Discrete Bit Flags SP56

See memory map

Description On when the table pointer equal to the table size.

NOTE: Status flags (SPs) are only valid until:, another instruction that uses the same flag is executed, or, the end of the scan The pointer for this instruction can be set to start anywhere in the table. It is not set automatically. You have to load a value into the pointer somewhere in your program.

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

Page 317

Chapter 5: Standard RLL Instructions - Table Instructions 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 1400 (V1400), which is the starting location for the destination table and table counter, is loaded into the accumulator. The source location (V1500) is specified in the Add to Top instruction. The table counter will be increased by “1” after the instruction is executed. DirectSOFT 5 DirectSOFT32 Display X1

LD K6 Load the constant value 6 (Hex.) into the lower 16 bits of the accumulator LDA O 1400 Convert octal 1400 to HEX 300 and load the value into the accumulator ATT V1500 Copy the specified value from V1500 to the table

Handheld Programmer Keystrokes $

B 1

STR

ENT

SHFT

L ANDST

D

SHFT

L ANDST

D 3

0

SHFT

A

T MLR

T MLR

0

PREV

3 A

G 6 B

ENT E

1 B

A 4

F 1

For the ATT instruction, the table counter determines the number of additions that can be made before the instruction will stop executing. So, it is helpful to understand how the system uses this counter to control the execution. For example, if the table counter was set to 2, and the table length was 6 words, then there could only be 4 additions of data before the execution was stopped. This can easily be calculated by:

A 0

5

ENT

0

A

A 0

ENT

0

Table

Table Counter

V1401

0

5

0

0

1

V1402

9

9

9

9

2

V1403

3

0

7

4

3

V1404

8

9

8

9

4

V1405

1

0

1

0

5

V1406

2

0

4

6

6

V1407

X

X X

X

0

0

2 V1400

Data Source X

X X

X V1500

( e .g .: 6 - 2 = 4 )

Table length – table counter = number of executions

Also, our example uses a normal input contact (X1) to control the execution. Since the CPU scan is extremely fast, and the table counter increments automatically, the data would be moved into the table very quickly. If this is a problem for your application, you have an option of using a one-shot (PD) to add one value each time the input contact transitions from low to high.

0

DirectSOFTDisplay 5 (optional one-shot method) DirectSOFT32 (optional one-shot method) X1

C0

C0 PD LD K6 Load the constant value 6 (HEX) into the lower 16 bits of the accumulator LDA O 1400 Convert octal 1400 to HEX 300 and load the value into the accumulator. This is the starting table location.

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–163

Page 318

Chapter 5: Standard RLL Instructions - Table Instructions The following diagram shows the scan-by-scan results of the execution for our example program. The table counter is set to 2 initially, and it will automatically increment from 2 – 6 as the instruction is executed. Notice how SP56 comes on when the table counter is 6, which is equal to the table length. Plus, although our example does not show it, we are assuming that there is another part of the program that changes the value in V1500 (data source) prior to the execution of the ATT instruction.

1 2 3 Example of Execution Scan N 4 5 6 7 Scan N+1 8 9 10 11 Scan N+2 12 13 14 A Scan N+3 B C D

Before ATT Execution Table

After ATT Execution

V1401

0

5

0

0

1

V1402

9

9

9

9

2

V1403

3

0

7

4

3

V1404

8

9

8

9

4

V1405

1

0

1

0

5

V1406

2

0

4

6

6

V1407

X

X X

X

0

0

0

2 V1400

Data Source 1

2

3

Table counter (Automatically Incremented)

Table

Table counter

4 V1500

SP56 SP56 = OFF

V1401

1

2

3

4

1

V1402

0

5

0

0

2

V1403

9

9

9

9

3

V1404

3

0

7

4

4

V1405

8

9

8

9

5

V1406

1

0

1

0

6

V1407

X

X

X

X

1

0 2

3

4

0

3 V1400

Data Source 1

2

3

4

V1500

SP56 SP56 =

OFF

Discard Bucket 2046

After ATT Execution

Before ATT Execution Table counter

Table

V1401

1

2

3

4

1

V1402

0

5

0

0

2

V1403

9

9

9

9

3

V1404

3

0

7

4

4

V1405

8

9

8

9

5

V1406

1

0

1

0

6

V1407

X

X

X

X

0

0

0

3 V1400

Data Source 5

6

7

Table counter (Automatically Incremented)

Table

8 V1500

SP56 SP56 = OFF

V1401

5

6

7

8

1

V1402

1

2

3

4

2

V1403

0

5

0

0

3

V1404

9

9

9

9

4

V1405

3

0

7

4

5

V1406

8

9

8

9

6

V1407

X

X

X

X

5

0 6

7

8

0

0

4 V1400

Data Source 5

6

7

8 V1500

SP56 SP56 =

OFF

Discard Bucket 1010

After ATT Execution

Before ATT Execution

V1401

5

Table 6 7

8

1

V1402

1

2

3

4

2

V1403

0

5

0

0

3

V1404

9

9

9

9

4

V1405

3

0

7

4

5

V1406

8

9

8

9

6

V1407

X

X

X

X

Table counter 0 0 0 4 V1400 Data Source 4

3

3

4 V1500

SP56 SP56 = OFF

Table counter (Automatically Incremented)

V1401

Table 4 3 4

3

1

V1402

5

6

7

8

2

V1403

1

2

3

4

3

V1404

0

5

0

0

4

V1405

9

9

9

9

5

V1406

3

0

7

4

6

V1407

X

X

X

X

4

3

0 4

3

0

0

5 V1400

Data Source 4

3

4

3 V1500

SP56 SP56 = OFF Discard Bucket 8989

Before ATT Execution

After ATT Execution

Table counter

Table

(Automatically Incremented)

Table counter

V1401

4

Table 3 4

3

1

V1402

5

6

7

8

2

V1403

1

2

3

4

3

V1404

0

5

0

0

4

V1405

9

9

9

9

5

V1406

3

0

7

4

6

V1407

X

X

X

X

0

0

0

5 V1400

Data Source 7

7

7

7 V1500

SP56 SP56 = OFF

V1401

7

7

7

7

1

V1402

4

3

4

3

2

V1403

5

6

7

8

3

V1404

1

2

3

4

4

V1405

0

5

0

0

5

V1406

9

9

9

9

6

V1407

X

X

X

X

7

7

0 7

7

3074

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

0

0

6 V1400

Data Source 7

7

7

7 V1500

SP56

Discard Bucket

5–164

0

SP56 = ON until end of scan or next instruction that uses SP56

Page 319

Chapter 5: Standard RLL Instructions - Table Instructions

Table Shift Left (TSHFL) The Table Shift Left instruction shifts all the bits in a Vmemory table to the left, the specified number of bit positions.

T S HF L A aaa

1 2 Table Shift Right (TSHFR) TSHFR The Table Shift Right instruction shifts all the bits in a VA aaa 3 memory table to the right, a specified number of bit positions. The following description applies to both the Table Shift Left and Table Shift Right 4 instructions. A table is just a range of V-memory locations. The Table Shift Left and Table Shift Right instructions shift bits serially throughout the entire table. Bits are shifted out the 5 end of one word and into the opposite end of an adjacent word. At the ends of the table, bits are either discarded, or zeros are shifted into the table. The example tables below are 6 arbitrarily four words long. Table Shift Left Table Shift Right 7 Discard Bits Shift in zeros V - xxxx 8 V - xxxx + 1 9 10 V - xxxx + 2 11 Discard Bits Shift in zeros Step 1: Load the length of the table (number of V-memory locations) into the first 12 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 13 parameter must be a HEX value. You can use the LDA instruction to convert an octal address to hex. 14 Step 3: Insert the Table Shift Left or Table shift Right instruction. This specifies the number of bit positions you wish to shift the entire table. The number of bit positions must be in octal. A 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. If you want to shift the entire table B by 20 bits, that is 24 octal. SP 53 will be set if the number of bits to be shifted is larger than the total bits contained within the table. Flag 67 will be set if the last bit shifted (just before it C is discarded) is a “1”. Operand Data Type DL06 Range D aaa DS5

Used

HPP

Used

DS5

Used

HPP

Used

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

See memory map

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

5–165