LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate an analog bipolar pulse

I would like to create a bipolar square pulse to my analog output that looks like the following:
 
_         _
  |  ___|  |  ___
  |_|        |_|
 
The pulse width, frequency, and duty cycle will be user defined.  I thought about adding functions to get this to work, but I'm not sure how to add them before input to DAQmx.
I know that there are some topics discussing digital pulse generation, but I would really like to use the analog output if I choose to switch to sine or other waves during my experiments. 
 
I'm using the PCI 6221 with SCC68 accessory.
 
Thank you for your help!
0 Kudos
Message 1 of 14
(3,776 Views)
There are a whole bunch of VIs that can do that for you under the Signal Processing --> Waveform Generation palette. You'll find sine, square, triangle and other functions. You can send the output of those functions into the DAQmx write block.
0 Kudos
Message 2 of 14
(3,760 Views)

Thanks.

I was familiar with the sine, square, triangle, etc. but wanted to add another option - the bipolar one.

0 Kudos
Message 3 of 14
(3,748 Views)
A bipolar square wave is just a square wave that oscillates around zero, so you can still use the square wave function, just don't offset it.
0 Kudos
Message 4 of 14
(3,739 Views)
Thanks, I had noticed the square function was *almost right* except it doesn't have a resting period.
0 Kudos
Message 5 of 14
(3,734 Views)
Ah. Something like this, maybe? You can play around with the controls, or make them linked with some formula if you have certain specifications with how you need the wave to be.
Message 6 of 14
(3,729 Views)

Thank you very much!!! That seems about right with just one or two changes.  I'm guessing I should make some kind of control that goes to an if statement, ie. if someone selects sine, square, etc. it goes to the normal waveform generator, and if they choose bipolar, it goes to this part of the block diagram?

I will have to mess around and check.

0 Kudos
Message 7 of 14
(3,716 Views)
Sure. You can use a case structure to define the different scenarios. Glad you got it running.
0 Kudos
Message 8 of 14
(3,696 Views)

Thanks Sima!

I did indeed do the case, although I am not elegantly handling task in/out for the bipolar case.  I just smacked a DAQmx Control Task.vi onto the block diagram with a control for the action.  Any advice on the appropriate way to handle this?

I also am having trouble syncing the output graph with the input graph (the input is hooked up to the output).  I just want the same time axis without manually saying exactly what window of time I want.  A different but related problem: at the end of this ordeal I will be copying this so that I have 4 outputs... any advice to make sure all the outputs are triggered the same?

Much thanks as always!

0 Kudos
Message 9 of 14
(3,693 Views)
I'm sorry, I don't have 8.2 here. Any chance you could save it down to 8?
0 Kudos
Message 10 of 14
(3,673 Views)