TIME() function not available?

Mehr
1 Woche 2 Tage her #277 von Sergey Romanov
Sergey Romanov erstellte das Thema TIME() function not available?
I am trying to create my own TON block with additional features. In Codesys I used to use TIME() function.
FUNCTION_BLOCK TON
    VAR_INPUT
        IN: BOOL;
        PT: TIME;
    END_VAR
    VAR_OUTPUT
        Q:  BOOL;
        ET: TIME; 
    END_VAR
    VAR
        M: BOOL;          
        StartTime: TIME;  
    END_VAR

    IF (IN) THEN
        IF (NOT M) THEN
            StartTime := TIME();
        END_IF
        IF (NOT Q) THEN
            ET := TIME() - StartTime;
            IF (ET >= PT) THEN
                Q := TRUE;
                ET := PT;
            END_IF
        END_IF
    ELSE
        Q := FALSE;
        ET := t#0s;
    END_IF
    M := IN;
END_FUNCTION_BLOCK

Pretty much straightforward. But function TIME() gets underlined. DO you have support for TIME()? What can I use?

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Woche 22 Stunden her #278 von Walter Zögernitz
Walter Zögernitz antwortete auf das Thema: TIME() function not available?
Hello Sergey,

"time" in logi.CAD 3 is a reserved word for the data type "time".
For writing down the current time value into a variable in your PLC program you have to get sure, that your target system supports a (system)clock.

For getting the value of the system time into a PLC variable you can use a C-function block like the one in this link:
github.com/rpoisel/lc3-lib/tree/master/System
Please note, that this code is only supported in linux systems.

kind regards
Walter

Haushaltsqualität ist für mich zu wenig!

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
4 Tage 18 Stunden her - 4 Tage 18 Stunden her #279 von Sergey Romanov
Sergey Romanov antwortete auf das Thema: TIME() function not available?
It is not exactly what I want. I do not want to get current RTC. TIME() in codesys returns amount of milliseconds passed from controller starts. And this information should not depend on controller but on RTS, RTS should measure ticks and update that time. It is like Step1.T internal variable of STEP ... END_STEP. Counts time passed from step become active. We need something like PROGRAM.T. Internal programm variable that will return time passed from program started to run.

In Codesys TIME also reserved for TIME data type, but TIME() function return time value.

I am sorry that I always compare you to Codesys, but I think this is what users who already have experience any try to use your system will also try to solve.
Letzte Änderung: 4 Tage 18 Stunden her von Sergey Romanov.

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 - 2018 logi.cals GmbH