0% found this document useful (0 votes)
292 views

Indirect Addressing in STL

Indirect addressing in STL provides three options: memory-indirect addressing, register-indirect area-internal addressing, and register-indirect cross-area addressing. Memory-indirect addressing stores the operand address in a tag located in memory. Register-indirect area-internal addressing uses an address register to index the bit and byte address within an area like inputs. Register-indirect cross-area addressing uses an address register to index the entire address including area, bit, and byte for the operand.

Uploaded by

Erick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
292 views

Indirect Addressing in STL

Indirect addressing in STL provides three options: memory-indirect addressing, register-indirect area-internal addressing, and register-indirect cross-area addressing. Memory-indirect addressing stores the operand address in a tag located in memory. Register-indirect area-internal addressing uses an address register to index the bit and byte address within an area like inputs. Register-indirect cross-area addressing uses an address register to index the entire address including area, bit, and byte for the operand.

Uploaded by

Erick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Indirect addressing in STL

In STL, the following options are available for indirect addressing:


 Memory-indirect addressing
 Register-indirect area-internal addressing
 Register-indirect cross-area addressing
Memory-indirect addressing
In the case of memory-indirect addressing, you store the address in a tag. The tag can be of
WORD or DWORD data type. The tag can be located in the memory areas "Data" (DB or DI),
"Bit memory" (M) or "Temporary local data" (L).
The following example shows applications of memory-indirect addressing:
Addressing
Description
in STL
// Execute an AND logic operation with a variable input bit. The address of the input
A I [MD 2]
bit is located in the memory double word MD2.
= DIX // Assign the RLO to a variable data bit. The address of the data bit is located in the
[DBD 2] data double word DBD2.
L EB [DID // Load a variable input byte to ACCU 1. The address of the input byte is located in
4] the instance double word DID4.
AUF DB // Open a variable data block. The number of the data block is located in the local
[LW 2] data word LW2.

Register-indirect area-internal addressing


Register-indirect addressing uses one of the address registers (AR1 or AR2) to pick up the
address of the operand.
In the case of register-indirect, area-internal addressing, you index only the bit address and the
byte address via the address register (e.g. P#10.0). You do not enter the memory area for which
the address in the address register is to apply until during programming of the instruction. The
address in the address register then moves to the memory area specified in the instruction.
Possible memory areas are "Inputs" (I), "Outputs" (Q), "I/O" (PI or PQ), "Bit memory" (M),
"Temporary local data" (L) and "Data" (DB or DI).
When you enter register-indirect, area-internal addressing, specify an offset after the
specification of the address register. This offset is added to the contents of the address register
without changing the address register. This offset also has the format of a pointer. The
specification of a pointer is mandatory and must be entered as constant (e.g. P#0.0 or P#2.0).
The following example shows an application of register-indirect area-internal addressing:
STL Description
LAR1 P#10.0 // Load pointer (P#10.0) to address register 1
// Increase content of address register 1 (P#10.0) by offset P#2.0.
L IW [AR1, P#2.0]
// Load content of input word IW12 into accumulator 1
// Increase content of address register 1 (P#10.0) by offset P#0.0.
L IW [AR1, P#0.0]
// Load content of input word IW10 into accumulator 1

Register-indirect cross-area addressing


In the case of register-indirect, cross-area addressing, use the address register to index the entire
address of the operand, i.e., the bit address and byte address, as well as the memory area.
Possible memory areas are "Inputs" (I), "Outputs" (Q), "I/O" (P), "Bit memory" (M),
"Temporary local data" (L) and "Data" (DB or DI). In the instruction, program only the operand
width. Possible operand widths are bit, byte, word, and double word.
The following example shows an application of register-indirect cross-area addressing:

LAR1 P#M10.0 // Load cross-area pointer (P#M10.0) to address register 1


// Increase content of address register 1 (P#M10.0) by offset P#2.0.
L W [AR1, P#2.0]
// Load content of memory word "MW12" into accumulator 1
LAR1 P#A10.0 // Load cross-area pointer (P#A10.0) to address register 1
// Add content of address register 1 (P#A10.0) by offset P#2.0
L W [AR1, P#2.0]
// Load content of output word QW12.0 into accumulator 1

You might also like