From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Signal length - uncontrollable

Why can't I control finite length of my sine signal, when I'm trying to generate it using DAQmx blocks? I want it to take for couple of milliseconds, but max I can get is 1 ms.

 

This is what I've done: I generated signal with Sine Waveform.vi. Using DAQmx Timing, DAQmx Write DAQmx Start Task, DAQmx Clear task blocks, I've generated it via NI USB 6211. Everything seems Ok, but when I take a look on the oscilloscope I just can not get the desired duration. Also, it looks like a last halfperiod of the sine signal is missing.

 

Any advice will be helpful, thanx forward.

 

Sincerely,

 

 

Pero Krivic

0 Kudos
Message 1 of 7
(2,511 Views)

Hi Pero,

 

You might look at the number of samples you are using to represent your signal, or the analog output update frequency (that is, the AO sample clock).  

 

The output frequency is going to be based on the number of samples that define the output, the AO sample clock frequency, and the number of cycles that you're representing with your samples.  You can see the KB on AO Update Rate vs. Desired Frequency to see the equations that govern this.  Also, this discussion post addresses the issue.  Finally, you might try looking at some online examples to help in your VI setup.  Let me know if these resources are helpful.

 

Hope this helps,

 

Andrew

National Instruments
0 Kudos
Message 2 of 7
(2,481 Views)

First of all, thank you for your good will and help, Mr. Andrew.
I've already seen one of the numerous LV examples, and based my design upon this one (AO Voltage Int clock). But, I don't want to bother myself calculating cycles in buffers, and samples in cycle. So I had it modified a little bit, to achieve control by entering desired pulse length. I want my sample rate to be constant (250 kS/s). Number of samples is calculated from that, and inserted into the blocks. But, it just doesn't generate full width. It generates only one millisecond.

 

An Instrument from your link (online vi) seems fine, I will try it tomorrow, and let you know if it is good for me.



Best regards,


Pero Krivic

0 Kudos
Message 3 of 7
(2,469 Views)

Hi Pero,

 

It looks like you're working on a mathematical way of outputting an analog waveform.  While you're testing out the other VI, you may want to keep in mind that, for the 6211 has an analog output FIFO size of 8,191 samples shared across the analog outputs (see this in the 6211 specifications).  If you are using one analog output, that means the maximum amount of time you can output a signal (for a finite analog output task) will be:

 

8,191 [Samples] / 250,000 [Samples/s] = ~32.7 ms.

 

So in this case, when your rate is constant, the duration of your output all depends on how many samples you load into the buffer.

 

Also--I didn't see you mention that you were using the "DAQmx Wait Until Done" VI in your original post.  It's important that you use this if you are using a Finite Generation, because otherwise you may be stopping and clearing your task before it finishes (which may be the case, if you never get anything beyond 1 ms output.)  This VI has a red triangle and can be seen in a use-case under the example finder:

 

Help>>Find Examples...

Hardware Input and Output>>DAQmx>>Analog Generation>>Voltage>>Gen Mult Volt Updates--Int Clk.vi

 

-Andrew

National Instruments
0 Kudos
Message 4 of 7
(2,442 Views)

Hello,

 

Thanks for help, but...you say that there would be problems if I want to generate more than 8,191 samples per cycle, what would last, at sampling rate of 250kS/s, for 32.7 ms. I had problems with much lower number of samples (that last for couple of milliseconds).

And, there's one thing I tried last few days: I used a Matlab to control the USB 6211, and everything was fine - I got the desired signal duration!

But I'd stil like to develop my instrument in the LV.

 

Best regards,

 

Pero

 

P.s. Now I see, I haven't used the Wait block. I'll try it next few days and post the results.

0 Kudos
Message 5 of 7
(2,400 Views)

Yes, the wait block fixed everything. Now, I got the desired length. Thank you very much!

 

But there is still some sort of problem - my signal doesn't begin from desired value. It looks like signal is cut off at the beginning. What could cause this?

 

Sincerely,

 

Pero

0 Kudos
Message 6 of 7
(2,357 Views)

Hi Pero,

 

The DAQmx Write VI would write out whatever array values you pass to it in the order of the array.  So, for instance, the array value at index 0 would be the first item to write out, then the array value at 1, then 2, etc.  Could you verify the signal you are passing through to it begins where you are expecting?  You might do this by creating an indicator or probing the wire connecting to the input of the DAQmx Write VI

 

-Andrew

National Instruments
0 Kudos
Message 7 of 7
(2,330 Views)