#Siemens step 7 struct extra byte series
A series of different load and transfer type instructions can be used to work with AR1. The Address Registersīesides the regular accumulators, there are two 32-bit address registers (AR1, AR2) for storing pointers used in register indirect addressing methods. These methods can be used to offset the address or increase/decrease the pointer in a loop. Since the bit position only goes to eight the result of P#8.7 + P#1.1 = P#10.0 and not P#9.8. Note that math can be done on the POINTER data type using the double math instructions (e.g. When monitoring memory indirect addressing the INDIRECT column displays the current address the instruction is using. The memory area identifiers I, Q, M, L, DB use a double word (32-bit) location using the POINTER data type. The memory area identifiers T, C, DB, DI, FB and FC use a word (16-bit) pointer location in integer format.
The first method of indirect addressing is called memory indirect addressing because it allows for a memory location (M, DB or L) to determine or point to another. When monitoring in STL the shared DB number is displayed in the DB1 column and the instance DB number is displayed in the DB2 column.įurthermore, there are instructions to confirm that the correct DB number is opened and that it is large enough for the next operation. byte 37 of the open shared data block DB10 Transfer the contents of ACCU1 into MW22 The OPN instruction can open either a shared data block (DB) or an instance data block (DI). When working with indirect addressing it is sometimes needed to first of all open a DB and then begin working on theĪddress without directly referring to any one DB. NOTE: A DINT can be converted to a POINTER by simply shifting the double word left by 3 bits. For example the address P#DB25.DBX 0.0 Byte 14 points to the first byte of DB25 with a length of 14 bytes. To do this, the last pointer method is used to describe an area. Some functions in the library use the ANY data type to work on whole sections of memory. The ANY data type is used to pass a parameter of an unknown or undefined data type. The pointer address may be in three different formats. A pointer is always preceded by a P# symbol. The POINTER and ANY Data TypesĪ POINTER data type is used to format a number to be accepted as an address rather then a value. It is also a method that must be understood to use some of the library and system function calls provided by Siemens. While this may increase the difficulty of troubleshooting, its advantage is to greatly reduce the number of networks and instructions needed to control a process. In this case, a memory location stores a “pointer†to another memory location.
The following are examples of direct addressing:īy using the methods of indirect addressing the address used by an instruction can be varied to point to any number of locations. When a direct addressed is referenced by an instruction there is no question as to the location in memory. The most common form of addressing used in the Siemens S7 PLCs is direct and symbolic. Check out their website for hands-on and online training classes. This is a really nice explanation of a difficult but important subject. The following is provided by Automation Training from their excellent Siemens Step 7 training manual.