LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

frequency control real time

Hey everyone

 

I'm user of Labview 8.5 and usb 6251 ni card. In all by generating program i've put daq max blocs.

I have one issue. I would like to control my sinus frequency in time reel by i don't know how. I've made by propertis of sempels (view atached) but its work with big mistake, I can't determine a precise value (it concerne of programes solutions which we can't change). I am looking for one where i could steer my frequency value more precisely. 

 

18445iB0EE2D0A17355D90

 

If you knerw some about of exemples or can help me solve my issue? Please.

 

Marek 

 

 

0 Kudos
Message 1 of 5
(3,113 Views)

 

Hi Marek,
This example allows you to change the update rate of your analog output. However, DAQ hardware obtains signal used as update clock of your AO task by dividing the master timebase of the board (20MHz). This implies that you cannot get every value of update rate.
In this example, you load a signal pattern in the buffer handled by DAQmx. Then, when you start the task, the driver automatically generates those samples, by 'looping' the data in the buffer (first sample, second sample, ... last sample of the buffer, then first, second and so on....).
If you want something more precise, you have to disable the regeneration mode of the AO task, and to compute the samples you will pass to the buffer for each iteration of the loop. This way, you can keep the phase information of the previous buffer, use it to generate the appropriate new buffer, and obtain a very precise frequency for your  generated signal.
(French, isn't it?)

 

Hi Marek,


This example allows you to change the update rate of your analog output. However, DAQ hardware obtains signal used as update clock of your AO task by dividing the master timebase of the board (20MHz). This implies that you cannot get every value of update rate.


In this example, you load a signal pattern in the buffer handled by DAQmx. Then, when you start the task, the driver automatically generates those samples, by 'looping' the data in the buffer (first sample, second sample, ... last sample of the buffer, then first, second and so on....).


If you want something more precise, you have to disable the regeneration mode of the AO task, and to compute the samples you will pass to the buffer for each iteration of the loop. This way, you can keep the phase information of the previous buffer, use it to generate the appropriate new buffer, and obtain a very precise frequency for your  generated signal.

 

Best regards,


PS: Do not hesitate to answer me in french...

0 Kudos
Message 2 of 5
(3,071 Views)

 

Hi Mathieu,

 

Thank you for your help, it's very kind.

As you told me " to compute the samples " of new buffer of new iteration loop. Can I this use by properties of buffer or I must put my sinus generator inside the iteation loop? Where i should placed the Write block?  When we tolking about generation block inside the loop, in this way, we don't charge the computer more?

 

Ps. I don't know better French language than English, yet, sorry. Speeking in French is easyier than write - its my opinion 🙂

 

Best regards,

Marek

0 Kudos
Message 3 of 5
(3,062 Views)

You're welcome, Marek.

 

I forgot to mention it, there is an example that exactly illustrates the code structure we are talking about. Use the Example Finder tool, in Help » Search Examples... menu. Then, browse to Hardware I/O » DAQmx » Analog Output » Voltage, and you'll find the example VI Cont Gen Voltage Wfm-Int Clk-Non Regeneration.vi

 

18617i738D257C832CBCB6

 

This actually increase the CPU load, because for each iteration of the main loop, you have to calculate the samples you are going to generate. But this can be aceptable if the update rate and the number of sample to compute is not too important. Performances are system dependant, so you have to test differents configuration in order to find wich best fits

 

Hope this helps.

0 Kudos
Message 4 of 5
(3,054 Views)

 

Thank you - it is very usefull!

 

I've delated "do not allow regeneration" block which one let make the variation of frequence. 

 

 

Have a good work

Marek

0 Kudos
Message 5 of 5
(3,037 Views)