SCL Interface inderect adressing

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Post Reply
executer
Posts: 4
Joined: Wed Oct 12, 2011 7:44 am

SCL Interface inderect adressing

Post by executer » Sat Feb 23, 2013 3:28 pm

Hello,
I would like to use indirect addressing of SCL block input interface. Inputs are UDT data structures (string and few reals inside).

So, my question is it possible at all?

Another way is to re-declare inputs as TEMP array and copy all of them one-by-one on block start, but it is extra work for PLC.

Code: Select all

VAR_INPUT
    REACTOR_01 : UDT_STRUCTURE_REACTOR; 
    REACTOR_02 : UDT_STRUCTURE_REACTOR;
    REACTOR_03 : UDT_STRUCTURE_REACTOR;
    REACTOR_04 : UDT_STRUCTURE_REACTOR;
END_VAR

VAR_TEMP
    REACTOR: ARRAY [1..4] OF UDT_STRUCTURE_REACTOR;
END_VAR

REACTOR[1] := REACTOR_01;
...
REACTOR[4] := REACTOR_04;

I know how to do it on STL, but here i need to proceed string data, so want to use SCL, witch I less familiar with (

executer
Posts: 4
Joined: Wed Oct 12, 2011 7:44 am

Re: SCL Interface inderect adressing

Post by executer » Sat Feb 23, 2013 3:41 pm

I find out a thread on https://www.automation.siemens.com/WW/f ... anguage=en and check SCL_WriteAll source from Late member. Am I right that clear solution for me will be following:

Code: Select all

....
VAR_TEMP
    REACTOR AT REACTOR_01: ARRAY [1..4] OF UDT_STRUCTURE_REACTOR;
END_VAR
Then I will be able to point input data by using REACTOR array?

---- UPD

No, It is not possible to deaclare temp variable AT input variable

pmmdavid
Posts: 29
Joined: Wed Oct 28, 2009 3:13 pm

Re: SCL Interface inderect adressing

Post by pmmdavid » Mon Feb 25, 2013 4:40 am

Hi,

Here's is my 2 cents if i understand your question...

Code: Select all

VAR_INPUT

Reactor  : Array [0..31] of STRUCT
                                    a : int ;
                                    b : bool ;
                                    c : word ;
                                     END_STRUCT;

END_VAR

executer
Posts: 4
Joined: Wed Oct 12, 2011 7:44 am

Re: SCL Interface inderect adressing

Post by executer » Tue Feb 26, 2013 5:55 am

Yep, it will works for STEP7, but I using PCS7 САС - so no arrays aloud on block interface (

I try to use AT instruction to represent several STRUCT Inputs as ARRAY, but compiler gave an error, probably because of size of repsesentator is greater than AT variable ((( It could not see that I have a lot of them.

indian
Posts: 122
Joined: Fri Aug 11, 2006 6:16 pm
Location: Russia, Komi

Re: SCL Interface inderect adressing

Post by indian » Thu Mar 14, 2013 8:59 pm

Code: Select all

FUNCTION FC99 : VOID // BLK_WR

VAR_TEMP
    DATE_TIME   : DT          ;    // date&time of event
    E_DATE      : DATE        ;    // date of event
    E_TIME      : TIME_OF_DAY ;    // time of event
    SFC_ERROR   : INT         ;    // Current return value
END_VAR

VAR_IN_OUT
    S_COUNT     : INT         ;    // pointer (previous entry)
END_VAR



BEGIN
    
    IF S_COUNT > 29 OR S_COUNT < 1 THEN // max count of entry 30
        S_COUNT := 1;
    END_IF;
    
    // write date&time
    SFC_ERROR := READ_CLK(CDT := DATE_TIME);
    E_DATE := DT_DATE(DATE_TIME);
    E_TIME := DT_TOD(DATE_TIME);       
    
    DB4.Status[S_COUNT].EVENT_D := E_DATE;
    DB4.Status[S_COUNT].EVENT_T := E_TIME;    

    // alarm's data

DB4.Status[S_COUNT].E70_B := DB50.DBB70   ;      // 
.........
..........yours data here........ reading or writing it doesn't matter.....
..........


    // inc of pointer
    S_COUNT := S_COUNT + 1 ;
      
END_FUNCTION
my DB4 is area which consist 30 UDT, each UDT comprises all information alarm's stop related. I guess yours goals are similar.

Post Reply