Hi
I got a rather big program on my CR1000
It should get a status from an ISCO sampler every 10 seconds
and other measurements every 60 seconds.
My scan is declared like this in my main loop: Scan(1,Sec,3,0)
I use "If TimeIntoInterval(0,10,Sec) Then" to get my ISCO statas
and "If TimeIntoInterval(0,60,Sec) Then" other measurements
I measured that a turn in my main loop takes 3-4 seconds. It varies a bit depending on different situation out of my control.
My problem is that if TimeIntoInterval is not hit on the correct second, it would not do the task.
I therefor calculate when the next 10 sec status should run in the future and then use this instead af TimeIntoInterval:
Call GetNextStatusTime
"If Now >= NextStatusTimeSS1990 Then"
Now is a timestamp on time right now and NextStatusTimeSS1990 is the calculated status time into the future.
My sub routines GetNextStatusTime & UpdateNow is:
Sub GetNextStatusTime
Call UpdateNow
SecTilNextStatusTime = StatusInterval - (Now MOD StatusInterval)
NextStatusTimeSS1990 = Now + SecTilNextStatusTime
CallTable (NextStatusTimeTable)
FormattedNextStatusTimeSS1990 = NextStatusTimeTable.NextStatusTimeSS1990(1,1)
EndSub
Sub UpdateNow
Now = Public.TimeStamp(1,1)
CallTable(TimeBarTable)
FormattedNowSS1990 = TimeBarTable.Now(1,1)
EndSub
I suggest reading the help on using Slowsequence.
You can have more than one scan on separate intervals.
The method you are attempting now would result in skipped scans since your measurements take more than one 1 second scan to complete.
That sounds like a good idea...thanks for the tip!