LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous Analog Output with Hardware Timing

Hi,
 
I'm trying to generate a continuous AO signal (data for which is obtained from a spreadsheet which has 1000 points and then converted to an array). I'm currently using an NI DAQPad-6015 borrowed from a colleague. Please see the attached simple VI I've generated. My problems are as follows:
 
1. When I select sample rate greater than 70S/s (which is very low indeed), I get an error: "Error 200016 occured at DAQmx Write. Onboard device memory underflow. Because of system &/or bus-band with limitations the driver could not write data fast enough to keep up with the device output rate." I'm guessing this device simply won't do for my purposes, in which case I need to make sure I purchase the right one.
 
2. The time intervals between my output data points (which I get from Writing to Measurement File together with time)  are not constant. I previously tried to do the same with a software-timed loop (because I had a USB-6009) and the time intervals between points haven't improved inspite of using the internal clock. For e.g. at 70S/s, I get time intervals of 0.015, 0.016, 0.0 and 0.031s. I thought using the internal clock should have fixed this?
 
3. I need to purchase a device that will output at a rate of atleast 1kHz consistently and accurately with regards to the time interval between points. I was thinking to buy the USB-6211. Would that serve my purposes?
 
I've also attached the software-timed loop I was previously using with the USB-6009. Please advise me on how to improve my hardware-time output.
 
Thank you in advance for your help.
0 Kudos
Message 1 of 13
(4,950 Views)

Hi,

 

1)  This error message indicates the combinations of input parameters for this VI are such that the analog output sampling rate is too great for the device.

Please see the following knowledgebase article to learn more about this and how you can resolved this issue:

Why Do I Receive Error -200016 When I Run DAQ Shipping Examples with the NI DAQPad-6015/6016?

http://digital.ni.com/public.nsf/allkb/8B2BAB87BCAB2D9C8625712B00559824?OpenDocument

 

2) I have noticed that you haven’t used any timing functions within the loops to allow you to achieve software timing.

 

Please see this article for further information:

 

Software Timed Loops using Wait (ms) and Wait Until Next ms Multiple

http://zone.ni.com/devzone/cda/tut/p/id/4120

 

With the USB-6009 vi I have noticed that you have two loops. One with software timing and the other without.

 

3) USB-6211 can certainly output 1KHz signal but I am sure you can also do that with the USB-6008/09 please check 2 and 3 first.

If you are new to LabVIEW I would like to suggest pursuing a LabVIEW basics 1 course. The courses offer:

 

The most efficient way to learn LabVIEW

Training courses for new and experienced users

Hands-on training with experienced LabVIEW instructors

Basics courses to help you get started quickly

Intermediate courses to help you learn how to optimize applications

Advanced courses to help you learn advanced features and architectures

If you don’t have the time to come on a course you can choose to purchase the manual and self pace the material in your own time. If you would like further information on content, quotes, promotional offers etc for LabVIEW or other National Instruments courses then please do not hesitate to let me know in reply.

 

I hope this helps!

 

Kind Regards,

 

Kirtesh Mistry

0 Kudos
Message 2 of 13
(4,914 Views)

Hi Kirtesh,

Thank you for your comments. I need a few clarifications:

1. As you can see from my VI, I want to input the data to be output using a spreadsheet of the waveform data- this gives me a lot more flexibility. So for this format and with the simple DAQ Assistant output how do I set the "samples per buffer" and "cycles per buffer"? In the example you have pointed out these are in the form of inputs to Labview function "waveform data".

2. The software loop attached does have timing within in the form of a "Wait (ms)". The second loop above the software loop is for my analog inputs. When I tried this software loop alone (and with the loop AI loop) I had issues with timing and low rates of output, please see my earlier post: http://forums.ni.com/ni/board/message?board.id=170&message.id=247895#M247895

3. The USB 6009 can only do 150S/s and my software-timed loop indicated that this cannot be achieved either at any regularity- so it won't do for me. I want to get the hardware-timed loop working before I purchase anything else, to make sure to get the right one. I basically need one sample/ms to be output from my spreadsheet data which has been converted into an array so it loops repeatedly. I need the timing to be quite exact between the outputs.

thanks,

Chanchala

 

0 Kudos
Message 3 of 13
(4,907 Views)

HI there,

 

Just take a look at this.

See if it works?

Thanx

AdamB

Applications Engineering Team Leader | National Instruments | UK & Ireland
Message 4 of 13
(4,878 Views)

Hi Adam,

