02-20-2008 04:20 PM
Dear Sir,
I am developing an application to send a defined number of square waveform to DAQMx card. If the number reaches the given value, the generator stops sending, the application will do something else.
For example the attached code will generate a square wave has freq=1 and dutycycle=50%. If I want to send 3 waveforms to daqmx, in principle I can stop the loop after 3 sec. I was trying to use Elapsed time function to count time elapsed, for low freq, it sort of worked, but didn’t work at high freq. I think it should have easy way to handle it. I would very appreciate somebody can tell me.
Thanks.
Guang
02-21-2008 07:39 PM
Hi Guang,
In your example code, why are you setting the sampling rate to 20000 and the number of samples to be generated to 5000?
If you want 1 complete period of the square wave to correspond to one cycle of the loop, then the number of samples generated needs to be equal to sampling rate when the frequency is 1 hertz (as in your code).
02-21-2008 08:30 PM