Guest Guest_jimbo

Recommended Posts

Guest Guest_jimbo

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?


jimbo :(

Link to comment
Share on other sites

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


if ((MyChannel[0] < 5) && (MyChannel[1] >= 5))

Var.TimeLow = MyChannel.Time[0]

Timer = Var.TimeLow


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


This topic is now archived and is closed to further replies.