Vai al contenuto

Risposte nei forum create

Stai visualizzando 15 post - dal 1 a 15 (di 18 totali)
  • Autore
    Post
  • in risposta a: Errore di compilazione TON #85697
    George
    Partecipante

    I should check it in the field.
    Maybe the image that I have made my tests is outdated.
    Next week I could check it.

    in risposta a: Errore di compilazione TON #85671
    George
    Partecipante

    Windows 11 Pro for Workstations (25H2).

    It should be noted that the problem appear in MPS050 xUnified as target with Pck055a050 library.
    In mps054 xUnified or mps056 xUnified targets there is no problem.

    in risposta a: Errore di compilazione TON #85588
    George
    Partecipante

    I have MPS050 xUnified as target with Pck055a050 library I get

    ON(32) – error S1305: TO_TIME => Unknown function,

    If I use TON and eTON function blocks in the same project.

    If I use only TON or eTON, there is no problem. I need to use eTON in old projects where I have configurations with preset time in UDINT variables.
    It would be convenient to have a way to convert UDINT to TIME, to be possible the use only TON.

    If I have mps054 xUnified or mps056 xUnified the mentioned error is not appeared. So I can use TON and eTON FBs in the same project without problem. The problem appeared in mps050 xUnified target.

    in risposta a: How to initialize a structured type variable #83988
    George
    Partecipante

    In my project have a structure like:

    MYSTRUCT: STRUCT
        V1 : BOOL;
        V2 : ARRAY[0..3] OF UINT;
    END_STRUCT;

    If I intitialize in a program it:

    VAR CONSTANT
        MS : MYSTRUCT := (V1:=FALSE, V2:=[10,20,30,40]);
    END_VAR
    
    VAR
        myS : MYSTRUCT;
    END_VAR
    
        myS:= MS;
        myS.V1:= MS.V1;
    
    // [End of file]

    I get errors

    MyProgram(2) - error G0291:  MS => Invalid constant value
    MyProgram(3) - error G0291:  MS.V1 => Invalid constant value

    I think this error has to do with constant variable instantiation of structure data type containing array element.

    in risposta a: How to initialize a structured type variable #83893
    George
    Partecipante

    Is it possible to declare a CONSTANT variable of structured data type?

    When I try to declare I get compilation error without error code.

    in risposta a: Question about object polymorphism #82315
    George
    Partecipante

    In LogicLab program i write a program like this:

    VAR
        SquareArea : REAL; (* Square area *)
        SquarePerimeter : REAL; (* Square perimeter *)
        RectangleArea : REAL; (* Rectangle area *)
        RectanglePerimeter : REAL; (* Rectangle perimeter *)
        RForm : Form; (* Reference to Form *)
        MySquare : Square; (* Square form *)
        MyRectangle : Rectangle; (* Rectangle form *)
        pMySquare : @Square;
        pMyRectangle : @Rectangle;
    END_VAR
    
        IF (SysFirstLoop) THEN
            CASE select OF
                1:
                pMySquare:= SysMAlloc(SIZEOF(Square));
                RForm:=@pMySquare; //Reference to Form
                
                2:
                pMyRectangle:= SysMAlloc(SIZEOF(Rectangle));
                RForm:=@pMyRectangle; //Reference to Form
            END_CASE;
        END_IF;
            
        CASE select OF
            1:
            SquareArea:=RForm.Area(); //Square area
            SquarePerimeter:=RForm.Perimeter(); //Square perimeter
    
            2:
            RectangleArea:=RForm.Area(); //Rectangle area
            RectanglePerimeter:=RForm.Perimeter(); //Rectangle perimeter
        END_CASE;

    In TWINCAT we could write

        pMySquare:= _NEW(Square);
        RForm:= pMySquare^;
        RForm.Area();
        RForm.Perimeter();
    in risposta a: Question about object polymorphism #82260
    George
    Partecipante

    If I would instantiate Square and Rectangle FBs dynamically (SysMalloc) as the example

    IF (SysFirstLoop) THEN
        MySquare:=SysMAlloc(SIZEOF(Square));
        MyRectangle:=SysMAlloc(SIZEOF(Rectangle));
    
        @MySquare.Side:=10; //Square side
    
        @MyRectangle.Width:=20; //Rectangle width
        @MyRectangle.Height:=4; //Rectangle height
    END_IF;

    is it possible?

    in risposta a: How to use dynamic memory in a program #81858
    George
    Partecipante

    The problem with variables of interface type that assigned with a reference of a pointer. I think it is not working as I would.

    In TWINCAT it is possible that:

    VAR
        pTxtLogger : POINTER TO FB_TxtLogger;
        ipLogger : ILogger;
    END_VAR
    
    pTxtLogger := __NEW(FB_TxtLogger);
    ipLogger := pTxtLogger^;
    
    IF (ipLogger <> 0) THEN
       Write := ipLogger.Write(CONCAT('logger: ', sMsg));
    END_IF
    in risposta a: Error on using structured variable in a Method of an Interface #81777
    George
    Partecipante

    Yes I tested your program and compiles correctly.

    Now I gonna test this function in my program.

    in risposta a: How to initialize a structured type variable #81762
    George
    Partecipante

    Thank you very much. this was the information I was missed. It was not so clear in the LogicLab manual (6.6.7 SETTING VARIABLES INITIAL VALUE).

    in risposta a: Missing the “SysGetSysTime” function #68464
    George
    Partecipante

    I think i solved the problem by upgrading the firmware to SFW198E060 (Pck051b060).

    What is difference between Pck051b060 and PCK054A010?

    in risposta a: Errore “eGetBYTE => Funzione sconosciuta” in compilazione #68455
    George
    Partecipante

    I think i solved the problem by upgrading the firmware to SFW198E060 (Pck051b060).

    What is difference between Pck051b060 and PCK054A010?

    in risposta a: Uscite analogiche su modulo espansione I/O analogico #66072
    George
    Partecipante

    Hello, if you had read the comments inside “MyProgram” in project i had sent, you could see that i had located the problem in malloc buffer size and the memory allocation mechanism of the linker. The information for malloc memory of SysSetAnOut FB  is very useful.

    Another problem that i found is that the measured output values are abnormal. The analog outputs drive the reference inputs of motor inverters. If for example set channel 1 to 1V and all the other channels to 0V, the measured values to channels other than channel 1 are like -3.5V or 2.5V etc.

    I checked that between analog inputs of inverters and the earth strip the impedance is about 100KOhm. The inverters specs for reference input give Ri about 40KOhm. If i disconnect the analog outputs from inverters reference inputs the measured values are as expected.

    The solution that implemented and solves my problem is to connect opamp buffers between analog outputs of the module and the inverters inputs. If you could suggest a more simple solution, it would be nice.

    in risposta a: Uscite analogiche su modulo espansione I/O analogico #65928
    George
    Partecipante

    I have connected two PCB126C150 on a MPS054A110 CPU (fw:SFW198E000) and i made a program to update the eight analog output channels.

    If i run this program from Task background, execution is as expected.

    if i run from Task slow, the update is done only on the first module (as i can see at Done output of SysSetAnOut FB). The same even if i play with longer loop time of slow Task.

    I may send the program i prepared.

    in risposta a: Caratteristiche di memoria dei sistemi #63935
    George
    Partecipante

    So, the information (20 kB RAM user data) I read in product characteristics is not valid?

    Is there the 20Kb option available?

Stai visualizzando 15 post - dal 1 a 15 (di 18 totali)