08-07-2008 08:48 AM
Solved! Go to Solution.
08-08-2008 03:52 AM
Hi choc,
As it happens, I have a piece of code I worte for a previous forum post that I think will do just what you want with a few minor modifications!
It generates a sinewave of user defined frequency, amplitude, and number of sinewave cycles. It then appends a pause period defined in seconds. Currently the code will output the signal continuously, but if you replace the larger while loop with a for loop and set the number of times you want to output the signal you should be able to achieve your goal.
let me know how this goes
08-08-2008 08:34 AM
Hi SheelaS,
Thank you for your VI, but I can't open it as it was written in LabView 8.5 and I am running 8.2.
08-08-2008 09:15 AM
ah, my apologies choc.
here is a copy for 8.2
08-12-2008 09:03 AM
Hi Choc,
Just wondering how you're getting on?
08-12-2008 11:27 AM
Hi SheelaS,
Sorry for the delay. I have been tinkering with the VI you gave me, adding things that I need. What is frustrating me beyond belief is that I can't figure out why the program is running slowly. For instance, if I enter a 1 second ON - 1 second OFF pattern on the front panel, when I look at the waveform chart (as well as an external oscilloscope connected to the analog output), it seems that what comes out of the AO is a (approximately) 2 second ON - 2 second OFF pattern. Also, entering a frequency of 80 Hz on the front panel results in the produced waveforms not looking 'smooth', but I don't know how to rectify this, as changing the rate on the timing loop from 1000 Hz (default) to 4000 Hz results in an error in the DAQmx Stop VI. Have I modified the VI correctly for an analog output? What could explain the timing issues? I have a USB-6259 (mass-term), and am running LabView 8.2, if that helps.
08-12-2008 01:23 PM
08-18-2008 06:33 AM
Hi Choc,
I am afraid you have implemented the AO aspect incorrectly.
The timing loop only works in software, and this is why the front panel is correct.
However, the timing of the loop doesn't give the hardware output any timing.
To setup timing in the hardware you need to setup a DAQmx timing vi in your AO task. There are examples on how to do this (and the model in general) for AO generation in the example finder within labview, help>>example finder>>Hardware Input and Output>>DAQmx>>Analog Generation>Voltage>>Cont Gen Voltage Waveform.vi and the timing vi would use the sample clock.
I would also recommend removing the timing loop, and using the while loop (as shown in the example) by writing the whole waveform to the Write DAQmx vi buffer outside the loop.
Another point: the non smooth results are caused by the number of samples being too low. It is currently set to the default 1000 (Fs). If you turn this into a control, you can alter it.
let me know how you get on,
Regards
08-20-2008 06:38 AM
Hi Choc,
I was wondering how your getting on, if you want to discuss anything, please post back.
Regards
08-25-2008 09:56 AM
Hi Hillman,
Sorry for the delay. I found a DAQmx tutorial on the NI website, and have been trying to educate myself somewhat by going through it many times (it was made by a "Hillman" working at NI...is that you? ) Anyways, I have modifed the VI, and I think it pretty much works! I am having a little problem with the STOP button on the front panel however. I want it so that when I click it while the VI is running, the VI stops immediately (this is very important to me, as the AO is controlling a motor that is attached to human subjects), but as it is now the VI will stop only after the iteration proceeding the one in which I click it. When the AO part of the VI was not incorporated, the way I wired the STOP button worked, but I am hoping you can help me with this.
On a related AO note, I have been trying to create another VI that generates a RAMP-HOLD-RAMP signal. I thought it would be simple enough just to modify the current VI I have to incorporate 2 ramp pattern VIs, but while I can see the pattern out on the waveform graph, when I look at the AO signal on an external oscilloscope, its running extremely slow. This confuses me, as I have used the DAQmx timing VI the same way as the ON-OFF VI (which is attached, and it works). Any thoughts?
BTW, I have been incredibly impressed at the level of customer support NI offers via their engineers in this forum, as well as in general (I recently bought a DAQ system). Thank you so much....this newbie appreciates all the help he can get!