06-14-2012 01:23 PM
I am trying to write a program that outputs digital pulses as a timer for my various DAQmx tasks and I need a counter to record counts into an array.
When the digital output goes HIGH, the counter should begin recording. When the digital output goes LOW, the counter should stop recording, save the previous counts as a new element in the array, and then waits to start counting again. Therefore, each element in the array should be the number of counts for an individual digital pulse.
I have been able to do a similar operation using a Sample Clock Timing VI that is edge triggered, but this is not good enough because it counts over the entire pulse.
When I run the Pause Trigger VI, the Read VI immediately runs and records as many samples as I request in the fraction of a second. Given that the amount of time it should take to read 1000 samples for a 100Hz digital signal is approximately 10s, this is impossible.
Using the Sample Clock Timing VI, there is an input for the samples per channel and I assume that acts as a buffer, but there appears to be no such command for the Pause Trigger.
It seems that it should be easy to integrate Pause Triggering into this VI, but I have been so far unsuccessful. Any help is appreciated.
I have attached my test VIs.
06-20-2012 05:48 PM
I have a couple of follow-up questions regarding your system:
1. What hardware are you using?
2. Have you tried running highlight execution on the Pause_Trigger_array_counter_notworking VI to figure out why it is running so much faster than expected? Other than the unexpected data acquisition time, does the Pause Trigger VI address what you need for your application?
3. What time of measurement are you doing and what is the frequency of your sample clock and pulse frequency?
I look forward to hearing from you and hope that you have a great day!
06-22-2012 12:21 PM
Thank you for the response. I am using a PCI-6229 DAQmx board on a Windows 7 machine.
I have run a highlight execution, but there is very little information about what the DAQmx is doing. I assume this is because I am trying to impliment hardware control over the counter and pause trigger. In this mode, it has the same problem I described in my first post. When the read counter command is called, the program immediately continues to the stop command.
The time scale of the pulses is approximately 1ms or slower. A1kHz frequency is the maximum clock speed we may require.
Thank you again for the response.
06-22-2012 03:46 PM
On M Series, both pause triggering and sample clocking need the counter's gate terminal, so you can do only one or the other. Pause triggering, when enabled will prevent the counter from counting edges when paused, however it will not prevent DAQmx from reading the counter. Hence your call to DAQmx read will read the same value from the counter repeatedly and quickly.
If I understand your description correctly, you need to count edges on some signal when a second signal is high. When the second signal goes low, you would like to capture the current count value. Is that correct? If it is, I'll see if I can figure out a way to do this.
PS... I'm thinking along the lines of using pulse width measurement, where you'd measure the width of high portion of the signal you're using as your pause trigger. For this measurement, I'd set the signal you're trying to count as the counter's source. This would basically allow it to return the width of the active portion of your pause trigger signal in units of ticks of the signal you're attempting to count. I think this ends yielding the information you need. I haven't tried this yet, just thinking aloud.
PPS... One feature of the newer X Series family of devices is that the counter gate and the sample clock are separate terminals. This would allow X Series to allow pause triggering and sample clocking at the same time, which sounds like what you want to do.