While Loop to Monitor a 1D 8Bit boolean Array for changes

Hi;
I need help in monitoring a 1D 8-bit boolean array for a value change. I think I need to use a while loop with shift registers???
Any suggestions?
Thank you,
4BoysDaD

Where are you going to put it in your code. It will depend on what you are already doing. Here is an example to show you how to do it with out shift registers.
Tim
Johnson Controls
Holland Michigan
Attachments:
Example.vi ‏8 KB
Check of 1D Boolean Array has Changed.vi ‏8 KB

Similar Messages

  • How do we save three 1D arrays in while loop as an excel file? I used build array, waveform. I could not make it work.

    I have three separate 1 dimensional arrays in a while loop. I need to combine these arrays and save as a excel file outside the loop.
    My second question is that is there any emergency STOP button in Labview so that when I press that button, it cuts all the power going to the system. Thanks...

    Just a comment on the Stop button.
    It's not really a good idea to rely solely on a software emergency shutdown. Especially if the shutdown is to prevent some type of hazardous condition to the people running the test. The problem is that if your application or PC in general is having some type of problem, it may not be able to shut everything down as needed.
    You should always have a mechanical �Big Red Stop Button� that you can hit to cut power to everything. In addition to the button, I usually do have LabVIEW monitor things and if conditions are not looking good, have it automatically shut things down. This has always worked good, and I can�t remember any time I�ve actually had to use the big button, but it�s nice to know it�s there.
    VERY IMPORT
    ANT:
    Using the �Abort� button on the LabVIEW toolbar is NOT the thing to do. This stops your application where ever it is in its execution and does not allow it to finish or execute any shutdown code you might have put in. A �Kill� button on the front panel works well. I�ve put a single Boolean terminal in its own little While loop to monitor it. It usually writes to a digital line that�s holding a relay on that will cut the power.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

  • How to stop execution in while loop without stopping execution of other loops in the same vi

    HI
    I am quite a novice in Labview.
    I have a problem in my project. I used a while loop inside my vi to build an array of ten values along with other loops. Then I used a stop button to stop manually the while loop. But it seems like the loop doesn't stop in the middle of the array building and so other loops in the vi doesn't work until the while loop finishes building the array and as soon as while loop execution is over, the complete vi stops. But all that I wanted was to build the array using the shift register along with the control to stop building array anytime. And not to stop execution of other structures when the while loop finishes.
    Can anyone help me?
    Rahul

    Hi Rahul,
    Modified ur Vi to work with single button.
    But the subtract case is not in any loop.
    So, once both the loops stop, the subtract case will execute only once. Depending on state of subtaract boolean at that time, corresponding case will be executed and the Vi will stop.
    so think of a logic where u can put this also in a new loop.
    Or you can also incorporate it in one of the two loops and pass the other loop's data to it.
    Let us know how you will proceed in this regard
    I am posting your VI as well a VI with my modifications VI in Labview 7.0 so that Thomas can give his suggestions too
    Plus, always keep a time delay in your while loops.
    Oh sorry, the "arrayinouttestnewfinal.vi" is the modified vi
    Regards
    Dev
    Message Edited by devchander on 01-10-2006 06:15 AM
    Message Edited by devchander on 01-10-2006 06:19 AM
    Attachments:
    arrayinouttestnewfinalnew4.vi ‏59 KB
    arrayinouttestnewfinal.vi ‏63 KB

  • Capturing of time taken by a while loop in bpm

    Hi ,
    I have a busniess process ,and my receive step is defined in a while loop.
    so it starts with a while loop.
    I want to keep a condition on the while loop that it should receive the messages only for a period of 1 hour ,and if it exceeds this period it should end up the process triggeringa mail.
    I mean to say if there are 12 records to be processed through the while loop ...and if I receive only 11 records ..it will be waiting for that final record in an infinite loop ..so I dont want that ...instead if the total no of records are reached then it should move forward ..If it is waiting for the missing records for an hour ..I should stop the process and trigger a mail to the queue monitor saying that record is missing...I have finished the process without this processing time condition successfully..
    I am new to XI and I dont have any idea on how to capture this processing time of while loop.
    can some one please help me out in this issue...
    Thank you in advance...

    Hi Latika,
    Yeah I understand we can go with fork but why I am going with this is ,I have already designed a Payload dependent loop ,by using while loop.so it makes my job simple ...
    Now I am converting it to time dependent loop,so only the final question I have is...In the time dependent loop documentation ..they have taken it as infinite loop and only kept the time limit in the deadline branch...so when the deadline reaches they trigger something.
    If you go to the documentation of time dependent loop(http://help.sap.com/saphelp_erp2005vp/helpdata/en/08/16163ff8519a06e10000000a114084/content.htm) ..they took the infinite loop...in this loop if I mention the counter ..and if this record count triggers before the time limit...it should come out of the block...would it work this way ?
    Thanks a lot...

  • Why does a sequence structure execute if a while loop is to the left of it?

      I have a while loop in a case structure whose boolean is wired to a sub vi.  To the right of this structure I have a sequence that executes regardless of the while loops condition.  I assumed that the program would not continue to the case structure until the while loop stopped.  Then it would proceed to the case structure.
    Thank You

    jemengineering wrote:
      I have a while loop in a case structure whose boolean is wired to a sub vi.  To the right of this structure I have a sequence that executes regardless of the while loops condition.  I assumed that the program would not continue to the case structure until the while loop stopped.  Then it would proceed to the case structure.
    As others have mentioned, you have to familiarize yourself with the core idea of dataflow programming. One of the great powers of LabVIEW is the fact that things can occur in paralell unless there is data dependency.
    A good start would be the LabVIEW beginners online tutorial:
    http://www.ni.com/swf/presentation/us/labview/aap/default.htm
    The quiz #1 on slide 11 deals with the above issues. Try to answer it. 
    In your particular case, you need to force execution order. This can be done by creating a data dependency (preferred) or by the use of a sequence structure. You could e.g. create a 2-frame flat sequence and place the loop in the first frame and the case structure in the second frame.
    The picture shows a few scenarios for comparison. Can you spot the differences?  Understanding dataflow is crucial for writing any LabVIEW program.
    Message Edited by altenbach on 07-31-2006 06:49 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ExecutionOrder.png ‏19 KB

  • BUG (?) with simple while loop in LV2011

    Hello all,
    I have found a very strange behaviour in LV2011: A While Loop is not executed when running as EXE (in Development Environment it works)
    While Loop:
    (OK, its not the best way to check if button was pressed, but the WHILE Loop itself should be executed)
    How to reproduce:
    1. download attached file
    2. open built EXE file
    3. Look at numeric indicator. At my PC, the values are not increased->this means: while loop is not running
    4. Open Project (lvproj)  (I hope I havent forgotten anything)
    5. Start running the VI from whithin LabView (debug) -> now it should run
    6. Try to build EXE
    7. Try with new EXE. Still not executed While Loop?
    BTW: I have saved the code for LV2010. There it is running. Strange.
    Thanks
    Eugen Wiebe
    Bernstein AG
    CLAD - Certified LabView Associate Developer
    Attachments:
    Project.zip ‏1253 KB

    Norbert_B wrote:
    I concur that this is unexpected behavior, but having dead code in the VI is always a bad idea.
    If this issue occurs with other code segments comparable to this (having dead code within case structures), i concur that it is a bug. ... 
    hope this helps,
    Norbert
    Hi Norbert,
    I'm hair-splitting as normal.
    Re Dead code
    Please cite a reference.
    1) There is an old school of thought that code should never be removed only replaced with a new version. This allows quickly switching back to the old version if the new version seems wacky.
    2) Diagram disable is new and we used to use a boolean to disable old code. Apperently there is some noob loose in R&D that never imagined anyone would use a constant and this bug fell through the testing cracks. I have recently logged a call >>> CAR about a case with a constant preventing a build.
    3) THe useage of a boolean constant to disable a code segment was knowan at one time becuase there was mutation code imlemented to convert constant to controls when open in a new version.
    4) A diagram disable will force an ignore of the code in the disabled state. A constant driven case did NOT have that behaviour and we used to use it to ensure dynamic VI's were included in VIs.
    So please cite the reference that I apperently missed.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Iteration Speed issue when Indexing 3D array wried to a while-loop

    Brief Description of my Program:
    I am working on the real-time signal generation by using LabView and DAQmx (PCI-6110 card). My vi reads the big data file (typically 8MB txt file containing about 400,000 samples (complex double precision). Then, the signal is pre-processed and I end up with a huge 3D array to feed while-loop (typically 3D array dimension is N x 7 x M where N & M >> 7). Inside the loop, that 3D array is indexed and processed before the results are written to the DAQmx outputs. I have a speed issue when indexing the large 3D array (i.e, 3D array having a large sub-array size). My while-loop could not run fast enough to top-up the DAQmx AO buffer (at the output rate of 96kHz). It could run faster only if I use smaller 3D array (i.e, smaller-sized sub-arrays). I do not quite understand why the size of 3D sub-array affects the rate of looping although I am indexing same sub-array size at each iteration. I really appreciate your comments, advices and helps.
    I include my 3D array format as a picture below.
    Question on LabView:
    How does indexing an 3D array which wires to the while-loop affect the speed of the loop iteration? I found that large dimension of sub-arrays in the 3D array slows down the iteration speed by comparing to indexing the same size of sub-array from smaller-sized sub-arrays of the 3D array to perform signal processing inside the while-loop. Why? Is there any other way of designing LabView Program to improve speed of iteration?
    attachment:

    Thank you all for your prompt replies and your interests. I am sorry about my attachment. But, I have now attached a jpg format image file as you suggested.
    I had read the few papers on large data handling such as "LabVIEW Performance and Memory Management". Thus, I had already tried to avoid making unnecessary copies of data and growing arrays in my while-loop. I am not an expert on LabView, so I am not sure if the issues I have are just LabView fundamental limitations or there are any other ways to improve the iteration speed without reducing the input file size and DAQ output rate.
    As you request, I also attach my top-level vi showing essential sections such as while-loop and its indexing. The attached file is as an image jpg format because the actual vi including Sub-VIs are as big as 3MB in total. I hope my attachment would be useful for anyone who would like to reply my question. If anyone would like to see my whole vi & llb files, I would be interesting to send it to you by an e-mail privately and thus please provide your e-mail address.
    The dimension of my 3D array is N x 7 x M (Page x Row x Column), where N represents number of pages in 3D array, and M represents the size of 1D array.  The file I am currently using forms 3D array of N = 28, & M = 10,731.  Refering to the top-level vi picture I attached, my while-loop indexes each page per iteration and wrap-around.  The sub-VI called "channel" inside the while-loop will further index its input (2D array) into seven of 1D arrays for other signal processsing.  The output from that "channel" sub-VI is the superposition of those seven arrays.  I hope my explaination is clear. 
    Attachement: 3Darray.jpg and MyVi.jpg
    Kind Regards,
    Shein
    Attachments:
    3Darray.jpg ‏30 KB
    MyVI.jpg ‏87 KB

  • What is the maximum size of indexed array that can be created during execution of while loop?

    Hello,
    I am using a ring acquisition to take in images. If i write them as files in the loop, it slows down the acquisition unacceptably. Therefore i am converting image to array and storing the array until the acquisition is complete and then reading the array and converting back to image to save. The program sometimes runs out of memory (after a couple of minutes). Can anyone think of a way where i can store the array/images within the execution (without losing image information), without slowing it down and to avoid this memory problem?
    I have included the VI.
    Thanks in advance for any help or advice.
    kindest regards,
    FraserD
    Attachments:
    LL_Ring_in_IMAQ_8_bit_array_then_write_as_png.vi ‏94 KB

    When you build the array of pictures you do it using auto-indexing out of a while loop. That means that memory is aquired for a copy of the previous picture array and the array is rebuilt on every iteration, this is slow and requires a lot of extra memory.
    If you want to speed things up try initializing a shift register with a 3D array of a size that will be able to hold a certain number of pictures, then replace the "pages" as new pictures are aquired, replace operations do not require copying of the previous array and will thus be much much faster. The difference is exeptional when dealing with large arrays/amounts of data.
    Now, the shift register buffer could be built into a functional global, and you can add a push/pop logic to it so that you can have a p
    arrallell loop that works on writing the elements to disk. You could use a que for this, but I think even though you specify a size limit to the que it still aquires memory as new elements are added (correct me if I'm wrong people...:-)), so a functional global acting as a circular buffer og fixed size frame for a que should be better.
    MTO

  • Unxepected behaviour with clusters inside of while loop with shift register

    Colleagues,
    I just would like to post here small, but important bug (I guess this is the bug), which was found by coworker today morning. Just would like to share knowledge, and probably this will save some debugging time for you...
    So, the problem that you can get wrong content of the cluster in some cases. The cluster used inside of while loop with shift register (we using this construction for functional globals), and after bundle operation you can get data, which are not expected:
    See also attached code for details (LabVIEW 8.6.1, WinXP Prof SP3).
    best regards,
    Andrey.
    PS
    Bug report already sent to NI.
    Message Edited by Andrey Dmitriev on 10-16-2008 12:30 PM
    Attachments:
    BugwithClusters.png ‏15 KB
    BugwithClusters.zip ‏10 KB

    Thanks Andrey for brining this to our attention!
    The "Show Buffer Allocations" reveals that LV is not processing the code in the right order.
    Under ideal conditions, all of the data should be manipulated using the buffer "A". But as this demo shows the data is being processed in the wrong order.
    The previously posted workaround get around this by forcing the array operation to happen first, but this resluts in two additional buffers "C" and "D" and then copy this back into "B".
    Using an "Always Copy" is another workaround that uses a seperate buffer "F" to hold the data being moved from the first cluster to the second inside "E".
    I think you won a shinny new CAR* Andrey!
    Ben
    CAR = Corrective Action Report
    Message Edited by Ben on 10-16-2008 08:05 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Cluster_Bug.PNG ‏57 KB

  • Execute case structure a certain number of times within a while loop

    Hi guys,
    I was wondering if it was possible to execute a case structure a specified number of times within a while loop. Basically I'm running a camera where each iteration of the outer while loop displays a frame of a live video feed and I'd like to capture the next x amount of frames (specified by the user) each time the 'Start Capture' button is clicked. The block diagram within the case structure captures and saves an image frame. As the program is written right now, frames will continue to be captured until the 'Start Capture' button is clicked again. Instead of having to click the button again to stop the case structure from executing for each iteration of the while loop, I'd like it to only execute for the next x iterations of the while loop. Any help would be appreciated. Thanks.

    Hello Uxorious,
    A while loop has a iteration counter that gives an integer value of how many times the loop has iterated. You can utilise this to count the number of frames captured. I assume that the program could be running for any amount of time before clicking start capture, if that is the case then you will need to be able to detect when you have clicked the button and add the desired number of frames you wish to capture to the current loop iteration.
    If you use a shift register on the outer loop with the start capture button connected to it (inside the loop) you will be able to compare its current value to its previous value. If it changes from false to true then you can add the desired number of frames to it to give you the loop iteration value where you need to stop.
    Then you can compare the current loop iteration value to that number and once reached, you can use a property node to change the value of your start capture button back to false.
    One final thing, don't forget to initialise the shift register I suggested to false so that you don't run the risk of missing the first time you press the button.
    I hope that makes sense.
    Alistair
    Best regards,
    Ali Bailey
    National Instruments
    Don't forget to Kudos useful posts!

  • While loop in xpress

    Hi,
    I have retrieved a list of users. Each user having some attributes like manger id, user id, location. I have stored the result in one attribute named 'test'. Now i want to create a while loop so that each user is fetched and all the attributes of eaach user are getting fetched.
    i have done the search on th basis of firstname and last name..here is the code
    <set name='test">
    <invoke name='funcname' class='classname'>
    <ref>fname</ref>
    <ref>lname</ref>
    </invoke>
    </set>
    now i want to start a while loop using this
    <ref>
    <concat>
    <s>test[#</s>
    <ref>i</ref>
    </s>]</s>
    </concat>
    </ref>
    please tel me what should be the code for while loop so that all the entries are fetched for each user

    Hi princy,
    Can you tell me how are the attributes stored in each user?
    Here test variable is a list,where each element of list represents a user.Now how attributes Like manager,location stored in it?can u clarify tht?
    Thanks.

  • Try catch problem in a while loop

    I have computerGuess set to -1 and that starts the while loop.
    but I need to catch exceptions that the user doesnt enter a string or anything other than a number between 1 and 1000.
    but computerGuess is an int so that the while loop will start and I wanted to reset computerGuess from the user input using nextInt().
    The problem is if I want to catch exceptions I have to take a string and parse it.
    import java.util.Scanner;
    public class Game {
         //initiate variables
         String computerStart = "yes";
         String correct = "correct";
         String playerStart = "no";
         int computerGuess = 500;
    public void Start()
         //setup scanner
         Scanner input = new Scanner(System.in);
         int number = (int)(Math.random()*1001);
         System.out.println(welcome());
         String firstAnswer = input.nextLine();
         if(firstAnswer.equalsIgnoreCase(computerStart)== true)
              System.out.println(computerGuess());
              //while (userAnswer.equalsIgnoreCase(correct) == false){
                   System.out.println();
         if(firstAnswer.equalsIgnoreCase(playerStart) == true)
              long startTime = System.currentTimeMillis();
              int currentGuess = -1;
              while (currentGuess != number){
              System.out.println(playerGuess());
              String guess = input.next();
              //currentGuess = Integer.parseInt(guess);
              if (currentGuess < number)
                   System.out.println("too low");
              if (currentGuess > number)
                   System.out.println("too high");
              if (currentGuess == number)
                   long endTime = System.currentTimeMillis();
                   System.out.println("Well done, the number is " + number);
              int i = -1;
              try {
                i = Integer.parseInt(guess);
                   } catch (NumberFormatException nfe) {
                        //System.out.println("Incorrect input, please try again.");
              if ( i < 0 || i > 1000 ) {
                   System.out.println("Incorrect input, please try again.");
         private String computerGuess()
               String comGuess = ("The computer will guess your number.\n" +
                        "Please enter \"too high\", \"too low\" or \"correct\" accordingly.");
               return comGuess;
         private String welcome()
              String gameWelcome = "Welcome to the guessing game \n" +
                                        "The objective is to guess a number between 1 and 1000.\n" +
                                        "You can guess the computer's number or it can guess your's.\n" +
                                        "You may enter \"quit\" at any time to exit.\n" +
                                        "Would you like the computer to do the guessing?";
              return gameWelcome;
         private String playerGuess()
              String playerWillGuess = "Guess a number between 1 and 1000.";
              return playerWillGuess;
    }The catch works , but because computerGuess is int -1 so that the while loop will run, I cannot use the input to change computerGuess because it is a string.

    the i was a mistake. and i commented on the other code, because it wasnt working at that moment. I need help understanding the try catch method.
    I want to catch any input that isn't an integer , and I would also like to catch any input that isn't a string at other parts of my program.

  • Print a message inside while loop

    Hi, I want to track the iteration of the loop while loop run. So I print a message for each iteration.
    But print message appears only after the loop completes , it does not print values for each iteration.
    I also tried to use the following workaround by going through one article but it doesn't work, Please help:
    declare
    @countint=1
    while
    (@count<10)
    begin
    print
    'iteration'+convert(varchar(10),@count)
    raiserror
    ('just
    to raise an error',10,1)
    waitfor
    delay'00:00:01'
    set
    @count+=1
    end

    You could try using a temp table instead and capture the results that way.
    e.g.
    declare
    @countint=1
    create table #temp (IterationText (nvarchar(255))
    while
    (@count<10)
    begin
    Insert into #temp (IterationText) select (‘iteration'+convert(varchar(10),@count)
    raiserror
    ('just to raise an error',10,1)
    waitfor
    delay'00:00:01'
    set
    @count+=1
    Select * from #Temp
    end
    Please click "Mark As Answer" if my post helped. Tony C.

  • ASC file to 2D boolean array

    Hey guys,
    I was wondering if there is a method of uploading an *.ASC or *.DAT file to convert into a 2-D boolean array.
    For example, I would create an .asc or .dat file composed of strings using MATLAB to generate
    1 1 0 1 1 0 1 1
    0 1 0 0 1 0 0 1
    1 0 0 1 0 0 1 0
    and it would convert the string to a 2-D boolean array of
    T T F T T F T T
    F T F F T F F T
    T F F T F F T F
    so that I can ultimately use it to create a modified Digital waveform graph like this:
    The purpose is because I will be using sample rates of 0.1 second intervals that spans to 2-5 minutes.
    So to sum it up:
    1. upload a *.ASC or *.DAT file with a 2-D array strings
    2. convert the file to create a 2-D boolean array for use to create the digital waveform
    Any help will be appreciated. I know it isn't much but I've uploaded the 2-D array to waveform *.VI for testing purposes.
    Solved!
    Go to Solution.
    Attachments:
    boolean_array.vi ‏14 KB

    sdkpark wrote:
    However, when I tried that first, it doesn't know how to separate each column of the *.asc file
    1 0 0 1 0 0
    0 1 1 0 1 1
    turns out just to read the first column
    Please attach your VI instead of a meaningless picture.
    Read from spreadsheet file will read all 2D data if used correctly. The defined delimiter is separating items, and linefeed separating rows. For example if you don't wire the delimiter, it will assume "tab" and only one value will get read per line if it is actually a space character. Try a delimiter of "space".
    LabVIEW Champion . Do more with less code and in less time .

  • 1D Boolean Array to 1D Integer Array conversion for FPGA FIFO

    Hello, I am using a PXI7813R card. I would like to pass some data between the target (FPGA) vi and the host vi using the FIFO. I have a FIFO setup to 1023 "32 bit integer" samples. I have a boolean array of 32000 samples which would be the same as 1000 32 bit integers, that I acquired using the PXI7813R card.  I would like to convert the 1D boolean array to a 1D "32 bit intger" array. This seems like a more a difficult problem than I first thought as the labview functions are reduced when targetting a FPGA device. I have attached a jpg of how I would like to do it. I am getting a "Arrays must be fixed size in current target" error for the output from the array subset function. I know this is because one of the inputs is not exactly a constant, i.e. the index input  for array subset, but regardless of the index, I will only ever be taking 32 bits from the boolean array at any time to convert to a 32 bit integer to then place in the FIFO. Any suggestions of how I may get around this problem would be gratefully recieved. Regards, Michael.
    Message Edited by Michael_Limerick on 02-08-2008 04:54 AM
    Attachments:
    fifo_out1.JPG ‏52 KB

    Hi Daniel,
    Thanks for your reply.
    I had a look at the thread that you suggested and I'm not sure if that would solve the problem I was having, the option box was checked as default. I think my issue has to do with the limitations of the different LV functions when targeting a FPGA device.
    I have decided to take another route anyway, it seems that trying to compile a large array (even a 1D boolean array) for a FPGA target both takes a long time and also a lot of FPGA resources.
    Thanks again for your reply,
    Regards,
    Michael.

Maybe you are looking for

  • The Zen Micro wired remote: Many raves, two small ra

    Just got my eagerly-anticipated white Zen Micro remote!! Here's my two cents: Pros: . Nice look that matches the design of the unit itself very well. 2. Definitely makes life easier in terms of controlling the unit while staying acti've. 3. Minimalis

  • HELP ! : PODCAST SUBSCRIPTIONS LISTED TWICE AFTER LIBRARY RESTORE

    I have restored my entire itunes library onto my new computer. When I restore my podcast subscriptions by drag and dropping the 'Podcasts' playlist over to the library a number of the subscriptions get listed twice. How do I get all of the podcast ep

  • Camera Problems with iOS4

    Hi All Has anyone experienced the problem of their camera on the 3GS now having a 'pink' haze on all pictures / videos that are taken? Even appears on the preview and on the photo Look forward to hearing from anyone else with similar issue. QubixTech

  • Mac doesn't recognize external HD anymore. Any help is appreciated.

    Hi Everyone. Suddenly, my MAC mini doesn't recognize my external hard drive any more. It was fine for years and today it's not "there". I tried connecting with different fire wire cables and still, same problem. I also tried connecting the external H

  • Synronize Folder - Kicks Out of Selected Folder

    Hello LR5 Users! When I try to Synronize a photo sub-folder in my Catalogue , the system starts Adding JPGs from my desktop and system?  Like it gets overwhelmed or something and the Sync Function just starts looking at Desktop and System images in a