01-24-2013 03:06 AM
I'm not sure I understand you. Is there any example to show this working in labview?
01-24-2013 11:15 AM
@Raw92 wrote:
I'm not sure I understand you. Is there any example to show this working in labview?
Do you understand what a shift register is? This is a key LabVIEW concept; see the help.
Here is my understanding of the sequence you are trying to achieve. Please rewrite this if incorrect.
1) User presses any button
2) System plays the main menu sound
3) User selects a menu option
4) System takes appropriate action for the selected menu option
Is this correct?
01-24-2013 12:51 PM
Yes that's correct and before the presses any button to bring up the menu there needs to be a loop that a) displays the current time and b) checks if it's time to turn on the heating.
See a problem I'm having is that in my program I have an event structure that registers if a button is pressed but it seems that I can't do that twice becaue they both seem to be looking for the same thing.
So you're saying that all I'm going to need is a shift register. I'm quite new to labview so I don't know what a shift register is and will need to try and find an example/ an explanation of what it is so I can implement it.
01-24-2013 01:06 PM
Again, a shift register is a fundamental LabVIEW concept. It lets you carry a value from one iteration of a loop to the next. You create one by right-clicking on the edge of a loop and choosing Add Shift Register. It would be well worth your time to work through some of the available online help.
01-24-2013 01:12 PM
Thanks again for your help. Looking through some examples now.
Going back to your last comment about using shift registers to define what state it's in. So I should be using a state machine in my program to seperate the first part of the menu and the second? Will that prevent my event structures from looking for the same thing?
01-24-2013 01:18 PM
You should have only one event structure. The shift register keeps track of whether this is the initial button press, or the second one.
The simplest case is you put store a boolean in the shift register, which you initialize to false. In the button press event case, you check that shift register. If it's false, then it's the first time a button was pressed and you should play the menu. Also pass a true value out of that event case and wire it to the shift register, to set the shift register to true. If the shift register value is true when you enter the event case, then the user is selecting a menu option and you should take appropriate action.
01-24-2013 01:40 PM
Ok and so this is what the event should look like? Obviously minus the LEDs in there
01-24-2013 01:55 PM
@Raw92 wrote:
Ok and so this is what the event should look like? Obviously minus the LEDs in there
The Event structure should be inside a While loop, and I'd use a case structure instead of lots of separate Equals comparisons. Without the LEDs and comparisons there's almost nothing inside that event structure, so I'm not sure what you're asking. It would be more helpful to show the entire program, since I still don't see a shift register anywhere (due to the lack of a while loop).
01-24-2013 02:11 PM
Still getting my head around how the overall layout of the program will look like. Going to work through what you have suggested tomorrow and see how I get on.
Cheers Nathan.