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.

User Flag to Trigger Different Scan Intervals

Terrapin Mar 23, 2017 08:25 PM

I am trying to write a program that will contain two different scan intervals that are controlled by a user flag.  I want the program scan interval to be 5 minutes normally, but when the flag is set True, run the same program at a 30 second (or ideally, user configurable)  interval.  I've tried creating variables for the Scan Interval and Scan Units, but it won't accept that. Is there a clever way I haven't thought of for doing this that doesn't involve putting the same exact code in the Main Scan and SlowSequence sections?  

Any help or suggestions would be very appreciated.

Sam Mar 24, 2017 12:37 AM


Public I_Wanna_Go_Fast As Boolean

Public ScanSec As Long
ReadOnly ScanSec

Public CS451(2)
Alias CS451(1) = Walker
Alias CS451(2) = Texas_Ranger

  Scan (1,Sec,0,0)

    If I_Wanna_Go_Fast Then
      ScanSec = 30
      ScanSec = 300

    If TimeIntoInterval(0,ScanSec,Sec) Then
      SDI12Recorder (CS451,1,0,"M!",1.0,0,2)



Terrapin Apr 4, 2017 04:38 PM

Thanks Sam for the suggestion and humor.  This is exactly what I was trying to do.

Raphael xing Apr 5, 2017 02:36 PM

a good idea

Nicolas Jun 11, 2021 06:33 AM

when the "Timetointevral" condition is not positive, does the logger have lower energy consumption?

Sam Jun 11, 2021 12:25 PM

The power consumption will be lower through a combination of less time spent on the SDI-12 communication and the reduced power draw in sensor operation. With that said, I believe that most applications would consider the power savings negligible in this exact example. How the concept is applied will be an important factor in determining the impact.

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