LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write x y position and voltage to same file

Hi,

I've been writing a program to perform a 2D scan with stepper motors.  There are actually 3 in the program but only 2 perform the scan.  I have used a subvi to take 10 voltage measurements at each position in the scan.  What I'd like to do is record the X and Y position for each set of 10 voltage measurements.  I'm fairly sure I can record the position with the 'GetPosition' function for the motors, but am a little lost on how to get them to write to the same file, and whether or not those positions would correspond to the voltages taken there.  I have included my vi and the subvi used for reference.  If anyone has any suggestions on this problem I'd greatly appreciate it.

Cheers

RJ
Download All
0 Kudos
Message 1 of 6
(3,723 Views)
Before getting to the root of the problem that you described, you need to clean up all the race conditions because of the abusive use of Local Variables.
First modify your code by removing ALL the Local Variables.
 
R
0 Kudos
Message 2 of 6
(3,709 Views)

Just looking at a small portion of your code...  There's a lot of cleaning up to do.

Having a nested loop inside an Event case is a bad design.  You should change the architecture of the code to a Producer/Consumer loop with Data.  Using queues to send event information to the consumer loop which would be a state machine.  And there should be No Local Variable..



Message Edited by JoeLabView on 07-07-2008 08:29 AM
Message 3 of 6
(3,704 Views)
Aside from that could you help me with what I asked?
0 Kudos
Message 4 of 6
(3,695 Views)


rjwilliams wrote:
... I'm fairly sure I can record the position with the 'GetPosition' function for the motors, but am a little lost
on how to get them to write to the same file, and whether or not those positions would correspond to the
voltages taken there.
Well, this is a bit too diffuse. You seem to be writing to a file, but the code is nearly incomprehesible from a dataflow point of view.
 
If you are not sure if the file contais the correct values, just run the program, proble the wires, and look at the file later. You should be
able to tell if the are correct or not. Why should they be different? What values do you expect? What values do you get?
 
I agree with Ray that you NEED to cleaup the code in order to troubleshoot. Your code is just a bewildering jumble of code fragments,
trapped deep inside stacks of while loops and event structures, all tied together with confusing logic.  All you need is a simple state
machine with one while loop containing one event structure.
 
 


Message Edited by altenbach on 07-07-2008 07:48 AM
Message 5 of 6
(3,665 Views)
well I figured out how to do what I had wanted but ran into some problems...took your advice on cleaning up the program and it solved my problems, so thanx guys!
0 Kudos
Message 6 of 6
(3,653 Views)