siemens s7 multiple instance block

DeepThought

Member
Join Date
Mar 2008
Location
Norwich
Posts
52
Hi All,

I have created an FB with a mulitple instance Data block, I use the block 4 times in my program ( only have one data block), however the first time i use it in the program it functions correctly and i can open it and view/modify it and it operates the conveyor perfectly.
However when i come to the second usage of it i can neither get it to work or view it inside correctly as what i see is its operation in the first instance.
my question is can i have all of the instance FB's enabled at the same time or do i have to enable and disable each one in turn to get them all to work. If not how do i get them to work all together while all enabled.
regards
DeepThought
 
Multiple instance FBs are created using STAT entries in a calling FB. You call each instance using the name you have assigned for each instance, not the FB number itself - is this what you have done ?

Simple example attached.
 
Last edited:
Can you explain what you have done?

Have you created an FB which you have added into the STAT area of another FB or have you called the same FB multiple times using the same DB?
 
Hi all, Thanks for your time,

To explain a little further, I have a pallet conveyor system and to save me time I wrote an FB to control 4 of the 13 conveyors as these 4 were identical in operation.
At the time of creation the function block I then created the Data Block changing the shared property to instance and assigning a data block number as it filled with the variables from my FB.
In my program i call for the function block 4 times they all use the same DB (i assumed internally the plc created a DB array of some kind one for each call).
But by the sounds of what mameet said I need to create an individual DB for each FB call I make ?
So in theory I can copy the original DB and rename it and the when i place the FB in the program its variable "name" will point to the individual DB.
Is this correct

Regards
DeepThought
 
Hi
If I reuse an FB multiple times through the code I simply type the DB name above the FB I wish to use and let S7 create it for me, less work than cut and paste maybe.

I tend tho use the method L D[AR2,P#0.0] mentioned for arrays of valves,pumps etc
 
The DB is memory for an instance of the FB call, any additional calls would need a different DB.

The system will create the DB each time you program in a call.

Alternatively you could create another FB that calls these.

In the STAT area you can enter TYPE of FB, there you could put this FB 4 times and each can have a unique name.

You can then call this FB and assign 1 DB that would cover the 4 calls.
 
Hi,
You can also try this one (STL):
call fbxx, db890 (Hit Enter)
Step 7 will ask for your permission to create DB 890 for this FB. Select Yes button.

Above entered statement will go red if db890 already exist. One of the way to check if stuxnet has infected you :)
 
Thanks Guys,

I will create the new DB for each FB call this will solve my problem I made the assumption as i said earlier that i thought the PLC created an array of DB's based on the one i originally created but now i understand the requirements.

Thanks again
 
u use it offenlty

see when u use multipal insatance example fb 100
then u have to call it many times but the db which u r assigning should be different at every fb call (u cant use the same db for every call)

suppose u have 10 motors and u have fb 100 for motor logic

the u have to call it 10 times but u have to assign differect db like db 100 - motor 1

db 101 - motor 2



db 109 - motor 10

now the question is how u should motinot for particular motor

open fb 100 and click on tab debub there u will find option operation

click on operation again click on debug then u will find the option call environmet highlitned

click on call enviroment and a popup will come put the db no

example if u want to monitor motor 2 then put 101

and then go online u will get the current status of motor 2 ie it refers db 101 with respect to fb 100

debug.jpg
 
Using FB numerous times

Hi all.

I am using an FB to measure the length of an item travelling along a conveyor (have highspeed counter set up) and then an output when the count reaches a certain value). It works great as a one use.

but I need to use it numerous times. I have numerous pieces travelling along the conveyor.
I have set it so when i call the FB, it has its own DB but when the output comes on, the output of all the FB calls come on.... I have assigned the output of the FB to different bits (created another DB to use as intermediates to Q outputs.) but they all come on?

Why?

I did try using the multi instance DB but it did the same thing. What am I doing wrong?

The simple way around this was to put the code into an FC copy the FC numerous times. Then call the desired FC. This worked but i soon ran out of memory.

I have attached an example of my usage. if the logic for the 1st piece puts on DB1.dbx4.6 then DB1.dbx4.7 will also come on, which is the 2nd piece output...... Is it possible to use an FB like this? Is the problem that i am using temps and need to use STAT?

Any help will be appreciated

1.jpg 2.jpg
 
Welcome to the forum Ian! I hope you find this to be as useful a resource as I have.

A couple of thoughts to help you get better/quicker answers:
- In cases like this, your best bet is to start a new thread. Even though your issue may be similar to the one you've jumped on to, many people will see the original post (OP) is four years old and pay less attention to it.

- Please provide as much detail as you can up front regarding hardware/software type & version. I'm new to Siemens PLC and have realized how important this is. A solution for one S7 may not work for another (300/400/1200/1500/etc.)

Now regarding your issue, I don't have experience with multi-instance but I can give a couple of guidelines for general PLC troubleshooting. Check your logic to make sure those output bits aren't being manipulated elsewhere. Also check the status of the bits in the iDB as this should tell whether the FB is causing them to come on or not.

Hope this helps.
 
Use the attached library, copy your blocks to the library, archive the library and then post as an attachment.
 
Last edited:

Similar Topics

This is the first time I am working with Simatic Manager Step7 as I started my siemens journey with TIA which is pretty easy and do a lot of stuff...
Replies
3
Views
115
Hi, I have been successfully sending emails from a Siemens Comfort HMI (TP1200), configured with a "Gmail" address via VB Script. The VB...
Replies
6
Views
2,269
Hi, I'm curious if anyone knows of a way to print a PDF from a Siemens Comfort Panel HMI to multiple locations. I can print a PDF to a single...
Replies
4
Views
2,257
Hi, I'm curious if anyone knows of a way to print a PDF from a Siemens Comfort Panel HMI to multiple locations. I can print a PDF to a single...
Replies
1
Views
1,541
Hi Guys. A vendor is delivering a non GMP machine with a 1500 CPU and 4 panels. one TP1200 and 3 TP700. Im searching con/pros for according to...
Replies
2
Views
2,057
Back
Top Bottom