LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

output for loop iteration

Solved!
Go to solution

You are getting the error message when you try to iterate your loop more than once because you create your tasks inside the loop, but don't clear them until after the loop is finished executing.  Create your tasks outside the loop.  Run them inside the loop.  Stop and clear them outside the loop.

 

BTW, what is that empty sequence structure for?

Message 11 of 28
(2,615 Views)

Yes, and no. 

 

That was part of the code, which was to loop my array. And that part is solved in that thread.

 

 

However, when I combine it with the rest of the code (in the vi attached) i get an

error, so I though that instead of putting the code all inside the For Loop I could use the

value of each iteration (not possible according to answers in this tread) and place the rest of the code outside of the For Loop.

 

So I'm back with the code inside the For Loop. Getting an error 200010... I think it's a buffer problem.

 

Just don't quite get out to fix it.

 

Hope I have not reposted.

 

Cheers. 

0 Kudos
Message 12 of 28
(2,614 Views)
It should look something like this.
Tim
GHSP
0 Kudos
Message 13 of 28
(2,611 Views)

The empty structure, I used from examples that I got by searching the forum. But

if it's unnecessary, than I will remove it.

 

By the way, the "write" and "read" vi's should be inside the loop, only the tasks created (DO,DO, AI) stay on

the outside, correct?

 

Rsilva 

0 Kudos
Message 14 of 28
(2,609 Views)

aeastet i'm using version 8.5.

 

 

could you upload it again, please?

 

 

cheers 

0 Kudos
Message 15 of 28
(2,602 Views)
Solution
Accepted by topic author Rsilva
Here is 8.5
Tim
GHSP
Message 16 of 28
(2,596 Views)

I believe this is it.

 

Not sure about the AI Read being out of the cycle because I need to read 16x14 measurements

but it's close enough, since my doubts were about the For Loop.

 

 

I might need to read more about arrays and loops.

 

 

Anyway, thank you aeastest and DianeS

 

Cheers!

0 Kudos
Message 17 of 28
(2,564 Views)

Ah, may I ask a question with regards to your analog acquisition?  (apologies for chiming back in late, I've been onsite for a client all day...and sorry for missing this on the first go 'round)

 

Your sample clock specifies that you want to collect 1000 samples, at a rate of 1kHz.

 

Your "Read analog input" function is set to "N channels 1 sample".

 

That means you're only reading one sample per channel.  Not 1000, as your clock configuration would indicate.


If you want to read 1000 samples per channel, you need to use "N channels N samples".  Your output will be a 2D array, containing 1000 samples for each channel.

 

If you're only reading one sample per channel, what do you need a sample clock for?  Stick the "Read analog input N channels 1 sample" inside your FOR loop, but get rid of your sample clock configuration.  You don't need hardware timing to read a single sample.

 

In other words, if you really only want one sample per channel and you want your analog input read to be synchronized with your digital output, do it as shown in the attached VI.

 

Sorry if this is irrelevant, but you did express a concern with having those acquistions synched with your digital write.

 

 

Message 18 of 28
(2,551 Views)

No need to apologize DianeS! I'm thankfull to you for taking the time to clear my doubts.

 

I have one request. Could your upload to version 8.5?

 

Thanks you.

 

RSilva 

0 Kudos
Message 19 of 28
(2,525 Views)

Sure, here you go.

 

 

0 Kudos
Message 20 of 28
(2,513 Views)