Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to drive analog output continuously in VB.NET?

The ContGenVoltageWfm_IntClk example in ...\MeasurementStudio70\DotNET\Examples\ DAQmx\Analog Out\Generate Voltage\VB says it will "output a continuous periodic waveform" but the output stops after a specified number of cycles.

Is there an example of driving the output indefinitely, until the user stops it?
0 Kudos
Message 1 of 4
(4,261 Views)
kevink52,

That's interesting. After how many cycles does the output stop? I ran the example and have confirmed that it indeed outputs a continuous periodic waveform. The number of cycles field is the number of buffered cycles for the continuous output. The example program should not stop on it's own.

Try running the example program again with '1' in the # of cycles field. Good Luck!

Craig H.
National Instruments
0 Kudos
Message 2 of 4
(4,261 Views)
You are right that under some conditions, the program works as you say.

Under other conditions, it stops updating the DAC and then clicking STOP causes an exception in the AOTask's Task.stop method.

I set the #cycles to 1 as you suggested.

It seems more prone to stopping and then failing when the frequency is turned up and the samples/cycle isn't turned down. Try 20 Hz at 1000 samples/cycle. This is on a 512MB WXPHome system running VS.NET 2003 and NIDAQ7.0.
0 Kudos
Message 3 of 4
(4,261 Views)
This is probably happening because the settings you are specifying exceed your DAQ card's maximum DAC conversion rate (for instance, 20Hz at 1000 samples/cycle gives an update rate of 20kHz, but many of our low-cost cards support a maximum update rate of 10kHz). Sometimes, the card will be able to keep up for a while, but will then generate an error like you are seeing.

We know that this example is problematic because it does not do any error checking during the generation to make sure that all is going well. The next version of NI-DAQ will have an updated example. In your own applications, you can check for errors during continuous analog output by getting the Task.IsDone property. Exceptions for errors will be raised when you attempt to ge
t the value of this property.

I hope this helps.

Tony H.
Measurement Studio
0 Kudos
Message 4 of 4
(4,261 Views)