Siemens Simatic S7-200 System Manual page 45

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

Advertisement

Sample Program for Using an Offset to Access Data in V Memory
This example uses LD10 as a pointer to the address VB0. You then increment the pointer by an offset stored in VD1004. LD10
then points to another address in V memory (VB0 + offset). The value stored in the V memory address pointed to by LD10 is then
copied to VB1900. By changing the value in VD1004, you can access any V memory location.
Sample Program for Using a Pointer to Access Data in a Table
This example uses LD14 as a pointer to a recipe stored in a table of recipes that begins at VB100. In this example, VW1008
stores the index to a specific recipe in the table. If each recipe in the table is 50 bytes long, you multiply the index by 50 to obtain
the offset for the starting address of a specific recipe. By adding the offset to the pointer, you can access the individual recipe
from the table. In this example, the recipe is copied to the 50 bytes that start at VB1500.
Network 1 //How to use an offset to read the value of any VB location:
//
//1. Load the starting address of the V memory to a pointer.
//2. Add the offset value to the pointer.
//3. Copy the value from the V memory location (offset) to VB1900.
LD
SM0.0
MOVD &VB0, LD10
+D
VD1004, LD10
MOVB *LD10, VB1900
Network 1 //How to transfer a recipe from a table of recipes:
// – Each recipe is 50 bytes long.
// – The index parameter (VW1008) identifies the recipe
//
to be loaded.
//
//1. Create a pointer to the starting address of the recipe table.
//2. Convert the index of the recipe to a double-word value.
//3. Multiply the offset to accommodate the size of each recipe.
//4. Add the adjusted offset to the pointer.
//5. Transfer the selected recipe to VB1500 through VB1549.
LD
SM0.0
MOVD &VB100, LD14
ITD
VW1008, LD18
*D
+50, LD18
+D
LD18, LD14
BMB
*LD14, VB1500, 50
PLC Concepts
Chapter 4
33
4

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents