Write variable of type TIME

2016-07-14
2018-04-27
  • yannickasselin1 - 2016-07-14

    Hi,

    Is it possible to write to a variable of type TIME without converting.
    If I use a rectangle with %d, it will display 1000 (meaning T#1S).
    But if I try to write to it, it does not work.
    I would like to be able to write 2000 and then my variable would be set to T#2S.
    I know I can do it by converting in the program but I was thinking that if it can read correctly it would be possible to write also.

    Thank you.

     
  • yannickasselin1 - 2016-12-15

    Is this possible or not?

     
  • Anonymous - 2016-12-16

    Originally created by: scott_cunningham

    I believe you have to enter T#2000ms or T#2s. Just like you have it in the code. I always just convert a number to time in the code.

     
  • MaraP - 2018-04-26

    yannickasselin1 hat geschrieben:
    Is this possible or not?

    Very old post but yes, it's possible. I personnally use REAL type variables to set time values. For example, enter your time value in seconds in real type (%.1f) on HMI. Lets say 1.5s. Then on the program side you have to make conversion to type TIME:

    tTime := REAL_TO_TIME ( fTime * 1000). Code turns given time value (1.5s) in real type to time format t#1500ms...

     

Log in to post a comment.