From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI starts normally, using an XControl Start button, but when I click the stop button connected to the Loop Condition, nothing happens

Solved!
Go to solution

I have a very simple app I created to demonstrate a few fundamentals to my students.  I created a really basic While loop that runs on a 100ms display.  I use 4 Quotient and Remainder functions to divide the iteration count by 36,000 / 600 / 10 and 1 respectively in order to create an hours/minutes/seconds/tenths display.  I wanted to show the students how much more elegant you can make an app, simply by adding a Start button, rather than using LabVIEW's Run arrow.

 

The problem is that, after adding the Start XControl, and placing my loop in a sequence structure and executing that sequence frame via the start button, the loop no longer responds to the Stop button. 

 

I'm sure it's simple, but I'm apparently sleep-deprived.  (That and short-term memory issues ever since November 2015 when I suffered a sudden cardiac arrest while running a Thanksgiving day race)

 

 

0 Kudos
Message 1 of 7
(2,344 Views)
Solution
Accepted by topic author DanNatCorning
  • We are missing the x-control, but what's wrong with using the run button?
  • Where did you get the x-control?
  • What would that be "more elegant"? It is not a common sight.
  • Instead use a very simple state machine where the VI is always running, but in an idle state it it is not supposed to be counting
  • All your indicators have the wrong representation
  • The sequence structure is completely unnecessary.
  • The last Q&R seems unnecessary.
  • Teaching simple loops and shift registers to avoid duplicate code is probably more important, see e.g. below. (Of course all this could be done more easily by using tools from the timing palette, but I guess you want to primarily show the integer math here)

100ms.png

Message 2 of 7
(2,339 Views)

Altenbach, you've provided quite a few helpful responses over the years, so I need to ask one more question.  Was there a bug up your butt Sunday, or it is personal?  Smiley Wink I'm not sure if you've ever taught students before, but sometimes in a basic intro class, you might not include the more refined methods, because they may only lead to questions that are well outside the scope of what you've been tasked with covering.   How about if I post a question in the future that you feel is beneath your dignity to answer that you just move along, shaking your head in amazement at my stupidity.  Smiley Frustrated Personally, I've never felt the need to blast others when they post a question that I feel has an obvious answer.  In fact, I love sharing what I DO know with others.  It's why I teach.  And I'm ALWAYS willing to admit my faults/weaknesses/deficiencies and ask for guidance from those smarter than myself.  In fact, that's what I did Sunday.  

 

If your're still reading, allow me to address your questions one by one.  

1.  Sorry about overlooking the fact that you would not be able to see the X-control that I created.  I based it on a video I'd watched online, posted by another developer (he must be an idiot too).  I saw the logic in creating a start button so that if a VI was deployed as an executable, it could be launched and then actually started when the user chose to start it.  

 

2.   I hadn't thought about the state machine in the role of an overall VI start button. It's a much more widely-accepted convention.  I haven't used them that much, and like I said, I'm always willing to broaden my horizons.  I VALUE what others can teach - I just tend to react negatively to being crapped on - probably a result of having served in the military for 11 years.  

 

3. Instead of chastising me about my indicators having the wrong representation, you might have just pointed out the fact that 64-bit is a waste of memory resources .  I overlooked it. Crap, rather than the 32-bit you suggested, 16-bit or even 8-bit would have been sufficient for the demonstration.  Seriously though, is it that much of a transgression when I'm trying to teach students in a basic data acquisition class that includes an intro to LabVIEW? 

 

4.  The sequence structure WAS completely unnecessary, except that it was necessary given the rest of the application that I removed before posting since I felt it just confused the issue I was seeking help with.  Amazingly enough, when I removed it and connected my evil X-control directly to the while loop, it worked perfectly (so thanks for that).  

 

5.  Man!  You were right about the last Q and R being unnecessary as well!  I probably would have done a better job if I wasn't hopped up on the muscle-relaxers that I have to take when back-spasms bring me to my knees (another reminder of my 11 years beating my body up on three ships).  Connected the Remainder terminal to that tenths indicator and voila!  Works like it should.

 

6.  And yes, you're right. I chose to do it this way in order to teach the integer math.  Your way is MUCH better and I was reminded of things I'd forgotten having been away from LabVIEW almost completely the last three years.  I just hope you'll continue using the opportunity you have to share your knowledge with others to...share your knowledge with others. I'm not in your class when it comes to LabVIEW development, but then again, I'd be willing to bet I could show you a few things in a wood shop.  And I would't cut your hand off to prove the saw is sharp.  🙂 

 

Thanks again for your help.  Seriously.

 

 

0 Kudos
Message 3 of 7
(2,285 Views)

I hope you feel better now. 😄

 

(I suggest you come back in a few days and re-read your post for a hopefully new perspective. At that time consider asking a moderator to remove it. Take care.)

0 Kudos
Message 4 of 7
(2,279 Views)

Incidentally, I realize that I32 is as low as I can go and still get 36,000 Smiley Frustrated

 

And honestly, thank you again 

0 Kudos
Message 5 of 7
(2,277 Views)

A few quick notes about the points:

 

  1. Since everything works if we delete the xcontrol, the problem is in the xcontrol, but we cannot troubleshoot that. I am curious: Do you have a link to the video or website? Xcontrols are quite tricky and mistakes are easily possible (For example if its code cannot complete). (LabVIEW NXG does not even have xcontrols, maybe for good reason!) For example, why is the output of the xcontrol wired to anything at all? Maybe it fails to complete, so even if the VI starts up, there is a data dependency, preventing the rest of the code to execute. Again, impossible to troubleshoot without the xcontrol. (but see also point #4)
  2. ..
  3. the iteration terminal is I32 and you cannot change that. If you want to do that calculation in I64, you would need to create your own incrementer in a shift register. The prototypical and most used integer in LabVIEW is I32, so if a terminal is U64, it means somebody must have had a good reason to manually change it. Students take everything at face value and they might get confused about the reason for (1) the red coercion dots and (2) the intentional type change. Of course this can turn into a good discussion topic. 😉
  4. that makes not a lot of sense, but again, I would like to test that with the xcontrol myself and do some research. Maybe there is a bug somewhere that would be nice to expose.
  5. OTOH, if you use a FOR loop like I did, that last Q&R operation is back in. Can't win. 😉
0 Kudos
Message 7 of 7
(2,259 Views)