pointers/indexing in S7 for guy coming from Allen-Bradley

buhnen

Member
Join Date
May 2008
Location
Somewhereland
Posts
131
Hi to everybody,

This thread's title can't be more explicit about the present topic. I've been up until now programming with RS-Logix. Here the indexing is an easy task which can be entirely accomplished by LADDER but now, when it's time to move back to Siemens (my initial introduction to PLC's was through the LAD STEP7) I'm feeling quite lost as I have no other choice than learning STL and I don't know yet some basic ABC's which allow me to build "words and sentences" by myself.

I've been reading some Siemens technical documentation, plus have spent a considerable time at reading/trying to decipher some posted code in this forum and still I haven't got myself on the right track of how to focus this subject.

Basiclly, what I'm trying to understand is the concept of registers AR1 AR2 , area cross pointer, internal pointer...who is who and what does each stand for?

The application I have in mind is the very typical one, let's say number of motors, 20 i.ex, with an instanced set each of boolean, int, dint ...variables (input/output). The aim is to control all of them with using loops, by means of indirect adressing and indexing.

As I'm lacking a general knowlegde on how the S7 internal memory areas are structured, I can't reach to see/understand the connection between what I need to do and the most suitable option within the different possibilities of indirect adressing.

Could someone experienced please provide me with any general guidelines to proceed?

Thanks in advance.
 
Before you go down the STL route, have you considered using SCL ? (structured text language that compiles into STL)
 
Yes, I've considered that option...but the senior fellow programmers in the company work with STL and I must be capable to understand their code, at least for now.
But personally I feel more encouraged to go with SCL
 
He says that siemens have failed to provide way to index trough array when using LAD. SCL does not solve that fundamental problem. See the post title:
I agree that SCL is the way to go for most things

I think its hard to read LAD when doing "complicated" programs when SCL(ST) is much more self commenting.
 
Last edited:
You can't declare an array of instances in SCL. I have tried. Each instance must have its own name.

I'm not sure I follow. An instance of what?

You can create an array of any custom struct you like:

Code:
STRUCT    
   MyArray : ARRAY  [1 .. 400 ] OF STRUCT   
    ParameterNumber : WORD;    
    IndexNumber : WORD;    
   END_STRUCT; 
END_STRUCT;
 
A way to achieve the same effect, would be to create a base UDT with all the required data.
Then use the UDT to create the declaration part in a subroutine FC.
And then create an ARRAY of the UDT with SCL in the higher level FB or FC.
The UDT data can then be indexed through (which must be the purpose of the excercise) with each loop passing the ARRAY data to the subroutine FC.
 

Similar Topics

Hello, I've just came out of a call where a program that was modified two weeks ago threw the processor into fault. The program has been done...
Replies
9
Views
3,470
I'm trying to get a 5069-L306er to talk to a Automation Direct ProSence Controller by using RA's AOI for modbus client but its stuck not getting a...
Replies
9
Views
1,881
The last time I did anything with Wonderware was just after the dot com bust. Boy, I feel old. Anyway, it looks like I will get the chance to...
Replies
3
Views
1,516
Hi guys, Some pointers needed: Having PC with WIN7 pro X64 and Amsamotion clone of 6ES7 972-0CB20-0XA0 cable and need to backup VIPA cpu...
Replies
14
Views
3,120
Is there any form of Reference Type or Pointer Type like Codesys has? I am aware that you can nut a tag in the index of an array reference. but...
Replies
7
Views
1,892
Back
Top Bottom