Counter / Timer from Trigger

William Dance

Posted on 23.08.2023 02:05

I have a trigger set to start storing once the data comes out of a small data window. Is there anyway to get a counter or timer that will reset when that triggger is activated? both the ADC_CLK clock in the Counter tab, as well as the signal "time" and "acqtime" functions in the math>formula tabs start counting from the arming of the system and not the trigger.


-William

Pika Kreča Šmid

Posted on 23.08.2023 12:50

Hello William,


thank you for reaching out to us. I believe what you are looking for is a stopwatch function. You can make it with formulas in the Math module, specifically by using the hold function. Here is a link to the solution if your triggered signal is a user input.


What you need to do is define the hold time- this means that the hold function will hold a certain value at the point when a trigger condition appears. Let's name this the time offset. Now we have to define the elapsed time- the difference between the offset and the total time of the measurement. The last formula will define the stopwatch time. For this, we will use an if statement. We define a condition, if the condition is fulfilled, then we will increase the time, if not, the function will show the last value of the time.


Let's make an example. I have created a pulse- the signal is equal to 0 for the first five seconds and then it behaves as a sine function. I have defined the trigger condition for storing as the moment when we get the pulse. Then I have defined the time offset. I will not hold the time for as long as there's no pulse. Once the pulse is present, I will start holding the time. The I have defined the elapsed time. I still had to define the stopwatch time, which I did with an if statement. Once the Pulse is different from zero, the time will reset and then increase. Before that, the function would exhibit the last value of the time.


Best regards,


Attached files:
Login to reply to this topic. If you don't have account yet, you can signup for free account .