LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Threshold counting from Analog Input

I'm just getting started with LabVIEW, and I've run into a bit of a problem with the threshold peak detector vi not working as I'd expect.

I'm trying to make a vi that will count the number of threshold crossings of a square wave coming in on Analog Input Channel 1 (Eventually these will be from a microswitch to control a filter changer for visual stimuls generation, but for now I'm looking at a fxn generator). I've attached a reduced VI that highlights the part of the vi I don't understand. It uses Analog In sample channel.vi to aquire the signal, gives the signal to waveform chart and Threshold Peak detector.vi. The input signal from the function generator varies between 1.0 and -1.0 V. I've set the threshold to be, say
, 0.5 V, and it never counts a threshold crossing, even though the waveform chart.vi shows the signal doing just that.

Does the signal from Analog In Sample Channel.vi need to be put into some kind of array format? And how would this be done?

Thanks very much for any suggestions

--Christian Reilly

----
heron@stanford.edu

Hopkins Marine Station
Stanford U
Oceanview blvd
Pacific Grove, CA 93950
0 Kudos
Message 1 of 2
(3,076 Views)
Christian,
The AI Sample channel.vi that you are using is collecting only one data point during each run of the while loop but the threshold peak detector requires a array input. You are able to see a waveform display on the chart beacuase of the while loop but in reality you are passing only one data point each time to the peak detector.
The best solution would be to use the intermediate AI vi's and use the peak detector with them in a loop.
To be more precise you can use any of the continuous acquisition shipped examples under >Hardware Input Output > DAQ > Analog Input > General
and use the threshold peak detector.vi inside the while loop.

For a simpler but a bit less flexible approach you can keep the same program setup and replace the AI Sample Chann
el.vi with a AI Acquire Waveform.vi and you should be good to go.

Hope this helps,
Pravin
Message 2 of 2
(3,076 Views)