Guest Guest_jimbo Posted April 18, 2005 Share Posted April 18, 2005 Hi All I wonder if anyone can help me with a question How can I trigger a timer from AI0 and save the data to file? Regards jimbo Link to comment Share on other sites More sharing options...
LabJack Support Posted April 18, 2005 Share Posted April 18, 2005 The important thing to note here, is that you will need to have a channel in DAQFactory store the time difference or the timer value, so you can log the values to file. You could use code in the Event like the following: if ((MyChannel[0] > 5) && (MyChannel[1] <= 5)) Var.TimeHigh = MyChannel.Time[0] Timer = Var.TimeHigh endif if ((MyChannel[0] < 5) && (MyChannel[1] >= 5)) Var.TimeLow = MyChannel.Time[0] Timer = Var.TimeLow endif Then the difference between Var.TimeLow and Var.TimeHigh will be your elapsed time or timer. Use a variable value component to display Var.TimeLow - Var.TimeHigh. This will display the time in seconds that it was over 5 volts. It will also display the time that your signal was under 5 volts, however it will record this time as a negative value. The Timer channel will record the time each time MyChannel changes state based on the if statements. You could then use a third channel to record the time differences, such as: Elapsed_Time = Timer[0] - Timer[1] Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.