LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Numerical Input and array

Hello, I have a labview program with a numerical input for frequency. I created an array that contain a series of numbers. How can I let the program to get each element from the array sequentially? For example, it will read the first element of the array. 2 seconds later it will read the second element so on. I try to use "index array" but it only gives me one specific element of that array. Any ideas?

Thanks

Message Edited by lxx on 04-20-2006 10:05 PM

Message Edited by lxx on 04-20-2006 10:06 PM

0 Kudos
Message 1 of 16
(3,718 Views)

Do the index arrayoperation inside a loop.

use the loop's iteration count "i" as the index input and you get out each successive element in each iteration

Keep suitable time interval between each iteration

Message 2 of 16
(3,700 Views)
You need to use a FOR loop. Autoindexing will automatically take care of the rest.
Message 3 of 16
(3,698 Views)
Thanks for your reply. I've attached my labview program using your suggestion. When I run the program, I noticed a time delay between each loop. Is it possible to remove this time delay?  I use this labview program and the counter output 0 on my 6024E card to drive a stepper motor. The program will genereate a finite pulse train using the given frequency which is supplied by the array. The problem is the motor is not running smoothly beacuse of the time delay between each loop. Is it possible to make the program run smoothly by removing any time dealy between each loop?
0 Kudos
Message 4 of 16
(3,684 Views)
.

Message Edited by lxx on 04-21-2006 11:05 AM

0 Kudos
Message 5 of 16
(3,673 Views)
I'm guessing someone else wrote the code that's inside the for-loop, given your questions so far. First point, you are auto-indexing the frequency array, so you do not need to wire to the "N" terminal of the loop - this is redundant. Second point, there's a "Wait + (ms)" function in the string of VIs. I'd bet $5 this is the source of your delay. However, without delving deeper into the code I wouldn't automatically delete it, 'cause it may be there for a good reason.

Message Edited by smercurio_fc on 04-21-2006 11:34 AM

0 Kudos
Message 6 of 16
(3,665 Views)
yes, I'm not sure how the program inside the loop works. I found it online as an example.
0 Kudos
Message 7 of 16
(3,650 Views)
Hello Ixx,

From taking a look at  your program, as far as I can tell, the code inside the loop is creating a pulse train, and using another single pulse generation task to control how long to generate the initial pulse train.  The Wait + (ms) VI is used to prevent the tasks from going directly from being started to being cleared, and they are a necessary part if you want your program to output as many pulses at each frequency that you have entered into the 'number of pulses' control on the front panel.  It seems that if you want to try to transition between these different frequencies more smoothly, you should generate more intermediate frequencies by increasing the 'Samples' input of the Ramp Pattern VI.  If you want to include more intermediate frequencies, but want to transition from your lowest frequency to highest in the same amount of time, then you will have to generate less pulses at each frequency by lowering the value in the 'number of pulses' control.

Have you considered programming with NI-DAQmx functions as opposed to these Traditional NI-DAQ functions?  They are much easier to use and actually perform better in almost all applications.  NI-DAQmx requires that you have LabVIEW 7.0 or later, and that your DAQ device is new enough to support it, which you can check here.

I hope this helps!

Regards,
Travis G.
Applications Engineering
National Instruments
www.ni.com/support
0 Kudos
Message 8 of 16
(3,630 Views)
Thanks Travis, I will try program with DAQmx.
0 Kudos
Message 9 of 16
(3,610 Views)

Hi all,

Along a similar theme I have attached the VI currently employed to collect data from friction experiments. Currently you type in a series of times at which you want samples taken, but this is unacceptably time consuming. What I am looking for is a table where the user enters the length of up to 5 time intervals and then the time between sampling for each one as well as eg sample length. Say for example 1 sec sampling every 10 seconds for five minutes then the same but only every 30 seconds for the next hour. Please find attached the VI as it stands. My labview skills are developing but still very basic at time of writing!

 

Thanks in advance,

Andrew

0 Kudos
Message 10 of 16
(3,492 Views)