LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview 7.1 execution

I am woking on a lbaview program in 7.1 I enter a contorl number into a loop and it executes that loop that many times to drive
a stepper motor.  I want to have the ability to when that loop finished executing i wnat ot have it sitting there waiting to put in another
value to run it again if user desires.  There are varibels that change when this happens wihtin and outside the loop.  I want the next time
it executes to continue to change those values from their previous state.  I want this to continue happeing until the user desires for this
to stop. 

How can i do this?

andrew
0 Kudos
Message 1 of 8
(2,721 Views)

Hi Andrew,

Have you tried using event structures for your applications?  According to the LabVIEW Help, “event structures have one or more subdiagrams or event cases, exactly one of which executes when the structure executes.  The Event structure waits until an event happens, then executes the appropriate case to handle that event.”

I think that this may be what you are looking for.  If you would like more information about event structures and how to use them, please take a look at this.

If I have misunderstood your application and event structures are not what you are looking for, please do not hesitate to let me know by replying to this post and explaining your scenario again.  I’ll be more than happy to assist in finding another solution.

Best of luck on your application, and have a great day!!

Regards,

Regards,
Ching P.
DAQ and Academic Hardware R&D
National Instruments
0 Kudos
Message 2 of 8
(2,698 Views)

Yeah it sounds like you know what i need.  I have never used event structures before. I am sending an attachment of my code so you can see what i am talking about.  When i run the pogram a second time i loose all my value i got after the first run.  The user wants to be able to enter a new number of steps as many times as like.  Each time the loop executes i need to keep the local varible for push volume and pull volume to change as well.  They way i have it set up right now it jsut keeps that first value and the next time i run it this value goes back to zero.

It is a user specification that it continue to run when new steps are entered on the user interface.  And the way i have it i am having problems keep the varibel up to date.  I believe that and event structure should help me with this.

any help would be appreciated.

andrew

using labView 7.1

0 Kudos
Message 3 of 8
(2,687 Views)

Hi Andrew,

The first thing I noticed is that  none of the values you would like to read constantly are being read in a loop.  The way you have your code written currently, the values are only read the first time the program is run. 

If you place all of your code in another while loop, you will be able to read the values of those inputs as they change, but you may run into some other issues.  Please take a look at this KnowledgeBase Article for more information on nested while loops.

If you have any further questions, please do not hesitate to reply to this post.  Best of luck on your application, and have a great day!!

Regards,

Regards,
Ching P.
DAQ and Academic Hardware R&D
National Instruments
0 Kudos
Message 4 of 8
(2,668 Views)

i dont see how my values are only being read the first time.  I want a continous reading because when it executes that first loop i want it to sit there and wait until more numbers are entered in the step number control.  And then use the values before and continue on with those.  I dont see how this can be done?

I wnat it to keep doing this until a stop button is pressed to exit the whole thing. 

I tired using event structure to chek for a change of value event at that control.  This works but the value is still the same as if i ran the code for the first time.

andrew

0 Kudos
Message 5 of 8
(2,662 Views)
I think you are not understanding some basics of how LabVIEW works. You've got three controls on the front panel that setup your acquisition (and one hidden control that can be replaced with a constant). After you set those, you hit the run button on the tool bar, the appropriate while loop runs, finishes, and the VI stops. At the same time that you hit your run button, the code you have at the bottom of your VI executes. It reads the local variables (whatever they might be at that time) and updates the indicators. It then stops and doesn't do anything until you hit the run button again. So, not only does it run only once, it runs with bogus data. You have to think data flow. If you want the tank indicator to remember the last value, you need to pass the data out of the while loop with shift registers and don't ever use local variables in this manner.
0 Kudos
Message 6 of 8
(2,650 Views)
I have fixed those problems that you were talking about. 
 
Now I am trying to use shift registers to store the value with no luck.  I have tried it like several different ways and i can not get it
to keep the old value. Tried initlizing it first and tired using the start call function.  Each way I set it up it still only stored the value of that
particular run.  I have it in a event case now where it should run again when the value in the number of steps control is changed.  That works fine but i need the values to continue adding up or subtracting if need be untill the program is stopped completly. 
 
I also need a auto zero to set the value to zero if need be.  The way i have it now it will not work until the execution that it is on has finsihed.
 
I need help please.  This is for my Senior Design project.  The examples online dont really work for my program becasue of the case statement i think.
 
andrew  
0 Kudos
Message 7 of 8
(2,637 Views)
You are effectively not doing anything with your shift register.  A shift register holds the value of the wire, and then passes it back into the next iteration of the loop.  But you have nothing happening with the shift register as it enters the loop from the left.  You want to use that shift register to add or subtract your volume to that on each iteration of the loop.  I'm not completely sure what sure what you are trying to do with this program, but it may be necessary to add a shift register to your outer most loop as well.
 
Your Autozero2 button AND true is redundant.  Just wire the autozero button directly to the case structure.  Also, the autozero button is kind of lost to the lower right of the front panel.
 
I'm not sure, but you may want to move this structure inside the main inner loop.  Or add the autozero button as another event to the event structure.
 
You could set your array constants to be of I8 instead of I32 so that you don't need the I8 typecasting function.  But these should actually be U8 because your DAQmx write says it is looking for unsigned 8-bit integers (U8).  Whenever you see red dots at a wire going into a node, that means that the data is being coerced into another data type.  And that means there is usually a better way to represent the data somewhere upstream on the wire.
 
One more thing "syringe" not "syring".Smiley Wink

Message Edited by Ravens Fan on 04-05-2007 12:01 AM

0 Kudos
Message 8 of 8
(2,634 Views)