PLC-5/250: indexed addresses

Indexed addressing lets you offset an address by the number of elements that you select. You store the offset value in an offset word in the processor's status file. The processor starts operation at the base address plus the offset. You can manipulate the offset word in your ladder logic. For example: #1N23:0.
The indexed address symbol is the # character. Place the # character immediately before the file-type identifier in a logical address. Enter the offset value in word 2 of the module status file (
n
S:2). All indexed instructions use the same word
n
S:2 to store an offset.
When you specify indexed addresses:
  1. Make sure the index value (positive or negative) does not cause the indexed address to exceed the file type boundary.
    The processor does not check this unless you use an indexed indirect address or you exceed the data table area of memory. If the indexed address exceeds the data table area of memory, the processor initiates a run-time error and sets a major fault. The processor does not check to see whether the indexed address crosses file types, such as 1N7 to 1F8. If you are concerned about exceeding file type boundaries, use indexed indirect addressing.
  2. When an instruction uses more than two indexed addresses, the processor uses the same index value for each indexed address.
  3. Set the offset word to the index value you want immediately before enabling an instruction that uses an indexed address. File instructions use the same offset word in the status file to perform operations. If the processor runs a file instruction before an instruction that uses an indexed address, the value in nS:2 may not be what you expect. The following instructions manipulate the offset value in nS:2:
    BSL/BSR
    Bit Shift Left/Right
    COP
    File Copy
    DDT
    Diagnostic Detect
    FLL
    File Fill
    FFL/FFU
    FIFO Load/Unload
    FSC
    File Search and Compare
    LFL/LFU
    LIFO Load/Unload
    SQI/SQL/SQO
    Sequencer Input/Load/Output
    FAL
    File Arithmetic and Logic
    FBC
    File Bit Compare
    IMPORTANT:
    File instructions manipulate the offset value stored at nS:2. Make sure you monitor or load the offset value you want prior to using an indexed address. Otherwise, unpredictable machine operations could occur, with possible damage to equipment and injury to personnel.
Indexed Addressing Example
The following
MVM
example uses an indexed address in the source and destination addresses. If the offset value is 10 (stored in 1S:2), the processor manipulates the data stored at the base address plus the offset.
MVM
MASKED MOVE
Source
#1N7:10
Mask
00110011
Destination
#1N11:5
In this example, the processor uses these addresses:
Value:
Base Address:
Offset Address:
Source
1N7:10
1N7:20
Destination
1N11:5
1N11:15
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal