Member Login
Search
Jump to a Date
Sponsored Communities
Cool stuff
Neat Stuff

Visit our shop for nerds in control lifestyle products.
Thermal Overload
The threads that wouldn't die...
- PC reliability?
- Windows, real time
- PID loops
- PCs vs. PLCs
- Replacing people
- MS 'monopoly'?
- Software quality
- Where do we go from here?
- Why pay?
- PC reliability?
- Windows, real time
- PID loops
- PCs vs. PLCs
- Replacing people
- MS 'monopoly'?
- Software quality
- Where do we go from here?
- Why pay?
Fortune
This is the ____LAST time I take travel suggestions from Ray Bradbury!
RSS Feed
www.control.com/rss/
To get a personalized feed, become a member at no cost.
Dear sirs,
I want to use a function block with an instance DB in a function that is called from another function twice, and this second function is called from OB1 with actual parameters.
So the situation is something like below:
FC1(first common function):
VAR_IN
DB_In : Block_DB
END_VAR
...
call FB1, DB_In
...
FC2(second function called by OB1):
VAR_IN
FC2_DB_1 : Block_DB
FC2_DB_2 : Block_DB
END_VAR
...
Call FC1
DB_In := FC2_DB_1 <--- ***
Call FC1
DB_In := FC2_DB_2 <--- ***
...
END_FUNC
At *** i get illegal parameter assignment
OB1:
...
Call FC2
FC2_DB_1 := DB1
FC2_DB_2 := DB2
...
So how may I do it?
Best regards,
k.zonouzi ahmad
I want to use a function block with an instance DB in a function that is called from another function twice, and this second function is called from OB1 with actual parameters.
So the situation is something like below:
FC1(first common function):
VAR_IN
DB_In : Block_DB
END_VAR
...
call FB1, DB_In
...
FC2(second function called by OB1):
VAR_IN
FC2_DB_1 : Block_DB
FC2_DB_2 : Block_DB
END_VAR
...
Call FC1
DB_In := FC2_DB_1 <--- ***
Call FC1
DB_In := FC2_DB_2 <--- ***
...
END_FUNC
At *** i get illegal parameter assignment
OB1:
...
Call FC2
FC2_DB_1 := DB1
FC2_DB_2 := DB2
...
So how may I do it?
Best regards,
k.zonouzi ahmad
Hello;
If this is for Siemens S7 CPUs (you don't mention the model of PLC), I would suggest that you replace FC2(second function called by OB1):
> VAR_IN
> FC2_DB_1 : Block_DB
> FC2_DB_2 : Block_DB
> END_VAR
by FC2(second function called by OB1):
> VAR_IN_OUT
> FC2_DB_1 : Block_DB
> FC2_DB_2 : Block_DB
> END_VAR
The In_Out variable can be used both as input and output of a FC/FB.
Tell us if it helps,
Daniel Chartier
If this is for Siemens S7 CPUs (you don't mention the model of PLC), I would suggest that you replace FC2(second function called by OB1):
> VAR_IN
> FC2_DB_1 : Block_DB
> FC2_DB_2 : Block_DB
> END_VAR
by FC2(second function called by OB1):
> VAR_IN_OUT
> FC2_DB_1 : Block_DB
> FC2_DB_2 : Block_DB
> END_VAR
The In_Out variable can be used both as input and output of a FC/FB.
Tell us if it helps,
Daniel Chartier
Hello again,
I forgot to say that it is in Siemens S7.
Best regards,
k.zonouzi ahmad
I forgot to say that it is in Siemens S7.
Best regards,
k.zonouzi ahmad
Hi dear Chartier,
Declaring Block_DB as a parameter type is only permitted in VAR_INPUT part of a SCL block, or as INPUT in FBD/STL/LAD interface section. But as I have tested, the changes in the block are reflected on the actual parameter defined as Block_DB in the INPUT section, despite its declaration in INPUT section.
But my problem is that when I pass a local variable defined as Block_DB as the input of a function that has a Block_DB input, I got the invalid parameter, or something similar that means I can't do this, as an error.
I have seen a way to pass DB number as a word input to the called function in Siemens site, to mitigate the error, but I don't know how in the called function I may use the DB number to call a FB with this DB number as its instance DB, something like the below, that is what I was looking in my example:
call SFB4, DB_Block
or as a word parameter
call SFB4, DB [#DB_Number]
In a FB we may declare DB_Number in Static part, but when we declare it in other parts, that are available in FC also, we get a syntax error.
As a reference, I read somewhere, "...you can't pass a local variable to an FC inside an FC..." in "http://modbus.control.com/user/1026236263/index_html".
< br>Best regards,
k.zonouzi ahmad
Declaring Block_DB as a parameter type is only permitted in VAR_INPUT part of a SCL block, or as INPUT in FBD/STL/LAD interface section. But as I have tested, the changes in the block are reflected on the actual parameter defined as Block_DB in the INPUT section, despite its declaration in INPUT section.
But my problem is that when I pass a local variable defined as Block_DB as the input of a function that has a Block_DB input, I got the invalid parameter, or something similar that means I can't do this, as an error.
I have seen a way to pass DB number as a word input to the called function in Siemens site, to mitigate the error, but I don't know how in the called function I may use the DB number to call a FB with this DB number as its instance DB, something like the below, that is what I was looking in my example:
call SFB4, DB_Block
or as a word parameter
call SFB4, DB [#DB_Number]
In a FB we may declare DB_Number in Static part, but when we declare it in other parts, that are available in FC also, we get a syntax error.
As a reference, I read somewhere, "...you can't pass a local variable to an FC inside an FC..." in "http://modbus.control.com/user/1026236263/index_html".
< br>Best regards,
k.zonouzi ahmad
From Control Engineering magazine...
Related articles from Control
Engineering magazine- Rockwell Automation releases VantagePoint for plant data visualization
- Tips for sustainability in manufacturing
- Deadline extended: Nominate award winning products now for upcoming competition
- Video listen in: Making Coriolis two-wire demands small sacrifices
- Fast HMI application development software
- HMIs: Rugged, instrument-grade-glass on projected capacitive touchscreens
- Third-party remote I/O available for ControlLogix, CompactLogix
- Control system and instrumentation design software
Above articles copyright 2008 Reed Business Information.
Subject to its Terms of Use.
Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2008 Control Technology Corporation. All rights reserved.
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Patronize our advertisers!




