11-12-2010 10:40 AM
Amplitude Variable Sinusoidal Pulse Generation
Hi all, I´m trying programming a pulse generation program that when I pulse one button into the interfase of the labview generate a Variable Amplitude Sinusoidal Signal.
The pulse consist a amplitude increasing sinusoidal wave, amplitude contant sinusoidal wave and decreasing sinusoidal wave. It will be controlled by three variables, Time to Rise, Time to Constant and Time to Decrecase, al of them in ms.
Also we must to specify how many time we spend in each iteration, time by cicle.
I need a pulse generation of sinusoidal wave a ramp in Labview with the card PCI-6251 and the module BNC-2110. I think that´s enough for my pruposes.
The problem
is when I try send the value to the analog output the time it´s too slow,
around minutes, theorically it must be in 300ms. How I can solve this?
I think that my problem is because I´m using a DAQ Assistant for make thism,
because when I erase it works good.
I´m thinking implementing this by arrays but how I can send then the values to analog output. Do you know some examples?
I generetae his with a loop for and I control the time of each iteration, around 1ms, even less, I think that my card can support that. I control that with a variable.
Please see the code,
-What methods are aviable to send values to analog output?
-If I save my wave into a array how I can send the wave to the card?
-Do you can recommend me a example?
-What do you recommend me to do?
-Where I can found the reference manual of all DAQmx functions?
Thanks youl.
Best Regards,
Pablo
11-16-2010 03:46 PM
Hi NGE Tech
In order to accomplish the amplitude change you will need to update your output values using software. Therefore, in order to increase efficiency I definitely recommend using low level DAQmx VIs instead of using a DAQ assisstant.
I recommend you to use an example such as "Continouous Gen Voltage Waveform Int Clk Non Regeneration" on the NI example Finder. Then you will need to add some logic so that you update the values that you write to your board using the NI DAQmx write VI. You can probably use a while loop where you keep sending output data to the onboard memory of your board. For every iteration of the loop you can programatically change the values that are wired ti the DAQmx Write VI. (the values that will be written to your board)
11-22-2010 09:57 AM
Dear Efrain G,
Thank you for your help. Rigth now, my program is more faster. But Theorically If I use a A "Sample Clock Rate" of the double of the signal that I want to generate, for instance: If I want generate a signal of 30000 Hz I must to Use a double of the frequency (Nyquist Theorem), in this case I want to generate a 30 Khz and I must to use a "Sample Clock Rate" of 60Khz... But the signal is not quite good. I try with another values for the Sample Clock Rate, for example 300Khz, but still has some aliasing. Some help on that? The card allow up to 1.25 Ms/s, for generate a 30Khz pulse, theorically will be enougth...
Also I have another problem:
That is, that Now I want generate two pulses with the Analog Outputs, I Dispose of two of them but DAQmx-Write show me a problem. I think that I must to change the number of a Channels or a number and the number of a outputs, etc... but where I can found some information about that?
Any recomendation? Any Example? Will be fine found some document with all the possible values of DAQmx feautres, Do you know something about that?
Thank you very much!
11-23-2010 08:09 PM
HI NGE,
The PCI 6251 was designed to update analog output sampes at a rate of 2.86 MS/s. With that said, it is important to understand that there is a bottle neck between your computer and your DAQ board, and that is your PCI bus. A PCI bus is rated to run at 133 MB/s. However there will be an overhead and depending on how many programs are using your BUS at the same time, that bandwidth can be reduced greatly.
Now, when you say: "I want generate two pulses with the Analog Outputs, I Dispose of two of them but DAQmx-Write show me a problem", are you trying to create a new task with the same AO channels?
11-24-2010 09:42 AM
Hi Efrain,
You're rigth in the analog output with two channels we can use around, 2.00Ms/s.
I read in the specifications that we can use (http://www.ni.com/pdf/manuals/371291h.pdf)
What do you propouse something for solve the bottleneck problem? Have some document for that?
But for achieve this what we need? a PXI bus?
I program that with differents Tasks, but the problem is the DAQmx-Write function...
Here I show the problems that I found, I make some different tryings with different configurations of DAQmx-Write, but always I get different
problems there you can see. I try with Multiple Channels, Single Channels, 1 Sample, N Samples... But I don
____________________________________
Error 200524 occurred at DAQmx Write (Analog 1D DBL NChan 1Samp).vi
Write cannot be performed,because the number of channels in the data does not match the number of channels in the task.
When writing, supply data for all channels in the task. Alternatively, modify the task to contain the same numbver of cahnnels as the data written.
Number of Channels in Task:2
Number of Channels in Data: 5000
Task Name: MyVoltageOutTask_AO1
_____________________________________
____________________________________
Error 200524 occurred at DAQmx Write (Analog 1D DBL 1Chan NSamp).vi
Write cannot be performed,because the number of channels in the data does not match the number of channels in the task.
When writing, supply data for all channels in the task. Alternatively, modify the task to contain the same numbver of cahnnels as the data written.
Number of Channels in Task:2
Number of Channels in Data: 1
Task Name: MyVoltageOutTask_AO1
_____________________________________
_____________________________________
Error 200371 occured at DAQmx Create Channel(AO-Voltage-Basic).vi
Requested multiple virtual channels that correpond to the same physical channel within a task. A task cannot contain multiple physical channels
of a specified type.
Use different physical cahnnels for each virtual channel.
Physical Channel Name: ao1
Virtual Channel Name: Dev1/ao1
Device: Dev1
Task Name: MyVoltageOutTask_AO1
______________________________________
What´s means Number of Channels in Data?? How I can control that? Because the problem is because is too much, around 5000?
My problem is that I don´t know what DAQmx-Write Option select.
Thank you for your help,
Best Regards,
Pablo
11-24-2010 09:44 AM
Here the last version of program.
11-29-2010 05:27 PM
Hi NGE,
To be honest, there is no other way to get around that throughput because you are using a PCI board. For example a PCIe express bus can handle up to 250 MBs. A PXI bus is an extension of your PCI bus so you will see the same speeds. Another option that people use is is to get a board that has a larger onboard memory. This allows you to preload more data on the onboard memory. With this data you can generate waveforms from your board direclty to the physical world without having to go through the bus.
I see that you are getting an error about the number of your channels. This error can be easily fixed by changing the type of your DAQmx Read polymorphic VI to "multiple channels" if you are using two channels or "single channel".
12-01-2010 07:39 AM
Hi Efrain,
I try the polimorphism solution, but I don´t know how to work with polimorphism. A polimorphism, is for work with different type of data.
I activate the polimorphism in automatic and I don´t get any solution. I think that the problem is with the tasks.
with "Measurement & Automation":
MAybe the problem I create two tasks:
MyVoltageOutTask_AO0 --> I select in tnis task the Analog Output 0 of the card
MyVoltageOutTask_AO1 --> I select in this task the Analog Output 1 of the card
-I must to create another Task with both outputs?? MyVoltageOutTask_AO0_A01 --> with the both aouputs in the same task
Theorically will be enougth for get in the output two different pulses, but still I get the next error:
______________________________________________________________
Error - 200524 occured at DAQmx Write (Analog 1D Wfm NChan NSamp).vi
Write cannot be performed, because the number of channels in the data does not match the number of channels in the task.
When writing, supply data for all channels in the task. Alternatively, modify the task to contain the same number of channels as data written.
Number of Channels in Task: 2
Number of Channels in Data: 1
_______________________________________________________________
I think is for the definition of the Task, but I don´t know for sure.
It´s rigth the definition of the task? How I can solve this problem?
Thank you.
______________________________________________________________
12-03-2010 02:09 PM
Hi Pablo,
I looked at your code and I found that there are two issues that we need to address here. The first one is that you are wiring to the "DAQmx create task VI" both a "DAQmx task" and also a "physical channel". You must wire either one or the other but not both because you create a resources conflict otherwise. You are probably wondering what is the difference:
If you create a DAQmx task in the Measurement and Automation Explorer (MAX) you can import it into LabVIEW. You import it by wiring the "DAQmx task" input terminal of the "DAQmx create task VI".
If you don't have a task created in MAX you can create a DAQmx channel in LabVIEW using the "Create DAQmx Channel VI", and then you only need to wire the physical channel that you will be using.
The second problem that we need to address here is that since the PCI-6251 only has one timebase, you cannot have two analog output tasks using that timebase at the same time. A workaround is to combine both of your analog output tasks into a single task. Or you can share the clock by using correlating your tasks like in the example found on this link:
http://decibel.ni.com/content/docs/DOC-10595