11-11-2005 01:10 PM
11-14-2005 04:44 PM
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
11-15-2005 11:16 AM
11-15-2005 01:53 PM
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
11-16-2005 09:56 AM
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
11-17-2005 01:20 PM
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
11-18-2005 11:11 AM
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
11-29-2005 03:17 PM
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
11-30-2005 05:04 PM
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