LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate a impulse signal

Hello,

 

I must write a program where I generate a analog output pulse signal (see the picture WaveDrive) with Labwindows and SCB-68A. I found in the libary the element for a pulse. It is only one pulse but I needed a whole signal. So I generated a positiv pulse and stored the data in an array, so I did for the negative pulse. At the end I merged the two arrays and got the signal pattern. You can see it in the picture "GenerationPulseSignal".

Put now I have the Problem, that I need to adjust the frequency. First I thought I should take the periodic time (T=1/f) and calaculate the array storage and then I can fill the array up with my values.

 

But somehow this does not work.

The problem is this command DAQmxCfgSampClkTiming(taskHandle,"", 100000,DAQmx_Val_Rising,DAQmx_Val_ContSamps, 1000)

I tried something:

I read that when I would like to have a 1 Hz signal I should use 1000 points per cycle at 1000 S/s.

So for a 1kHz signal I needed 100000 S/s to see the signal with correct frequency.

 

For some reasons I can not generate a signal over 1 kHz. I do not understand how I can adjust the command so, that it show the correct signal with my frequency. I tried to increase the sampel rate but that didn't work. Hope someone can help me?

 

It can be, that I took a difficult way, is there a easier way to generate such a signal with the frequency included.

 

Best Regards

 

 

Download All
0 Kudos
Message 1 of 7
(3,964 Views)

Hello, the SCB68 is simply a connection block: capabilities are give from the DAQ board the block connects to. Which is the board you are using?

 

To test the capabilities of your board have you tried running some of the examples that ship with CVI and DAQmx? You could for example run ContGen-IntClk-AnlgStart.prj program and try generating the desired signal: this will give you both a test of your hardware and some hint on how to develop the software side.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 7
(3,944 Views)

Ah sorry. This is my card.

http://sine.ni.com/nips/cds/view/p/lang/de/nid/207408

 

With 900k S/s it should be possible to reach over 1kHz for one period?

 

 

 

 

0 Kudos
Message 3 of 7
(3,941 Views)

The PCIe-6343 can run the example I pointed you to so you can test it by yourself.

By the way, it would be simpler to use ContGen-IntClk.prj sample program, since it does not rely on a analog triggering signal, capability which seems missing in your board.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 7
(3,934 Views)

Thank you. I will test it. 

 

Can I ask you, if the method I use is correct.

 

I use the data that I get out of the command "Pulse". So the only thing I do is connect the array (positive pulse and negative pulse) an give it to the output. I caluculate the space for the array over the period.

Example:

f=50 Hz

T= 1/50=0.02s

My array storage is then 20. My signal has 4 parts (positve pulse, negativ pulse and two zero parts). Every part should have a time of T/4. So I can get the signal in the picture you can see in the first message. Is the frequency higher, then the array will be also bigger an so I can integrate the frequency in the pattern.

 

Is there a better way or is this okay?

 

 

0 Kudos
Message 5 of 7
(3,924 Views)

In principle this is correct. You may want to use more samples (more that 1 sample per signal value) in case you need to have an asymmetric duty cycle (say one period positive, 2 periods off, 1 negative, 2 off) or shift signals between them. If doing so, you will need to raise generation frequency correspondingly (e.g. in the example above your signal will have 6 parts, so you will need to raise sampling frequency by 1.5).

Additionally, if you have other tasks in the program and want to sync them (e.g. an acquisition task that you want to syncronize with generation task) you may need to use a higher sampling frequency and have correspondingly larger output patterns.

It depends on the whole application.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 7
(3,915 Views)

Thank you but I do not understand how my rate from DAQmxCfgSampClkTiming can change my frequency. In my pattern the frequency is calulated but now I can not give the pattern correctly out (beginns about 1kHz). How does my rate effect the array with the pattern and is it a problem if my array is to big (some test gave me a array size from 5000+ but for two output channels)? I know that thing that I need for 1Hz 1000 S/s to generate the signal correct, so do I need for 10kHz than 1 000 000 S/s or better to say what  must I do do generate a 10 kHz signal without using so a high sample rate?

 

Sorry for so much questions.

 

Best Regards

 

0 Kudos
Message 7 of 7
(3,909 Views)