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.
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
BeginProg
Scan (1,Sec,0,0)
If I_Wanna_Go_Fast Then
ScanSec = 30
Else
ScanSec = 300
EndIf
If TimeIntoInterval(0,ScanSec,Sec) Then
SDI12Recorder (CS451,1,0,"M!",1.0,0,2)
EndIf
NextScan
EndProg
Thanks Sam for the suggestion and humor. This is exactly what I was trying to do.
a good idea
Hello,
when the "Timetointevral" condition is not positive, does the logger have lower energy consumption?
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.