Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog monitoring of digital line

Greetings,
 
I am trying to develop software code that allows me to take a buffered analog input of a digital line (0-5Vdc Pulse Train < 1kHz) to detect a high state, and that moment in time from the buffered samples.  I am needing to gather from this the duration between pulses to interpret a frequency.  If any one has a vi that performs this, I would be gracious.  I am trying to time sync this data with other analog information.
 
Thanks in advance!
 
 
0 Kudos
Message 1 of 4
(3,899 Views)
Alan,

Normally, if you wanted to record change detection and frequency of a digital pulse train, you would connect your input to a counter source.  You would setup a DAQmx Create Channel VI for counter input frequency as in the examples located under Hardware Input and Output >> DAQmx >> Counter Measurements >> Digital Frequency. 

You can use the polymorphic DAQmx trigger VI for a number of modes, including an analog trigger mode, examples of which are located under Hardware I/O >> DAQmx >> Analog Measurements >> Voltage >> Acq&Graph Voltage-Int Clk-Analog Start w Hyst.VI

If all the analog data you're acquiring is from the same device, you can group them into the same task to ensure that they are synchronized.  Perhaps with more information about your application, I could offer more insights into the best way to accomplish what you're trying to do.

Elijah Kerry
NI Director, Software Community
0 Kudos
Message 2 of 4
(3,884 Views)
Thanks for your reply,
 
However; I may need to clarify my needs again.  Lets not worry about measuring frequency just yet, but only counts.
 
"Normally, if you wanted to record change detection and frequency of a digital pulse train, you would connect your input to a counter source.  You would setup a DAQmx Create Channel VI for counter input frequency as in the examples located under Hardware Input and Output >> DAQmx >> Counter Measurements >> Digital Frequency. "
-As you stated this is true, however; when using a counter, inside the vi, the while loop does not iterate until a count has been registered.
 
At this time, I do not feel that i am needing to use a trigger, as I wish to show a time history (waveform graph) of the information.  For example, I wish to show that at an arbitrary time, the counts incremented to a certain level and stopped, then at a later arbitrary time, the counts resumed again.  I believe that only an analog monitoring of the channel will allow the loop to continue iterating and plotting all of the information, just not the number of counts.
 
A vi that would take the 0-5 V square wave, turn it into a 0 or a 1, and cumulatively add these values up and plot them to a chart vs time is what I need.  However, I have been unable to do this quickly (not greater than a few hundred Hz).  See the attached VI written in LV 8.2.
 
Thanks,
0 Kudos
Message 3 of 4
(3,875 Views)
Hey Alan,

There is actually an example program that ships with LabVIEW which I think you'll find does exactly what you're wanting to do.  From the code you supplied, it seems you're trying to create a rising edge counter.  If you open the example finder in LabVIEW and search for 'events' you should see a result with the title, "Count Digital Events.vi"  You can set it to count rising edges starting at 0, and you'll find that is capable of counting at rates well beyond 1kHz.  I just ran it on my hardware at about 1MHz.

Using a counter is a more effective method because you can actually configure it to perform the event detection in hardware, which is much faster than doing a comparison in software.  Hopefully this will be more along the lines of what you were looking for.  Let me know if you have any further questions or problems.


Elijah Kerry
NI Director, Software Community
0 Kudos
Message 4 of 4
(3,853 Views)