hit counter script

Simatic Indirect Addressing Of The Cpu Memory Areas; Creating A Pointer; Using A Pointer To Access Data - Siemens SIMATIC S7-200 System Manual

Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

5.2

SIMATIC Indirect Addressing of the CPU Memory Areas

Indirect addressing uses a pointer to access the data in memory. The S7-200 CPU
allows you to use pointers to address the following memory areas indirectly: I, Q,
V, M, S, T (current value only), and C (current value only). You cannot address
individual bit or analog values indirectly.

Creating a Pointer

To address a location in memory indirectly, you must first create a pointer to that
location. Pointers are double word memory locations that contain the address of
another memory location. You can only use V memory locations, L memory
locations, or accumulator registers (AC1, AC2, AC3) as pointers. To create a
pointer, you must use the Move Double Word (MOVD) instruction to move the
address of the indirectly addressed memory location to the pointer location. The
input operand of the instruction must be preceded with an ampersand (&) to signify
that the address of a memory location, instead of its contents, is to be moved into
the location identified in the output operand of the instruction (the pointer).
Example:

Using a Pointer to Access Data

Entering an asterisk (*) in front of an operand for an instruction specifies that the
operand is a pointer. Using the example shown in Figure 5-9, *AC1 specifies that
AC1 is a pointer to the word-length value being referenced by the Move Word
(MOVW) instruction. In this example, the values stored in both V200 and V201 are
moved to accumulator AC0.
V199
V200
1 2
V201
3 4
V202
5 6
V203
7 8
V204
Figure 5-9
S7-200 Programmable Controller System Manual
A5E00066097-02
CPU Memory: Data Types and Addressing Modes
MOVD
&VB100, VD204
MOVD
&MB4, AC2
MOVD
&C4, LD6
AC1
address of VW200
AC0
1 2 3 4
Using a Pointer for Indirect Addressing
Creates the pointer by
MOVD &VB200, AC1
moving the address of
VB200 (address of
VW200's initial byte) to
AC1.
MOVW *AC1, AC0
Moves the word
value pointed to by
AC1 to AC0.
5-13

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents

Save PDF