Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquiring and saving data in RT

Hi all,
 
I am a newbie in Realtime programming and sincerely wish to seek help from anyone in solving the problems which I am encountering. Pls feel try to point out any flaws in my understanding of the program. Thanks.
 
I am currently using a digitizer PXI-5922 with a controller PXI-8186. The version of Labview is 8.0 and I am using a PC (host) to control the digitizer and the controller (RT targets).
 
First let me do a description of my program. The objective of the program is to acquire the instantaneous information of waveform A whenever waveform B crosses a pre-defined value on the y-axis. I am using Labview Real-Time project and NI-scope to do the program. (refer to 1.jpg) In the deterministic loop, it contains mainly the data acqusition VIs of NI-scope and in the non-deterministic loop, there are functions to create an RT FIFO so as to pass on to the host.vi. As for the host.vi, its main function is to save the FIFO data from the global variable into a file.
At this point, i wished to ask if I am on the right track. Is there any problems of how I attached the various VIs? Is it the correct way of acquiring data using NI-scope, create FIFO variable and also to save FIFO data? Sorry for asking so many qns...
 
Actually, I have tried to test the program by inputting a 100Hz sinusoidal wave as waveform A and a 1kz sinusoidal wave as waveform B and that the program will acquire the instantaneous data of waveform A whenever waveform B crosses the x-axis. So theoretically, I should have 20 points for every single wave of waveform A since waveform B will cut the x-axis 20times within the time frame of one wave of wave A. However, the data which I acquired is quite chaotic and that the frequency of the waveform which i plotted from the data does not actually give me back 100Hz.(I should be getting back waveform A, right? Pls correct me if I am wrong.)
 
I feel that there is a serious problem with my programming and hope that some kind souls can offer help.
 
Thanks a million in advance.
 
Regards,
FW
Download All
0 Kudos
Message 1 of 4
(4,320 Views)

Hi,

While it may be easy to say that everything looks fine with the code, it can be very difficult to see the big picture and understand the exact problems without being able to see the data being produced.  It would be very helpful if you could include some of the "chaotic" data, in the form of either a front panel screenshot or, better yet, just include your VI in a form that others could use to test (this would require simulated data, of course).

Peter

Peter L.
Applications Engineer
National Instruments
www.ni.com/support/
0 Kudos
Message 2 of 4
(4,280 Views)

Hi,

Sorry for the very late reply. I was trying to rectify the problem myself all this while, but I am still having problems. Attached is the vi which I had made.

For verifying purpose, my input wave (the one to be captured) is 100Hz, Vpp=3V and my triggering wave is 5Khz. The sample rate is 600k and the no, of samples to read is 50. Ideally, i should be having 25trigger points per waveform of the 100hz wave and after each trigger i should have 50 data points, so it is something like trigger, read 50 points, wait for the next trigger etc. I also attempt to record the time for each trigger.

The data which i collected is quite disappointing as i cannot see the 50 points after each trigger, and also the time which i recorded is not correct as in the period of the wave is not 1ms but 15s instead.

Pls kindly take a look at the vi and point out any mistakes which i have made. Really appreciate your help.

Thanks.

Regards,

lfw

 

0 Kudos
Message 3 of 4
(3,854 Views)
Hi lfw,

Thanks for sending the VI over. It looks clean enough, but there's way too much there to definitively tell you a section of your code is incorrect. I think the best solution here is to see if you can get one of the NI-Sope examples up and running and merge the two VIs. Have you taken a look at the niScope EX Fetch Forever.vi example located in the LabVIEW 8.0 folder (C:\Program Files\National Instruments\LabVIEW 8.0\examples\instr\niScope)? This would be a good reference point for modifying your VI.

Let me know if your comparison raises any new questions.

Michael K.

| Michael K | Project Manager | LabVIEW R&D | National Instruments |

0 Kudos
Message 4 of 4
(3,832 Views)