LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquire data at specific sampling rate and continuously plot

Hi everyone,

 

I hope you can give me some advice on what to do, here is my issue:

 

Basically, when the user clicks 'Start' I need to sample data from 2 channels on a SCXI 1102C (connected to an SCXI 1300) these channels are for Load and Travel measurements. These need to be sampled at 100 samples per second (each channel) and should stop either when a given travel is reached, or a maximum number of samples is reached, or the user selects 'Stop'. While the data is being acquired I need to be able to continuously plot this in the GUI and the data needs to be held so that it can be saved as a whole at the end.

 

I'm able to take single samples and plot them continuously but this is not at the sampling rate required, likewise I'm aware that sampling at this rate for a given number of points in a buffer is fairly simple to do, however this would not allow me to continuously plot the data as needed, nor limit it by using the conditions described above.

 

Is there a way that I could satisfy all of these requirements? Perhaps using the method of taking single samples but including some sort of timer?

 

Thanks guys.

0 Kudos
Message 1 of 7
(4,330 Views)

Hi Cottonb,

 

Out of interest what DAQ hardware are you interfacing your SCXI 1102C with?

 

Continuous voltage sampling can be achieved using LabWindows/CVI, if you are familiar to LabVIEW at all it is the same basic procedure as you would carry out using the DAQmx vi's, i.e.

 

1. Create a task.

2. Create an analog input voltage channel.

3. Set the rate for the sample clock. Additionally, define the sample mode to be continuous. 

4. Call the Start function to start the acquistion.

5. Read the data in a loop until the stop button is pressed or an error occurs.

6. Call the Clear Task function to clear the task.

7. Display an error if any.

 

Please see the example code for "Continuously Acquiring Voltage with CVI and NI-DAQmx" available here which shows how this can be achieved.

 

Hopefully this assists in the development of your application Cottonb.

 

Many Thanks

Jamie S.

Applications Engineer
National Instruments
0 Kudos
Message 2 of 7
(4,305 Views)

Hi,

 

Apologies for my delay in reply, I've been having to work on other issues! Thank you for your reply.

 

The DAQ hardware is a PCI 6035E card, this is connected to SCXI 1001 chassis which contains two SCXI 1161 modules, an SCXI 1102C (with SCXI 1300 accessory) and an SCXI 1124 (with SCXI 1325 accessory).

 

I actually only have experience using LabWindows/CVI, I've never used LabView!

 

The method you're referring to for acquiring the data, isn't that for one channel only? My situation is that I have 4 SCXI modules in a chassis and need to acquire data from 2 of these channels at the same time. I think the acquisition certainly needs to be in a loop as you say so that if one of the stop conditions is met, the acquisition stops. I have had a look at that example before but it doesn't do what I'm needing unfortunately.

 

Many thanks,

 

Ben

0 Kudos
Message 3 of 7
(4,281 Views)

Hi,

 

Any possibility of some further assistance with this issue?

 

Many Thanks,

 

Ben

0 Kudos
Message 4 of 7
(4,257 Views)

Giving this a bump in case anybody can help! I think the method suggested won't allow me to read in both channels on the SCXI module at the same time as they will both come through the same channel on the PCI card. Please let me know if I'm wrong! And simply using SCAN_Op in a loop or whatever isn't giving me the sampling rate required along with the real time plotting ability.

 

Cheers

0 Kudos
Message 5 of 7
(4,228 Views)

Cottonb,

 

I think the ContAcq-IntClk example may be a good starting point for you. This will continusously acquire data and plot it continously to a graph. You can modify the sample rate to 100Hz and add a second channel by entering something like "Dev1/ai0; Dev1/ai1" in the Physical Channel parameter. You may be able to get away with doing 1 Samples per Channel at 100Hz, but typically the Samples per Channel is about 1/10 the Sample Rate meaning that the EveryNSamples function will run 10 times per second. In that case, you would have to check your conditions on a block of 10 samples (may or may not be acceptable for your requirements).

 

Now it sounds like you may have looked at something similar to this, but could not get it to plot continuous data. Maybe you just need to increase the Points Per Screen attribute of the strip chart ot see it plotting continously. In this example, that attribute is modified programmatically to be equal to the Samples per Channel. I increased this to 10 * Samples Per Channel to view more data.

 

Let me know if I need to elaborate on anything or if I have misunderstood you.

National Instruments
0 Kudos
Message 6 of 7
(4,214 Views)

Thanks for the help, I've taken a look at that example on a couple of occasions, the only thing that stopped me from progressing with that method is the multi channel part. Because of my SCXI Chassis setup how would I be able to set things up so that I could read Channel 6 of the SCXI 1102C module through channel 0 on the PCI card and Channel 7 of the SCXI 1102C module through channel 1 for example? As far as I'm aware, they all read in through channel 0 currently, can this be changed without messing about with hardware? I was under the impression that I had to use a scan function such as SCAN_Op, which I have been trying to use but unsuccessfully!

 

Also, just for some background info for you, I have been able to continuously plot acquired data previously with other methods and much simpler setups just using DAQmx functions and loops. But now things have become more complex with several SCXI modules in a chassis and the need to be able to obtain data at a specific sampling rate whilst continuously plotting and stopping the acquisition if certain criteria are met has made things more difficult!

 

Many thanks,

 

Ben

0 Kudos
Message 7 of 7
(4,208 Views)