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

I think the attachement will make the picture a bit clear. M12.0 transfer 1 to DB12.DBX10.0. I need to transfer 2 to same memory location with another bit i.e. M12.1

FB.jpg
 
first, DBX10.0 is bit memory address. you can't transfer 2 to same memory address. bit is either 1 or 0. so let's say, for an example, you would like to transfer 2 to BYTE 10
then waht i meant is that if M12.1 is global yoou could do the check inside the FB:
Code:
A #Input
L 1
T #DB12.DBB10
AN M12.1
JC M0001
L 2
T #DB12.DBB10

M0001:
.....
 
Is the problem that M12.0 has been used inside the FB as a global bit to zero all scales at one time ? And you want to be able to zero calibrate the scales one at a time ?

If so, there is a simple but not pretty solution.
Be sure that M12.0 is not used anywhere else in the program.
Set aside some other memory bits for zeroing each individual scale.
Then for each call of the FB you update M12.0 like this:

M12.0 := scale_1_zerobit ;
CALL FB with IDB for scale_1 ;

M12.0 := scale_2_zerobit ;
CALL FB with IDB for scale_2 ;

edit: as you have described, there is an input leg to zero the scale. Just set as

M12.0 := scale_3_zerobit ;
CALL FB with IDB for scale_3 ;

Not pretty but should work.

edit: The way you have described it, I dont see the problem or why you need to "transfer 2 to same memory location" as you put it.
edit: What you have described in posts #1 and #16 are totally different cases.
 
Last edited:
I think I am not able to explain it properly.
Yes , you are right. I typed it by mistake , it should not T DB12.DBX10.0. Sorry.
Now if you see #input is one of digital signal at input of FB , it triggers the transfer of 1 to some memory location.
I need additional input which will transfer 2 to same memory location.
I can not use M12.1 inside the FB as this FB is used for many location.

FB.jpg
 
I think I am not able to explain it properly.
Yes , you are right. I typed it by mistake , it should not T DB12.DBX10.0. Sorry.
Now if you see #input is one of digital signal at input of FB , it triggers the transfer of 1 to some memory location.
I need additional input which will transfer 2 to same memory location.
I can not use M12.1 inside the FB as this FB is used for many location.

so you want to use calibration only on some of FB calls.
then before that specifiic FB call you could set global marker to On, call FB then Reset it.
 
The screenshots by panthripu makes me think that he is not really proficient in STEP7 (no offense intended).
I bet that it is a very simple to implement programatically, but panthripu seems to have mixed things up quite a bit.
I think its is best that panthripu describes exactly what to achieve functionally, and only then we should discuss how to implement that functionality.

EDIT: HEY !!! I just notice that that was my post # 11000 ! I'll have a beer later to celebrate that. :)
 
Last edited:
I think once again its better to explain it.
I have 10 different weighing systems (siwarex). Where we need to calibrate them on regular basis as a system requirement.At present the calibration is done using laptop with siwatool.
The programmer originally created one FB and SFC58 and SFC59 are called in this FB. This FB is called at 10 different FC to read data from weighing system.
One other that reading ,progarmmer created the possibility to make weighing scale zero.SO we use M12.0 to trigger it. Now I want to modify the system so that i dont need to use siwatool connect laptop to individual siwarex card and calibrate. Instead i want to creat one more bit in PLC that will do span calibration. It is very easy job , if i think it logically but i dont know the consequences of it as i never did it before.
I have two possibilites as mentioned above, Modify the FB and write the code inside it to transfer the span code to siwarex. but to trigger it i need one additional input.I mean i have to declear on more input in FB in-out decleration.So that when i call this FB , it gives me addition input terminal where i will trigger it by M12.1. Thats all.
Second option is , let the existing FB as it is. and use it for zero.And call the SFC58 again in the FC related to that weighing system with new network. This SFC58 will be enabled when we trigger span calibration.
I think now it is clear to you all.
 
It is simple.
Do not modify the FBs (!).

I assume that each call of FB24 has an individual instance DB assigned to it. In your screenshot you have DB100, I assume that it is a different DB for the next scale and so forth.
These IDBs takes care of handling each instance.
Instead of one bit for all scales (M12.0) use individual bits for each scale, for example M12.0, M12.1, M12.2, etc.
For each instance of FB24, use the individual bits on the leg "SET 0".
Link each of the bits M12.0, M12.1 .. to individual buttons on your HMI, and you are done.
 
no all the weighting systems are not calibrated at same time. For each weighing system there is specific FC..i.e. FC1 for system1,FC2 for system2 and so on.
In each FC , the FB is called with dedicated DB.DB100,DB200,DB300....and so on.Each weighing system has its own set 0 bit.So when i want to zero one particular system , i make the bit related to that high from HMI. So zero is done. Now problem is with span calibration.I will configure seperate bit for each system for span calibration. I have done it with another part of plant where we had only one system so there was no FB created. Directly SFC 58 and 59 were called in one FC to write and read . If i am sure that by adding one more IN-OUT (boolean) to FB24 ,then there will not be any problem , it will be easy to do.
 
you could have bits M22.1 .1 .2 ..... M23.2 for 10 systems.
then in each FC before FB call put
M23.7 = x (where x is the system bit, one of m22.1 - m23.2)
call FB
right after call reset M23.7
in FB:
L 1
T memloc
AN M23.7
JC M0001
L 2
T memloc
M0001:
(rest of the code)
 
Can you add new FB and DB's for span calibration and leave old FB24 untouched? This way you don't need to worry about that old IDB's need updating and data loss.
 
Yes creating new FB is one of good suggestions but I dont want to make the things again complicated , rather calling SFC58 again is preferable.
I know its quite easy as mentioned above and I have some ideas to do it in couple of ways but it is lack of confidence which make me look for some more ideas to do it.
 

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
512
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
625
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
264
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,156
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
268
Back
Top Bottom