HELLO! Can SCL and STL use the same DB block?

a___yue

Member
Join Date
Mar 2005
Posts
3
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 block?How to do like this? thanks!
 
Provided you are talking about global Data Blocks (not Instance Data Blocks), then carry on. The data doesn't know what 'language' is using it. Once it's at the point of execution in the PLC all the code has been compiled down to MC7 machine code anyway. (I assume you're referring to Siemens S7 since you use their abbreviations of SCL and STL)

As a general rule, until you are very confident you know what you're doing, I would not recommend accessing one FB's instance data from another different FB regardless of whether they were written in the same language or not. I suspect from this question you're not quite at that level yet.

Regards

Ken.
 
As a general rule, until you are very confident you know what you're doing, I would not recommend accessing one FB's instance data from another different FB regardless of whether they were written in the same language or not.



I wonder if I've got a case of over-confidence here? In a program I've written recently, I'm accessing data in an IDB directly and the program isn't working properly yet. Whether it's anything to do with that is another matter entirely.

Everything is in FBD/STL, what are the potential pitfalls?

Cheers

Roy
 
Unless you have a very good reason (and I can't think of one), instance data should only be referenced symbolically within the function blocks that contain a reference to it's definition. If you want use this data elsewhere, pass the data out of the block as a parameter.

If you look through the instance DB and find the address of the data you are after and then try and use it, this will work, but, and this is a very big but, if you change any of the interfaces of the function blocks the instance data will be re-arranged and the data you were accessing will now be something else !
 
Thanks for the quick reply !
you are right! I am referring to Siemens S7 .
FB is called by an FB higher up in the call hierarchy, it does not require its own DB. Its instance data can be stored in the instance data block of the calling FB when using SCL.

Is it working properly if the FB higher using STL and FB called using SCL like that above?
 
Obviously it was getting too near the weekend!

Now I've had a closer look, I am indeed only accessing the IDB from inside the calling FB. Where the confusion arose, was that during testing I was getting a counter value that had gone negative, instead of halting at zero, as intended. During further testing, I was then setting this back to zero manually, directly in the DB. This had obviously reached my subconscious as an IDB access from somewhere other than the calling FB.

The weekend break was evidently long overdue!
 
a___yue

When you call one block (FC or FB) from another (FC or FB), neither block cares what the language used to create the other was. Their only relationship is by the interface area defined by the formal parameters of the called block.

Let's say we have 5 possible languages (STL, LAD, FBD, SCL and SFC) for the calling block. We also have 5 possible languages for the called block. I can't think of any pairs that don't work together, so that gives 25 possible combinations of calling/called languages whenever you build a program.

Use whichever language gives you the best tool for solving the problem each of your FBs or FCs is designed to tackle. Don't worry about how they will link together - that can be done with all languages.

regards

Ken.
 
thank you very much!
I am trying to use(STL and SCL) in a program.
I want to use SCL language doing the arithmetic.
the program struct:
OB100,OB1(STL language),OB1 calling FB10,DB2
FB10,DB2(SCL language) FB10 calling FC9
FC9(STL language)

I am not sure they can work well,because I first use SCL and STL languages in a program.
From your replying,I am sure that!
Can you give me some advice about (STL and SCL)languages in a program.
thanks a lot!
 
Concerning the choice between STL and SCL, try and use SCL - it will be more readable, you can use arrays and it will be more transportable if you ever need to move the program to another plc.
(SCL will also produce smaller and faster code [by approx a factor of 3] if you reference UDT's inside your blocks)
Ladder logic would be my choice for interlocks though.
 

Similar Topics

I have an HMI 2711R - T4T Series B, and I want to know which PLCs, besides Micro 820, can communicate with it.
Replies
2
Views
116
I want a free plc programming software that is available for download onto laptop or pen drive. I have read books at length, I want to do...
Replies
16
Views
4,100
Hi guys. Im in need of some help. Im working on a down hole tool. one of the sensors failed and it is stuck down hole. I cannot find a way to...
Replies
11
Views
2,231
Hi guys im new here, Im trying to convert a .rss from a micrologic 1500 into a pdf
Replies
4
Views
1,258
First hello to everyone 🍻 Right as for the daft question......... My company has a policy that we must verify our PLC's programme every...
Replies
3
Views
1,456
Back
Top Bottom