Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Running a task once every 2 days at specific time


Uri May 3, 2016 08:16 AM

I'm using a CR6 in a remote station. I need to turn a small pump once every 2 days, at 11:00 am for 5 secondes. My program main scan rate is 250mSec and I also use a slow sequence of 5 sec.

Can I use this code in my slow sequence scan:

If IfTime (660,2880,Min) Then SW12 (1,1 )
  Else SW12 (1,0)
EndIf

Thanks,
Uri


JDavis May 3, 2016 02:29 PM

Iftime is safer to use in the main scan. There would be less chance of it being skipped.

Note that the code you wrote would only have the SW12 on for 1 scan every 2 days. If you skipped that one scan, it won't happen.


Uri May 3, 2016 03:08 PM

Thank you JDavis.

I've put the code in the slow sequence because I need the SW12 port to be on for only 5 secondes (1 scan, as you noted). If I move the code to the main scan the SW12 port will turn on for only 0.25 secondes.

The main scan MaxProcTime is about 100,000 microsecond (from Status Table). Do you have a resone to think that my program will skipp scans?

Thanks again,

Uri


JDavis May 3, 2016 04:54 PM

If you don't have any skipped slow scans recorded in the Status table, you are probably fine.

The new TimeIsBetween instruction is very useful and worth consideration.

Log in or register to post/reply in the forum.