05-17-2010 08:33 AM
Hi!,
I hope this is the right place to post..
I'd like to generate a square wave of defined length on one line of my NI 6501 (digital output).
I've tried with Square Waveform,with PulsePattern and Square wave without success.
I'd like to have for example to have a train of 50 (up to, let's say, 100Ksteps) rising edges at a frequency of 1000Hz (this one can raise up to 9KHz ) to drive a stepper motor...where I'm wrong?
I connected wrongly the 3 trials just to make you understand.
Need more information??
thanks
Wal
05-17-2010 08:36 AM
05-18-2010 02:34 AM
Hi Wal,
try to use a DAQmx Start and DAQmx Clear task after the Write function.
Hope this help,
05-18-2010 03:00 AM
Hi Matteo!, thanks for replying.
that is not solving the problem: in fact I can move the stepper motor right now with this VI (even without Start and Clear), my problem is to define a right square wave...
I'd like to have only N edges of a certain amplitude (say 5V) at a certain frequency (say 1KHz) and with neither of the 3 developed branches I could get it...
I can't use Counter Output cause I need it to read another signal, so I must put this train of edges out of a Digital Output
thanks again
Wal
05-19-2010 02:23 AM
Hi!,
I tried anyway with a Start and Clear but they didn't give me more that what i already had..
thanks anyway
Wal
05-20-2010 01:24 AM
HI!,
I don't know if this is a very stupid question or a very hard one...no replies at all??, neither a link to a possible solution??
Wal
05-20-2010 03:21 AM
I Wal,
I want to suggest you this link:
http://zone.ni.com/devzone/cda/epd/p/id/211
Hope this help,
05-20-2010 02:30 PM
You do understand the basic mathematical relationships between frequency, sample rate, and # of samples, don't you? As an example, take the Square Wave function. With the default of 10 Hz, 1000 samples/sec and 1000 samples. That will generate 1 seconds worth of data (1000 Samples/1000 Samples/sec). The period of 10Hz is .1 second so with 1 seconds worth of data, you will have exactly 10 pulses. Increase the number of samples to 2000 and you will have 20 pulses. Add some calculations at the front end based on frequency and number of samples and you should be able to manipulate the sample rate and number of samples and generate x number of edges like you want.
p.s. Since you are using the 6501, this might all be a waste since the card is not hardware clocked and you will see considerable jitter at low frequencies and not have any chance at all of obtaining frequencies much higher tha 1KHz.
05-21-2010 03:13 AM
Right!!, thank you so much!
I tried with the square wave function as you can see in the first attachment, but without looking at the "sampling info".
It was difficult for me to understand in the other Square Wave function that the "frequency is the frequency of square wave in normalized units of cycles/sample. The default is 1 cycle/128 samples or 7.8125E–3 cycles/sample." and consequently how could I manage different pulse train length and different frequencies with only "samples" and "frequency".
In this Square Wave in fact we have 3 parameters (frequency and 2 sampling info)
So now I can keep the frequency stuck and add more pulses by changing only the last parameter...
@Matteo: I had already seen the example but it didn't help
Thanks again to you both
Wal