I am using NI USB 9215 and would like to detect the rising edge (without polling). When rising edge is found start the timer and stop timer when falling edge is detected. Could not find trigger on 9215. Is there a way to achive this without being too CPU intensive? Currently using Voltage - Continouous Input.vi examples.
Are you trying to measure the width of the pulse?
The settings shown in the image will give you a block of data after 10 seconds. Starting a timer several seconds after the pulse does not seem to be very useful.
Please tell us more about what you are trying to accomplish.
There are two things I am trying to achieve
1. Need to detect rising edge, once found perform some actions and stop actions when falling edge is encounter.
2. Calculate how many samples should be acquired if I only want to acquire half a cycle. Need to save the #of samples in an array but want to do only for 2 consequtive rising edge half cycles. There will be two arrays for each half cycle.
1. The only way I know of to detect the edges in software essentially requires polling of the DAQ device. Determine the required timing resolution and read available samples more often than the timing resolution. Find edge. Take action. The limits on what are achievable depend on the OS, the DAQ device, the drivers, and what else the software must do during the detection process. For example suppose you need to respond within 0.1 second to the rising edge. Suppose also that it takes 20 ms to do the processing. Then you would need to read the data from the DAQ device every 80 ms or more often (>= 12.5 samples/second). Much faster than 0.1 s will not be reliable on a desktop OS and even at that rate an occasional dely may occur.
2. I am not sure I understand what you want to do. Do you want to measure the width of the first high pulse and then use that value for subsequent acquisitions? I would probably acquire all the data and sort it out later. Your data rates and the quantity of data are low enough that temporarily keeping all the dat ain memory should not be a problem.
I got #2 to working as per suggestion.
For #1: I acutally have two channels on 9215. On rising edge (from first channel0, that is the one shown on original image) need to start timer but stop the timer when peak value of second signal(CH1) has reached. peak value of second signal is achieved before the falling edge of first signal. Should PFI0 be used to tirgger to find the peak of second signal (CH1)? Not sure how PFI0 is connected externally to 9215?
I believe this forum has a similar explaination for a workaround that seems close to what you are trying to achieve. Check out the second post for more details: