04-14-2010 08:53 AM
Hello,
I have 2 triggers for my counting application. One starts the whole
process, it is a long pulse whose length changes each time, and the other is a
short pulse (300 ns) being used as a pause trigger to gate the counter in my M-series board. Ideally, I want to
count only when both are high (AND). In fact I need to count with 2 different counters, and the gates will have different timings for each.
I was using a digital line 8 and change detection to look for the rising
edge and falling edge of the digital line, and read 2 samples. In my while loop, the counters would count when
the first sample was 256 (bit 8 high) and the pause trigger was high, and while loop would exit when the
2nd sample was 0.
I had 1 signal generator connected to produce both the pause trigger and
the starting trigger, and another for producing pulses synchronized to the first. Everything looks fine on
the oscilloscope, I can see the pulses and they are all stable with respect to each other.
But when I count using the counters, I often get an error saying that the
DAQmx tried to read too many samples and could not read anything. I also get 0 on the counter data. If I
run in highlighted mode, I get a number, but the number fluctuates each time I run it, which I don't think
should happen since the signal generators are producing constant number of pulses. I think this mode
basically does not work.
From the examples, I see that I can use change detection events to be the
arm start trigger. I changed my code to do that instead, and now I don't get an error, but the counter
reading is still 0. I also don't get a constant number each time.
How does one implement an AND function for 2 triggers in Labview and DAQmx?
I am attaching the first version of the code.
NI Software : LabVIEW version 8.5.1
NI Hardware : Multifunction DAQ (and NI ELVIS) device PCI-6229
Driver Version : 1.13.0f4
OS : Windows XP
04-14-2010 10:40 AM - edited 04-14-2010 10:41 AM
Sorry, can't look at code as my LV system is tied up and far away from my network connection. Also, I'm pretty sure I don't have a clear picture in mind of what you're trying to do. You've given a lot of details, but I don't think I've put it together yet. That said, here are a couple quick thoughts:
-Kevin P
04-15-2010 04:58 PM
I agree with Kevin on some of that, I’m still unclear on a lot of what you tried. From what you originally asked, the simplest solution to count only when two lines are high is to use a hardware AND gate like Kevin Suggested. There is an AND function is LabVIEW but it is a software operation and I’m sure how you would incorporate that.