Dear friends,
I am writing a FC for my PLC inside which I need to call FB with it's instance DB.
FB and IDB are variable, and should be passed from user program trough block interface input.
Is there any way to do this, either in STL or SCL? Can anybody provide some example code?
Any help is highly appreciated
[?]: Simatic STL or SCL indirect addressing
-
- Posts: 66
- Joined: Tue May 12, 2009 9:50 am
Re: Simatic STL or SCL indirect addressing
Hi
Anyway, take a look here:
http://support.automation.siemens.com/U ... n/24519683
glhf
Why FB is variable? Maybe should be only IDB variable?ludakrava wrote:FB and IDB are variable, and should be passed from user program trough block interface input.
Anyway, take a look here:
http://support.automation.siemens.com/U ... n/24519683
glhf
-
- Site Admin
- Posts: 1387
- Joined: Sat Aug 13, 2005 6:15 am
Re: Simatic STL or SCL indirect addressing
you can use
UC FBx
UC FBx
-
- Posts: 2
- Joined: Sat Sep 24, 2011 5:15 pm
Re: Simatic STL or SCL indirect addressing
Hi all!
I didn't yet figure out how to call FB indirectly, either in STL or SCL. In STL, it is possible to call instance data block indirectly, just defining one of the inputs as "BLOCK_DB" (for example IDBNUM). Then you can make a call:
CALL FB50, #IDBNUM
I still can't figure out how to make this call in SCL syntax.
On the other hand, in STL one can make one input, let's say FBNUM (type "BLOCK_FB"), and make a call:
UC #FBNUM
But this is unusefull for me, because unconditional call does not take IDB into consideration.
On official Siemens support forum one of their platinum experts said that this is possible using pointer of type "ANY". I tried, but no success at all.
So, once more, I need to call FB with it's IDB. Call should be made inside an FC, and FB and IDB number should be defined on the FC interface.
Is this possible at all?
Many thanks.
I didn't yet figure out how to call FB indirectly, either in STL or SCL. In STL, it is possible to call instance data block indirectly, just defining one of the inputs as "BLOCK_DB" (for example IDBNUM). Then you can make a call:
CALL FB50, #IDBNUM
I still can't figure out how to make this call in SCL syntax.
On the other hand, in STL one can make one input, let's say FBNUM (type "BLOCK_FB"), and make a call:
UC #FBNUM
But this is unusefull for me, because unconditional call does not take IDB into consideration.
On official Siemens support forum one of their platinum experts said that this is possible using pointer of type "ANY". I tried, but no success at all.
So, once more, I need to call FB with it's IDB. Call should be made inside an FC, and FB and IDB number should be defined on the FC interface.
Is this possible at all?
Many thanks.
-
- Site Admin
- Posts: 1387
- Joined: Sat Aug 13, 2005 6:15 am
Re: [?]: Simatic STL or SCL indirect addressing
you can try
& into fb50 in first net
P.S.but you can not have to use IN & IN_OUT parameters!
only if you first save him in temp_var & after change DI you can store in STAT parameters!
Code: Select all
CALL FB50,DB50 // db50 it`s default db
Code: Select all
L #IDBNUM // input_var INT number db
T #IDBNUM_temp // temp_var INT
OPN DI[#IDBNUM_temp]
only if you first save him in temp_var & after change DI you can store in STAT parameters!