Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

analog output timing from file

Hey All,
 
I want to output analog data from file and the file format is in the following format:
 
Time    CH1    CH2
0.05      1.1       4.3
0.05      3.6       2.2
0.05      4.6       1.4
0.10      4.5       2.4
0.10      4.7       3.1
0.05      3.6       2.2
0.05      1.6       1.2
0.001    3.2       2.4
0.001    5.2       3.4
............
.........
....
 
So the first column shows the time but this is the interval (or spacing) between the points in seconds. The second and third columns shows to channels which I want to output as analog data. I'm having trouble with this as examples I have seen show accumulated time and not the format as above and the fact that the interval or spacing between points varies, how can I maintain this accuracy with the O/P updates?
 
Using LV 8.20 and DAQmx 8.3
 
Also note that the text file which this is held in has much more data than that shown. In fact multiple text files hold all of the data and must be loaded on the fly to get all of the data?
 
Can anyone help me with how to approach this and/or show an example??
 
Thanks,
 
John
 
0 Kudos
Message 1 of 6
(3,552 Views)
Not quite sure how the first time value got written as a non-zero value and since the interval is not regular, you'll have to use and XY graph to display the data. You can use the Read From Spreadsheet File to get all columns and then create an x array for each plot by doing something like below. If you want to start the x axis at the time that is in the file and not zero, just wire a 0 to init the shift register.
Message 2 of 6
(3,547 Views)

Hi Dennis,

 

Thanks for the input and I like the method of 'accumulating' the data as a running total. One further question with regards to this. This data is to be used for an analog output and in order to implement the correct timing would I need to reconstruct the data so that the points are evenly spaced with time? The only way I can think of doing this is to insert data into an array based on the lowest common multiple of the time interval.

Any thoughts on this and how to approach it?

Message 3 of 6
(3,547 Views)
Wow, wasn't expecting anything back for a day or 2.

You're quite right, this needs to be used as an analog output and was previously carried out with software timing (each time value would be used to set wait until next ms function) and now I want to move to hardware timing i.e. output an array of data.

I recreated the image you sent in LV and this works well for displaying the data on the XY graph (wired a constant of zero into shift register too). Just need to know how to approach the analog output side of things. SR: I was thinking along the same lines with placing additional dummy time values into an array but can't think of a slick way of doing this either, I'll have a look at the Math palette and see if there's anything that can be used out of the box 😉

Thanks Y'all
0 Kudos
Message 4 of 6
(3,525 Views)
Good luck JS, there may be something there, but I can't think of anything off the top of my head. I guess you would first have to find out what the lowest common multiple is by crunching through the data. At this point it could get messy as you will probably need to look at each element and determine whether data needs to be inserted or not. If it does then you will need to insert the correct data i.e. the value from the previous element. There must be a good way of doing this but I've got a graphical block at the moment 🙂 Plus you array could increase significantly!!
0 Kudos
Message 5 of 6
(3,524 Views)

I didn't understand that you wanted to use the data for an analog output. I think you might be able to use one of the resample functions on the Waveform Conditioning palette. Either Resampe Waveforms (continuous) or the Align and Resample Express VI. Maybe by creating a waveform with the max dt in the data and using the min dt as the new. It would help if you could give some indication of what the data is supposed to be.

Message Edited by Dennis Knutson on 03-11-2007 12:49 PM

0 Kudos
Message 6 of 6
(3,520 Views)