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

The text of a manual · part 64 of 70

SLC 500 Instruction Set Reference Manual, pages 631 to 640

Pages 631 to 640 of 694

The original document is the PDF (7.2 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 Allen-Bradley 1747-L514

Page 631

Data File Organization and Addressing

E-9

Slots 1 through 10 contain I/O modules. The remaining slots are saved for future I/O expansion. The figure indicates the number of inputs and outputs in each slot and also shows how these inputs and outputs are arranged in the data files. For these files, the element size is always 1 word.

Slot numbers

0

1

2

3

4

5

6

Power CPU Supply

I/O I/O I/O I/O I/O I/O I/O

7

8

9

10

Power I/O I/O I/O I/O Supply

Future Expansion

Modular controller using a 7-slot chassis interconnected with a 10-slot chassis.

Slot

Inputs Outputs

1 2 3 4 5 6 7 8 9 10

6 32 None 8 None 16 16 8 None None

6 None 16 8 32 None None None 16 16

Data File 0 - Output Image 1 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0 5 4 3 2 1 0 Slot 1 outputs (0 to 5) INVALID O:0 Slot 3 outputs (0 to x O:3 15) Slot 4 outputs (0 to 7) INVALID O:4 Slot 5, word 0 outputs x O:5 (0 to 15) Slot 5, word 1 outputs O:5. (0 to 15) 1 Slot 9 outputs (0 to O:9 15) Slot 10 outputs (0 to x O:10 15) Data File 0 - Input Image 1 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0 5 4 3 2 1 0 Slot 1 inputs (0 to 5) INVALID I:1 Slot 2, word 0 inputs x I:2 (0 to 15) Slot 2, word 1 inputs x I:2.1 (0 to 15) Slot 4 inputs (0 to 7) INVALID x I:4 Slot 6 inputs (0 to 15) I:6 Slot 7 inputs (0 to 15) x I:7 Slot 8 outputs (0 to 7) INVALID I:8 x = See the examples on the next page.

Publication 1747-RM001G-EN-P - November 2008

Page 632

E-10

Data File Organization and Addressing

Specifying Indexed Addresses The indexed address symbol is the # character. Place the # character immediately before the file-type identifier in a logical address. You can use more than one indexed address in your ladder program. Enter the offset value in word 24 of the status file (S:24). All indexed instructions use the same word S:24 to store the offset value. The processor starts operation at the base address plus the offset. You can manipulate the offset value in your ladder logic before each indexed address operation. When you specify indexed addresses, follow these guidelines. • Make sure the index value (positive or negative) does not cause the indexed address to exceed the file type boundary. • When an instruction uses more than two indexed addresses, the processor uses the same index value for each indexed address. • Set the index word to the offset value you want immediately before enabling an instruction that uses an indexed address.

ATTENTION

Instructions with a # sign in an address manipulate the offset value stored at S:24. Make sure you monitor or load the offset value you want prior to using an indexed address. Otherwise unpredictable machine operation could occur with possible damage to equipment and/or injury to personnel.

Example of Indexed Addressing The following Masked Move (MVM) example uses an indexed address in the source and destination addresses. If the offset value is 10 (stored in S:24), the processor manipulates the data stored at the base address plus the offset.

Publication 1747-RM001G-EN-P - November 2008

Page 633

Data File Organization and Addressing

E-11

In this example, the processor uses the following addresses:

Table E.5 Addresses used for Indexing Value:

Base Address:

Offset Value in S:24

Offset Address:

Source

N7:10

10

N7:20

Destination

N7:50

10

N7:60

SLC 5/03 (OS301 and higher), SLC 5/04, and SLC 5/05 processors: If the indexed address is a floating point (F8:) data file, then the index offset value in S:24 is the offset in elements. If the indexed address is a string (ST) data file, then the index offset value in S:24 is the offset in sub-elements. This limits string element boundaries from being crossed. Note that file instructions (SQO, COP, LFL for example) overwrite S:24 when they execute. For this reason, you must insure that the index register is loaded with the intended value prior to the execution of an indexed instruction that follows a file instruction.

Creating Data for Indexed Addresses Data tables are not expanded automatically to accommodate indexed addresses. You must create this data with the memory map function. In the example on the previous page, data words N7:3 through N7:12 and N11:6 through N11:15 must be allocated. Failure to do so will result in an unintended overwrite condition or a major fault.

Crossing File Boundaries An offset value may extend operation to an address outside the data file boundary. You can either allow or disallow crossing file boundaries. If you choose to disallow crossing file boundaries, a runtime error occurs if you use an offset value which would result in crossing a file boundary. SLC 5/02 processors: You are allowed to select crossing file boundaries only if no indexed addresses exist in the O: (output), I: (input), or S: (status) files. This selection is made at the time you save your program. The file order from start to finish is: • O0:, I1:, S2:, B3:, T4:, C5:, R6:, N7:, x9:, x10: . . . • x9: and x10: . . . are application-specific files where x can be of types B, T, C, R, N.

Publication 1747-RM001G-EN-P - November 2008

Page 634

E-12

Data File Organization and Addressing

SLC 5/03 (OS301 and higher) SLC 5/04, and SLC 5/05 processors: When an indexed string data file is specified, indexed addressing is not allowed to cross a string element boundary. A run-time error will occur if you use an offset value that results in crossing a string element boundary.

TIP

If a file is constant protected, indexing across file boundaries is not allowed.

Example The figure below indicates the maximum offset for word address #T4:3.ACC when allowing and disallowing crossing file boundaries.

T4:0.ACC

Maximum negative of 3 #T4:3.ACC

#T4:3.ACC T4:9.ACC

B3:0

Maximum positive of 6

End of highest file created

Crossing file boundaries disallowed Crossing file boundaries allowed

Crossing file boundaries disallowed: In the example above, the highest numbered element in the timer data file is T4:9. This means that #T4:3.ACC can have a maximum negative offset of -3 and a maximum positive offset of 6. Crossing file boundaries allowed: The maximum negative offset extends to the beginning of data file 3. The maximum positive offset extends to the end of the highest numbered file created.

Publication 1747-RM001G-EN-P - November 2008

Page 635

Data File Organization and Addressing

E-13

Monitoring Indexed Addresses The offset address value is not displayed when you monitor an indexed address. For example, the value at N7:2 appears when you monitor indexed address #N7:2.

Example If your application requires you to monitor indexed data, we recommend that you use a MOV instruction to store the value.

N10:2 will contain the data value that was added to T4:0.ACC.

File Instructions The # symbol is also required for addresses in file instructions. The indexed addresses used in these file instructions also make use of word S:24 to store an offset value upon file instruction completion. Refer to the next page for a list of file instructions that use the # symbol for addressing.

ATTENTION

File instructions manipulate the offset value stored in word S:24. Make sure that you load the correct offset value in S:24 prior to using an indexed address that follows a file instruction. Otherwise, unpredictable operation could occur, resulting in possible personal injury and/or damage to equipment.

Publication 1747-RM001G-EN-P - November 2008

Page 636

E-14

Data File Organization and Addressing

Effects of Program Interrupts on Index Register S:24 When normal program operation is interrupted by the user error handler, an STI, or an I/O interrupt, the content of index register S:24 is saved; then, when normal program operation is resumed, the content of index register S:24 is restored. This means that if you alter the value in S:24 in these interrupt subroutines, the system will overwrite your alteration with the original value contained on subroutine entry.

Specifying an Indirect Address Indirect addressing allows you to write less complex ladder logic programs and saves you memory space. You have the option of using word-level and bit-level indirect addresses when using an SLC 5/03 (OS302), SLC 5/04 (OS401), and SLC 5/05 processors. Indirect bit addresses are based on the form of the indirect address and the type of bit instruction. Use indirect addressing for applications such as indexing sequential batch files in a multiple batch operation. For example, at completion of each operation, let a counter accumulated value call out the next batch file, such as: N10, N11, N12,...N[C5:0.ACC]. When you specify indirect addresses, follow these guidelines. • You can indirectly address: – file number. – word number (element + sub-element). – bit number (in a binary file). • The substitute address must be any address specified to the word level. • Enter the substitute address in brackets [ ].

Publication 1747-RM001G-EN-P - November 2008

Page 637

Data File Organization and Addressing

E-15

Examples

Table E.6 Valid Addresses Valid Address

Variable

Explanation

N7:[C5:7.ACC]

Word number

The word number is the accumulated value of counter 7 in file 5.

B3/[I:0.17]

Bit number

The bit number is stored in input word 17.

N[N7:0]:[N9:1]

File and word number

The file number is stored in integer address N7:0 and the word number in integer address N9:1.

St10:[N7:0].1

Element number

The element number is stored in N7:0.

I:[N7:0].1/1

Slot number

The slot number is stored in N7:0.

Creating Data for Indirect Addresses Data tables are not expanded automatically to accommodate indirect addresses. You must create this data with your programming software.

Crossing File Boundaries Crossing file boundaries is not allowed. A runtime error occurs if you use an offset value which would result in crossing a file boundary.

Monitoring Indirect Addresses An asterisk is displayed at all times when monitoring an indirect address.

Addressing File Instructions - Using the File Indicator (#) File instructions employ user-created files. These files are addressed with the # sign. They store an offset value in word S:24, just as with indexed addressing discussed in the last section.

COP FLL BSL BSR FFL FFU

Copy File Fill File Bit Shift Left Bit Shift Right (FIFO Load)* (FIFO Unload)*

LFL LFU SQO SQC SQL

(LIFO Load)* (LIFO Unload)* Sequencer Output Sequencer Compare Sequencer Load*

* Available in the SLC 5/02 and higher processors.

Publication 1747-RM001G-EN-P - November 2008

Page 638

E-16

Data File Organization and Addressing

ATTENTION

If you are using file instructions and also indexed addressing, make sure that you monitor and/or load the correct offset value prior to using an indexed address. Otherwise, unpredictable operation could occur, resulting in possible personal injury and/or damage to equipment.

The following paragraphs explain user-created files as they apply to Bit Shift instructions, Sequencer instructions, Copy File, and Fill File instructions.

Bit Shift Instructions The following figure shows a user-defined file within bit data file 3. For this particular user-defined file, you would enter the following parameters when programming the instruction:

Bit Data File 3 15 Address of the bit array is #B3:2. Length of the bit array is 58, entered as a separate parameter in the Bit Shift instruction.

INVALID

0 0 1 2 3 4 5

#B3:2

6

• #B3:2 - The address of the bit array. This defines the starting bit as bit 0 in element 2, data file 3. • 58 - This is the length of the bit array, 58 bits. Note that the bits “left over” in element 5 are unusable. You can program as many bit arrays as you like in a bit file. Be careful that they do not overlap.

Publication 1747-RM001G-EN-P - November 2008

Page 639

Data File Organization and Addressing

E-17

Sequencer Instructions The following figure shows a user-defined file within bit data file 3. For this particular user-defined file, you would enter the following parameters when programming the instruction.

Bit Data File 3 15

0 0 1 2 3 4 5 6 7 #B3:4 8 9 10 11

0 1 2 3 4 5 6

Address of the user-defined file is #B3:4. Length of the file is 6 elements beyond the starting address (elements labeled 0-6 in the diagram).

• #B3:4 - The address of the file. This defines the starting element as element 4, bit file 3. • 6 - The specified length of the file, 6 elements beyond the starting address (totals 7 elements). You can use user-defined integer files or bit files with sequencer instructions, depending on the application. You can program as many files as you like within another file. However, be careful that the files do not overlap.

Copy File and Fill File Instructions These instructions manipulate user-defined files. The files are used as source or destination parameters in Copy File or Fill File instructions. Files can be Output, Input, Status, Bit, Timer, Counter, Control, or Integer files. Two examples are shown in the following figure. Note that the file length is the specified number of elements of the destination file; this differs from the file length specification for sequencer instructions.

Publication 1747-RM001G-EN-P - November 2008

Page 640

E-18

Data File Organization and Addressing

The following figure shows a user-defined file within Data File 0- Output Image. We used this particular data file configuration in regard to I/O addressing on page B-12. Here, we are defining a file 5 elements long. Note that for the output file (and the input file as well), an element is always one word, referenced as the slot and word taken together. For example, element O:3.0 refers to output file, slot 3, word 0. This defaults to O:3, where word 0 is implied.

Data File 0 - Output Image 15 INVALID INVALID

0 O:1 O:3 O:4 O:5 O:5. 1 O:9 #O:3 O:10

File #O:3 shown above is 5 elements long: Elements 3, 4, 5, 5.1, 9

Numeric Constants You can enter numeric constants directly into many of the instructions you program. The range of values for most instructions is -32,768 through +32,767. These values can be displayed or entered in several radixes. The radixes that can be displayed are: • integer. • binary. • ASCII. • hexadecimal.

Publication 1747-RM001G-EN-P - November 2008