1/22/2011 11:52 AM | |
Joined: 10/7/2005 Last visit: 11/14/2024 Posts: 3027 Rating: (1057)
|
Hello mracni call me old fashioned but myadvise is: Take the plunge and do it directly in STL. Apart from reading up on indirect addressing (see link below), there's basically only threethings to bear in mind when doing so in STL: 1.) You ALWAYS work with absolute addresses (never symbolically) 2.) Any indirect access to DB's requires that you explicitly open the DB beforehand 3.) A "pointer" value in S7 is a 32 bit long value representing the Byte.Bit address(see also attached pic) that: a.) may additionally contain a memory area in the most significant Byte b.) ALWAYS points to a BIT address. What this means is the following: - Adding 1 to a pointer will point to the next Bit, adding 8 to a pointer will point to the next Byte, adding 16 to a pointer will point to the next Word etc. - Any typically available "Index" value that you have (e.g. an Integervalue in the range of 1 to 50 in your case) needs to receive a "SLD 3" to "convert" it to aByte.Bit "pointer" value (I'll do a "SLD 5" in the attached example which is a multiplication with 32 (bits) as we are dealing with REAL values). Anyway, attached is a pic with someSTL example code for your C logic and below is a link that "points" to someadditional info on this subject. Step 7- Indirect Addressing FAQ's I hope this helps to get you started andencourage you tohave a go at it in STL and come back shouldyou have more questions. |
Cheers |
|
This contribution was helpful to2 thankful Users |
3/19/2019 12:33 AM | |
Joined: 10/7/2005 Last visit: 11/14/2024 Posts: 3027 Rating: (1057)
|
It's because Siemens decided to make "+AR1" a signed 16 bit Integer addition which limits it to a positive pointer value addition of 4095.7 (and I presume you use the +AR1 instruction). Using a pointer value of 4096.0 with +AR1 actually decreases AR1 by P#4096.0 which I fear is the cause for your PLC stop. Solution is simple, do a "+D" DINT based pointer math addition beforehand followed by "LAR1". |
Last edited by: fritz at: 3/19/2019 4:33:35 AMCheers |
|
This contribution was helpful to1 thankful Users |
3/27/2019 1:11 AM | |
Joined: 6/7/2015 Last visit: 5/20/2024 Posts: 29 Rating: (0) |
Thanks Fritz ! I got it sorted out. Cheers Steve |
Follow us on