Hi friends!
I desire to count the number of pulses on a PFI line for a fixed time after a trigger is received. This process should be hardware timed (not software timed). The counter should be reset after the gated counts are recorded so that when the next trigger arrives, the counter starts from 0. The gate time is 25 ms every 1s or so.
I started from this example:
The code simply uses a counter input task (that is pausable) to count the pulses and a counter output task (used to pause the counter).
My additions to the code from the link above are:
1) a primary control TTL task that I will use to trigger the gate task that triggers the counting.
2) DAQmx Implicit timing vi such that the gate task only produces a single pulse per trigger.
When I run the code, I find that the primary control TTL task and the gate task appear on their respective PFI lines as programmed (Yay!).
The "gated counts" waveform chart however, updates even when the counter is paused (many zeros are displayed). This is in agreement with my while loop timer that shows that the while loop is running more than 10 times during a gate period. Furthermore, there are multiple none-zero counts plotted while the counter is active (gate is high).
I only desire to know the total number of counted pulses during a gate period. I thought that my "is task done" vi would mean that the while loop would wait to read the number of counts during a gate period until after the gate task had finished. Apparently not.
What do I need to change in order to read only the total number of pulses counted during a gate period? Or, said another way, what do I need to change such that my while loop only executes once the gate task has completed?
I have tried replacing the "is task done" vi with a "wait until done" vi but found that this vi simply timed out. This suggests to me that perhaps the gate task is never completing.
Thanks!
Software: LabVIEW 2019
Hardware: USB-6211, USB- 6218