LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Numerical Input and array

0 Kudos
Message 11 of 16
(950 Views)
0 Kudos
Message 12 of 16
(948 Views)
Hello Andrew,

I see from your code that you are also programming with Traditional NI-DAQ function calls.  If your just getting started with LabVIEW and DAQ programming, I would recommend that you use the NI-DAQmx function calls, as these VIs are newer, easier to use, and execute more efficiently.  Here are some good resources for getting started with programming with the DAQmx function calls.

Developer Zone: Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applic...


Developer Zone: Transition from Traditional NI-DAQ to NI-DAQmx

As far as your application, your on the right track by putting your DAQ configuration in a for loop.  This will allow you to create a new task and configure it with new timing parameters each iteration of the for loop.  You can configure all the relevant timing parameters with the DAQmx Timing VI.  The important inputs are the sampling rate, sampling mode (finite), and number of samples to read.  You can use the auto-indexing functionality of the for loop to run the DAQmx code a desired number of iterations.  Here's a sample of how I would recommend going about programming this application with DAQmx.



I hope this helps,

Travis G.
Applicaitons Engineering
National Instruments
www.ni.com/support


Message Edited by Travis G. on 09-26-2006 02:35 PM

0 Kudos
Message 13 of 16
(920 Views)

Thank you for getting back to me. Unfortunately I cannot seem to find any of these daqmx functions, and because the system i uploaded is what is currently being used, (and the people using it do not know how to programme in labview) I would prefer to stick to the original. Performance, speed etc... arent critical. I have uploaded my attempt at the problem - note that no. ints is the equivalent of array size of interval size etc... however this doesnt seem to work. what i have noticed is that in your example you dont link the for loop iteration count through an element call as I have, but your suggestion seems to just know that it has to refer to the next element of the array each time. Is it as simple as that?

Thanks again for your help, I finish work here on Friday so any responses before then would be really really really appreciated.

All the best,

Andrew

0 Kudos
Message 14 of 16
(895 Views)
Hello Andrew,

In the screenshot I've shown in my above post, the autoindexing functionality is used to extract individual elements of an array each iteration of a for loop.  When you wire an array into a for loop, autoindexing will be enabled by default, and you can tell the array is being autoindexed by the unique tunnel icon with the [ ]  brackets.  With autoindexing, each iteration of the for loop will extract the next element of the array, starting at array element 0 on the first iteration, array element 1 on the second iteration, etc.  Remember that all arrays and iteration counts are zero based, so the first element in an array and the first iteration of a for loop will be 0.  Also with an array being autoindexed by a for loop, you do not need to wire a number into the N loop count terminal of the for loop.  The for loop will know to execute only as many times as there are elements in the array.  If you have arrays of two different sizes being autoindexed by a for loop, the loop will only execute as many times as there are elements in the smallest array.  If you want to disable autoindexing, you can right-click on the tunnel and select 'Disable Indexing.'

Another suggestion I would make for your program is to place an AI Clear.vi after the AI Read.vi.  This will clear the task every iteration of the loop, which will free up any resources and allow you to create a new task with new timing settings.  With the addition of the AI Clear.vi your DAQ programming looks fine.  It's just a matter of using the numeric, array, and timing functions to implement your desired algorithm.

I hope this helps,

Travis G.
Applications Engineering
National Instruments
www.ni.com/support
0 Kudos
Message 15 of 16
(884 Views)
brilliant got it working! thanks so much for your help, and promptness.
 
All the best,
Andrew
0 Kudos
Message 16 of 16
(865 Views)