S7 diff. bet FB & FC & all data in FB need to be available to any block or only STAT

arocon

Member
Join Date
Oct 2006
Location
Dubai
Posts
171
S7 diff. bet FB & FC & all data in FB need to be available to any block or only STAT

I am newbie in S7. I want to know difference between FB & FC. I know that FB & FC can be parameterized with IN, OUT, IN-OUT and TEMP. and only FB has STAT. My question is value of these parameter (IN,OUT,IN-OUT , TEMP and STAT) for FB to be available at any time to any block during the execution of PLC program or only ‘STAT’ parameter to be available to any block during the execution of PLC program.



And Only FC has RETURN/RET_VAL . what is that mean and what is it returning?
 
With FC's you don't have a Data Block and no STAT's as you pointed out. The IN, IN_OUT's and OUT's are available to the rest of the program in the form that they are addressed at the block call.

With FB's these and the STAT's are stored in the instance DB and be accessed from the DB at any time. Because these DB's have to exist you do not have to enter any data at the input and output pins.

I've never used RET_VAL, but below is a small description from Siemens manual S7prv54_e.pdf, you should be able to find it and download from Siemens site http://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&lang=en&siteid=cseus&aktprim=0&extranet=standard&objid=10805161&DataKey=10805161&treeLang=en

retval.JPG



EDIT: I've not used it, I would imagine the value is held in the RLO on returning from block.
 
I haven't used it either, and I haven't a computer handy with Step7 on it, so I may be guessing here...


The RET_VAL is, I believe, effectively a Status Word. In this case
it contains "0" if the operation was successfully executed and "-1" if the operation has failed - in this case, because the value was out of range, i.e. > 1000. I'm pretty sure that it has no effect on the RLO.
 
RET_VAL is part of a functions interface (along with INs, OUT etc.) If you don't declare one, the RET_VAL doesn't appear when you call the block. If you do define one, it will appear on the output side of the function call. You can declare the data type of the RET_VAL to be bool, byte, char etc.

Function blocks do not have a return value as part of their interface.

If a recall correctly, the RET_VAL is the only thing you should use when using a function to comply with IEC61131. Why Siemens have provided OUT's and IN_OUT's for functions is something I'd like to know.
 
the RET_VAL is the only thing you should use when using a function to comply with IEC61131. Why Siemens have provided OUT's and IN_OUT's for functions is something I'd like to know.
Absolutely correct about IEC61131: the only result defined by them for an FC is the RET_VAL. By definition a 'function' is intended to produce only one result.
However, if Siemens hadn't added what is after all the option of having other parameters, can you imagine the bashing we'd be giving them in this forum for having ridiculously inflexible FCs!

Ken
 

Similar Topics

Hello every body my name is rao. what is the main difference between QUICK PANEL, DATA PANEL
Replies
1
Views
1,715
What happens if you put Ethernet/ip, Modbus TCP, and Profinet on the same network? Do they need to be isolated from each other or can they work on...
Replies
8
Views
3,228
I am receiving attached error on Wonderware 2012R2 Alarm Database.As per InSource, the solution is Tech Alert 118 but its no longer available on...
Replies
5
Views
3,564
dear all what is the difference between SEW BSG 825 459 && BS24 826 763 I asked about the usage as I see the circuit diagram are the same for...
Replies
0
Views
1,354
Tell me if I'm all wet here because I'm arguing with PE but I'm not yet convinced. I have a 20 foot tall liquid CO2 Tank with vacuum jacket...
Replies
25
Views
4,864
Back
Top Bottom