03-13-2009 07:53 AM
I have a triangular select function with its output wired to a shift register in a state machine. The shift register is then used to set the case selector to determine the next case to flow to. The inputs to the triangular select function are T: value of 10 and F: the value in the shift register after being incremented by 1 so it can go to the next case ?: a Boolean flag that lets me know if another parallel loop is running. The question I have is when the flag is True how does it flow to case 10 when I only have 9 cases in that state machine? Will I get an error or will the state machine just end?
Solved! Go to Solution.
03-13-2009 08:07 AM - edited 03-13-2009 08:08 AM
03-13-2009 08:15 AM
03-14-2009 03:08 PM
If you wire a selector to a case structure and no corresponding case for that selector exists, the case structure will execute the default case.
So: if your flag comes back "T" and feeds a value of 10 to your case structure (for which no case exists), the default case in your case structure will execute.
The point of having a default case is to handle situations exactly like the one you describe, and LabVIEW forces you to either define a case for every possible value, or to designate a case as the default.
03-16-2009 09:10 AM
03-16-2009 09:20 AM - edited 03-16-2009 09:20 AM
Your default case is the one that is labeled 'Default'. You can select any case and right click and select "Make This the Default Case".
03-16-2009 09:26 AM
BME genuis wrote:
I am using Labview 5.1.1.
That makes a big difference. Not sure, but I don't think default cases were supported in 5.1.1. If I remember correctly, if the case structure was driven by a numeric value, and you sent a value larger than the largest value, then the last case would be executed.
03-16-2009 09:57 AM
03-16-2009 10:05 AM
BME genuis wrote:
.. need to verify what happens when you send a value to a case selector that has no case for that value.
You can easily do this by running your code in highlight mode (the lightbulb in the toolbar). You will see the value of the wire and you will see which case gets executed. The LabVIEW manual explains how to do this.
03-16-2009 10:26 AM