Signal Generators

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom square signal NI PXI-5412

Hi,

 

I am learning about how to control the NI PXI-5412 AWG.

 

After reading the basics and learning how to generate basic signals, I am now interested to know if it would be possible to generate a "custom" square signal. Meaning that I would like a signal looking something like in the attached draw

 

example.jpg

 

This is just an example of what I would like to achieve.

 

From the exaamples included in LabView it is not clear to me if I should go for "Arbitrary sequence", or "Arbitrary waveform". And in addition, I do no really know how to generate different pulses or different delays between pulses, etc.

 

Thanks for any help

0 Kudos
Message 1 of 6
(5,550 Views)

Is the signal periodic? How long are the pulses?

 

Jason

Product Support Engineer
National Instruments
0 Kudos
Message 2 of 6
(5,509 Views)

Yes, periodic signal, (I made this draw using Paint, so of course it looks not perfect).

 

In the example I showed 5 pulses, so after the 5th pulse it would start the next period.

 

The pulse length would be something around 50us but I am not sure yet, I am more concerned about how to generate the signal.

 

Thanks!

0 Kudos
Message 3 of 6
(5,505 Views)

This is possible with both modes.

 

I would probably start with Arbitrary Waveform mode. Please look at the Arbitrary Waveform Generation example. This example also niFgen Util Create Waveform Data VI (the DBL version) to convert a waveform into a DBL array for the niFGEN Create Waveform VI. niFgen Util Create Waveform Data VI is unnecessary for all applications and is not particularly helpful if you have your own custom waveform. For what you are doing, you can generate your waveform by removing niFgen Util Create Waveform Data VI and just putting an array of I16 or DBLs of the waveform you want to generate. I believe this example should generate the waveform in a continuous loop. 

 

To give you an example of what the  niFgen Util Create Waveform Data VI does, if you select a square wave with ten samples, the result is [1,1,1,1,1,-1,-1,-1,-1,-1]. Alternatively  you could just write that array and delete the niFgen Util Create Waveform Data VI. For your waveform you probably want something like [1,1,1,1,0,0,1,1,1,1,0,0,-1,-1,-1,-1,0,0,1,1,1,1,0,0,1,1,1,1]. I also want to point out that there is a limitation regarding acceptable waveform lengths. You can learn more about it here: http://digital.ni.com/public.nsf/allkb/45A9AAF2920309B2862572C9005B5DA7?OpenDocument

 

Note that you must normalize the data points in the array to be between -32768 and 32767 inclusive if you are representing you waveform array as an I16. If you choose to use a DBL array, then you must normalize your DBL array between -1 and 1. The waveform is then scaled to the desired amplitude as specified by the Gain property. The sample rate is the rate at which your samples are outputed by the front end. So to get the actual pulse width you want, you should do the math with your given sample rate (that you can change with the sample rate property). The length of the array that you can write to your device is dependent on your device's memory option.

 

See here for more detail: 

http://zone.ni.com/reference/en-XX/help/370524P-01/nifgenlv/nifgen_create_waveform_poly/ 

http://zone.ni.com/reference/en-XX/help/370524P-01/nifgenpropref/pnifgen_arbitrarywaveformgain/

 

For more information on Arbitrary Sequence Mode, please look at this page: http://www.ni.com/white-paper/2990/en/#toc2. In this mode, your Waveform A can be a single positive pulse [1,1,1,1,0,0,] , and your Waveform B can be the single negative pulse. [-1,-1,-1,-1,0,0,]. Your waveform segments will be Waveform A with 2 loops and Waveform B with 1 loop and Waveform A with 2 loops again. This is just one way to recreate your waveform. Sequence mode is useful if you want to easily customize the number of loops and change up the order. If you want more delay, with sequence mode you can upload a Waveform C that is just 0 volts [0,0,0,0] and link that together for the appropriate time/number of loops based on your sample rate to achieve the delay you want. 

 

You upload the waveform segments Waveform A and Waveform B to your device the same way, by using the niFGEN Create Waveform VI. 

 

Regards,

Jason

 

Product Support Engineer
National Instruments
Message 4 of 6
(5,495 Views)

To make it more clear, your waveform will be something more like  [1, ... ,1,0,...,0,1,...,1,0,...,0,-1,-...,-1,0,...,0,1,...,1,0,...,0,1,...,1] where the number of 1's and 0's and -1's between at the "..."'s and your sample rate you use will determine the pulse widths. If you want the second pulse to have half the amplitude as the first pulse, then you would use 0.5 instead of 1. 

 

Regards,
Jason

Product Support Engineer
National Instruments
0 Kudos
Message 5 of 6
(5,493 Views)

Thanks A_Donfigulatio for your detailed explanation.

 

I will read it carefully, and I will try to do it step by step with Labview.

 

Thanks for your time.

0 Kudos
Message 6 of 6
(5,484 Views)