SFB4 in shared Datablock possible?

edda

Member
Join Date
Jun 2008
Location
At the office
Posts
100
Hi!

Is it possible to declare several SFB4 (TON) in a UDT and then create several DB of type (from our UDT)?

I was hoping not to have them stored in a instance datablock for an FB (in the STAT Area)...

Best Regards
 
Unfortunately you cant do that directly.
UDTs, shared DBs, or derivatives thereof cannot be definded from the declarations of FBs or SFBs.
The best I can suggest is to use multiple-instance FB+IDBs.

I am sure though that LD can find a way to do it for shared DBs with some clever pointer addressing.
 
Is it possible to declare several SFB4 (TON) in a UDT and then create several DB of type (from our UDT)?

I was hoping not to have them stored in a instance datablock for an FB (in the STAT Area)...

Best Regards

More explanation required. As you can define an instance DB for each call to SFB4, I fail to see the advantage or reason for creating your own global DB's to do the same job.
 
Thanks for your responces.


Okey, here is what I´m after.

Let´s say that we have a couple of blocks that are similar, let´s say 3 diffrent Motor blocks.

1. Ordinary Strait Motor.
2. Y/D-Started Motor
3. 2-direction Motor

All of these share some command / status bits to HMI/SCADA.

Let´s say: Auto/Manual, Manual-Start, SSW-Alarm, CB-Alarm, Running and so on.

I would like to have the same addresses for all block indipendent on the number of In, Out, In_Out of the block (because the Instance DB maps up everything in the datablock I get offsets in the start addesses of Stats depending to witch block it belongs to).

So I would like to use the same adresses of the shared bits only have to keep track of the DB number.

Very simplified in the attached image...

My plan was to create Shared DB with the data and passing a DB-number...

s7.png
 
I would link only the HMI-relevant data to an IO-pin on the FB or FC.
You can define the data in both the shared DB and on the FC/FB IO-pin by a UDT. In that way you get what you want. It will be easy to maintain because any change to the UDT will permeate throughout the program.

By placing a complete structure (greater than 4 bytes) on an IO-pin, then all accesses inside the FC/FB to that data will be by pointer. Some will argue that it will then be not so optimal, but it is not so critical when it is only for the relatively few data that is related to the HMI.

edit: To return back to the original topic.
You can see by this that all of the data for the various SFB4 instances will not be linked to your shared DB. Only what you configure to be included in the HMI UDT.
 

Similar Topics

Hi All I managed to use SFB4 in a FC using the IN_OUT interface, but I would like to improve if possible. Can I determine where the "timer area"...
Replies
9
Views
3,147
Hello! I have used two instances of the iec function block SFB4. They are defined as STAT instances within a calling function block. The presets...
Replies
1
Views
1,607
If I want to force a TON (SFB4) to be complete can I use a one-shot to initiate a move where I will take the PT value and place it in the ET...
Replies
12
Views
4,541
Hi, I have a simple function block that does not function when I use multi instance SFB4 IEC Timer On Delay. I could not attached a zip of the...
Replies
7
Views
9,089
I have modified an existing program on an S7-400 and download just the FC that had the change made to it while the PLC continued in RUN mode...
Replies
2
Views
1,552
Back
Top Bottom