Some problems in ST implementation.

Mehr
8 Monate 3 Wochen her #282 von Sergey Romanov
I am sorry I'll mention Codesys again.

This is about passing array variable to function block without knowing number of elements

If I have this code
PROGRAM
    VAR
        axMyArray: ARRAY[1..5] OF BOOL;
        fbTest1: Test;
    END_VAR

    fbTest1(axIN := axMyArray);
END_PROGRAM

FUNCTION_BLOCK Test
    VAR_INPUT
        axIN: ARRAY[1..100] OF BOOL;
    END_VAR
    VAR
        iCount: INT;
    END_VAR

    FOR iCount := 1 TO 100 DO
        axIN[iCount] := TRUE;
    END_FOR;
END_FUNCTION_BLOCK

It will not work because axIN and axMyArray does not match. Although following code would work in Codesys.
PROGRAM
    VAR
        axMyArray: ARRAY[1..5] OF BOOL;
        fbTest1: Test;
    END_VAR

    fbTest1(axIN := ADR(axMyArray), iSize := SIZEOF(axMyArray));
END_PROGRAM

FUNCTION_BLOCK Test
    VAR_INPUT
        axIN: POINTER TO ARRAY[1..100] OF BOOL;
        iSize: INT; 
    END_VAR
    VAR
        iCount: INT;
    END_VAR

    FOR iCount := 1 TO iSize DO
        axIN^[iCount] := TRUE;
    END_FOR;
END_FUNCTION_BLOCK

Although FB variable and variable I path does not match in number of elements it is still a valid code until INPUT variable defined with more elements than variable referenced.

The same sample but wih REF_TO abd REF() does not work in logi.CAD which is a frustration. I do not see any other way to create function block that can accept arrays of different length.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
6 Monate 3 Wochen her #306 von Walter Zögernitz
Hello Sergey,

After detailed clarification with my collegues I'm afraid to tell you that there is still no possibility in logi.CAD 3 for array-inputs of an undefined size.

kind regards
Walter

Haushaltsqualität ist für mich zu wenig!

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
6 Monate 3 Wochen her #307 von Sergey Romanov
Any hope that there ever will be that?

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
6 Monate 3 Wochen her #309 von Walter Zögernitz
Yes there is a hope. But this topic is not scheduled by now.

Haushaltsqualität ist für mich zu wenig!

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

logi.cals Österreich

Adresse

Europaplatz 7/1,
3100 St. Pölten

logi.cals Deutschland

Adresse

Postfach 1306,
40738 Langenfeld

Benutzer

Registrieren
© 1987 - 2019 logi.cals GmbH