Transistor

Time variable comparison. IF T#3S <= 0

3 posts in this topic

This isn't urgent but a TIME value is failing a comparison test for me.

t_delay    : TIME;		// Declaration
-----
IF t_delay <= 0 THEN
    t_delay := T#3S
END IF

If I modify the variable value to T#2S the IF sets it back to T#3S.

Internally the TIME variables are integer. Why would a compare not work as I intend?

Many thanks.

Edited by Transistor

Share this post


Link to post
Share on other sites

Have never compared with time values but shouldnt your if say

if t_delay<=t#0s then

t_delay:=t#3s

 

 

Share this post


Link to post
Share on other sites

Good catch (on the missing assignment ':'). Today I've been programming in Codesys STL, VBA and Python. I got mixed up!

Fixed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now