[?]: Simatic STL or SCL indirect addressing

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
ludakrava
Posts: 2
Joined: Sat Sep 24, 2011 5:15 pm

[?]: Simatic STL or SCL indirect addressing

Post by ludakrava »

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 :-)
sanruku
Posts: 66
Joined: Tue May 12, 2009 9:50 am

Re: Simatic STL or SCL indirect addressing

Post by sanruku »

Hi
ludakrava wrote:FB and IDB are variable, and should be passed from user program trough block interface input.
Why FB is variable? Maybe should be only IDB variable?
Anyway, take a look here:

(sfaq) http://support.automation.siemens.com/U ... n/24519683

glhf
sania
Site Admin
Posts: 1387
Joined: Sat Aug 13, 2005 6:15 am

Re: Simatic STL or SCL indirect addressing

Post by sania »

you can use
UC FBx
ludakrava
Posts: 2
Joined: Sat Sep 24, 2011 5:15 pm

Re: Simatic STL or SCL indirect addressing

Post by ludakrava »

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.
sania
Site Admin
Posts: 1387
Joined: Sat Aug 13, 2005 6:15 am

Re: [?]: Simatic STL or SCL indirect addressing

Post by sania »

you can try

Code: Select all

CALL FB50,DB50   // db50 it`s default db
& into fb50 in first net

Code: Select all

L #IDBNUM        // input_var INT number db
T #IDBNUM_temp   // temp_var INT
OPN DI[#IDBNUM_temp]
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!