Jump to content

Recommended Posts

Posted

Looking at the image below,

Q1. How can I pass the value of a variable (integer or DINT) in to my timer preset variable "T1_PRE" which is a Time data type. Short of creating a custom timer function, is there any way to have the native "TON" timer's "PT" and "ET" have their values in just seconds or milliseconds? 

Q2. How do I pass a a value of 2500ms in to this Time data type from an NB series HMI?  

Q3. TON instruction summary says "PT" & "ET" values are set in "ms". But below it states time is set in nanoseconds? Can someone explain this?

Thanks.

TON.png.32e57d48e39ab1fd184e38d77a0e3776


Posted
35 minutes ago, skyfox said:

Looking at the image below,

Q1. How can I pass the value of a variable (integer or DINT) in to my timer preset variable "T1_PRE" which is a Time data type. Short of creating a custom timer function, is there any way to have the native "TON" timer's "PT" and "ET" have their values in just seconds or milliseconds? 

Q2. How do I pass a a value of 2500ms in to this Time data type from an NB series HMI?  

Q3. TON instruction summary says "PT" & "ET" values are set in "ms". But below it states time is set in nanoseconds? Can someone explain this?

Thanks.

TON.png.32e57d48e39ab1fd184e38d77a0e3776

 

Q3 - The timer is capable of nanoseconds and is set with them behind the scenes so to speak but only ms can be specified for a value. You can use 100.43ms for example though.

 

Posted

Thanks.

Is it possible to just extract minutes and seconds out of Time data type in to 2 integer data types? Is the Time data type structure described anywhere in detail?

Posted

have not used Omron in long time so my best guess is that it is a 64-bit value (8bytes). if you prefix literal with DT# it should be in seconds and format may be YYYY-MM-dd-hh:mm-cs. which would make everything single byte except year. not sure if BCD or BCI coded. again, just a guess, not confirmed. you may also try DTToSec instruction, then rest should be easy. good luck

Posted

The time datatype is quite simple. At the core it is a LINT and it represents the nanoseconds of time.

Extracting mins and secs would be fairly simple. Use TimeToSec to get seconds and then a little math to figure out mins/secs.

  • Like 1

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
×
×
  • Create New...