S7 SCL - Compare string from Block_DB

SeH

Member
Join Date
Jun 2011
Location
Göteborg
Posts
9
Hi

I'm having some problems comparing a string to an element from a Block_DB. My code look like this right now (I've removed some parts).

Code:
FUNCTION_BLOCK  Recipe_handling

    VAR
        area_start : INT;
        active_start : INT := 0;
    END_VAR
    
    VAR_INPUT
        recipe : BLOCK_DB;
    END_VAR
    
    VAR_IN_OUT
        article_nr : STRING[50];
    END_VAR
    
    BEGIN    
    WHILE EQ_STRNG(S1:=article_nr, S2:=REAL_TO_STRING(DWORD_TO_REAL(recipe.DD[area_start]))) DO
            ;
     END_WHILE;
    ;
END_FUNCTION_BLOCK

When I try to compile i get an error saying "Illegal parameter transfer". Does anyone know how to solve this?

Thanks
 
You cannot pass a string IN_OUT parameter on to another block. You will have to copy the in_out string to another variable before performing the string compare. e.g.

Code:
FUNCTION_BLOCK  FB888
    VAR
        area_start : INT;
        active_start : INT := 0;
        sComp:STRING[50];
    END_VAR
 
    VAR_INPUT
        recipe : BLOCK_DB;
    END_VAR
 
    VAR_IN_OUT
        article_nr : STRING[50];
    END_VAR
 
    BEGIN
    sComp:=article_nr;    
    WHILE EQ_STRNG(S1:=sComp, S2:=REAL_TO_STRING(DWORD_TO_REAL(recipe.DD[area_start]))) DO
            ;
     END_WHILE;
    ;
END_FUNCTION_BLOCK
 

Similar Topics

I am trying to compare the current version to an archived version of a block created in Siemens' SCL language. My working project is in its own...
Replies
4
Views
1,502
Is it possible to compare functions or source files within the SCL editor? I could not find such a utility or tool. If there is such a tool, can...
Replies
3
Views
5,575
HI i would like to know how to get a variable that will store the amount of times a program has been executed. The issue is I have 3 DBs for 1 FB...
Replies
2
Views
61
Hi, I have an intermediate-advance knowledge of programming with TIA Porta in Ladder, would you recommend me to start learning SCL for it to...
Replies
11
Views
550
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
314
Back
Top Bottom