LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

output signal distorted

I have a pretty large VI which outputs high frequency signals to control some hardware and then takes an input from that hardware for image rendering.  My problem is that whenever I activate the imaging portion of my VI, the output signals become slightly distorted.  For example, a 1Hz sawtooth output doesn't ramp up smoothly but becomes slightly staggered.  This also messes up the frequency of the signal.  Does LabVIEW have problems outputting signals properly when another portion of the VI has a lot of cpu intensive processing?
 
I am using the "Simulate Signal" block to create a 1 Hz sawtooth wave, 128 Hz triangle wave, and a 65,536 Hz square wave and outputting these signals through DAQAssist.
0 Kudos
Message 1 of 9
(3,563 Views)

Hello AntLee,

If your output is software-timed, the CPU intensive portion of your code will cause your output to have the effect that you described. 

I assume you probably are setup for hardware-timed analog output.  You may want to try using the NI-DAQmx API instead of the DAQ Assistant to see if it makes a difference.  To see examples of this, in LabVIEW go to Help >> Find Examples >> Hardware Input and Output >> DAQmx >> Analog Generation >> Voltage.  In particular, look at Cont Gen Voltage Wfm-Int Clk.vi for an example of generating  hardware timed analog output. 

Can you tell us what hardware you are using and post the portion of your code that does the analog output?

Thanks,

Laura

0 Kudos
Message 2 of 9
(3,529 Views)
Our signals are coming out of the PCI-6259 acquisition card and sent through a SCB-68 board which is connected to our laser/circuit system.  Attached is the scanner control portion of the vi.  I'm taking a look at that Cont Gen Voltage Wfm-Int Clk.vi.  Hopefully that is what I need.
0 Kudos
Message 3 of 9
(3,521 Views)

The Cont Gen Voltage Wfm-Int Clk.vi seems to be working.  Is there a way to modify this vi to create three different signal types with different frequencies?  I've been trying but haven't had any luck.

Thanks,

Anthony

0 Kudos
Message 4 of 9
(3,509 Views)

Hi Anthony,

I have modified that shipping example slightly to produce two output waveforms.  It can be expanded to do more.  I have not cleaned it up yet much, but I plan to do that and then submit it to our website.

Thanks,

Laura

0 Kudos
Message 5 of 9
(3,497 Views)

Hi Laura,

I expanded that vi to produce the third signal, but it keeps giving me error messages when I attempt to create a high frequency signal.  Using three low frequency signals are ok, but my square wave needs to be set to 65,536 Hz.  I attempted to adjust the sampling until the error disappeared, but then the output had an incorrect frequency and amplitude.  Any ideas why it isn't working?  Attached is the modified version for my three output signals.

Thanks for your help,

Anthony

0 Kudos
Message 6 of 9
(3,482 Views)

Hello Anthony,

You will want your first waveform, which sets the sample clock, to be the waveform with the highest frequency.  If you use a slower frequency waveform and it sets the sample clock, you will not be able to generate a fast waveform because you do not have enough samples per second to actually form the wave that you want.  Please try this.

Thanks,

Laura

0 Kudos
Message 7 of 9
(3,469 Views)

Hi Laura,

I went ahead and changed the 65,536 Hz square wave signal as the first input, but the three signals still do not output simultaneously.  Although the signals slightly change as I vary the Samples per Buffer and Cycles per Buffer, I can't seem to get a combination that is capable of outputting these two low frequency signals with my high frequency signal.  I would either get an error message about "DAC conversion attempted before data to be converted was available," or there would be no error message but the signal output didn't match the given specifications.  Attached is the vi with the modifications.  Presently, there is no error message with the given sampling information, however there is no square wave output at all, and the sawtooth waveform only shows a partial amount of the signal.  I had to make some slight modifications to the Waveform Buffer Generation vi in order to allow me to change phase, duty cycle, and offset of my square wave.  I don't think this would have any effect on the Cont Gen Voltage Wfm vi though.  Any ideas what's going on?

Thanks a bunch,

Anthony

0 Kudos
Message 8 of 9
(3,442 Views)

Hello Anthony,

You have to be very careful when choosing values for the samples per buffer and cycles per buffer.  I have played around with the VI for only the first two analog outputs (this is all I have on my hardware).  There are a number of relations that you need to be aware of.  You need the sample clock to be fast enough that you can actually form the square wave.  This means that your sample clock should come out to be a good deal higher than the frequency of your square wave.  If you look in the waveform buffer generation VI, you'll see that

sample clock = (frequency * samples per buffer) / cycles per buffer

Also, in order for your sawtooth wave to not jump when the output gets back to the beginning of the buffer, you need

sample clock = n * samples per buffer

where n is some integer like 1 or 2. 

Using these two relations, using n = 2 we find that cycles per buffer = 32,768 for frequency = 65,536.

When I use samples per buffer = 400,000 everything seems to work out correctly.  I have a fast enough sample clock to resolve my square wave and the sawtooth wave does not glitch when we circle back to the beginning of the buffer.  If I increase my samples per buffer to 600,000 I get a warning from the driver that the fast sample clock does not allow adequate time for the DAC to settle to a 16 bit resolution.  You can still run the program this way, you just do not have the full advertised resolution of your board.

I think by extending this logic, you should be able to come up with parameters that allow you to output all three waveforms. 

Hope this helps!

Laura

0 Kudos
Message 9 of 9
(3,429 Views)