LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping a For Loop, part 2

Hello. Thank you everyone for your help, getting to this point. I asked for help to create a stop condition, while a For Loop is running. I was given many ideas and selected the one that used local variables. It works well however, if I am in the "Test in progress" state, in the first For Loop, and the "Stop" button is selected from the front panel, when it stops the Vi, it sends the value "5" to the second For Loop before going to the "End" state, which puts it to "0", then stops the Vi. What this Vi is doing is feeding 0-200VDC signal to an eddy current sensor, then it feeds 200-0VDC going the other direction. I have tried sequencing, putting in timers and a few other goofy things but I can not get the Vi to stop in the first For Loop, without the Vi performing the initial "5" to the second For Loop. Someone had mentioned using an event handler, in my previous post. I practiced for quite some time, trying to understand how to use an event handler but am not much the wiser. Any and all input would be greatly appreciated.

0 Kudos
Message 1 of 14
(3,039 Views)

Do you want any help?

1. Did not include all of the VIs.

2. Gave us a password protected VI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 14
(2,997 Views)

@crossrulz wrote:

Do you want any help?

1. Did not include all of the VIs.

2. Gave us a password protected VI.


1. Did not include all of the VIs. I will try again

 

2. Gave us a password protected VI. Oh no, sorry about that. It's "2015"

0 Kudos
Message 3 of 14
(2,990 Views)

@ceilingwalker wrote:

@crossrulz wrote:

Do you want any help?

1. Did not include all of the VIs.

2. Gave us a password protected VI.


1. Did not include all of the VIs. I will try again

 

2. Gave us a password protected VI. Oh no, sorry about that. It's "2015"


I hope I did it right this time, with all the sub Vi's

0 Kudos
Message 4 of 14
(2,974 Views)

Why is the entire front panel locked down?

 

You are autoindexing way too many thing between the two FOR loops. If you don't want the second loop to run when the first one is ended prematurely with the stop button, put it in a case structure.

 

Message 5 of 14
(2,972 Views)

OK,

This is one of those times I will "Chime in"  and, you might wish to duck... duck "Grey duck"

 

Yes, I have also used angle worms and made a hot-dish in a cassarole.  Just making the text blue does not attach the files!


"Should be" isn't "Is" -Jay
Message 6 of 14
(2,964 Views)

@altenbach wrote:

Why is the entire front panel locked down?

 

You are autoindexing way too many thing between the two FOR loops. If you don't want the second loop to run when the first one is ended prematurely with the stop button, put it in a case structure.

 


You are autoindexing way too many thing between the two FOR loops I was doing this to create a data dependency, at least that was my thought process behind it. As far as the physical channels and VISA refnums, I did it this way so I didn't create more controls for the front panel. Being my first project, I am very certain my logic is flawed, this is why I like posting here and getting feedback from

 

 If you don't want the second loop to run when the first one is ended prematurely with the stop button, put it in a case structure I tried a Case structure for the second For Loop. I couldn't find a way to change conditions that didn't affect the Vi's overall performance.

0 Kudos
Message 7 of 14
(2,956 Views)

@altenbach wrote:

Why is the entire front panel locked down?

 

You are autoindexing way too many thing between the two FOR loops. If you don't want the second loop to run when the first one is ended prematurely with the stop button, put it in a case structure.

 


Why is the entire front panel locked down?  Sorry Sir, I missed this one on my previous response. I locked things down so they couldn't be edited. I thought that's what the lock function was for. When I would try to select certain entities to edit, it would also select background items I didn't want selected. Is this not the purpose of the Lock function? Smiley Embarassed

0 Kudos
Message 8 of 14
(2,949 Views)

@ceilingwalker wrote:
You are autoindexing way too many thing between the two FOR loops I was doing this to create a data dependency, at least that was my thought process behind it. As far as the physical channels and VISA refnums, I did it this way so I didn't create more controls for the front panel. Being my first project, I am very certain my logic is flawed, this is why I like posting here and getting feedback from

 You have many visa sessions that (hopefully) never change during the execution of the loops, so why woold you turn them into an array of 11 identical elements just to autoidex them out again at the next loop. Change the tunnels to no autoindexing and things would look cleaner. Why are these session controls inside the loop? Are you expect them to be changeable during loop execution or would that screw up the results?

 

Wounld't it be easier to simply create an up&down ramp once and use a single FOR loop, autoindexing on the ramp? You have way too much duplicate code!!!

 

 If you don't want the second loop to run when the first one is ended prematurely with the stop button, put it in a case structure I tried a Case structure for the second For Loop. I couldn't find a way to change conditions that didn't affect the Vi's overall performance.

 

Then show us what you tried! That should be trivial to implement. Why would a case structure affect performance? Makes no sense!

 


 

 

Message 9 of 14
(2,944 Views)

@altenbach wrote:

@ceilingwalker wrote:
You are autoindexing way too many thing between the two FOR loops I was doing this to create a data dependency, at least that was my thought process behind it. As far as the physical channels and VISA refnums, I did it this way so I didn't create more controls for the front panel. Being my first project, I am very certain my logic is flawed, this is why I like posting here and getting feedback from

 You have many visa sessions that (hopefully) never change during the execution of the loops, so why woold you turn them into an array of 11 identical elements just to autoidex them out again at the next loop. Change the tunnels to no autoindexing and things would look cleaner. Why are these session controls inside the loop? Are you expect them to be changeable during loop execution or would that screw up the results?

 

Wounld't it be easier to simply create an up&down ramp once and use a single FOR loop, autoindexing on the ramp? You have way too much duplicate code!!!

 

 If you don't want the second loop to run when the first one is ended prematurely with the stop button, put it in a case structure I tried a Case structure for the second For Loop. I couldn't find a way to change conditions that didn't affect the Vi's overall performance.

 

Then show us what you tried! That should be trivial to implement. Why would a case structure affect performance? Makes no sense!

 


Why would a case structure affect performance? Makes no sense! I used a boolean operator to change the state. When I used a false, it worked for that problem but shut down my Vi before the second For Loop. 

 

Wounld't it be easier to simply create an up&down ramp once and use a single FOR loop, autoindexing on the ramp? You have way too much duplicate code!!!  I tried using one For Loop to begin with but because I had to ramp up, then ramp down, I couldn't figure out how to use just one. I needed an Add function for the ramp up and a Subtract function for the ramp down.

 

Why are these session controls inside the loop? Are you expect them to be changeable during loop execution or would that screw up the results? No Sir, the values are not changed during operation. I did this because I wanted it to display the data on the front panel, during operation of the Vi. For display only.


 

0 Kudos
Message 10 of 14
(2,916 Views)