LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Beginner question re: case structures

Solved!
Go to solution

Hi NIquist,

 

I've spent a lot of time on Google, and NI's site searching, & definitely did not come up with pages of examples. I found a few, but they all seemed rather complicated to me. Maybe this is just a complicated project for a newbie to attempt? I absolutley wouldn't just copy some code, as I really want to understand what is going on under the hood. Along with the VI, I need to submit a .doc explaining how all of my code works, and why I chose to program it the way I did. I'm a middle aged guy back in school trying to learn a new trade, so not having any prior programming experience is slowing me down a little I feel.

 

I appreciate all of the help, and will continue to search for some explanation(s) that make sense to me. The event structures lookd interesting to me because they seemd to trim some of the fat off of just using case structures, but again, I really don't know what I'm talking about. I have seen a couple of examples using ques, and I don't understand how those work yet.

 

Thanks again for taking the time to post, I appreciate it!

 

George

0 Kudos
Message 11 of 37
(2,087 Views)

I've been using LabVIEW since version 3 and I almost always use event structures (though they weren't available until version 6.1 I think).

"If you weren't supposed to push it, it wouldn't be a button."
Message 12 of 37
(2,060 Views)

Hi Paul,

 

Here is what I have so far. I just need a shove in the right direction...

 

Thanks,

 

George

Download All
0 Kudos
Message 13 of 37
(2,050 Views)

@gsrokmix wrote:

 

Here is what I have so far. I just need a shove in the right direction...

 


  • When taking money, keep taking money until the amout is sufficient (use a select node wired to the comparison to either go to a new state or stay in the same state).
  • Your loop needs a wait (e.g. 100ms). There is no need to spin the loop millions of times per second
  • Your bottle selectors should be latch action, especially if all items cost the same. This way the button will reset after each bottle displense operation.
  • Keep the total amount entered in a shift register.
  • I think you have way too many states.
  • You could make the coin counts an integer array to be multiplied with an array constant of unit coin values in cents followed by "add array elements". It seems more normal to do integer math. You can divide by 100 for the final DBL display.)
  • ...
0 Kudos
Message 14 of 37
(2,022 Views)

You missed something.

 

You have LabVIEW 2015 (I can tell from the vi properties) yet, you misssed all of the information available from the create project from template dialog!  This is a major mistake!

 

From the "Getting Started Window"  Menu >>View>>Getting Started Window  Select the BIG button that reads "Create Project"

Capture.PNG

There is a reason why those "More Information" hyperlinks are bold!  Go there!  we will be happy to help clarify any points you don't fully understand from that source.

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 15 of 37
(2,003 Views)

Hi Jeff,

 

Thanks for pointing that out. I feel stupid for not seeing those options before. We have only been creating VI's in my class, and haven't dove into projects yet. I like that there are notes all over the code to help you through. That is the kind of help I think I need.

I'm sure I'll have more questions, and I thank you again for your time / help.

 

George

0 Kudos
Message 16 of 37
(1,995 Views)

Thanks altenbach,

 

Those are great suggestions. I will try to figure out how to impliment them.

 

Thanks again,

 

George

0 Kudos
Message 17 of 37
(1,991 Views)

@gsrokmix wrote:

Hi Jeff,

 

Thanks for pointing that out. I feel stupid for not seeing those options before. We have only been creating VI's in my class, and haven't dove into projects yet. I like that there are notes all over the code to help you through. That is the kind of help I think I need.

I'm sure I'll have more questions, and I thank you again for your time / help.

 

George


No problem!  Post those questions as soon as you have them!


"Should be" isn't "Is" -Jay
0 Kudos
Message 18 of 37
(1,990 Views)

Hello again,

 

So after struggling to figure out how to program the machine the way I really wanted, I changed my criteria somewhat to make things simpler, and give me a working model that at least works....kinda sorta...... 🙂 I just could not figure out how to use the case / event structures to get the functionality I was looking for. I gave up on the state machine model for now, and zoomed out a bit in the interest of making some progress.

 

The machine functions, but there are a few issues I'd love to sort out.

 

Currently, after the minimum amount of money is entered, and the selection is made, the machine (just sitting there in its current static state) will allow the user to keep "buying" more soda without entering more money. I understand this is where the case structures would come into play. The amount of change displayed (if any) will also stay in the indicator until the entered amount is changed.

 

One big thing I wanted to implement, but couldn't figure out, was to make each of the 5 selections, cost a different amount of money. Again without the state machine model, I just couldn't figure out how to do this.

 

Also since I have used a photo as my background, and placed all of my controls, & indicators on top, if the front panel window is resized at all, everything is shifted, and looks terrible. I tried to find out how to compile, or make the VI a stand alone app, but I couldn't figure out how to do it. Is this one of the features not included with the Student Edition of Labview? I did change the prefs as to not allow someone to resize the window, or to have scroll bars, but I believe this only works while the VI is running?

 

I have attached the current version of my machine. If there is a way to use most of my existing code by integrating it with the case structures I couldn't figure out, that would be great. Again because of my lack of knowledge, I don't know if this is possible.

 

Thanks so much again in advance for any help and / or advice. I am really hoping that maybe with a small example of what I'm missing, things will "click" and I can complete the project the way I had hoped. Please know that I'm not asking for the work to be done for me, but we have not covered case or event structures at all in class, & I am having a hard time figuring them out on my own.

 

Thanks!

 

George

 

0 Kudos
Message 19 of 37
(1,963 Views)

What do you think would change if you remove that select node and just keep the boolean wire?

 

(see also)

 

0 Kudos
Message 20 of 37
(1,946 Views)