11-17-2013 02:55 AM
Hi,
I'm trying to measure the time elapsed between two conditions.
That is, I am measuring the reflex time of a muscle.
I have two signals, one being the impulse applied to the muscle and the other being the signal generated from an electrode connected to the body.
When the impluse signal threshold goes over a limit, so when I apply impulse (eg.3mV), i need to start counting the time.
Then when the electrode signal creates a voltage, (say 50mV) I need to stop counting time.
How would I go about doing this? I figure tick count would be utilized but I can't seem to figure out how to put these into a correct structure.
11-17-2013 03:02 AM
We probably need to see some code.
Typically you would take a tick count (or better a high resolution relative seconds timer) at both event and subtract the two to get the elapsed time.
11-17-2013 09:04 AM
Measure both signals by using two channels of hardware timed analog input in one task. Use the Threshold 1D Array function or a comparable waveform function to find the indexes of the places where the two signals cross their respective thresholds. Subtract the indexes and multiply by the sampling interval (dt = 1/fs). The resultis the time between the two threshold crossings.
Lynn
11-17-2013 11:54 AM
I thought one was an analog output ("impulses applied to ...").. But yes, you can run the AO and AI both off the same clock and apply Lynns solution.
The question is sitll no clear enough to give a definite solution, that why I wanted to see some code.
11-17-2013 12:01 PM
I agree it is not clear.
The concept of measuring the stimulus as well as the response is a general technique which can be very useful in many timing situations, especially when a desktop OS or human users are involved.
Lynn