LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using the value from one program to stop another program when that value rises aove a preset limit

hi,

I am running two programs through labview 5.0- one to read the resistance from an externall DMM using a GPIB and easy VISA read.vi, and the other to run a step motor. both these programare running simultaneously. I want the signal from the resistance program to stop the step motor when the resistance rises above a certain value. I had a program worked out as follows:

the multimeter-read program was run in a FOR loop ( for a hign value of N ,say 1000) and its output was given to a VI that compares resistance and outputs a toggle when the resitance rises above a certain value. this toggle woudl then stop the motor. but when I run this, the comp
are res vi does not get its input until the DMM loop has executed N times. hence what I am essentially sampling is just the last value of output resistance. how do I connect the two so that the output from the MM is continuously compared by the 'ompare res" vi thro' out its loop execution?

thanks
Lalitha.
I am also attaching a copy of the entire program for DMM, comparison andstopping the step motor.
Download All
0 Kudos
Message 1 of 12
(3,715 Views)
I was able to open only the step motor program. Based on your, I will recommend you try a WHILE loop. Do your comparison within the loop and include a condition that will enable you to exit the loop when resistance rises above predetermine value or when N is reached.
Message 2 of 12
(3,715 Views)
hi-

so do u suggest that I place the MM read and the compare in a while loop and place this while in a FOR loop? then would my step motor be placed inside the for loop or outside it?

if the MM is placed inside the for loop, I would have o actually run the motor in small increments, which is somethng I do not want to do. if it is outside , how do I stop the step motor when the while loop is exited?


I tried programming this using a FOR loop inside a while loop( I have attached a word doc containing the flow of data for this program), but when I wire the data from the FOR loop to the arrow of the while loop, I get error " bad wiring".

could u please suggest what I can do?

thanks very much,
lalitha.
0 Kudos
Message 3 of 12
(3,715 Views)
What I'm actually suggesting is that you replace the FOR loop with a WHILE loop. Find attached an outline of the proposed vi (LabVIEW 5.0). One other thing you can do is to post all your vi's for review where necessary. The earlier ones you posted seem to be missing some vi.
0 Kudos
Message 4 of 12
(3,715 Views)
If you want to control multiple VI, I recommend that you use global variables in combination with a while loop. That way, you can share data between the 3 windows...
Message 5 of 12
(3,543 Views)
hi,

thanks very much for the program. it compares the resistance values as reqd. but what also happens is when I send the true output to my motor program when the resistance is still less than the desired value - the motor program takes this TRUE value but waits to run. and when the resistance goes above the desired value , I am able to exit my while loop , but the motor now receives the FALSE output to stop without having started at all !

I tried putting the motor program in a case loop, this didnt seem to work.

also, I put the motor program in an outer while loop with the stop signal making both the inner and the outer while loop stop when the resistance is higher than what we need. while this makes the motor run at the st
art, it does not stop the motor when the resitance limit is reached because the while loop executes atleast once completely, so the motor runs to its full step size before it stops. so I wont have instantaneous control over motor movt this way.

I have attached a file of what I implemented. I think if this solved, the program shoudl work perfectly . can u please help me this ?

thanks so much,
Lalitha.
0 Kudos
Message 6 of 12
(3,715 Views)
I've implemented the test vi to use global variable to pass values (outcome of the resistance comparision) between your two vi's. My inital response assumes that you want to exit the WHILE based on the results of resistance comparision. Ignore the earlier vi that I posted, I apologize if I got you confused.

Use the attached three vi's to set-up your program. The controlling vi is the "main vi."
Download All
0 Kudos
Message 7 of 12
(3,715 Views)
hi,

ur logic makes sense to me - but when I implement the main program, the step motor does one of the two-

1. it fails to run when the resistance is below the desired value ( I made a small change in the greater than symbol here- because I want the motor to run when the resistance is above a preset value and stop when resistance falls below this)

2. when the resistance is higher than the limit ( which is when the motor shd run) the motor program begines to run , but does not stop- the STOP condition global variable value is not updated , bcos the MM read program is just executed once initally. as I see it , this shd not happen bcos while the motor runs , the MM shd also be read and its value simultaneously update
d acc to the main program.

what do u think could be the trouble now?

I really appreciate ur helping me back n forth over this , thanks very much,

lalitha.
0 Kudos
Message 8 of 12
(3,715 Views)
From my simulation I understand what is going on with our current logic. #2 occurs because we currently have a WHILE loop operating in the StepMotor vi. I will recommend we change the WHILE loop to a Case structure. Attached is a modification of the StepMotor vi. All the existing vi's remain as you judge they should be. I ran a simulation that shows everything should be okay now. Let's know what your results are when you try this.

Please pay attention to the logic conditions i.e. >, =, initial global variable value, and the main program WHILE loop stop condition to make sure they satisfy your program intent.
0 Kudos
Message 9 of 12
(3,715 Views)
hi

I could not open the file. error msg: "resource ot found. labview load error code 8: could not load vi resource". is this test program in LV 5.0? or am I missing something else here?

thanks,

Lalitha.
0 Kudos
Message 10 of 12
(3,715 Views)