To have access to data, the S7 uses those peculiar DBs. Why? And for what else are they good? Is there a way around them?
Well actually, I think they should have left this S7 over the ocean! Because PLC programming shouldn't have too much to do with Assembler.
One clue: compare the size of the working memory for a Siemens PLC to that of a Controllogix or Quantum CPU. A CPU 315-2DP uses 128 kB RAM; our latest Controllogix L63 has 4 MB. And the S7-315 can do almost as much as the comparable Rockwell PLC (a CPU 317-2DP would be a better equivalent). But to do so, you have to organize your program differently.
So directly accessible memory (known set addresses in the CPU memory) is limited to the input/output image tables and a zone of flag bits (M-memory). All other memory is organised in DBs; these are simply STRUCT variables (C/C++ users use this concept constantly) created by the user, but available in RAM only when needed. The CPU loads them from load memory into work memory only when required (called), as all other program blocks anyway; the working address of the variables is known only when the DB is loaded, much as a C/C++ variable's address is known only when it is used. It's a memalloc() function: create the memory space for the required variable when it is used, and when your need for it is finished, free the used memory for other variables.
Just a different way of doing things. After writing a few programs in Step 7 you will get used to its power and efficiency.
No one is asking you to enjoy writing in STL (statement list, looks like assembler); most of your programming can be done in LAD/FBD anyway, except for indirect addressing and loops. But like assembler for a microchip, code is much more efficient if you write it in Assembler, rather than a high-level language using a cross-compiler. And once you start understanding the (very) simple structure of STL, you get used to it.
Try this: write a simple single network of LAD, and View it in STL (Step 7 allows translation between LAD, FBD and STL languages, under most conditions). Examine the code. Add a branch to the LAD network, or a NC contact; View it again in STL. Add a timer, a CUP, a GEQ box in LAD, again examine how it is handles in STL. You'll see a lot of the translation is quite simple.
Where it gets complex, come back for specific questions.
Hope this helps,
Siemens S7 is the most difficult PLC to learn. However, spending time learning the ins and outs of S7 opened my eyes to a beauty and power similiar to Windows and Unix. As mentioned by Daniel, the structure is quite different and the ways of programming a S7 are many but having the ability to code efficient and reusable code is what peaks my yearning to learn more about S7. It helped to think in C and C++ to speed up the learning curve. Pretty much like learning Unix for the first time, you can do what you want and create the functions you need verses working with pre canned Windows functions.
Good Luck and regards,
Here we go again... :-(((
You don't like Chinese food? Don't eat it!
You don't like classical music? Don't listen it!
You don't like S7? Don't buy it!
(and don't take our time with such simplistic complaints, plz.)
You don't like simplistic complaints! Don't answer!
Soon more, I just returned from a trip to Vienna.
Please hire someone to program for you. Since you don't know what you are doing, you will hurt someone.
Don't feel too bad, I've got a fairly firm grasp
on what I'm doing and I think their implementation
feels like assembler too. Kinda like programming
on your hands and knees. And that's coming from
a C programmer who started with machine language.
In a given situation, I might prefer assembler where
I can define the constructs.
Since the early 1980s I have written hundreds of PLC programs all over the world. If someone was ever hurt by those accidentally, I was never informed.
But you hurt me on purpose.
I already read a lot of complaints about Siemens S5/7, but never a serious one about AB.
Do you remember the posts about S7 in this forum
more or less 6 years ago? I'll just quote two.
Who helps me climbing the S7-mountain?
Some people think, that they are intelligent, if they do something, that is difficult, that they might have easy.
Constructive critics would help Siemens S7 a lot
more, than defending it aggressively.
Best regards from Brazil,