CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Tue Dec 11, 2018 11:58 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Jul 14, 2016 2:30 pm 
Offline

Joined: Mon Apr 28, 2014 7:05 pm
Posts: 94
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.


Top
   
PostPosted: Thu Dec 15, 2016 7:02 pm 
Offline

Joined: Mon Apr 28, 2014 7:05 pm
Posts: 94
Is this possible or not?


Top
   
PostPosted: Fri Dec 16, 2016 4:48 am 
Offline
Frequent User
Frequent User

Joined: Fri Sep 02, 2011 8:02 pm
Posts: 291
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.

_________________
Scott Cunningham
KEB America, Inc.
www.kebblog.com
www.kebamerica.com


Top
   
PostPosted: Thu Apr 26, 2018 10:45 am 
Offline

Joined: Sun Feb 04, 2018 1:42 pm
Posts: 4
yannickasselin1 wrote:
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...


Top
   
PostPosted: Fri Apr 27, 2018 1:09 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3010
Hi,
attached an example:

BR
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited