S7 actual parameters vs formal parameters

TurboCharger

Member
Join Date
Jan 2012
Location
FL
Posts
9
I am new to siemens S7 and trying to understand how FB,DB and FC are intended to work by simulating programs in plcsim. I created a FB which is only used once throughout the program. The assign DB has it 2 outputs (actual parameters). Since I am only using this FB once, is it possible to use the output formal parameters ( inside FB) to control contacts, inputs to FCs & FBs? I know I could have created FC instead of FB and assigned M,Q, or DBX at the actual parameter but I am trying to understand what can and can not be done in S7 and what's acceptable. Through the forum, other programmers stated instant DB is just a DB and can be used anywhere throughout the program. I used instant DB parameters as inputs & outputs throughout the program as well as formal parameters; all working in plcsim. Would this cause a problem in a real project?
 
Not sure what you are referring to as actual and formal parameters, don't mean anything to me in reference to Siemens FB's.

Yes an IDB is just a DB in regards to using the data throughout the program, the main difference is how it is created. An normal DB is created by the programmer and can be changed by the programmer. An instance DB is created by the system when a FB call is created and cannot be changed by the programmer unless the programmer changes the FB and re-generates the IDB.

The IDB is the IN, OUT, IN_OUT and STAT parameters of the called FB.

So what do you mean when you say the assigned DB has 2 Outputs? A DB does not have outputs, do you mean the FB has two outputs?
 
Yes, I meant the FB have 2 outputs. The formal parameters according to Siemens are internal local variables and the actual parameters are located outside the FB (IN,OUT,INOUT). In FB there are local variables which are assigned an address in DB. Lets say for example I am using a FB once in the program, instead of assigning an external bit, byte or word on the OUT of FB, can I just use the internal (local variable) which is assigned to a DB address throughout the program?
 
In FB there are local variables which are assigned an address in DB. Lets say for example I am using a FB once in the program, instead of assigning an external bit, byte or word on the OUT of FB, can I just use the internal (local variable) which is assigned to a DB address throughout the program?

Yes you can, a couple of implications as follows:

When monitoring the FB call you will not be able to "see" the state of these outputs so you will have to monitor the instance DB instead.

If you use the instance DB data globally, then if you change the FB interface (by adding some input parameters for example) and the DB bits shift in location and you will have to update all other FB/FCs that reference your instance DB data. I would assign an M flag to the output and use the M flag globally.

If an FB parameter is not assigned, somebody else looking at the program at a later date may assume the output is not used.
 
Last edited:

Similar Topics

Why is the configuration IP different from the actual IP address still able to run normally?
Replies
6
Views
828
Hi all, Just looking through the CIP_AXIS_DRIVE data type in a Logix controller to look for something that can tell me whether the current...
Replies
2
Views
1,069
Hello everyone, i would like to read in pcs7 v8.2 the actual day of the month(ex 1 or 25 of the month) i used as attached read_CLK AND DT_DATE but...
Replies
4
Views
1,934
Hello all! I have a problem. We are using SINAMICS V20 (6SL3210-5BB17-5UV1) to move a car tire with a motor up and down. The main principle is...
Replies
1
Views
1,089
Hi all, I'm working on an FX1S-10MR-ES PLC where there are 6 inputs (X000-X005) and 4 outputs (Y000-Y003). I used the programming from another...
Replies
7
Views
1,976
Back
Top Bottom