5/27/2021 3:13 PM | |
Joined: 3/9/2018 Last visit: 5/20/2024 Posts: 182 Rating: (14) |
Small hijack on this subject. To indirectly access the data in a memory address, you create a pointer to that location by entering an ampersand (&) and the memory location to be addressed. 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). Entering an asterisk (*) in front of an operand for an instruction specifies that the operand is a pointer. As shown in Figure 4-12, entering *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 VB200 and VB201 are moved to accumulator AC0. --- Anyone can explain how you use it and in when you use it? ------------------------------------------------------------------------------------------ |
Last edited by: Henry1675 at: 05/27/2021 15:14:33Last edited by: Henry1675 at: 05/27/2021 15:17:21Last edited by: Jen_Moderator at: 05/28/2021 06:42:45New subject after splitting |
|
5/28/2021 7:42 AM | |
Joined: 3/30/2020 Last visit: 5/23/2024 Posts: 4531 Rating: (946) |
Hello. The help given in the manual is straight forward when looking at the images. Firstly the address of any memory element is a 32 bit value. Indirect addressing is powerful in the S7-200 for writing to / reading from a list. This can be data recording or recipe management. This was the only option before the data logging and recipe management was made available via external memory. Calculating a moving average also makes use of this indirect addressing. Curve fitting to a data table stored in the datablock is another useful application In my programs I normally use &VB0 as the base address. Then some constant is added to give the location of the actual variable that needs to be handled. So VW200 would be the word sitting at address location (&VB0 + 200), for example. Do notice that some (older?) documentation (software / manual ?) have notation errors where the & and * are swapped. Does this bring more clarity? Attachmentextract_indirect_addressing.pdf (463 Downloads) |
Activities of this user is voluntary. There is no obligation or liability placed on this user. Though optional, your 'please' and 'thank you' is highly valued. |
|
This contribution was helpful to1 thankful Users |
Follow us on