09-03-2019 04:13 PM
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.
09-03-2019 08:57 PM
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.
09-04-2019 08:47 AM
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.
09-04-2019 08:59 AM
I divided it by 2 just to made it smaller. That's not necessary.
09-04-2019 02:02 PM - edited 09-04-2019 02:03 PM
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?
09-04-2019 02:13 PM
I'm really sorry for my misunderstanding. I check the wire and it returns no error.
09-04-2019 02:30 PM
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?
09-04-2019 02:32 PM
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?