The text of a manual · part 41 of 61
DL205 PLC User Manual, Volume 1 of 2: Chapter 5: RLL and Intelligent Box Instructions, pages 383 to 392
Pages 383 to 392 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 383
Chapter 5: Standard RLL Instructions - Table 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. 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
A 4
1 T MLR
B
A
1
0
0 F
A 5
It is important to understand how the table locations are numbered. If you examine the example table, you’ll notice that the first data storage location, V1401, will be used when the pointer is equal to zero, and again when the pointer is equal to six. Why? Because the pointer is only equal to zero before the very first execution. From then on, it increments from one to six, and then resets to one.
ENT A
0
ENT
0
Table 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
Data S ource 0
5
0
0 V1500
S S
DirectSOFT
Also, our example uses a normal input contact (X1) to control the execution. Since the CPU scan is extremely fast, and the pointer increments automatically, the source data would be moved into all the table locations very quickly. If this is a problem for your applicaton, you have an option of using a one-shot (PD) to move one value each time the input contact transitions from low to high.
Table Pointer
V1401
(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.
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–161
Page 384
Chapter 5: Standard RLL Instructions - Table
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 to 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. Example of Execution 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
0
0
0
1 V1400
Source 0
5
0
0
V1500
SP56 SP56 = OFF
. .
. .
Scan N+1
Table Pointer (Automatically Incremented)
V1401
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
. .
0
0
0
2 V1400
Source 9
9
9
9 V1500
SP56 SP56 = OFF
. . . . .
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
. .
Scan N+6
5–162
Table Pointer (Automatically Incremented)
V1401
0
0
0
Source 2
0
4
6 V1500
SP56 SP56 = ON until end of scan or next instruction that uses SP56
. .
Before STT Execution
6 V1400
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
. .
DL205 User Manual, 4th Edition, Rev. A
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
. .
0
0
0
1 V1400
Source 1
2
3
4 V1500
SP56 SP56 = OFF
Page 385
Chapter 5: Standard RLL Instructions - Table
Remove from Table (RFT)
1 V aaa 2 instruction is executed. If the length counter is zero or greater 3 than the maximum table length (specified in the first level of the accumulator stack) the instruction will not execute and 4 SP56 will be on. The instruction will be executed once per scan provided the input remains on. The function 5 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. 6 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. 7 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 8 HEX value. Step 3: Insert the RFT instructions which specifies destination V-memory location (Vaaa). This is where the value will be moved to. 9 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 10 the value into the accumulator. Helpful hint:, The instruction will be executed every scan if the input logic is on. If you do 11 not want the instruction to execute for more than one scan, a one shot (PD) should be used in the input logic. 12 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 13 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 14 one scan and will not affect the instruction operation. Operand Data Type DL260 Range A aaa B Discrete Bit Flags Description C NOTE: Status flags (SPs) are only valid until:, another instruction that uses the same flag is executed, or D, the end of the scan
Remove From Table instruction pops a value off of a table 230 The and stores it in a V-memory location. When a value is removed 240 from the table all other values are shifted up 1 location. The 250-1 first V-memory location in the table contains the table length 260 counter. The table counter decrements by 1 each time the
RFT
DS Used HPP Used
V-memory
SP56
V
All (See page 3 - 56)
On when the table counter equals 0.
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.
DL205 User Manual, 4th Edition, Rev. A
5–163
Page 386
Chapter 5: Standard RLL Instructions - Table
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 5–164
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 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
B
A 4
1 F 1
A
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. 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 applicaton, you have an option of using a one-shot (PD) to remove one value each time the input contact transitions from low to high.
ENT
0
0 A
ENT
0
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
6 V1400
Des tination X
X
X
X V1500
S S
DirectSOFT
(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 table pointer location.
DL205 User Manual, 4th Edition, Rev. A
Page 387
Chapter 5: Standard RLL Instructions - Table 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 to 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 indicates that these 4 positions will be used
After RFT Execution
Before RFT Execution Table
Table Counter 0
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
X X
X V1500
Start here
SP56 SP56 = OFF
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
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
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
V1401
8 8
9
V1403
8
9
8
9
3
V1404
8
9
8
9
4
V1405
1
0
1
0
5
V1406
2
0
4
6
6
9
X
1 2
0
0 5
0
0
0
0
3 V1400
Destination 0
5
0
0
V1500
SP56 SP56 = OFF
Table Counter (Automatically decremented)
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
0
0
0
2 V1400 Start here
Destination
9
9
0 9
9
0
0
2 V1400
Destination 9
9
9
9 V1500
SP56 SP56 = OFF
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
X
2
Table
SP56 = OFF
Table 9 8 9
X
1
9
After RFT Execution
Before RFT Execution
X
9
7
Table Counter
Table
V1407
9
0
Table
3 V1400
Before RFT Execution
8
9
4
Table Counter
Table
Scan N+3
9
After RFT Execution
Before RFT Execution
Scan N+2
V1401 V1402
Destination X
Table Counter (Automatically d ecremented)
Table
4 V1400
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
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–165
Page 388
Chapter 5: Standard RLL Instructions - Table
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Add to Top (ATT)
230 240 250-1 260 DS Used HPP Used
The Add To Top instruction pushes a value onto a V-memory ATT table from a V-memory location. When the value is added to V aaa 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 instruction which specifies 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 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
DL260 Range
V-memory
All (See page 3 - 56)
aaa V
Discrete Bit Flags SP56
5–166
Description On when the table counter equals 0.
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.
DL205 User Manual, 4th Edition, Rev. A
Page 389
Chapter 5: Standard RLL Instructions- Table 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 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
B
A
F 1
A 0
4
1
A 5
ENT
0 A
0
For the ATT instruction, the table counter determines the number of additions that can be made before the V1401 instruction will stop executing. So, it is helpful to V1402 understand how the system uses this counter to control V1403 the execution. V1404 V1405 For example, if the table counter was set to 2, and the V1406 table length was 6 words, then there could only be 4 V1407 additions of data before the execution was stopped. This can easily be calculated by: 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 applicaton, you have an option of using a one-shot (PD) to add one value each time the input contact transitions from low to high.
ENT
0
Table
Table Counter
0
5
0
0
1
9
9
9
9
2
3
0
7
4
3
8
9
8
9
4
1
0
1
0
5
2
0
4
6
6
X
X X
X
0
0
0
2 V1400
Data Source X
X X
X V1500
( e .g .: 6 - 2 = 4 ) DirectSOFT (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.
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–167
Page 390
Chapter 5: Standard RLL Instructions - Table
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. The table counter is set to 2 initially, and it will automatically increment from 2 to 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. Example of Execution Scan N 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
0
3 V1400
Data Source 1
2
3
4
V1500
SP56 SP56 =
OFF
Discard Bucket 2046
Scan N+1
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
Scan N+2
After ATT Execution
Before ATT Execution
V1401
5
Table 6 7
V1402
1
2
3
8
1
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
8
2
6
7
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
Scan N+3
Before ATT Execution
V1401
4
Table 3 4
V1402
5
6
7
After ATT Execution
Table counter
Table
(Automatically Incremented)
Table counter 3
1
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
0 7
7
DL205 User Manual, 4th Edition, Rev. A
0
0
6 V1400
Data Source 7
7
7
7 V1500
SP56
Discard Bucket 3074
5–168
7
SP56 = ON until end of scan or next instruction that uses SP56
Page 391
Chapter 5: Standard RLL Instructions - Table
Table Shift Left (TSHFL)
1 2 Table Shift Right (TSHFR) 3 The Table Shift Right instruction shifts all the bits in a V-memory TSHFR table to the right a specified number of bit positions.
4 Vaaa
5 The following description applies to both the Table Shift Left and Table Shift Right instructions. A table is a range of V-memory locations. The Table Shift Left and Table Shift 6 Right instructions shift bits serially throughout the entire table. Bits are shifted out the 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 arbitrarily 7 four words long. 8 9 10 11 Step 1: Load the length of the table (number of V-memory locations) into the first level of the 12 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 13 be a HEX value. You can use the LDA instruction to convert an octal address to hex. 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. 14 Helpful hint:, Remember that each V-memory location contains 16 bits. The bits of the first word of the table are numbered from 0 to 17 octal. If you want to shift the entire table A by 20 bits, that is 24 octal. Flag 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 B is discarded) is a “1”. C Operand Data Type DL260 Range aaa D
Table Shift Left instruction shifts all the bits in a V-memory 230 The table to the left a specified number of bit positions. 240 250-1 260
TSHFL Vaaa
230 240
250-1 260
DS Used HPP Used
Table Shift Left
Table Shift Right
Discard Bits
Shift in zeros
V - xxxx
V - xxxx + 1
V - xxxx + 2
Discard Bits
Shift in zeros
V-memory
V
All (See page 3 - 56)
DL205 User Manual, 4th Edition, Rev. A
5–169
Page 392
Chapter 5: Standard RLL Instructions - Table
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Discrete Bit Flags
Description
SP53
On when the number of bits to be shifted is larger than the total bits contained within the table.
SP67
On when the last bit shifted (just before it is discarded) is a “1”.
5–170
NOTE: Status flags are only valid until:, the end of the scan, or another instruction that uses the same flag is executed.
V 3000
V 3000
1 2 3 4
6 7 8 1
The example table to the right contains BCD data as shown (for demonstration purposes). Suppose we want to 5 6 7 8 1 2 2 5 do a table shift right by 3 BCD digits (12 bits). 1 1 2 2 3 4 4 1 Converting to octal, 12 bits is 14 octal. Using the Table Shift Right instruction and specifying a shift by octal 14, 3 3 4 4 5 6 6 3 we have the resulting table shown at the far right. Notice that the 2–3–4 sequence has been discarded, and the 5 5 6 6 0 0 0 5 0–0–0 sequence has been shifted in at the bottom. The following ladder example assumes the data at V3000 to V3004 already exists as shown above. We will use input X0 to trigger the Table Shift Right operation. First, we will load the table length (5 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 Table Shift Right instruction and specify the number of bits to be shifted (12 decimal), which is 14 octal. DirectSOFT X0
Load the constant value 5 (Hex.) into the lower 16 bits of the accumulator.
LD K5
Convert octal 3000 to HEX and load the value into the accumulator. This is the table beginning.
LDA O 3000
Do a table shift right by 12 bits, which is 14 octal.
TSHFR O 14
Handheld Programmer Keystrokes $
A 0
STR SHFT
L ANDST
D
SHFT
L ANDST
D
SHFT
T MLR
ENT PREV
3 A
F 5 D
3
0
SHFT
S RST
H
A
A
3
0
5
R ORN
F 7
ENT
DL205 User Manual, 4th Edition, Rev. A
A 0
0 NEXT
ENT B
E 1
4
ENT