Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Analog Inputs with PCI-6221

Hi,
 
I am using LabView and M Series board PCI-6221 to read 4 analog inputs in RSE (Refenced Single-Ended) mode. The frequency of the signals are up to 500Hz (not so high).
I am using the DAQmx tasks to set the parameters for this measurements.  My objective is to use this information in a closed-loop control system.
To read the channels, I wrote a code in a while loop and I am reading 4 samples per channel each time. Then, I average the results and use these results as the values for each input. To start the measurements, I used internal clock as trigger (HW trigger). I tested this method with DC signals and it worked fine.
 
I am having problems when reading the 500Hz signals. As this frequency is not so high, I set the trigger for 50kHz and also for 100kHz (I also used a buffer). I thought that would be easy task, but for some reason, the signals I am reading does not correspond to the real ones (as read in a scope).
 
So, my question is: can you help me with this issue? How can I synchronize these measurements and acquire then in a fixed period (constant period sampling)?
 
I really appreciate your help.
 
Thanks
Jeferson
 
0 Kudos
Message 1 of 9
(3,812 Views)

Hi,

Are you saying that ur VI acquires DC signals but is not able to measure a 500Hz periodic signal?

Do keep in mind Nyquist Criteria while choosing sampling rate for measuring a signal of 500 Hz (When an analog signal is sampled at a rate more than twice that of its highest Frequency component, it can be properly reconstructed when reconverted back to the analog domain. The required sampling rate is called the Nyquist frequency.)

If you think this is not the source of your problem, plz post the VI you have developed so that we can suggest better

Regrads

Dev

 

0 Kudos
Message 2 of 9
(3,809 Views)

Hi Jeferson,

I think that Devchander has a good point about the Nyquist frequency. I also noticed that you are only acquiring 4 samples/channel.

To obtain an accurate representation of a waveform, I recommend that you acquire at least 20 points per period of your signal. So, let us assume that you are sampling at 10,000 Hz (this will be a good frequency to use in your application as well): then you will need to acquire 20 samples/channel to obtain an accurate representation of the signal since 10,000/500 is 20.

I would also like to point out that there are some good shipping examples for triggered analog acquisiton.  Go to Help >> Find Examples >> Hardware Input and Output >> DAQmx >> Analog Measurements >> Voltage.

Regards,
Hal L.
0 Kudos
Message 3 of 9
(3,787 Views)
Hello,
 
Thank you for advice.
I am used to program with micro-controllers and, in that case, we normally sample 3-5 samples per control period.
 
My goal is to control in real-time. This mean that I have to acquire the data every sanmpling period. As I wrote, I used even 50kHz for sampling frequency, higher than Nyquist frequency,
 
I am attaching a VI that I wrote to acquire 2 analog signals. Please take a look and see if I am dooing something wrong. By the way, is there a way to measure the actual internal clock (sampling rate, as a square wave) and show it in a chart/graph?
 
Thank you,
Jeferson
 
 and I cannot wait to acquire the whole waveform c
0 Kudos
Message 4 of 9
(3,776 Views)

Hi Jeferson,

You have got the Continous acquisition coding wrong.

First of all, i suggest that you have a look at examples shipped with labview which perform continous buffered acquisition.

Also, have a look at attached VI.

I suggest you go with intermediate File write VI's instead of write to spreadsheet VI( this reduces overheads of opening a file and closing a file in each iteration).

In continous mode, the 'samples per channel' control in scan clock determines the buffer size.

see this link

http://digital.ni.com/public.nsf/websearch/E1E67695E76BA75B86256DB1004E9B07?OpenDocument

 

The number of samples per channle you want to read on each iteration ( 4 samples in your case), samples per channel( 12) do not seem to be optimal for the sampling rate  you have chosen.

see if you can set these parameters : sampling rate, number of samples per channel to more optimal values.

regards

Dev

 

 

 

 

 

Message Edited by devchander on 01-03-2006 01:34 AM

0 Kudos
Message 5 of 9
(3,765 Views)
Hi Dev,
 
I am using labView 7.0, so I could not open the VI you sent to me. Could you please convert it to labview 7.0?
 
Thanks,
Jeferson
0 Kudos
Message 6 of 9
(3,758 Views)
Hi Jeferson,
 
Here it is in labVIEW 7.0
 
0 Kudos
Message 7 of 9
(3,735 Views)

Hi dev,

 

Thanks for the VI. It is working now!

Listen, now I am trying to send a signal to an anlog output, in a closed-loop system. However, I am having some troubles to send a calculated signal (from the inputs) to this output.

How would I program this part inside the vi you sent to me.

 

Thanks again.

Jeferson

0 Kudos
Message 8 of 9
(3,711 Views)

Hi Jeferson,

Do you want to,  Acquire voltage on analog input -> scale/modify it -> generate the scaled Voltage on analog output?

am i right?

Regards

Dev

 

0 Kudos
Message 9 of 9
(3,665 Views)