6/21/2012 8:26 PM | |
Posts: 55 Rating:
|
Needing some S7 indirect help. I am experienced in Allen-Bradley and have done extensive indirect addressing in PLC-5, SLC-500 and Logix-5000 (Control and Compact Logix). I am new to Siemens and S7 and having trouble begining my own programs past what all these samples are showing. Most of these samples I am looking through use the STL rather than LAD. I am trying to (or maybe was trying to) build my logic in LAD (most farmiliar) It seems that all of my tries to use the indirect addressing result in syntax error or invalid calls. Even my latest attempt, using the examples in https://support.automation.siemens.com/US/llisapi.dll?func=cslib.csinfo&lang=en&objid=24519683&caller=view I tried an example L 2 T MW30 L T[MW30] That works, but if I try L PIW[MW30] I get a syntax error. Why? Can I not indirect address to an input? I am reading many examples and manuals, but I am just not getting the "how to" just yet. Are there some sample programs available that are more akin to areal machine or process controlinstead of just a basic sample? Perhaps I will learn it easier to see how others have actually done this. Thank you for any help someone may provide. |
Last edited by: O_Moderator at: 6/25/2012 12:01 PMnew subject after splitting from /tf/WW/en/Posts/66945#top |
|
6/22/2012 4:21 AM | |
Joined: 10/7/2005 Last visit: 9/12/2024 Posts: 3020 Rating:
|
Hello DLittlejohn412 you can use indirect address to an input, but your "index" value isin that case a32 bit value(doubleword) and must comply with theByte.Bit format of a pointer (the three least significant bits of the pointer value contain theBit address whichwill of course allhave to be zero in case you load a PIW). Your orignal code has an Integer value as the index value for the indirect addressing whichcan only be done for Counters, Timers and Blockswho do (obviously) not have a bit address in their number. Every other address(e.g. I, Q, M, DB variables etc.) require a pointer format Byte.Bit address compliant value. As for your logic,simple fix is this: L P#2.0 // Load Byte.bit pointer value for address 2.0 in to accu1 T MD30 // Store pointer in adoubleword L PIW[MD30] // Result:Load PIW 2 Alternatively, you can use an address register for this: LAR1 P#2.0// Load Byte.bit pointer value for addr. 2.0 into AR1 LPIW [AR1,P#0.0]// Result: Load PIW 2 OR LAR1 P#P 2.0//Load Byte.bit pointer value for Peripheral addr. 2.0 into AR1 LW [AR1,P#0.0]//Result: Load PIW 2 Below is another example on top of the link that you already have, but you will find plenty forum/user related practical examples (and challenges) with a search for indirect addresing here. Sample program for sorting a data block I hope this helps |
Cheers |
|
This contribution was helpful to
4 thankful Users |
Follow us on