LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display a message to a user in a while loop

Solved!
Go to solution

Hello.  I have been using Labview for about 4 days and I will preface this by saying that this is for a homework problem, so I am not looking for an exact solution just someone to point me in the right direction.  I need to display a message to a user.  The problem is that since it is inside a while loop, when the condition is met for the notification to display, it just keeps coming back up and never lets the user change the values to correct the problem.  It should be pretty apparent what the vi is supposed to do by looking at it, and everything else works fine, until I put the message into it.  As an aside, I know that there are probably much better ways to accomplish the tasks that I set out to do for this, but like I said, I am completely new to LabView, so I apologize to the more elegant programmers out there for my brute-force programming!  I have searched the forums and found a couple of things regarding case statements and shift registers, but I have no idea how to use them.  I have been working on this part of the problem for hours now and am getting nowhere, so any help will be really appreciated.

0 Kudos
Message 1 of 5
(3,652 Views)
Solution
Accepted by topic author christopherbrown0317

Welcome to the Forums!

 

First, thank you for pointing out that this is a homework problem. We do mind helping people learn LabVIEW but do object when someone tries to get his homework done for him.

 

Case statements and shift registers are probably what you need to learn next. Specifically, a state machine is probably well suited for this kind of program. I think your version of LV came with a templat or Design Pattern for a state machine. Look under the File menu >> New.. (Not New VI) and see if you can find a state machine template.

 

Other comments:

- If you are not going to use an event structure, then put a Wait (ms) inside the loop so it does not spin thousands of times per second doing exactly the same thing every time until the user changes a control.

- In Range and Coerce? will do the comparison and Select at the bottom left and upper right parts of your VI.

- Coercing the Amount Inputted to the nearest 5 cents is OK but may be confusing to the user who tries to enter 3 cents. A note on the panel or a tip strip for the control might be helpful.

 

Lynn

0 Kudos
Message 2 of 5
(3,628 Views)
Lynn,
Thank you for the reply. I guess I will be off to take a look at shift registers. I am surprised that there isn't an easier way to accomplish this since it is my first assignment and I have never used the program before! Thank you again. I will be sure to come back and mark as solved when I figure out how to do it. Thank you!
0 Kudos
Message 3 of 5
(3,611 Views)

@christopherbrown0317 wrote:
I am surprised that there isn't an easier way to accomplish this since it is my first assignment and I have never used the program before! 

Shift registers ARE the easiest way. Nothing complicated about them 😄

0 Kudos
Message 4 of 5
(3,507 Views)

I just wanted to thank you again for the help.  I found out from my instructer that it is okay if the program stops running and you have to manually rerun it after getting the error message (I know that isn't how it would be done ideally, but we are beginners).  We arent going to learn anything about shift registers until the fifth week of class, but now I will have a heads up on them so I appreciate that.  I ended up just using some logic gates to exit the while loop and end the program when the condtions are met for the message to display.  Not very elegant, but it will get the job done for this assignment.  Again, thank you so much for your help.  I'm sure I will be back.  I am going to mark your solution as the one I used, because I understand how it could be done with shift registers and a switch statement now, I just didnt have time to implement it before the assignment was due!

 

Chris

0 Kudos
Message 5 of 5
(3,459 Views)