7/17/2008 6:13 PM | |
Joined: 9/23/2005 Last visit: 11/4/2024 Posts: 4351 Rating: (1452) |
Hi, the STEP7 accept arrays with index. However the index must be a constant, not a variable. If you use absolut adressing and STL programing, you can use index as variable; example: L DBW [MD0] = load the DBW which number stay on MD0 (note: MD0 is related with the start BIT number = byter number * 8) Normaly I suggest to see the follow sample project. It has FB that do the most common tasks for you AttachmentSTEP 7 Staker.zip (1981 Downloads) |
Denilson Pegaia |
|
7/18/2008 5:07 PM | |
Joined: 1/30/2006 Last visit: 9/11/2024 Posts: 104 Rating: (16) |
Since I am between projects (my next PLC is still on order), I have not tested the code in the attachment, so I cannot be certain whether it works. However, I am laying out what I hope is a viable function for accessing data in any single-dimension array of elementary data types.
The attached zip file contains an .AWL file which imports to Step 7 as an STL Source file. From there, the source may be compiled into the actual function. My default function number is 200, but this is easily adjusted in the source code before compilation if necessary. AttachmentSD_Array_Access.zip (1625 Downloads) |
Follow us on