First Use of SFB4

rikcando

Member
Join Date
Apr 2012
Location
Ontario
Posts
128
I have done some considerable reading here regarding the use of timers and have decided to use the IEC timer (SFB4) instead of the standard on delay timer. I have pressed the F1 key and it was informative on how it works and what each in and out variable is used for. I believe I understand its use and I should have no trouble with using this instruction (function).

The issue I am having is the symbol. When using a standard timer I simply assign T0 - T255 and all is well. What type of symbol do I use for this block? On my 315-2 PN/DP I am only allowed so many timers and T321 gives me an error on download.

Please note that this is my first 'from scratch' Siemens project so consider me a newbie with Step 7 (v5.5). Any simple bits of information that you can offer me will be helpful and appreciated.

Thanks.
 
Maybe if I explain what I need to know it might help.

When I place the SFB4 into the ladder logic it has ??? for a symbol. I need to fill this in.

I go to the symbol editor and I enter 'diag1' into the Symbol column, 'SFB4' into the Data Type column, and 'Diagnostic Timer #1' into the comment column.

What do I put into the Address column?
 
Call the SFB4 in a rung.
Assign a symbolic name to it such as "Timer_1" or so.
For each instance of SFB4 you'll use a different name/Symbol.
"Timer_2", "Timer_3" and so on.
 
The ??? is prompting for an instance DB number. Use function blocks and you can embed the timers into the stat area and you will not need to assign a separate instance DB for each call to SFB4
 
Last edited:
Thank you. I created an instance data block, DB999.
I think I saw an example somewhere on this forum of what goes into this for an SFB4 instance.

But I am still confused on the symbol. I insert the block an type DB999 as the symbol. That works fine. But what about the second instance? What symbol is use for the next one.

In the symbol editor I see address Db999 as data type SFB4 with the name that I gave to it. If I need to assign a new symbol for the another SFB4, what would the address be? DB998? Is a new DB number required for each instance of my SFB4?

I must really be missing something.
 
Check out LD's example above.
"Timer1idb" uses DB4.
Add another "Timer2idb" say DB5 for the second instance.
Add another "Timer3idb" say DB6 for the third instacne.
Or whatever DB number you choose.
Each instance of a timer (SFB4) requires its own DB.
 
Great, thank you all very much. I understand this.

I have a considerable amount of diagnostics required so I'll dedicate DB900 - DB999 as diagnostic timers #0 to #99 and be on my way.
 
Here's how you can embed SFB4 timers into a function block - the single instance DB you create when you call the FB will contain all the SFB4 instances:

sfb4a.jpg
 
The examples that I have seen on this forum all seem to have used a function block (FB) but I am using this in a function (FC). Should this bother me?
 
Wow, I think I need to start over. I had a Siemens 'expert' help get the program started and he did everything in FC blocks. I just read up on the difference again and I think I need to move to FB. My general control logic for the real world outputs is all within FC's.

Did I mention Newbie (with a captial 'New')
 
Here's some example processing using SFB4 timers. FB1 processes all the timer calls and will process all the timers you declare by examining the length of the instance DB. If you want some more, add them to the end of the STAT area and then regenerate the instance DB. You can set the time values in OB100 (called when the plc starts up) or within your program as you wish.

sfb4b.jpg
 
I see how all of that works except for one thing. You called FB1 before setting Pump#Fault.IN . If the .IN is raised it will not be used until the next scan, correct?

By the way, this will be helpful as I have two identical robots each with 5 sets of 2 cylinder tooling, and 7 sets of conveyors using 31 motors total. I was quickly running out of TIMER variables with only 256 available.
 

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,148
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
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...
Replies
4
Views
2,214
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,544
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
Back
Top Bottom