LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to plot real time vs. data using multiplier

Hi,

 

I am a beginner of Labview programming. I am trying to get signal from monochromator and plot it with real time. Since the signal is very noise, I planed to average it for every 3000 data points using mean function and set number of samples as 3000 in DAQmx Read. Then I sent the averaged signal to both waveform chart and write to file. I used the property node to control the maximum value of X-axis and tried to make it as real time by using the x-axis multiplier. My question is that,  how is the value I set for the X-axis maximum corresponding to the X-axis range appeared on the chart? Is the unit of the value which I set in second? I set multiplier around 2.4 which gave me about the right real time, however my sampling rate should be much faster than that. How can I know my actual sampling rate? Can anyone have the answer for this?

 

Vi is attached.

 

Thanks,

--

Weiye

0 Kudos
Message 1 of 13
(2,964 Views)

Weiye,

   How many samples per second are you pulling? What is happening is that you are pulling off batches of sequential samples, averaging them, and returning a single number to the chart. Is this what you are trying to do?

 

Regards from Austin,

Ben J.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 13
(2,932 Views)

Ben,

 

Thank you for your reply. Yes, that's what I want. The A/D board I am using is SCB-68, E-series. The board is 12 bit. I don't know which model is it in E-series. I supposed that it is using the fastest sampling rate. If I set the number of samples as 3000 in DAQmx Read function, does it average these 3000 samples into one data point? I have ~20 data points/second after averaging using 3000. If so, sampling rate is 3000*20=6E4 sample/sec.

 

Thanks,

--

Weiye

0 Kudos
Message 3 of 13
(2,921 Views)

Weiye,

   Try throwing a DAQmx Timing VI in there so you can ensure your sampling speed.

 

SS-2011.01.21-11.06.31.png

 

Regards from Austin,

Ben J.
National Instruments
Applications Engineer
0 Kudos
Message 4 of 13
(2,900 Views)

Ben,

 

I put the Timing VI just before the while loop and set rate as 3000 sample/sec. I also set "numbers of sample" in Read VI as 3000, which will give me one sample per second after averaging. However, when I run the program, I was given some error message about Timing VI: "Specified property cannot be set while task is running"  What did I do wrong?...

 

I have another basic question about DAQmx Read. What is the difference between "multiple sample in single channel" and "single sample in single channel"?

 

Thanks,

--

Weiye

 

0 Kudos
Message 5 of 13
(2,886 Views)

Sounds like you did not look at any of the numerous examples that come with LabVIEW. You probaly put the timing function after the start task instead of before.

 

Multiple means more than one. That is what happens when you specify 3000 samples. Single means one sample.

0 Kudos
Message 6 of 13
(2,872 Views)

Thanks for replying. I put the clock in front of the start VI. It works.However the program stopped running and show the error message “Measurements: Attempted to read a sample beyond the final sample acquired. The acquisition has stopped, therefore the sample specified by the combination of position and offset will never be available.” No matter what number I input, the error message always pop up. Do you know what happened?

 

Thanks,

--

Weiye

0 Kudos
Message 7 of 13
(2,827 Views)

Weiye,

   I would recommend uploading the new VI with every post so we can help you more.

 

Regards,

Ben J.
National Instruments
Applications Engineer
0 Kudos
Message 8 of 13
(2,813 Views)

Ben,

 

The updated VI is attached.

 

Thanks,

--

Weiye

0 Kudos
Message 9 of 13
(2,807 Views)

What's missing is selected sample rate and number of samples. One would hope that the number of samples is less than the rate.

 

Also, you don't need a control for the multiplier. You just divide the number of samples by the rate. For example, if you have a sample rate of 1000 S/sec and request 500 samples, the multiplier is .5.

0 Kudos
Message 10 of 13
(2,796 Views)