LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming a Sine Wave Ouput for a 6299 in Labview

Hello

 

I am a new user to LabView and I am trying to come up to speed in the software.  We have a USB 6229 and I am using the analog outputs to stimulate our product.  Ideally I would like to ouput a signal that is anywhere from 10us to 8s long with a varrying amplitude (5mV to 1.25V) with a constant 1.25V offset.  Ideally I would like this offset to remain when the input signal is not applied.

 

While working in Signal Express I was able to generate the signal I wanted.  I have moved to LabView to try and get some more automation in my testing.  In Labview I am running into some issues with my signal. 

 

With the current setup I am only getting one period of the sine wave (1ms or 1kHz) every 20ms.  I can not get a continous signal.  This was measured with an external scope.  Within labview I am seeing the correct signal.  I don't see what I have wrong in my code.  Could someone take a look and let me know what I am doing wrong?

 

Also, how I would control the input signal to run for certain lengths of time?

 

Regards

 

Chris

Download All
0 Kudos
Message 1 of 4
(2,934 Views)

Chris,

 

Hello, and thank you for using the forums.  I have taken a look at your code and I believe the reason why you are running into the problem of the program stopping prematurely is because of the stop condition that you are using.  The condition that you are using is continue if true and what you probably want is stop if true.  Also you will want to create a stop button to use to stop your program (See Attachment).  This will continuous generate points.  Keep in mind that everytime the DAQ Assistant is called you have it so it will output 1000 points, so it will have to generate those points before any changes that you have made to the signal will take effect.  I hope that helps.

 

Regards,

 

Brian P. 

Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(2,911 Views)

Hello Brian:

 

I have implemented the stop button and that works while I implement in the continuous generation mode.  I have also noticed some interesting behaviour.

 

1) if I run the program continously, the stop button when activated will allow the signal to run continuously as desired.  When deactivated the program still generates a one period of the signal roughly every 25ms, as noted above.  This is strange as I would have thought that is the stop button was diactivated then there would be no output signal.

 

2) Output voltage on the AO0 pin when program is not running varries and is not always 0V.  If I run a sine wave with a 200mV swing with a 0.0V offset.  I found that when I stop running the program the output voltage on the AO0 line will stay at the last programmed value of the output DAC.  Is there a way that I can have this be consistent at a specified level?  0.0V or a specified offset? 

 

Thanks for your help.

 

Chris

0 Kudos
Message 3 of 4
(2,893 Views)

Chris,

 

I am glad that you were able to get some of your program to work correctly.  As for when you run the program continuously, do that mean that you are using the run continously button, if so it generally not recommended to use that button except for debugging purposes.  As for the stop button, would it be possible to post your new code that is exhibiting this error.

 

For your second question, yes the AO line will continue to output the last known voltage.  If you would like to change this to a specified offset like 0, at the end of your program, you can write a 0 to the output line and then have the program close.

 

Regards,

 

Brian P.

Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(2,872 Views)