skyfox Posted November 15, 2021 Report Posted November 15, 2021 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.
skyfox Posted November 15, 2021 Author Report Posted November 15, 2021 Just found the "SecToTime" and "TimeToSec" functions. So for Q1 & Q2, I have the answer. Still would like to get a clarification on Q3.
photovoltaic Posted November 15, 2021 Report Posted November 15, 2021 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. 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.
skyfox Posted November 16, 2021 Author Report Posted November 16, 2021 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?
panic mode Posted November 16, 2021 Report Posted November 16, 2021 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
skyfox Posted November 16, 2021 Author Report Posted November 16, 2021 Thank you. I will dig around a bit. Cheers.
photovoltaic Posted November 16, 2021 Report Posted November 16, 2021 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. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now