I need to generate a single pulse (see attachment) using NI PXI-5402 signal generator. Pulse needs to start from 4.2V and for 50ms it is 0V and then back to 4.2V. How to do that?
Here is one example for sine waveform
So I need to generate 16384 samples long waveform? How to define it in this case (50 ms low etc)?
I'm no expert in function generators, but I have a couple of things in mind.
As I see it, I think we have two options.
1) Use a Frequency List
Example: Hardware Input and Outpur => Modular Instruments => NI-FGEN => Standard Function Generation => Fgen Sweep Generator.vi
2) Create your own waveform using primitive LabVIEW functions, and input that to the FGEN.
Example: Hardware Input and Outpur => Modular Instruments => NI-FGEN => Configuration => Fgen Clock Mode.vi
I hope you can use this.
If it is not, try this example.
I setup for the following settings to make this work:
With this code, a few things are going on. Lets first talk about the waveform. The waveform is basically a square wave in custom waveform mode. The waveform is scaled from -1 to 1. By setting a DC Offset of 2.1 and Amplitude of 4.2. When we are at the high edge of the custom waveform, the signal generator will output 4.2. When the low edge of the custom waveform is generated, we should be at 0V since the waveform is centered at 2.1V. We must do this because the maximum offset of the device is limited.
With burst mode triggering, the waveform will only change when a trigger is sent. The frequency list that we have setup is 0Hz and 10Hz. Right after the initiate there is a send software trigger. This will send the command to the signal generator to begin generation of the custom waveform at 0Hz. Since the waveform's very first sample is a "1", it will hold the high value of 4.2V. The signal generator will keep generating the 0Hz (4.2V held high) signal until another software trigger is sent.
When you press the boolean to execute the case structure, you can see that the case structure will send 2 software triggers to the device. What this does is it will generate the second frequency of 10Hz (a pulse of 50ms will have a period of 100ms, which equates to 10Hz). This second frequency at the duration configured will be your 50ms pulse of 0V. But since we send two software triggers, the second start trigger is received within the specified duration of this step, the second Start trigger will be applied after the duration elapses. This means that after the pulse finishes, we switch the frequency back to 0Hz, which holds to 4.2V high.
If the pulse is periodic and needs to occur at a particular frequency, there is probably an easier way to achieve this. It is also much easier to generate this waveform with an Arbitrary Waveform Generator, and not an Arbitrary Function Generator.
Hello and thanks to your answers!
I will definitely try that when I get my device ready. The need is send the pulse (as in the attached pic) only once.
I also developed own arbitrary waveform of 16384 samples. I am not able to try it yet but what do you think, should it work?
I have related question: is there a way how to generate a burst of pulses (say, 1,2,5,7,10, 20, ...) using 5402. Playing with duration and frequency of your code seems to be not precize enough - wave starts and stops not exactly at 0.
Any suggestions I would greatly appreciate.