LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save data in while loop to array

Solved!
Go to solution

Hi everyone. I'm trying to output the results in the while loop via an AO port. But I could only output the first data in the loop. I don't know where I go wrong. 

Any feedback could be helpful.

Attached is my code.

Thanks.

 

0 Kudos
Message 11 of 18
(1,233 Views)

Are you getting any error messages?

 

What kind of value is being written to the analog output?

 

I see you calculating a value for center of gravity and dividing it by 2.  Then writing that value to the analog output?  What is the result of that calculation?  If that value is outside the range of 10 to -10, then you will get an error because you are writing a value of CG into a function that expects a value in Volts, and a voltage that is in the range of what it can put out.

0 Kudos
Message 12 of 18
(1,176 Views)

I didn't receive any error message.

 

The result is not divided. I add "sum" and "multiple & sum" just to check the calculating process. The "center of gravity" is what I need.

0 Kudos
Message 13 of 18
(1,156 Views)

I divided it by 2 just to made it smaller. That's not necessary.

0 Kudos
Message 14 of 18
(1,149 Views)

I cleaned up your VI to get rid of your backwards running wires.

 

You say you aren't dividing?  That is not what I see?  Check the notes I placed in the snippet!

 

Have you done any probes to see what values are on the wire?  Specifically the error wire and the double that goes into the DAQmx Write?

 

0 Kudos
Message 15 of 18
(1,137 Views)

I'm really sorry for my misunderstanding. I check the wire and it returns no error.

 

Capture.PNG

0 Kudos
Message 16 of 18
(1,126 Views)

And what is the value on that orange wire going to the DAQmx Write?

 

And to go back to your original question where you said "But I could only output the first data in the loop".

How do you know it is only outputting the first data?  What is your evidence that something isn't working right?

 

 

0 Kudos
Message 17 of 18
(1,117 Views)

I delete the DAQmx Timing and the vi runs well.

 

I suppose the problem is that the clock could only serve one AO, one AI?

0 Kudos
Message 18 of 18
(1,115 Views)