This works with the USB-6259 (though not with the 6015). However I need the exact timing (when the ramp starts and stops) so I can relate this to analog input data that I'm collecting. With your vi, my 'Write to Measurement File' X column is no.s 1-1000 (and repeats again 1-1000) and no longer time. I tried using an 'Elapsed Time' function and wiring the present(s) to the 'Write to Measurement File' but I only get the time every 1000 points. Is there a way of writing the time for each of the 1000 data points that makes up my ramp?

thanks,

Chanchala

0 Kudos
Message 5 of 13
(4,867 Views)

Hi again,

What we are doing is sending a series of 1000 points to the card buffer.  The speed of the ramp etc is depicted by the rate at which you output those 100 points.  For example if you want your 1000 points to be completely finished within a second, set your output rate to 1k.  If you want the ramp to take longer, decrease the output rate of the card and vice versa.

I assure you that the card has very accurate hardware timing and so the rate you set will be very closely matched with the Hardware rate of the output.  So from the start of the test, every point will be exactly 1/1000th of a second later.

Therfore if you creat a waveform (as you did previously) onle once, before the write to DAQmx Card, and set the "t0" as the current time (start time) then set the "dt" to be "1/rate" the rest of the waveform will have the time values.

Does that make sense?

Thanks

AdamB

 

p.s another way of doing as you ask is to use teh DAQmx lower level functions.  From here you can export the "AiSampleClock" to the "AoSampleClock".  This will synchronise the inputs and outputs.  You could then read the analog input as a waveform, and the first point in that waveform will match the first point you outputted almost exactly.

It might be worth looking at some examples in the example finder.

Applications Engineering Team Leader | National Instruments | UK & Ireland
Message 6 of 13
(4,861 Views)

Hi Adam,

I can't open your attachment because I have Labview 8.0 and yours is 8.2. Could you please re-post the attachment so I can open it in 8.0.

thanks,

Chanchala

0 Kudos
Message 7 of 13
(4,855 Views)

Sorry about that

 

AdamB

Applications Engineering Team Leader | National Instruments | UK & Ireland
Message 8 of 13
(4,847 Views)

Hi Adam,

Sorry about the delay with this, I had some other work to do so could not work on this for a while.

I'm working with the USB-6259.

The code you sent me above: Flow%20Loop1-USB6015-hardware%20timed%20AO[1].vi works fine when I change Timeout to -1 (from default of 10s in DAQ Assistant). I also added Elapsed Time- Present (s) and am writing the Analog Output data to a Measurement File- see attachment. My problem is that the Elapsed Time is giving me crazy times when compared to what I would expect:

So at a rate of 100Hz AO; with 2000 points in my spreadsheet, I get the Elapsed Time noted every 2000 points (every repetition of my spreadsheet data). It gives: 0....33.282....73.282....113.282s. What is Elapsed Time recording (computer time, or DAQ onboard clock time)?. I would expect at the rate specified: 0....20...40...60...80 etc. I am happy with what you tell me that my output in this case should be at exactly 1/100th of a second as specified, but Elapsed Time is telling me otherwise.

I coupled the above code with Analog Input readings- again see attached- and wrote to measurement file together with Elapsed Time. This time I compared the values in X-column, which I believe are time (DAQ onboard clock), to Elapsed Time, again the two are different. Where X column gives 0, 0.002, 0.004....2.000....4.000...6.000; elapsed time gives (every 1000 points the time is recorded in this case) 0.....2.125.....4.109...6.125.

I also tried the other code you sent me: NewSynchInput-Output[1].vi. However, I need my AO rate to be much slower than AI rate and when I specified different rates, the Elapsed Time indicated that AI seemed to wait for AO to complete its slower output. So for eg. at an AI and AO rate of 1kHz, it gives time in X column for AI (every 1000): 0...1.000...2.000....3.000 and in elapsed time: 0....2.297...4.313...6.329. AO Elapsed Time gives (every 1000): 2.297...4.297...6.297.

As I mentioned before I need the timing between output and inputs so I can compare the two at the exact same time. The AO is to a flow control valve and AIs are from sensors in the flow. I also need the output/input intervals to be very accurate.

thank you,

Chanchala

0 Kudos
Message 9 of 13
(4,745 Views)
Hi Chanchala

The Elapsed Time Express VI that you are using is not completely deterministic. They can execute at anytime during the iteration proces sof the loop. This maybe a reason why you are finding the timing results are a little crazy.

Kindest Regards
0 Kudos
Message 10 of 13
(4,700 Views)