- Posts: 12
- Thank you received: 0
TIME() function not available?
- Sergey Romanov
- Offline
- New Member
Less
More
6 years 4 months ago #277
by Sergey Romanov
TIME() function not available? was created by Sergey Romanov
I am trying to create my own TON block with additional features. In Codesys I used to use TIME() function.
Pretty much straightforward. But function TIME() gets underlined. DO you have support for TIME()? What can I use?
Code:
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?
Please Log in or Create an account to join the conversation.
- Walter Zögernitz
- Visitor
6 years 4 months ago #278
by Walter Zögernitz
Replied by Walter Zögernitz on topic TIME() function not available?
Please login to view the answers
Please Log in or Create an account to join the conversation.
- Sergey Romanov
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 0
6 years 4 months ago - 6 years 4 months ago #279
by Sergey Romanov
Replied by Sergey Romanov on topic TIME() function not available?
Please login to view the answers
Last edit: 6 years 4 months ago by Sergey Romanov.
Please Log in or Create an account to join the conversation.
- Sergey Romanov
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 0
6 years 3 months ago #281
by Sergey Romanov
Replied by Sergey Romanov on topic TIME() function not available?
Please login to view the answers
Please Log in or Create an account to join the conversation.
- Walter Zögernitz
- Visitor
6 years 3 months ago #283
by Walter Zögernitz
Replied by Walter Zögernitz on topic TIME() function not available?
Please login to view the answers
Please Log in or Create an account to join the conversation.
- Walter Zögernitz
- Visitor
6 years 3 months ago #290
by Walter Zögernitz
Replied by Walter Zögernitz on topic TIME() function not available?
Please login to view the answers
Please Log in or Create an account to join the conversation.