LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop Frequency with DAQ

Hello,

 

I'm new to LabView and am trying to use it to control a test rig.   The attached program uses a while loop to send a single digital value, a single analogue value and receive a single analogue voltage reading from a number of sensors each iteration using DAQ Assistant, before compiling a matrix with all readings and saving the data.  Everything is communicating correctly, but I can't get it to run faster than exactly 10Hz (I'd like to up this to ~100).  I created a test program performing the same functions without the DAQ assistant blocks and am able to control the loop frequency using a time delay, so I figure there's a setting or something that I've missed in the DAQ assistant holding the loop up?

 

Any help would be much appreciated.

 

Thanks,

Alex

0 Kudos
Message 1 of 6
(2,663 Views)

I've just found that it's the sine wave generator holding everything up- I changed the samples per second and number of samples values in the settings and the loop frequency doubled.  Is there a better way to generate a sine input to control the actuators using this program architecture?

 

Thanks

0 Kudos
Message 2 of 6
(2,639 Views)

Stupid question, my brain has just caught up.  I'll use a simple mathematical operation taking an input from an elapsed time function.

0 Kudos
Message 3 of 6
(2,628 Views)

@amannamedalex wrote:

Stupid question, my brain has just caught up.  I'll use a simple mathematical operation taking an input from an elapsed time function.


You cannot "take" an input, just an "output".

 

Overall, I would really recommend to do a few basic tutorials.

 

There is really no need for all that dynamic data. Compare the two code sections in the attached image. Their output is identical, but the lower part is arguably slightly simpler. 😄

 

Booooooleans.png

Message 4 of 6
(2,622 Views)

I would recommend against using the DAQ Assistant at all. LabVIEW has some great examples in the Help->Find Examples->Hardware IO->DAQmx (or thereabouts).

 

Open up some of the signal generation ones and you'll see some examples of a sine wave being created and sent out.

0 Kudos
Message 5 of 6
(2,600 Views)

Hi amannamedalex,

 

welcome in LabVIEW community then 🙂 

As guys already mentioned you in previous posts, some tutorials can be great start - and there are plenty of them online.

For example this Introduction to LabVIEW or Begin Your LabVIEW Training.

 

For your application, as others already recommended, try to avoid using of DAQ Assistant inside of loop. 

DAQ Assistand is using DAQmx API and every time you run DAQ Assistant (in your case every single iteration), it creates a task with all of the setting (init part), then it starts task, read/write and then stop and clear the resources. This is unnecessary and can cause significant delays in your application.

 

Instead of that, you can use DAQmx API directly. Then, you are able to create the init part before the loop, the closing of the session after the loop. Inside the loop you will just write/read the data.

 The easiest way how to use DAQmx API is to use examples (as was mentioned Help->Find Examples->Hardware Input and Output->DAQmx).

 

If you want first some introduction, I can recommend Getting Started with NI-DAQmx: Getting Started with NI-DAQmx Programming in LabVIEW.

 

Hope this helps.

Regards,

Patrik
CTA, CLA
Helping (sharing) is caring!

If the post was helpful - Kudo it.
If the post answered your question - Mark it as Solution.
Message 6 of 6
(2,559 Views)