First Use of SFB4

He called FB1 from OB1 because it has to run on every scan (continiously).
The call to the pump fault is just placed there or it could be in a sub-routine (FC) that is also continioulsy scanned (the FC containing the pump fault code would also be called from OB1)
Hopefully LD can correct me if this is wrong.
 
When I change the STAT information and try to save the block I get a warning message as follows.

You have changed the interface of a function (FC), a function block (FB), or a user-defined data type (UDT). If you save or download the block, conflicts will arise in blocks which reference these

Does this mean that the change in the static variable definition is stored with the call to the function, and if I change the blocks definition, then any place that I had previously programmed a call of this block will have an incorrect definition. I will need to go and re-insert any previously programmed calls to this function block if I change the static variable list.
 
Last edited:
Rick, Anytime you change the declaration table of a block you will get that warning.
Back in Simatic Manager, there is function to "Check Block Consistency" to locate / fix any issues. Select the blocks folder, its under the Edit menu I think - I am not at a workstation so I am guessing.
 
Sorry to keep dragging this out but my first attempt is not going well. I try to enter SFB4 as the data type and it changes it to 'TON' (same thing right). The previous example shown has it defined as 'SFB 4' though. Then I try to use the symbol that I gave to the TON and it tells me that there is a type conflict.

I can only guess that I did something in the wrong order. Added symbol to the STAT area and tried to reference it. This worked for the BOOL.

The picture shows where I tried to insert it beside the old style timer that I had. I will remove the other one if I could get this one in place. Yes, I know one is TOFF and the other is TON. The logic is not important now, just the method of implementation.

SFB4.JPG
 
Last edited:
Mine show up as SFB4 because my block options are set to display absolute addresses, you have the option set for symbolic addresses hence you get TON

sfb4f.JPG
 
Ok, I am getting so close.

The timer is in place in FB50. The instance data block has been created (DB50).

I tried to place the .IN instruction into OB1 and it gives me an error (Syntax at "LC_ES_Chnl1"). I selected the bit from the pull down options provided so I know it is there.

SFB4.JPG SFB4-1.JPG
 
You have one pair of "" too much in there. And is DB50's symbolic name DB50?

Global symbolic name is referenced with "". Eg if DB1 symbolic name is data and first member name is channel named struct and it has member named in.

Code:
"Data".channel.in
Would reference it.

In this example, data is global symbol, channel and in are not.
 
Last edited:
I used the pull down selection to place the proper symbol reference as seen in this picture. I tried removing the quotes from aroun DB50 and it change to DB50.DBX2.0 and accepted it. No symbol name.

SFB4-s.JPG
 
You cant mix symbolic and absolute addresses. Give DB50 a symbolic name (ofc prefer representative name).

DB50 is absolute address.

LC_ES_Chnl1.IN is symbolic.

Ps. im happy to see one intelligent and interested like you.
 
Last edited:
So, I use the following steps:
  1. Open FB#.
  2. Add the reference to the STAT area of the FB.
  3. Reference it by symbol name when adding the block.
  4. Save file to create the definition.
  5. Place the call with OB# (or FB#) and reference an unused DB. This will create the proper DB definition.
  6. Close file and give new DB a symbol name.
  7. Open OB# (or FB#) and insert -(.IN)- instructions. (and/or Move To .PT)
  8. Save and celebrate.
I can do this. (with a little help from all of you's out there.)
Thanks.

SFB4-d.JPG
 
For the record, I do not have to set the .IN in a seperate network, or seperate FB (or OB), but if it is a BOOL I can simply place it directly onto the IN of the SFB4(5) where it is programmed. Correct?

If I place a time value on PT do I need to reset this on start-up in OB100?

SFB4-q.JPG
 

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,164
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,615
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,241
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,571
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,118
Back
Top Bottom