Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

pci 6229

Deznium,

I ran your example VI, and can take a guess at the problem you may be experiancing. I believe that your while loop is executing faster than you are acquiring samples. Because of the way your diagram is programmed, you will read either the number of samples per read specified on your front panel, or the number available which you querry from the read property node. When running on my system I seemed to get about 15 points per read (simply because read is called before the hardware has acquuired any more data). To get a consistant display, simply instruct the read VI to read number of samples per channel ever read. It will take care of waiting for that data to become available. It will allow you to specify a timeout for the operation. If you take this approach with the parameters you specified, you should get new data 5 times ever second in sets of 200 points. I have attached my modified version. Let me know if this doesn help.

Hope this helps,
Dan
Message 11 of 31
(2,051 Views)
Deznium...

I just wanted to reply to a question you also had in this thread about simultaneously acquiring the signals. Your exact question was "Also, what if I want to acquire 5 signals continuously and simultaneously, what do I need to add in my labview module? I know that labview scans through the analog channels at a specified rate to acquire the signal. So, in such a case, are my acquired signal being captured simultaneously?"

You have it a little backwards...it is actually the DAQ cared which scans through the channels sequentially. Because the M series boards are multi-plexed (i.e. only one ADC) then all the channels must be scanned in a sequential order. Unfortunately there is nothing in LV or DAQ you can do to prevent this. A couple of options you do have are a) buy a simultaneous sampling board which has one ADC PER channel. This is a more expensive board and probably not an option for you at this time. The other option is you can manipulate the convert rate (i.e. the rate at which each channel is scanned) to make it faster. Right now the algorithm is something like 50% of your scan rate. You can increase this rate so the sample happen faster, but you run the risk of cross talk on your signals. If you voltage swing between channels is minimal this probably won't be an issue. This won't completely be simultaneous but could be fairly close.

You can set the AI.Convert rate in the timing property node.

StuartG
Message 12 of 31
(1,983 Views)
Hi Deznium,

You can configure the x-axis to display time by right clicking the chart and choosing X-Axis >> Formating. In the "Format and Precision" tab, you'll be able to configure the x-axis to display time. Also, if you right click on the graph and unclick "Ignore Time Stamp", you'll be able to see measurements at different x values. LabVIEW ships with a variety of examples which may be helpful too. Check out Help >> Find Examples.

Thanks,
Lesley Y.
Message 13 of 31
(1,985 Views)
Thanks a lot, I've come very close to making the whole setup work. The thing is, when I try to read a square wave with frequencies of 1Hz, 10 Hz and so on, it works fine sampling and displaying the data. But, it doesn't read/display other signals like sine, triangle etc.. am I missing out something? Also, the x-axis on the plot displays 0 - 200 samples, can I display the data w.r.t time on x-axis instead? Also, I get very confused in deciding how to choose the right numbers for no. of samples/channel, no. of samples/read etc. Can anyone give me some insight into these parameters?

Thanks for your help
0 Kudos
Message 14 of 31
(2,026 Views)
That was helpful, but what if I want to display time on x-axis, and the axis should scroll updating the time and displaying it till the acquisition stops.

Thanks
0 Kudos
Message 15 of 31
(1,960 Views)
Deznium,

The 'samples per channel' input on the DAQmx timing VI is used for finite sampling mode. DAQmx will us this to program the hardware with the total number of samples to acquire. Since you are setting up your acquisition as a continuous acquisition, you can ignore this parameter. Once you start your acquisition, your device will read samples and send them to a buffer managed by DAQmx (this is the buffer that you are configuring with the call to DAQmx Configure Input Buffer VI). All of your data will accumulate in this buffer. When you query the DAQmx Read property node to find Available Samples Per Channels, DAQmx will see how many unread samples are available in this buffer. When you call the DAQmx Read VI, it will return data out of this buffer. The amount that is returned is specified by the 'number of samples per channel' parameter. If you don't specify anything, its default behavior is to return all samples available (this is essentially the behavior you were seeing when you were querying available samples per channel, then passing this number to the read VI). If you do specify a number, then if that many samples are already available, it will read the from the buffer and return them to you. If not, it will wait for either 'number of samples per channel' to become available, or to time out, based on the timeout parameter. If 'number of samples per channel' become available before timeout occurs, then it will return to you that number of samples from the buffer.

