LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Question

I'm just now getting into the testing phase of my program and when running a 30 cycle data measurement I'm only getting 364 data points. My time delay is 0.01s and I'm reading from a 1hz signal. From what I understand I should be getting around 3000 data points...can anyone look at my VI and give me some direction on how to fix this problem?

0 Kudos
Message 1 of 20
(3,521 Views)

You are creating your channels on every iteration of the while loop.  That takes time.  Plus over time that could eat up resources and potentially crash your PC.

 

The Create Channel VI's should be outside the While loop before it starts.

 

You should also use the close or destroy task functions after the while loop is over.

 

Don't forget to make the labels of your control and indicator terminals visible in the block diagram and give them meaningful labels so you know what each do.

0 Kudos
Message 2 of 20
(3,518 Views)

ahh, makes sense about the channels...will this give me the 3000 data points that I need? I'm new to this so forgive me: "close or destroy task functions" - what exactly does this do?

0 Kudos
Message 3 of 20
(3,512 Views)

Problems I see:

1.) You are initializing each channel during every loop iteration.  The initialization should only happen once.  Move it outside the loop.

2.) You are only reading one sample per loop iteration, so the sample rate is limited by the time delay in your loop.  I suggest reading multiple samples per iteration.

 

 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 4 of 20
(3,511 Views)

how would I read mutiple samples per iteration?

0 Kudos
Message 5 of 20
(3,508 Views)

It closes out the resources you opened when you created the task.  I'm pretty usre the ULx library has it as it was modeled after DAQmx.  I just don't have tha library installed on this PC.

 

For multiple samples, click on the polymorphic selector below those VI's and you should see an option for N samples or multiple samples.

Message 6 of 20
(3,506 Views)

Initialize the tasks before the loop, then clear the tasks after the loop is complete.  Could you bundle all of your signals into one task?  That would make your code a lot cleaner.

 

 

 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
Message 7 of 20
(3,504 Views)

I'm not sure how to do the singals all in one task. I'm using a MCC usb daq...

0 Kudos
Message 8 of 20
(3,502 Views)

Ravensfan, does the polymorphic selector VI go inside my while loop? I get creating the channels everytime is dumb and that I need to do it outside the while loop, but which VI do I put outside the while loop? There's 2 VIs...

0 Kudos
Message 9 of 20
(3,495 Views)

Here is a starting point.  This is not a complete solution, but should give you an idea. 

 

Choose all of the AI channels you want to aquire with the "physical channels" control.

 

 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
Message 10 of 20
(3,492 Views)