S7 SCL not the same for every Siemens PLC?

Ah, and while you mentioned re-usability:

There are some functions that come with TIA, like mathematical functions etc, and I can use them directly.

I have also found that you can make own libraries, so I made one, but it seems that functions within them cannot be used directly, but you have to copy them completely into the project where you use them?
Is that just one way of using libraries, or is there another, so that code which is maintained in only one place, can be shared, not copied?
 
"multiple instance" is not a good name for what it does.
With multiple instance you embed an FB or FBs in other FBs. You are nesting the code so that simple basic blocks gets embedded inside other blocks that have a higher level.

Libraries does not have anything directly to do with it. A library is just a collection of code, and you pick what you need to use from the library.
Multiple instance is a programming concept. It is similar to procedural languages.
 
Aaaaah :D I see. That "multi instance" definitely seems useful, I agree the name is weird. I currently have a huge pile of DBs and if I understood you correctly, it is not necessary :) Thanks. I hadn't extracted that of the Siemens pages I've read.
 
actually "multiple instance" means you don't have DB for each FB call yet program put DB of each lower FB call in main (higher) FB static part of interface. hmm, what i wanted to say is that you still use the same amount of memory but it is differently used. All the single instance DB that you would have are now in static part of higher FB interface and in its DB accordingly. Effectively, you got cleaner code and you have used less number of DBs.
 
By the way,

there are variable tables where you cannot set initial values.
Is it *guaranteed* that those will always be initialized with zero? Does someone know off the cuff where this is described in the manual?
 
A variable table is just a "view" of actual values in Merkers and DBs.
"initial values" of DBs, or IDBs, are only for when you create the program from scratch, or for when the "actual values" have been corrupted.

What is it you want to achieve ?
 
To achieve, nothing in particular for that question, it would just be good to know whether things (say, the memory here) are "zeroed" at start.

Another thing, say, is it possible to use labels of some sort in CASE OF?
E.g.
CASE #hallo OF
someCase:
anotherCase:
END_CASE;

..etc, instead of numbers.
I tried to make user constants of type int and use them there, but the compiler didn't like that.
 
to set certain values at start you use OB100, OB101 etc. which are startup OBs that are executed, each for its own reason, before main OB1.
as for CASE OF why would int be a problem?

you could try this if you want labels:
Code:
CASE iVar OF
1: goto Label1;
2: goto Label2;
...
ELSE
...
END CASE
 
to set certain values at start you use OB100, OB101 etc. which are startup OBs that are executed, each for its own reason, before main OB1.

Ah, I see. Hadn't used one of those yet. It looked until now as if stuff was zeroed at startup, so I wanted to make sure... if it's the case it would shave off some init work, but good to know that OB type.

Now that you mention OBs, is it a good idea to have more than one "program cycle" type OBs to get quasi parallel behavior?
 
don't know if that is possible with siemens (it is with AB & RSL 5k)
With Siemens each OB has its purpose (i am a little old fashion) but as i recall now in TIA with S7-1200 there are and i had multiple program cycles OBs in some projects.
as for good idea, i like consistency, but i do not see why not. think of it like object oriented programming.
 
Btw, should I better open new threads for new questions that are not very connected to my original question?

I refrained from doing so for now because I felt this as a sort of "collection of beginner questions" which might not be so bad, and it's about the one same PLC and language...
But some forums don't like this "question collecting".

EDIT: removed new question, opened new thread
 
Last edited:

Similar Topics

HELLO! I think to use blocks programmed using SCL in combination with blocks programmed in Statement List (STL).Can they can use the same DB...
Replies
8
Views
3,994
HI i would like to know how to get a variable that will store the amount of times a program has been executed. The issue is I have 3 DBs for 1 FB...
Replies
2
Views
97
Hi, I have an intermediate-advance knowledge of programming with TIA Porta in Ladder, would you recommend me to start learning SCL for it to...
Replies
11
Views
572
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
348
Hi everyone, I am new to this amazing world of PLC, well... I mean, in practice, since I already knew electronics, programming languages, IT, and...
Replies
7
Views
661
Back
Top Bottom