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.

timer issue


fi Sep 30, 2014 08:11 AM

Hi,
I try to manage the memory of a camera calculating is time "ON".
I use the function "timer" but i don't understand where i miss something in the code. Is it the good way to do it?

'Video Start
If (AEven=1) AND (arTime>=4) AND (arTime<=19) Then
Avideo=1
PortSet (3,1)
PortSet (4,1)
Timer (1,Sec,0)
EndIf

'Video stop
If AEven=0 AND TimeIntoInterval(0,10,min) Then
PortSet (4,0)
PortSet (2,0)
Timer (1,Sec,1)
ATVideo = Timer (1,Sec,4)
EndIf

Regards,
Firmin


JDavis Oct 1, 2014 03:45 PM

There are a few options available in CSI dataloggers for timing actions apart from scan intervals:

1)Using variables to count a number of scans.
example; counter += 1 'counter goes up by 1 each scan
If counter > 20 Then
Portset(1,1)
Endif
If counter > 40 Then
Portset(1,0)
counter = 0
Endif

2)TimeIntoInterval - Simple way to perform actions at regular time intervals.
example; If TimeIntoInterval(0,10,min) Then
Portset(1,1)
EndIf
If TimeIntoInterval(5,10,min) Then
PortSet(1,0)
EndIf

3)RealTime - Useful for peforming actions at specific times like between midnight and 5AM each day.
example; RealTime(rTime())
If rTime(4) > 0 and rTime(4) <= 5 Then
PortSet(1,1)
EndIf
If rTime(4) > 5 Then
PortSet(1,0)
EndIf


4)Timer - Great for measuring elapsed time from an event which does not occur at a set time.

example;
If EventStart Then
Timer (1,Sec,2)
PortSet(1,1)
EndIf
ElapsedTime = Timer (1,Sec,4)
If ElapsedTime > 60 Then
Timer (1,Sec,3)
PortSet(1,0)
EndIf

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