Building a case structure with four boolean (true/false) inputs.

I currently have two boolean inputs that I would like to use to select cases in a case structure. I would like to have four cases, each one dependent on the true/false condtions of the two booleans. If boolean 1 =true, then case 1 should be used, if boolean 2=true, then case 2 should be used, etc.
What structure should I use to convert these boolean inputs into numeric cases?

Or build them in to an array and "Search 1d Array".  If you are only looking for a single bool being true, this would be easier because your cases could be {0,1,2,3} instead of {1,2,4,8}

Similar Messages

  • Case structure with more than 200 cases, slower lab view app

    Problem Description :
    i am currently making a vi which compose of a simple case structures, a case structure with more than 200 cases, what i noticed is that the more i added cases the slower the labview reacts, it takes time for me to route wire on each of the cases.
    i dont know if there are any setting in the labview environment that i can increase the buffer size? i dont know... but its getting slow (only on the
    vi with more cases in a case structure)
    mytestautomation.com
    ...unleashed the power, explore and share ideas on power supply testing
    nissanskyline.org
    ...your alternative nissan skyline information site

    Can you clarify what you mean by "slow". Does it run more slowly or does it feel sluggish during editing?
    Could you attach the actual VI?
     Overall, I agree with the notion of local variable overuse. For example, you read the same local variable twice in the same case. Is there a need for this? Is there a chance that it varies between the two reads? Typically, you would place the terminal in front of the case structure and wire to all the locations where you need the value. This ensures that the data is consistent. Still, this should not cause any slowdown problem.
    (On a sidenote, the code in the upper left corner is inefficient. You convert the same data to lower case with each iteration, so you might want to place this before the loop and do it only once (well, if you are lucky, LabVIEW will fold the operation, but still....). Also your "index array" operation can be replaced by autoidenxing of the 2D array on the outer loop boundary.)
    LabVIEW Champion . Do more with less code and in less time .

  • Execute Case Structure with Button Press Slows Down VI

    Hi -
    I'm fairly new to LabView, and I am having some issues with using a button to run a timed while loop.
    I am writing a VI that outputs a timed voltage pulse to an output channel on a DAQ; meanwhile, the VI reads and graphs the voltage on three input channels on the DAQ. When I use a timed loop that automatically executes when the VI runs, the program works. However, I would like to include a button so I can control the timing and number of voltage pulses sent to the output channel, instead of sending only one voltage pulse each time the VI runs. I have tried to do this using a button wired to a case structure. If the button is 'true,' the VI should send the voltage pulse. If the button is 'false,' the VI should keep the voltage at zero.
    When the button is 'false,' the VI runs normally; however, when the button changes to 'true,' the VI slows down and never sends the pulse. Why does this happen? How can I fix it?
    Also, how can I send the voltage pulse only when the value of the button changes?  I only want the timed loop to execute once when the button changes value.
    Thanks for any help or advice!!!
    Attachments:
    Sensor Read6.vi ‏85 KB

    The graph is in the same while loop as the case structure.  The while loop won't iterate until all the code inside of it has completed.  So the graph only gets updated once, and won't update again until the while loop iterates again.  If you need more continual updating you may want to put that in a loop that executes a couple of times, or completely separate your code into 2 while loops.  Is it that long of a wait considering your pulse length is 1 second?
    Your analog output code is just writing a voltage out (7 volts) until it eventually writes out 0 volts.  There is no reason for it to drop down unless you have some sort of electrical problem between your DAQ device and the device on the other end that is reading the 7 volts.  What are you connecting that analog output too?
    What if you don't use LabVIEW and try to test out that analog output using Measurement and Automation Explorer?  Does it do the same thing?

  • How about an Error Case structure with warning?

    Hi,
    while wiring some vis and thinking about error handling....
    In most cases the simple case structure feet by the error cluster will do the job. However in some cases when you deal with warnings, wouldn't it be nice to have an additional (optional) warning case that is true for a not empty source string and/or an error number?
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

    I forget to mention: Of course there is a solution possible by unbundling the cluster and check the error number and string followed by a case. I still remember the time when the case selector couldn't handle the error cluster ... (started with LV3.1 )
    I just thought it would be a nice thing when you wire the error cluster to the selector and get the red and green case and you can right click, add a case and get a yellow(?) case named 'warning'
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'
    Attachments:
    Example_BD.png ‏2 KB

  • Case structure with two selectors

    Hi all
    Once again I'm wondering...
    ...if it is possible to wire more than one value to a case structure. I'm just working on a project and came to a point where I have to nest case structures. I have two enums and depending on both enums I set a value.
    How would it be to have more selectors so that the following code extract could be "drawn" with just one case structure?
    enum X1 = {manual, auto}
    enum X2 = {red, green}
    if(X1 == manual && X2 == red)
    else if(X1 == auto && X2 == red)
    Maybe something useful for new LV versions, if it does not exist yet.
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...

    @David - Great solution. I might remember it one day .
    @Shane - You could have given me at least "en stutz" . Well, I see your point, but in every textual language exists this possibility. Although your argument is acceptable (the compound enum), I prefer to have enums without combinations. Ok, maybe the values would make some sense, but I like it better if they are separate. In addition, what should I do if one input is an enum and the other a boolean? And now don't say "use DavidCrawford's solution" .
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...

  • How do I use a Case Structure with Strings?

    I need to use a string list to set up a set of cases to be performed. Is it possible to tell a single case structure to do "a, b, c, and d, but not e or f" or "do a, c, d, and f, but not b or e" etc... when you use a string containing the cases to be used?

    Blackavar,
    A case structure will only execute a single case at a time. If you want to have multiple cases execute in parallel, then you would need to have multiple copies of the case structure and split the string apart and wire them to all of the needed case structures.
    This could be done with reentrant subVIs to run truely in parallel. Anther method would be to have 6 different case structures, all with 7 cases each. The 7 cases would be "a", "b", "c", "d", "e", "f", and "0". Your input sting will need to be built up so that it will always be 6 characters long and then split up so that each character goes to one of the case structures. You would have your needed code for cases a - f. Case "0" would do nothing.
    Randy Hos
    kin
    Applications Engineer
    Nationsl Instruments
    http://www.ni.com/ask

  • CASE STRUCTURES WITH TAB CONTROL

    Hi,
    I have created  tab controlled  case structures for three different cases,
    Tablet type
    Machine Input
    Output
    It seems that data is not interlinked while switching betweeen the cases.
    I have to select the start buttun for each tab to get results.And also if I skip the second tab and jump to third tab, it doesnot give results. SOmehow the data is not acquired.
    Can anyone help me out for the same.
    Attached is the main VI (PAR_LAB_ATT_00_01)followed by a sub VI(gen time array)
    Thanks
    Sumit
    Attachments:
    PAR_LAB_ATT_00_01.vi ‏200 KB
    Generate Time Array.vi ‏15 KB

    Please don't use all CAPS when posting your message subject.
    How are you running your VI?  I don't see any while loop in it, so it only runs once.  Which means only the case structure associated with the tab that is currently highlighted before you press the run button will actually run.
    The vast majority of the time, a tab control is only used to control what is displayed in the front panel and is not used to actually control the execution order of the program.
    I would recommend looking at the online LabVIEW tutorials
    LabVIEW Introduction Course - Three Hours
    LabVIEW Introduction Course - Six Hours

  • Modify Case structure with VI Scripting

    This is possible:
    you need a file, where only a case structure is on the BlockDiagram (BD).
    This file is called (e.g. Test1.vi)
    Then you start this VI:
    And in your test1.vi you have updated the case structure ( CaseStructure ) with VI Scripting
    Sometimes you will need this
    BR
    Eugen Wiebe
    Eugen Wiebe
    Bernstein AG
    CLAD - Certified LabView Associate Developer

    I now understand what you were saying about inlining a subvi.  I did as you said and made a subvi with a case structure and an indicator within it.  I use the New VI Object node to add that subvi to the slow-inlining parent VI.  Then I tried to inline it using the invoke node, but I got error 1399, which make sense.  Is this what you meant for me to do, or did I misunderstand?
    Also, I tried the ControlTerminal reference approach you mentioned earlier.  Unfortunately when I called the move method on the control terminal property and had the 0th frame of the case structure as the owner I got error 1060 again.
    I really appreciate your help.  Do you have any other thoughts?

  • Executing Code with true/false input

    Ok so I must be over thinking on how to do this. I am trying to run a section of my code when I recieve a True value. When False I do not want it to do anything. Ive tried using a true/false case structure but the requirement to hook the false case to something is screwing me. Also tried a while loop but it just latches on and never reads the false after its already on. 
    Solved!
    Go to Solution.

    joedirt wrote:
    Okay and I will check out tutorials. I just did all that silly code because I wanted to take the last element of the array and write it to the spreadsheet without adding other values, BUT at the same time enable it to append to file because Ill repeat this code over. 
    You don't have an array until you make one right there out of a single element. There are no "other values". There is one element in the array, which is the first and the last element and exactly same as the value you used to build the array. Once you do the tutorials, you'll laught about your code. It is absolutely pointless.
    LabVIEW Champion . Do more with less code and in less time .

  • Case structure with arrays

    why don't the array values are not shown in array 0 and array 1 in the enclosed attchment array0.vi.
    thanks
    Attachments:
    array0.vi ‏14 KB

    Then default value then NOT wired is an empty array. So using array 0, as an example. It will be filled with data on iteration 0. But this data will be overwritten with an empty array. In the next iterations.
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • How to build a current loop with cFP-1808 and analog input module AI-110?

    I am trying to build a current loop to measure temperature via and a resistance thermometer a transmitter that converts the signal to current. I am using cFP-1808 with the power supply PS-5 directly connected to it.
    For the current measurement I am using AI-110 but I am having trouble with getting current in my loop. I have looked in he manual of the AI-110 module and am using the set up for a "loop with an external power supply", counting the PS-5 as external. That is to say, I have connected the negative transmitter terminal to Vsup on the AI-110, and the positive side to Vin. Now, however, I am stuck. I don't get any signal in my loop.
    Can I use the PS-5 to power my AI-110 module or do I need to use another external power supply? In this case, how do I connect this?
    Thanks for any help!

    Clara G:
    I overlooked that in your 1st post you were connecting the other end of the transmitter to Vin, you actually need to connect it to Iin on the AI-110.
    Regarding the use of the PS-5 to power the cFp and supply power to the loop, I do not know if that will work or not.
    Suggest that you switch over to Iin terminal and use the separate 24V supply to power the loop. If that works, them maybe try the PS-5 for both the cFP and loop power.
    -AK2DM
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    "It’s the questions that drive us.”
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

  • Translating Boolean true/false into Yes/No of what I am doing wrong

    Having a hard time figuring out how to translate this. Here is the method I think should do it:
    instance variable: private boolean isPaperback;Method:
       public void translate(boolean trueOrFalse)
            if (isPaperback = true) {
                System.out.println("Yes");
            else {
                System.out.println("No");
        }When I run the method, it gives me an answer of "Yes" for both true and false. Any idea of what I am doing wrong?
    TIA, Marc
    Edited by: Celtica on Feb 9, 2009 12:33 AM
    Edited by: Celtica on Feb 9, 2009 12:34 AM

    here is the code of the program:
    public class Book
        // instance variables
        private String title;
        private String author;
        private String isbn;
        private int numberOfPages;
        private boolean isPaperback;
        private double price;
         * Constructor for objects of class Book
        public Book(String theTitle, String theAuthor, String theIsbn,
                    int theNumberOfPages, boolean theIsPaperback,
                    double thePrice)
            // initialise instance variables
            title = theTitle;
            author = theAuthor;
            isbn = theIsbn;
            numberOfPages = theNumberOfPages;
            isPaperback = theIsPaperback;
            if (price < 0.00) {
                double price = 0.00;
            else {
            price = thePrice;
         * Display the title
        public String getTitle()
            // put your code here
            return title;
         * Display the Author
        public String getAuthor()
            // put your code here
            return author;
         * Display the ISBN
        public String getIsbn()
            // put your code here
            return isbn;
         * Display the Number of pages
        public int getNumberOfPages()
            // put your code here
            return numberOfPages;
         * Display the isPaperback Status
        public boolean getIsPaperback()
            return isPaperback;
         * Display the price
        public double getPrice()
            return price;
         * set the title
        public void setTitle(String newTitle)
            // put your code here
            title = newTitle;
         * Set the Author
        public void setAuthor(String newAuthor)
            // put your code here
            author = newAuthor;
         * Set the ISBN
        public void getIsbn(String newIsbn)
            // put your code here
            isbn = newIsbn;
         * Set the Number of pages
        public void setNumberOfPages(int newNumberOfPages)
            // put your code here
            numberOfPages = newNumberOfPages;
         * Set the isPaperback Status
        public void setIsPaperback(boolean newIsPaperback)
            // put your code here
            isPaperback = newIsPaperback;
         * set the Price
        public void setPrice(double newPrice)
            // put your code here
            price = newPrice;
         * Returns the string "Yes" if passed true, and "no" if passed false
       public void translate(boolean trueOrFalse)
            if (isPaperback = true) {
                System.out.println("Yes");
            else {
                System.out.println("No");
         * Displays book information
        public void displayBook()
            System.out.println("Title: " + title);
            System.out.println("Author: " + author);
            System.out.println("ISBN: " + isbn);
            System.out.println("Pages: " + numberOfPages);
            System.out.println("Paperback:" + isPaperback);
            System.out.println("Suggested Price: $" + price);       
    }

  • Multiple booleans controlling one boolean input for a case structure

    Hello,
    I have four boolean buttons and a case structure with a boolean input. I would like to write the program so that whenever any one of the four boolean button changes value, the case structure reads true for one loop interation, and then returns to false.
    I have tried all sorts of things and can't seem to figure it out.
    Ultimately, the ideal function of the program is so that whenever you push any one of the four boolean voltage controllers, that voltage case is chosen in the case structure, the time in seconds is written to a file, and the elapsed time timer is reset.
    I have attached my program. Let me know if you have suggestions. Thanks.
    Attachments:
    Volt_Control_And_Time_Counter.vi ‏71 KB

    Zappow wrote:
    However, with this setup, the time counter still doesn't work.
    The event structure for all four buttons has a true boolean constant connected to my file-saving case structure. If I connect this to my elapsed time express VI reset button, the timer doesn't count.
    The timer does not count because you have not wired a timeout to the lower event structure. The default timeout is -1, so the lower loop never spins via timeout
    It is useless to have a wait in a loop that also has a timeout case. Just wire an approriate timeout value to the timeout terminal and remove all waits. It is also not necessary to have a 1ms ttimeout if your timeout values only displays to 100ms resolution. Can you explain why you think you need two loops and all that extra code?
    Attached is a quick rewrite that solves some of the problem. Since I don't have any hardware, I replace the voltage out with a meter.
    You have way too many FP controls and indicators. Use arrays!
    Let me know if yo have any questions. Modify as needed.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Volt_Control_And_Time_CounterMOD.vi ‏63 KB

  • Multiple boolean values to be used in case structure

    Hi,
    I am trying to implement a case structure with multiple boolean cases and am having trouble with that. What I want to do here is : I have a set of 5 values, each of them being "true" or "false". For each "true" value, I have a certain set of steps to be executed. The "false" of each can be ignored. Ideally, I would like to have a case structure for the 5 "true" cases. I am not sure how to go about wiring these boolean outputs to my case structure. Also am using LabView 6.1.
    Any ideas?
    Thanks,
    Sukanya
    Solved!
    Go to Solution.

    Additional comments regarding code:
    It is a mistake to configure the serial port inside the loop. This is a waste of time and resources. Configure outside, read in the loop, and close outside after the loop is done. The flushing of the buffer would be part of the "configure outside".
    The default values of the controls for the VISA Configure Serial Port VI are such that the termination character for reads is enabled, and the character is set to a linefeed. This means the VISA Read will read until it sees a linefeed or reaches the value wired to its byte count input. Thus, the VISA Bytes at Serial Port isn't really necessary.
    You should not rely on the settings in the LabVIEW option for automatic error handling. You should explicitly handle errors in your code. Thus, you probably want to stop the loop on an error and provide a dialog via the Simple Error Handler.

  • Numbers into textfield using boolean buttons and case structure?

    Hi!
    I'm very new to these forums, and to LabVIEW in general. I'm currently trying to implement a calculator-ish, but without the operations (+ - * /).
    I have 10 boolean buttons, named 0-9, and with these I want to basically write a sequence of numbers into a textfield. I've managed to solve the problem using an Event structure, but now i'd like to achieve the same result using a Case structure instead. The problem is that I can't identify which button has been pressed, so I can't make the program go to the correct case (0 to 9). Is there any simple solution to this that you guys could help me with? Maybe a property node that's generic for every button? I dont know
    Anyways, I'm attaching a simplified version of what I'm trying to achieve, withouh the code I don't know how to write obviously.
    Thanks for your help in advance!
    /Sebastian
    Solved!
    Go to Solution.
    Attachments:
    help.vi ‏12 KB

    Here is a way to do it: bundle the boolean values into an array, turn that into an 8 bit number and wire that to a case structure with a boolean radix
    Message Edited by jmcbee on 03-31-2009 02:29 PM
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
    Attachments:
    helpMOD.PNG ‏13 KB
    helpMOD 80.vi ‏20 KB

Maybe you are looking for

  • No sound on youtube or any other webpage

    When I go to a website such as youtube.com or any other site that plays sound, it only plays through the speakers on my monitor. The speakers in my monitor do not work very well, so i bought a Edifier Surround Sound System. The surround sound works w

  • How to get the line type of a table type

    Hi,   i want to indetify the line type of a table type dynamically in my program. how to do? For example: data: lv_ttype type type ROLLNAME value 'PRXCTRLTAB'. how to identify line type of lv_ttype in the program. Thanks, johnney.

  • A slight prob

    I hope that this is in the right spot if it isn't please move it there or answer anyway. Now to my problem I am getting grey screens when I try to use anything to do with java. The main problem is that I get load:class loader not found and it ends up

  • SSRS 2008: connection failure, timeout or low disk condition within the database. (rsReportServerDatabaseError)

    Hi, I have started getting this error since a week now when I try to schedule a report or change a schedule of a report.  An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition with

  • InDesign with eps image

    Hi Experts, We have a problem with EPS image which duplicates the pages while exporting in to PostScript file. For example, we have placed the particular EPS image in page 2 and if we export the document as PS the same page has duplicated (i.e. 1,2,2