News:

  • June 09, 2026, 10:37:19 AM

Login with username, password and session length

Author Topic: DTCMP  (Read 7865 times)

PLCGuy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 677
DTCMP
« on: November 17, 2017, 02:30:23 PM »
When using the Date Time Compare DTCMP can it be modified to eliminate looking at seconds. I do not care about seconds. I have to program an unit to come on and perform test at certain days at certain times. I ended up breaking up my data entry on the HMI to eliminate using seconds. I do not care about seconds, makes it too much for the operator to enter. I have data entry for month, day, hour, and minutes that load into the UDT0.month, etc. As long as .seconds is zero, I am good.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6158
  • Yes Pinky, Do-more will control the world!
Re: DTCMP
« Reply #1 on: November 17, 2017, 03:08:22 PM »
Not now.

If you are looking for equivalence, just set the .Second member of each struct to 0 immediately before the DTCMP. $Now.Second will get reset before the next scan, but it will remain 0 until the bottom of the current scan.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3827
    • Host Engineering
Re: DTCMP
« Reply #2 on: November 17, 2017, 03:18:57 PM »
We are looking at doing a different instruction to make this easier.

In the mean time, you can use Date (only) Compare to test for equality to set a bit (it would be on for an entire day), then use relational contacts to compare Hour and Minute.

In the example below, C100 is on when Date portion of the User Date/Time UDT10 matches $Now.  C101 is ON when the date matches AND when UDT10's hour and minute match $Now's hour/minute.

PLCGuy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 677
Re: DTCMP
« Reply #3 on: November 17, 2017, 06:46:13 PM »
Thank you, that makes sense and looks easy to implement.
Can't wait to see what instruction you come up with.