Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Detection of a 10 ms wide square-wave pulse

I am working on programming a weather monitoring software in LabView. The problem is that I have to detect 10 ms square-wave pulses, indicating flipping of the precipitation measuring cups. I have solved this using a continuous reading of a digital line. However, this approach makes it hard to run the precipitation VI in parallel with the other software, since the time-gaps when other VI:s are running/using the DAQ-card is too large. I was wondering if there might be some other way to solve the problem, e.g. using interrupts. Any ideas would be greatly appreciated.
0 Kudos
Message 1 of 7
(3,239 Views)
Well, there is, but I think I'd have to know a little more about what you mean by detecting a 10 ms square wave. Are these continuous? Do they happen only once in a while? What kind of harware (DAQ) do you have?

Mark
0 Kudos
Message 2 of 7
(3,239 Views)
Thanks for your reply. The pulses do not appear continuously. The signal is high until a cup is filled with rainwater, then a "scale" flips over and the signal is low for about 10 ms. After that it returns to high again. Each pulse corresponds to 0.5 mm of rainwater, so the time interval between the pulses will, under normal circumstances, be much larger than the pulse width.

As I remember it (I don't have access to the computer in question right now, unfortunately), we are dealing with a NI-5102 device and a Windows NT platform. Thanks again for your time.
0 Kudos
Message 3 of 7
(3,239 Views)
The NI-5102 is a digitizer, and doesn't have any digital inputs. Could you be thinking of another device?

Mark
0 Kudos
Message 4 of 7
(3,239 Views)
How ever you are sensing the signal (through an analog or digital input) you will need to sample the signal fast enough to distinguish noise from signal.

If you sample once every 10ms you will definitely find your highs and lows when they occur. But, you may see noise also (highs or lows of smaller duration not caused by the instrument). You would be better off to sample at least 3 times per 10ms (300kHz). Then only accept the change of state after three consecutive changed readings.

If you are sampling a TTL digital signal, then when starting from a Low signal any signal above 0.8V will be seen as a High, when starting from a High signal any signal below 2.5V will be seen as a Low. If the signal is very clean you will be OK, but this problem has surfaced for more than one person. If you have a lot of noise your results will be very bad.

If you are sampling via an analog input (as suggested in anothe reply) then you can apply som logic to the incoming signal to discriminate as outlined above.

As I write this I wonder what you will do with this information. Will you respond by counting the occurances? Will you record the time at which they occur? Will you accumulate occurances over time and report a cummulative rusult? These questions could have some bearing on how to sense the signal.

You bring up the issue of other VIs tieing up the DAQ card. Can you explain what demands the other activities put on the card? THe sensing of the 110ms pulses will use up some resources and the sum of all these demands muct not exceed the cards capabilities. The use of OS interrupts will not be faster than the hardware capabilities of the DAQ card.

The main point of LV and DAQ cards it not to involve the OS. When you configure an acquisition you actually configure the DAQ card hardware. The DAQ card can run on its own with out the intervention of the OS (and much more quickly I might add).

I haven't looked at the specs of your card yet, but it may be possible to run the various DAQ tasks in parallel (very normal and very easy with LV). Your mention of time gaps leads me to wonder if you are trying to create a sequence of DAQ tasks as one might do programming in a text based language?

Mike
0 Kudos
Message 5 of 7
(3,239 Views)
Greetings,

I just had the chance to read over this discussion and had some suggestions for your application, as well as comments on posts by other users. First off, I believe you are using the PCI-5102, which is one of our digitizer boards. As you probably know, the digitizer has nothing to do with digital inputs, as was implied by markwysong's comment. This is simply a high-speed DAQ board.

This board supports analog and digital triggers. Since your square wave pulse is not constant, I would just use triggers to detect the pulse. You may want to look into "retriggering" or the ability to trigger once and then configure the trigger again. This is because you know you are going to receive a 10ms pulse, but you don't know when and it will not happen
at any specific frequency. So, you could either connect the pulse to a digital line and poll it, as you are doing now, or just connect the pulse to a digital trigger line.

Regards,
Justin Britten

Applications Engineer
National Instruments
0 Kudos
Message 6 of 7
(3,239 Views)
Actually, the NI-5102 is simply a high-speed DAQ device. The digitizer has nothing to do with digital inputs. It simply performs analog operations at extremely high rates. This board is capable of acquiring from 2 analog input channels at speeds of 20MSamples/sec.

Regards,
Justin Britten

Applications Engineer
National Instruments
0 Kudos
Message 7 of 7
(3,239 Views)