07-26-2011 06:46 PM
Hi,
So I don't know which counter board I'd be using yet for this (it's used in conjunction with a PCI-6280--the PCI-6280's counter inputs are all taken and so I need another board), but assuming this is possible at all in DAQmx I wouldn't mind knowing whether, say, the PCI-6601 (or any other timer board for that matter) could do this. I'm programming this in LabVIEW 2010 by the way.
I want to have a counter which counts the number of pulses on one channel (I'll call this the 'clock' channel) between when another channel goes from low to high (which I'll call the trigger). It's basically a pulse width measurement, but I only care if there are more than n clock pulses between triggers. I need to have a hardware-timed digital signal which goes from low to high if there are ever more than n pulses between trigger changing state from low to high.
What I am planning to do is this:
Is this possible? Reading through the manual of M series PCI-62xx devices, the index pulse loads the counter with a particular value so it seems like you could conceivably set the counter to the terminal count if you wanted. My only real problem is whether DAQmx Export Signal Property Node works on all counter tasks or just on edge counting tasks.
Thanks in advance for your help. If this isn't possible, I can reply with more details on the problem this is supposed to solve so that you can help me figure out an alternate method.
Solved! Go to Solution.
07-27-2011 10:49 AM
There is probably a way to do it, but it it may be easier to use an X-series board for the job. They support a new counter capability for count reset on a digital edge without needing to be configured in encoder position mode. I am not sure exactly how that feature's been implemented however, so maybe it won't make things easier after all.
The plan based on the hoped-for behavior:
1. Configure an X-series counter for pulse generation based on "ticks" of your clock channel.
2. Set both initial delay and low time to the critical # of ticks.
3. Configure for count reset on a digital edge (if possible in pulse generation mode)
4. Configure the count reset value to be the critical # (or possibly 1 less, if possible in pulse generation mode)
5. If you want the output to remain high indefinitely, configure the counter task to use its own output as a
pause trigger, and pause while high.
The way pulse generation works is to preload a # of "low time" ticks into the count register. Then every source edge will decrement the count. When the count reaches terminal count (0), the counter's output is toggled (or can be configured to pulse). The register is then loaded with the # of "high time" ticks and the process continues.
You would be perpetually interrupting the count-down process as long as you got your triggers in time. The count would keep getting reset to the # of low counts, keep decrementing toward 0 without reaching it, and so on. If ever you did reach 0, the output state would toggle high, then the high state would prevent subsequent clock signals from decrementing the count.
You can conceivably do a similar thing with a 6601, but I'm pretty sure you'd need 2 counters working together to get it working.
-Kevin P
07-27-2011 11:04 AM
Thank you for your response. It's interesting to hear about the X-series cards--I'd only been looking at M-series boards. I'll look into X-series timing cards when I have time.
"You can conceivably do a similar thing with a 6601, but I'm pretty sure you'd need 2 counters working together to get it working"
I think you're saying that another counter needs to be used to generate a frequency. But I think although a counter generating a frequency could be the easiest thing to program, the PCI-6280 comes with a frequency generator on board as well. Although I don't get very much choice of frequency (100 kHz or some integer division (1-16) of 100 kHz) with the generator, I was thinking that I could get it to clock out a digital waveform continuously, and in doing so could have a large degree of freedom in my choice of frequency. Then I`d only need one counter on the 6601 (or, if I'm lucky, an X-series) to do tick counting.
Alternately, I was thinking I could just by a $1 counter chip from an electronics store, and have it do this for me--by rigging up the right frequency and by wiring the encoder's A-channel to the counter's asynchronous master reset (and using one of the parallel 14-bit outputs as a digital trigger for a PCI-6280 digital channel which toggles to high the first time it ever sees the counter's output line rise) I could probably bypass the whole problem of buying another counter board altogether. Thoughts?
Also, I'd be interested in responses from anyone with information about the X-series boards and their counter abilities (and maybe recommendations about the cheapest X-series timer card NI has).
07-27-2011 01:50 PM
If you can do the job with an electronics store part and a bit of hardware wiring, that'll be your cheapest option.
The method for the 6601 (or an M-series board) wasn't about a freq generator. One counter would be setup as a position measurement with a "two pulse" encoder. You'd then have to config z-index reload stuff. And you'd also have to explicitly set it up to "pulse on terminal count." Then a 2nd counter would get triggered by that pulse and could pause-trigger itself to keep its output high.
That's it in a nutshell, but I just don't have enough time right now to lay out all the details. I agree that there should be an easier way, and hopefully the X-series offers it.
-Kevin P
07-27-2011 01:51 PM
Fair enough Kevin. Thanks again for your help.
07-27-2011 01:56 PM
Wait... One more thing. Why can't you just use a digital line with a digital start trigger instead of a counter? The digital line is originally low, but has a write task on it which sets it high--the task is triggered by a rising digital trigger edge.
07-27-2011 04:36 PM
Sure, you could use a triggered digital output to toggle high, but you'll still need the counter to generate the pulse to trigger it. The 660x boards don't have triggered DO capability, but your M-series board does. So unless you remap your existing counter signals to the 660x, you'd have to route the signal between boards. You can do it programmatically if you have a RTSI cable between them inside a PC case, or you can do it with terminal block jumper wire.
-Kevin P