Siemens PLC indirect addressing is a key feature in the S7-300 series, allowing flexible access to memory locations. This article focuses on how to use and implement indirect addressing effectively. 1. When the highest bit (bit 31) of the pointer in the area is 0, it indicates that the address is within the same memory area. In this case, the area identifier (rrr) is also 0, and the format is similar to standard memory indirect addressing. Here are some examples: - `LP#5.0` // Load the indirect address pointer into accumulator 1 - `LAR1` // Transfer the contents of accumulator 1 to AR1 - `AM[AR1, P#2.3]` // Access M7.3 by adding offset P#2.3 to P#5.0 - `= Q[AR1, P#0.2]` // Store the result in Q5.2, which is P#5.0 + P#0.2 = P#5.2 - `L MW[AR1, P#19.0]` // Load word from address P#5.0 + P#19.0 = P#24.0 The brackets represent the operand address, calculated as the address value in AR1 plus the offset specified after the comma. For instance, in the third instruction, the operand is at P#7.3, which corresponds to M7.3. 2. If the most significant bit (bit 31) of the inter-area pointer is 1, it means the address spans different memory areas. Here’s an example: - `LP#M 6.0` // Load the double-word address of M6.0 into accumulator 1 - `LAR1` // Move the value to AR1 - `LW [AR1, P#20.0]` // Read the word at address M6.0 + P#20.0 = MW26 The binary representation of P#M6.0 is `2#1000 0011 0000 0000 0000 0000 0011 0000`. Since the address already includes the area information (rrr = 2#011 for the M area), you don’t need to specify the area again in subsequent instructions. When accessing words, bytes, or double words using an address pointer, the bit number to the right of the decimal point must be zero; otherwise, an error will occur.
Wenzhou Hesheng Electronic Co., Ltd. , https://www.heshengelec.com