LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

usb-6008 pulse generation

Hi to all forum members!

I need to generate a square wave with frequency range 1-50 Hz on the analog output channel. I need to vary both frequency and duty cycle during program execution.
I have a USB-6008 board and Labview 7.0.

I know I cannot use the counter of my board for this purpose.
Is there some trick to obtain such a pulse train?
I tried to generate it by hand, setting high and low status for suitable time intervals on the AO channel, as suggested in

http://forums.ni.com/ni/board/message?board.id=170&message.id=218725#M218725

but the obtained wave is extremely unstable both in frequency and in duty cycle, and definitely too dangerous to use for driving my instrument (I need to tightly control in particular the duty cycle).

Is there some alternative approach?

Thank you for whatever help

0 Kudos
Message 1 of 10
(4,824 Views)
The best alternative approach would be to use a piece of DAQ hardware that has a counter output or timed digital I/O. A pure software solution on a os such as windows is always going to have some jitter but you might be able to minimize it with the timed loop or the timed sequence.
0 Kudos
Message 2 of 10
(4,810 Views)
With small loop times you would rather use 'Wait' in stead of 'Wait Until Next ms Multiple' because the next multiple could be one too late. Trim the delay times for the best result.
Since your application is so time critical consider removing running 'services' from your computer and minimize interacting with your system.
Also consider hardware alternatives.
Bart Boshuizen,
www.morechemistry.com
0 Kudos
Message 3 of 10
(4,783 Views)
I have Labview 7.0 and I did not find the "timed sequence" structure.

In my first attempt I used the ExpressVI "TimeDelay" (see attached "handmade-waveform1" picture ).

In a second program I tried a different sampling in the "write" function,  using a simulate waveform as input in the write function (see attached "handmade-waveform2"):
this waveform seems to be more stable than in the first program, but the duty cycle reliability is still very unsatisfactory.


Download All
0 Kudos
Message 4 of 10
(4,768 Views)
Hi to all,
take a look to this example and let me know how works:

NI-DAQmx: Software-Timed Variable Duty Cycle Pulse Train Using Analog Output
http://zone.ni.com/devzone/cda/epd/p/id/5235#0requirements

Beppe
0 Kudos
Message 5 of 10
(4,762 Views)
Hi Beppe,

the example you suggested behaves similar to the programs I tried: low duty cycle stability.

Also, I tried to use both "wait" and "wait until next ms multiple", as suggested by Bart, instead of "Time delay", but the differences in duty cycle stability (if any) cannot be noticed.

Anyway, thanks to everybody for  suggestions.

Do you think that generation of a digital waveform and acquiring of the same waveform as timing source for analog output could be a possible improvement?

Thanks

0 Kudos
Message 6 of 10
(4,751 Views)
I used Square Waveform (Not in Base Package) before. That generates a waveform of 1000 samples by default. Simulate Signals generates 100 samples by default. If you increase the number of samples in the waveform you might squeeze in many more waves. There could only be a glitch when the waveform starts over again.
 
'Analog Wfm 1Chan NSamp' doesn't need to put it in a loop. Now you start it over and over....
 
Bart
Bart Boshuizen,
www.morechemistry.com
0 Kudos
Message 7 of 10
(4,730 Views)
Thank you, Bart.

I'm sorry: I'm very inexperienced in Labview programming!
In your previous message you explained clearly that a possible reason of the duty cycle instability is the insertion of  'Analog Wfm 1Chan NSamp' function inside a loop.
Please, could you suggest an alternative?

I need the loop because I need:
1)  stopping the program execution (i.e. the wave generation) by pressing the "stop" button (because when I launch execution I don't know when I have to stop it)
2) changing frequency, amplitude and duty cycle during program execution

If I don't put the write function inside the loop, the wave is not produced.
What option can I choose for the write function if put inside the loop?

Thank you again
ely
0 Kudos
Message 8 of 10
(4,717 Views)

You could try the program I made for Malte Bartels at DelftChemTech. It was made for lower frequencies but I adapted it for 50 Hz. It supports both block and sinus waveforms. Hope you can read it.

http://www.morechemistry.com/labview/contributions/wavegen2.llb

Bart Boshuizen,
www.morechemistry.com
0 Kudos
Message 9 of 10
(4,710 Views)
Dear Bart,

thank you for the kindly given link to your vi.

I have a question.

Actually you don't put write barely inside the loop, but in an event structure with its suitable timeout.
The output wave is produced just inside the temporal window given by the timeout and in that window I cannot change wave parameters (duty, etc..).
Only when the timeout is expired and the output is zero (no more wave) I can change wave parameters.
In that case by pushing "activate" button a new wave is generated, again within the same temporal window.

Is my understanding correct?

In my program I tried to move the write function outside the loop (for example in a case structure which becomes true in the event that some wave parameter is changed on the front panel),  but in this case the wave is generated only after some change on the front panel and only in the temporal window of the case structure ("wait" function or "wait until next ms multiple").
Up to now I did not be able to generate a 'continuous' wave output without  any  time settings.

Do you know some trick about it?

thanks
ely


0 Kudos
Message 10 of 10
(4,696 Views)