best way to modify Function Block (FB) in siemens S7 PLC

panthripu

Member
Join Date
Mar 2004
Posts
228
If we need to modify a FB which has already been used/called in various FCs , what is the best way to do it?
Example : A FB , with three inputs #input1 ,Input#2,input#3 and one output #output#1 has been called 10 times at various FCs . Now I need to add one more input i.e. #input#4 to this FB.
 
Close down all block editor windows.
Edit the FB and add the new input parameter.
Open each FC in turn
Use File>Check and update accesses to update the block call and regenerate the instance DB.
Enter the new FB parameter

Save the FC's

Download the updated FB, FC's and instance DB's
 
Just one word of caution.
When changing the declaration part of an FB or FC, you should only download the modification when the machine or process is shutdown.
If the modification is in the code part of the FB or FC, and no change to the declaration part, then you can download even when the machine or process is running.
 
Just one word of caution.
When changing the declaration part of an FB or FC, you should only download the modification when the machine or process is shutdown.
If the modification is in the code part of the FB or FC, and no change to the declaration part, then you can download even when the machine or process is running.

I mean no disrespect, from a learning point why is that? I kind of thought once you had checked the block consistency and updated the accesses you should be able to download in run mode all the changed blocks and the processor would handle the changeover?
 
I mean no disrespect, from a learning point why is that? I kind of thought once you had checked the block consistency and updated the accesses you should be able to download in run mode all the changed blocks and the processor would handle the changeover?
You will loose the actual values of all DBs, including IDBs.
 
I am afraid of , making the things worse.
In our system , As we have number of weighing system ,the programmer during commissioning , created one FB to communicate with siwarex weighing.The FB has one IN-OUT parameter to trigger the zero calibration.When the bit is triggered it transfers zero calibration code ( 3 )to siwarex.Now I want to add the provision of full calibration by creating another bit which will tranfer span code to siwarex.If FB is modified by adding another bit in the decleration IN-OUT , it may distrub the data in the DB.
 
If you change the declaration-part of an FB, the IDBs of all the calls to the FB will have to be updated as well. And that means the actual values in the IDBs will be set to the initial values.
 
Although this thread is a year old, to avoid loosing data values, upload the data blocks and generate a source file for each. This will save the current values. After modifying the fb, compile the sources generated previously and it will put the values back in. Then download the fb and db as normal.
This works in v5.4/5 don,t know about TIA.
 
To use Mike's suggestion, you would have to meticulously mirror the changes to the FBs declaration, to the source file that you have created by the upload.
Even then it is not foolproof. From the time that you have uploaded, till you have made the modifications to the FB, the DBs via the source, and downloaded all, the actual values may have changed again.
 
So in such conditions there are chances of making error and facing problem.What about i call SFC58 again in the same FC where we already called FB. This time I will enable SFC58 only when the button for span is pressed.This SFC will be used only to write span code to the siwarax. Will it work with new DB ?
 
in TIA there is something called snapshot. so before any changes create a snapshot of values, paste it into excel and after download rewrite them back.

EDIT:
or monitor online and copy current online values to excel?
 
If we need to modify a FB which has already been used/called in various FCs , what is the best way to do it?

I am afraid of , making the things worse.
In our system , As we have number of weighing system ,the programmer during commissioning , created one FB to communicate with siwarex weighing.The FB has one IN-OUT parameter to trigger the zero calibration.

if that input is constant for all of the FB calls why not simply use a Marker bit. that way you do not change interface yet only the code part.
or you can set reset that bit before each call.

that you you would avoid recreation of IDBs.
 

Similar Topics

Compactlogix controller, program has 28 conveyors that use TON's to start the conveyors. The TT sounds a warning horn during start and the DN...
Replies
10
Views
482
I have S7 1512C controler for controlling 48 PID temperature loop, the output is PWM. Please I need the best, most efficient way to write the...
Replies
13
Views
591
I am going to need to use HART multi-drop in order to handle a series of Vega Radar units. There are a lot of options and I'm wondering what...
Replies
3
Views
251
Out of interest, I'd like some thoughts on what would be considered best practice with regards to a 2-position turntable control scheme (see...
Replies
17
Views
1,124
Hello colleagues Anybody knows, what could be the best or a better option to bring with you when you are in service at factory to connect via...
Replies
1
Views
259
Back
Top Bottom