Specifications

CPU Memory: Data Types and Addressing Modes
5-14
S7-200 Programmable Controller System Manual
C79000-G7076-C233-01
Modifying Pointers
You can change the value of a pointer. Since pointers are 32-bit values, use
double-word instructions to modify pointer values. Simple mathematical operations,
such as adding or incrementing, can be used to modify pointer values. Remember
to adjust for the size of the data that you are accessing:
When accessing bytes, increment the pointer value by one.
When accessing a word or a current value for a timer or counter, add or
increment the pointer value by two.
When accessing a double word, add or increment the pointer value by four.
Figure 5-10 shows an example of how you can create an indirect address pointer,
how data is accessed indirectly, and how you can increment the pointer.
AC1
address of VW200
AC0
1 2 3 4
1 2
3 4
5 6
7 8
V199
V200
V201
V202
V203
V204
MOVD &VW200, AC1
MOVW *AC1, AC0
Creates the pointer by
moving the address of
VB200 (address of
VW200’s initial byte)
to AC1.
Moves the word value
pointed to by AC1
(VW200) to AC0.
INCD AC1
AC0
5 6 7 8
1 2
3 4
5 6
7 8
V199
V200
V201
V202
V203
V204
MOVW *AC1, AC0 Moves the word value
pointed to by AC1
(VW202) to AC0.
INCD AC1
AC1
address of VW202
Increments the pointer
two times to point to the
next word location.
Figure 5-10 Modifying a Pointer When Accessing a Word Value