Signal Generators

cancel
Showing results for 
Search instead for 
Did you mean: 

square wave of defined length in edges

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

0 Kudos
Message 1 of 9
(7,159 Views)
sorry, forgot attachment
0 Kudos
Message 2 of 9
(7,158 Views)

Hi Wal,

 

try to use a DAQmx Start and DAQmx Clear task after the Write function.

 

Hope this help, 

Matteo Brunella
Application Engineer
NI Italy
0 Kudos
Message 3 of 9
(7,146 Views)

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

0 Kudos
Message 4 of 9
(7,142 Views)

Hi!,

I tried anyway with a Start and Clear but they didn't give me more that what i already had..

thanks anyway

Wal

0 Kudos
Message 5 of 9
(7,118 Views)

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

0 Kudos
Message 6 of 9
(7,099 Views)

I Wal,

 

I want to suggest you this link:

 

http://zone.ni.com/devzone/cda/epd/p/id/211

 

Hope this help, 

Matteo Brunella
Application Engineer
NI Italy
0 Kudos
Message 7 of 9
(7,092 Views)

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.

0 Kudos
Message 8 of 9
(7,079 Views)

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

 

 

 

0 Kudos
Message 9 of 9
(7,070 Views)