LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview-DAQ

My analoge and digital InputMy analoge and digital Input

I have two signals as shown, the Analog input signal is pulse Gaussian. I want to measure the value of Analog input signal amplitude (1 sample) with 4 Analog input channels AI0 to AI3 on ​​NI ELVIS II device when the input digital signal changes from high to low as shown in the picture above. Each Analog signal will have a Digital pulse input and a Gauss pulse peak corresponding to Digital input from high to low.

I wrote an VI like the following figure

2.PNG I use triggers to start the task when the edge is down. But I think it only works once and then it goes into the while loop, the program in the while loop will repeat until I stop. Thus it will not be possible to check the condition of a falling edge if there is a 2nd or 3rd pulse to measure the Analog signal amplitude. Someone help me solve it. Thanks everyone.

 

 

 

 

 

0 Kudos
Message 1 of 8
(2,761 Views)

You configured your A/D to acquire 4 channels of data (but you describe reading a single Analog channel having a Gaussian pulse) and have set your Clock and A/D to record 1000 points at 1000 Hz, taking finite Samples (i.e. 1000) every time a trigger pulse comes in.  So far so good.

 

However, your DAQ Read is set to read 1 sample, even though it should take 1000 (or one second's worth) for every trigger pulse.  Why didn't you set it up to take N samples, and wire the number of samples into the DAQmx Read function?  You'll have a choice of getting the 1000 points out as either a Waveform (do you know what this is?) or as a 1D Array of Dbl (or, if you are acquiring N channels, you'll get an Array of Waveform or a 2D Array of Dbl).

 

Bob Schor

0 Kudos
Message 2 of 8
(2,736 Views)

Hi Bob_Shor, 

Thank you, I did as you said I changed the DAQmx Read function to NChan NSamp, I need 1 sample so I only get the element with the first number of arrays (eg [0,0]). But what I want to ask is whether the trigger works when there is a next analog pulse (2nd and 3rd ...) as I think when the first pulse enters the trigger, it starts the task of reading the Analog signal after it will go into the while loop and only run DAQmx Read function until I stop the program, it will not check if there is an edge down with the DAQmx Trigger function. Because I only read when the digital input signal started to move from a high to a low level, other times I didn't care and I didn't need to read them. Is that right?

 

0 Kudos
Message 3 of 8
(2,730 Views)

I encountered an error after running the program

CapturERR2.PNG

0 Kudos
Message 4 of 8
(2,724 Views)

Which VI generates the error?  It looks like it is probably before the For Loop.

 

I'm suspicious of the Start Digital Edge subVI.  The Edge Enum control has a coercion dot going in.  Why is that?  How did you create the "Edge" control?  Delete it and recreate it by clicking on that terminal and picking Create Control.  That should create a control of the proper data type without a coercion dot.

0 Kudos
Message 5 of 8
(2,719 Views)

Help me!

Capture.PNG

 

 

0 Kudos
Message 6 of 8
(2,684 Views)

Different error number.  -200284  Basically a timeout error.

"Some or all of the samples requested have not yet been acquired.

 

To wait for the samples to become available use a longer read timeout or read later in your program.  To make the samples available sooner, increase the sample rate.  If your task uses a start trigger, make sure that your start trigger is configured correctly.  It is also possible that you  configured the task for external timing, and no clock was supplied.  If this is the case, supply and external clock."

 

Do you have a channel selected in the "Peak Channel" control.  (In your VI, the default value is blank.)

 

Your number of samples to read is not wired, so it defaults to -1, which is all available.  I would suggest wiring in a number like 100 which is 1/10th of your sample rate.

 

(Why are you grabbing N samples, and only using the first row?  If want multiple samples at a defined rate of 1000 Hz, I think you'd want to do something with them.  With a -1 setting for reading, that means you grab whatever was there, use the first and throw away the rest, and how many you throw away is dependent on how fast your loop runs.  The effective acquisition rate of the data you use is random.)

 

Are you sure you are getting a valid signal in the "Peak Channel" input of the DAQ device?  If you go more than 10 seconds before getting a trigger, your DAQ Read will timeout.

 

0 Kudos
Message 7 of 8
(2,678 Views)

Thanks you!

 

0 Kudos
Message 8 of 8
(2,672 Views)