PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

PXI 5421 Generating Arbitrary Waveform on the fly

Solved!
Go to solution

I have a PXI 5421 card. I need to generate an arbitrary waveform with different frequencies. I need to have a trigger to switch between waveforms of different frequencies. I am using script for this. I am not able to update the frequency of the next waveform on the fly without stopping the program. In other words, can I download signals in real-time? The code is attached. 

Regards,
Santosh R Kodandarama
Missouri S&T
Download All
0 Kudos
Message 1 of 9
(4,505 Views)
Solution
Accepted by Kakrott

 

Hey Kakrott,

 

You should be able to accomplish this with your PXI 5421. The example "FGEN Switch Between Waveforms" found in the LabVIEW examples does something similar to what you are trying to do. As explained in the documentation: "This example shows how to switch back and forth between two different waveforms while generating, using fresh data each time." This example uses a trigger to change which waveform is being generated.

Regards,
Efrain G.
National Instruments
Visit http://www.ni.com/gettingstarted/ for step-by-step help in setting up your system.
Message 2 of 9
(4,487 Views)

Everything looks so simple after looking at the example you suggested. 

 

Thanks a lot.

Santosh

Regards,
Santosh R Kodandarama
Missouri S&T
0 Kudos
Message 3 of 9
(4,476 Views)

Sorry, I have another question realting to this example. What does Position start and position current mean in the example? When I am using the current position, I cant switch back and forth between wavefoms? And also there is a slight delay between switching, How can I prevent this delay?

 

I am attaching the new code.

 

Thanks,

Santosh

 

 

Regards,
Santosh R Kodandarama
Missouri S&T
Download All
0 Kudos
Message 4 of 9
(4,461 Views)

From the LabVIEW help:

 

"Relative To specifies the reference position in the waveform. The position and offset together determine where to start loading data into the waveform." So basically you use the "Relative to" in combination with the "offset" input to figure from where are you going to start writing your new waveform. You can start writing relative to an offset on the current value. Or you can start writing relative to an offset on the first value of your first waveform.

 

What kind of waveforms are you sending? Is it possible that they are indeed switching but this is not readily apparent because the waveforms you are using look very similar? As far as the delay between switching, this could be caused by your operating system. Do you have more applications running?

 

 

Regards,
Efrain G.
National Instruments
Visit http://www.ni.com/gettingstarted/ for step-by-step help in setting up your system.
0 Kudos
Message 5 of 9
(4,452 Views)

Yes, the waveforms that I am sending are very similar. I just change the frequency of the signal by a very small value. (Ex: Waveform 1 - Frequency =239.75kHz and the waveform 2 - Frequency =240.25kHz). Also, I am running my PXI 5122 to capture the waveform generated. This delay is found only in some trials. It is very important that I dont get this delay because this is the signal I'll be using to drive a piezo in an atomic force microscope. Is there a way I could confirm this transition? 

 

Thanks,

Santosh

Regards,
Santosh R Kodandarama
Missouri S&T
0 Kudos
Message 6 of 9
(4,434 Views)

Santosh,

 

Have you been able to detect the change of waveforms? Do you know how long is the delay between switching waveforms? How are you measuring this delay? With the PXI 5122? What do you change between the trials? There is always going to be a delay between switching your waveforms, specially since the switching is done in software. The question is wether this delay is within your specifications or not. What is the maximum delay that you are looking for? Sorry , for asking so many questions. I need to know this information so that I can help you better.

 

Thanks!

Regards,
Efrain G.
National Instruments
Visit http://www.ni.com/gettingstarted/ for step-by-step help in setting up your system.
0 Kudos
Message 7 of 9
(4,417 Views)

Sir,

 

Firstly, I think the delay I observed was an aliased signal and not the delay itself. Now after realizing that, I have captured the transition again on my PXI 5122 of which I have attached some pictures. To answer some of your questions:

1) For each trial in my actual experiment, I change the frequency only. (Ex: 239.2KHz to 239.3KHz to 239.5KHz and so on.)

2) I do not have a number in mind for the maximum delay I can let go without killing the system. Maybe around 1us would be fine.

 

Please take a look at the image where I am plotting the transition between the waveforms and let me know if thats right?

 

Thanks,

Santosh

Regards,
Santosh R Kodandarama
Missouri S&T
0 Kudos
Message 8 of 9
(4,414 Views)

Santosh,

 

I have looked at your waveforms, but unfortunately I am not quite sure of what is shown there. It looks like your x axis on your graph is depicting the time domain, but you have frequency units instead. Unless I am looking at it the wrong way and your frequency is on the y axis and it is varying periodically.

 

Can you help me out to understand your waveform?

Regards,
Efrain G.
National Instruments
Visit http://www.ni.com/gettingstarted/ for step-by-step help in setting up your system.
0 Kudos
Message 9 of 9
(4,395 Views)