I hope this helps,
Dan
Message 16 of 31
(2,007 Views)
Hi Dan,
I tried doing that but I'm still unable to sample a sine/triange signal. I can only read a square signal and it has a out range of 4.55 to 5.3 volts, shouldn't it be from -5 to 5 volts for a signal with max. and min ranges set to -5 and 5 volts? Like you mentioned earlier, I removed the parameter 'number of samples per channel' but this causes the A/D to sample really fast and it becomes hard to interpret the signal on the waveform chart. Do you think adding a delay can cause my A/D to miss out on samples? And, why does the X-Axis display values from 0 to 99 and shows the x label as "time". I was wondering if I could produce an output just like the outputs produced in the test panels (when you run the tests in MAX) with time (in seconds) on the x-axis.
I've attached a sample output for your reference

Thanks!
0 Kudos
Message 17 of 31
(1,988 Views)
Deznium,

I think that maybe the best thing to do right now, is to verify that your channels are correctly wired to the signals that they are measuring, and the device is reading correctly. To do this, I would recommend that you hook a DC signal up to the inputs you are trying to read. A simple way to do this is to wire your 6229's analog output channels into it's input channels, and write out a voltage. Then run your acquisition VI, and see if you measure the correct voltage level. If this does not work, it often points to an error between how the signal you are measuring is wired to the 6229, and the configuration of the 6229. With the example you posted, you have left the 'input terminal configuration' input to the DAQmx Create Channel VI unwired. As such, the channel will default to differential mode for its measurements. For this configuration you need to ensure that your signal(+) is attached to ai0 (pin 68), and your signal(-) is attached to ai8 (pin 34). If your signal(+) is attached to ai0, and signal(-) is attached to ai gnd, then you should use RSE mode. This is a common source of readings that seem incorrect.

If all of your connections and configuration are correct, then I would be curious what you are using to generate the signals you are measuring, and how your measurements compare to what you would expect. For instance, what is the square wave you attached supposed to look like ideally? What happens if you set aiMin/Max to +/- 10 V. Does this change what you read? I would be curious to see if it did.

As for the 'number of samples per channel'... I fear that I may not have been as clear as I would have liked yesterday. The parameter that you can omit is the 'samples per channel' input on the DAQmx Timing VI. It is unused for continuous acquisitions. I would recommend that you use the 'number of samples per channel' input on the DAQmx Read VI. This can make your data much easier to interpret, as you are sampling at a known rate. By specifying 'number of samples per channel' to the Read VI, you can read data in chunks that correspond to know blocks of time in your acquisition. For instance since you are sampling at 1000 Hz, if you read 200 samples per channel, read will return .2 s worth of data every read. This makes viewing the data on a graph a little more intuitive.

I do want to point out that the parameter you specify here has no effect on the A/D, and will not cause it to miss samples. Basically when you call the start VI, your 6229 starts acquiring data at the rate that you have specified. This data is sent from the device to a buffer in DAQmx via DMA. This happens continuously, whether you read the data or not. When you call read, DAQmx reads data out of this buffer and returns it to you. The 'number of samples per channel' parameter of the read VI, simply specifies how much data should be read out of that buffer. If there is not enough data there, read will wait for more data to appear in the buffer. This is independent of the timing controlling the A/D.

I have attached an example, in which I have formatted the X-Axis to display time, rather than a zero based index for the data displayed. To adjust the format for this axis, right click on the graph and select X Scale->Formatting and select the Format and Precision tab.

I hope this helps. If you have further questions, please reply back.
Dan
Message 18 of 31
(1,970 Views)
Hi Dan
Atlast! I was able to get the whole setup to work, the problem was that I wasn't using the RSE option, you were right!
Thanks a lot for your support, you've been very helpful!
0 Kudos
Message 19 of 31
(1,952 Views)
Just one last thing, I'm able to read upto 5 Analog signals and display them on the screen. The problem is all of them are plotted on the same chart. I was wondering if there's a way of plotting them on 5 different plots each seperately shown in the front panel.
I tried searching for examples but couldn't get hands on anything helpful.
Thanks in advance.
0 Kudos
Message 20 of 31
(1,930 Views)