LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

square waveform

Hi,
 
Can I get some idea to generate square waveform without square waveform VI and to make output through DAQ board?
The reason is that when I use square waveform vi with high frequency, DAQ has a trouble even I increase timeout.
 
Thank you.
 
0 Kudos
Message 1 of 10
(4,072 Views)
Unless you're not setting the sampling info of Square Waveform correctly, it's not likely the problem is with that. It's just creating an array so you should be able to generate a square wave of whatever frequency you. Most likely, you're not setting the DAQ timing correctly or you're exceeding the max output rate of the DAQ board. What board are you using? What frequency do you want to output? What DAQ functions are you using (DAQmx, traditional)? Posting your VI or an image (no bmp files, please), could help isolate the problem.
0 Kudos
Message 2 of 10
(4,068 Views)

Dennis, Thank you for your response.

What I am trying to do is that I generate square pulse train with an arbitraty frequency and with an offset to set zero point. I am using PCI 6259 board and DAQmx.

When you open square.vi, you see my default values. If you are possible to run this vi, you continuously see the output 3Hz square pulse train using two square waveform vis. In this case, I set timeout of DAQ assist 20 sec. There is no problem. 

But, when I set duty cycle 0.09% to give 0.3 ms of pulse width under sampling frequency (20KHz) and # of sampling (4000000) under offset 2.5, amplitude 2.5  and frequency 3Hz for the first square waveform vi and second square vi has 0 amplitude, and 0 frequency with sampling frequency (20KHz) and # sampling (20000),  I set timeout 400sec in DAQ assist vi.   How can I determind optimal timeout in my case? And for the high frequency (more than 100Hz square waveform), I have a trouble. How can I solve that problem?

I am not sure whether or not my way is general case to generate square pulse train.

Is there a different method to generate general square waveform pulse train with the amplitude range (0 to 10V)?

Thanks

 

 

0 Kudos
Message 3 of 10
(4,059 Views)
A duty cycle of .09% and a 3 hz waveform gives you a pulse width of 300 microseconds, not 300 milliseconds. The same duty cycle at 100 hz is a pulse 9 microseconds wide. Your sample rate in both cases isn't high enough to give you a very square pulse.
0 Kudos
Message 4 of 10
(4,049 Views)
Dennis:  I humbly suggest that you might be wrong about the sample rate not being high enough.  A sample rate of 20KHz will take a sample every 50 microseconds.  This should be more than enough to measure a pulse that is 300 microseconds long.  According to Nyquist, a sample rate of 6.66 KHz should be enough to capture the pulse (1/.0003 = 3.33KHz,  Nyquist says 2 times that frequency is sufficient, which is 6.66KHz, so 20KHz is more than fast enough).  If I have made an error, someone please point it out to me.  (what a stupid statement, of course there is always someone who will be quick to point out an error)
 I should add that the 20KHz rate would NOT be enough for the 100Hz signal at .09% duty cycle.  You would need at least a 55.555KHz sample rate for this one)

Message Edited by tbob on 08-12-2005 02:06 PM

- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 10
(4,047 Views)
I agree that you're correct that the 20 kHz sample rate would be enough for the lower frequency to capture it. What I was attempting to say was that if the original poster was expecting to see a nice clean, square pulse, he would need to increase the sample rate. I just zoomed in on the actual waveform generated and didn't try to do a capture.
0 Kudos
Message 6 of 10
(4,036 Views)
Tbob, thank you for your comment,
I still have a question regarding to timeout setting in DAQ assist.
How can I determind optimal timeout in DAQ when I set high frequency?
 
And, Is there a different method to generate general square waveform pulse train with the amplitude range (0 to 10V) using Labview program?
 
Thank you
0 Kudos
Message 7 of 10
(4,031 Views)
Dennis, thank you.
How much do I increase sampling frequency and # of sampling to see a nice clean square pulse?
 
When I checked the pulse using oscilloscope(tektronix320), the pulse width was almost 300 microsecond (0.3millisecond).
 
If you are available, could you give me comment as following questions?
Could you recommend also how I determine optimal timeout in DAQ?
And is there a different method to generate general square waveform pulse train with the amplitude range (0 to 10V)?
 
Thank you.
 
0 Kudos
Message 8 of 10
(4,027 Views)
I'm not that familiar with DAQ Assist so I don't know what you mean by timeout.  Sorry.
Why would you want to generate a square wave with something other than the square wave vi?  It does an excellent job.  You could use the Basic Function Generator vi and set the Type to Square Wave.  But this does the same thing as the Square Wave vi.
- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 10
(4,022 Views)
Hello Leek,
 
The timeout is how long the VI waits for the data to be ready to read in. If the timeout is too small, you will get a timeout error before all the data is read. If it is too large than, if the something happens to your signal and it stops you will have to wait for a long time before the error is thrown. The timeout shouldn't be affected by high frequencies. What kind of trouble are you talking about? Are you getting an error? Make sure that your board allows the frequencies that you are trying to achieve.
 
If you don't want to use the DAQ Assistant, you can use an example from the Example Finder in LabVIEW. Go to the Help menu>>Find Examples. Browse Hardware Input and Output>>DAQmx>>Analog Generation>>Voltage>>Cont Gen Voltage Wfm-Int Clk.vi. You can specify a 10 V square wave using this VI. Please take a look at this and let me know if you have any questions. Have a great day!
 
Sincerely,
Marni S.
0 Kudos
Message 10 of 10
(3,988 Views)