event structure and while loop iteration

Hello

It took me time to identify the problem I have, but I think I've nailed it and need help to solve.

I am right to say that a while loop that contains a structure of the event will travel only once and then wait for another event to occur before a loop again?

The question I have is that I need mark to a timestamp of a data acquisition driver (DataTaker) value, and whenever he changes the Labview event structure would take care of the rest of the incoming data.

So is there a way to make everything in continuous loop on questioning my value of timestamps from my Datataker driver so that I can create an event Value (Signaling) for the Structure of the event to take care of?

Thank you

Richard

Two options.

1 put the stuff event to query a regular base in its own while loop that runs in parallel to the loop containing the structure of the event.

2 put the stuff that you need mark in the case of delay of the structure of the event and a thread time-out value in the upper left corner of the structure.  Now, if no event to occur in this time, the structure of the event will run the case of timeout and the loop will iterate again.  The only problem with this method is that the case of timeout to run irregularly, or never at all if it turns out that events come more frequently than the timeout value.

Tags: NI Software

Similar Questions

  • VI is paused and while loop has highlighted

    I'm in parallel while loops and for some reason when it should start to run loops, it pauses for the VI and highlights one loops. It was not last week when I ran it so I don't know what is the issue. I've included a screenshot of the beginning of the code, the loop that is highlighted is the down right. Also, what is the red dot on the wire in error right after the structure of sequence?

    Thank you

    lvuser333 wrote:

    I'm in parallel while loops and for some reason when it should start to run loops, it pauses for the VI and highlights one loops. It was not last week when I ran it so I don't know what is the issue. I've included a screenshot of the beginning of the code, the loop that is highlighted is the down right. Also, what is the red dot on the wire in error right after the structure of sequence?

    Thank you

    Someone snuck into a breakpoint on you.  The red dot is the stopping point, and that's why your VI made a break.

  • loop for and while loop with empty table entry

    Hello

    I have a question with loop and loop.

    When a constant empty array (zero element) is connected to the loop For with "allowing the index", there are no interactions performed in loop For. But, if the loop is replaced by any loop, no problem.

    LabVIEW 2010

    Hello

    It is ok. I have no problem at all.

    For the 'loop' For when you connect the table thanks to indexing, the number of iterations is set to the size of the array. The iteration number assigned to N (in your case 10) is ignored.

    For the 'While' loop the number of iteration is defined by the Boolean Condition and the size of the array is ignored.

    Paul

  • for and while loops

    Hello, im new to java, and now I have an assignment. I need to analyze a phone number like this-> (656) 345 6544 to 6563456544. I wrote the following code which works very well with a while loop. Now, I would like to know how can I make it work with a loop for.

    and the code is
    import java.io.*;
    public class Tema
    {
    
      public static String removeChar(String str, int i)
      {
        String first= str.substring(0,i);
        String last= str.substring(i+1,str.length());
        str=first+last;
        return str;
      }
      public static String cautaTrimite(String str)
      {
         /*for(int i=0; i<str.length(); i++)
        {
           if ((str.charAt(i)==' ')  ||(str.charAt(i)=='5')  ||(str.charAt(i)=='(')
              ||(str.charAt(i)==')') ||(str.charAt(i)=='-'))
              {
              str = removeChar(str,i);
              }*/
           int i=0;
            while(i<str.length())
             {
                 if(( str.charAt(i)== ' ' )||( str.charAt(i)== '8' )
                         ||(str.charAt(i)==')')||(str.charAt(i)=='('))
          {
            str = removeChar(str,i);
          }   
                
          else
          {
            i++;
          }
    
             }
        
      return str;}
      public static void main (String [] args)
      {
      try{
         BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
         System.out.println("Introduceti un numar de telefon oarecare: ");
         String str= in.readLine();
         
         str= cautaTrimite(str);
         System.out.println(str);
      
         }
      catch(IOException e){System.out.println("S-a produs o eroare de IO");}
      }
    }
    Published by: 1002443 on 30-Apr-2013 05:17

    In the while loop, you have full control on when you increment the i and when not, and what you're doing is correct.
    Do this with the because the loop always increments the i. To avoid this, you can discover that when you removeChar, you decrement the i, just to increment the loop right after.
    Everything in that this would mean by code more obscure all loop, so I wouldn't use it.

    Edit: Why you remove 8 in the while loop and 5 in the loop remains a great mystery.

    Published by: baftos on April 25, 2013 11:56

  • get the structure of the event inside the while loop to wait for event occurs before the execution

    Hello

    I have a small problem, when I raise an event using a value change button, which works very well.  The problem is that the VI does not wait for me raise an event and instead runs the same event again, even if I have not pressed the button to start again.  The mechanical action of the button switch is released is.

    I was wondering how you get the structure of the event to wait for a user event, after that he executed the first time.

    James.Morris wrote:

    There is no reason that the event should be raised twice as much that the only way that it fires in your code is by the user by clicking on 'Hall measure only'.

    Oh yes, there is, and I deserve a kudo for this one.  Mechanical action on the button is set on the switch until published, so click to generate an event, on the bottom and on the square, attached is an example.

    My boy has my students hate this question, and to be honest, I hated it.  When never would you do that intentionally?  Honestly?  Anyway to change the button back to normal (as default latch when released) and move the terminal button in the structure of the event where it is managed and it will work as usual.

  • Serial port visa and while loop

    Hello

    I am trying to acquire data of a device through serial communication. This is an RS232 interface. I use a port of visa and I know open and close the port of visa again and again while the program is running is bad style. So, I trieed to use a while - excluding the Visa open loop and nearby (see the attachment of a second, program 2). Unfortunately this work of isn´t program and I can´t find the bug. However the first attachment (program 1) works properly (except that the speed is maybe more low). Sombody could me to get the second work programme.

    Thank you!

    Best regards

    Soffi

    What you need to do is to add a register to offset for the name of resource VISA and error. See attachment a screenshot.

    I couldn't find this anywhere in the examples of NEITHER. (This one is based on the basic series example write and read vi.) When I started with LV, I asked tech support how to do this, and they told me. I WISH THEY WOULD SHARE THIS TECHNIQUE WITH USERS IN THE UNITED STATES!

    I hope this helps. (I can reach the vi if you wish.)

    Ed

  • PAUSE loop based on events (unemployment and UI)

    Hello

    I made a loop, where I needed to be paused at each iteration, and waiting for an event to happen, then go to the next iteration.

    Here is an excerpt:

    It runs only when you press the button START and STOP whenever you press the corresponding button.

    I need to have the same behavior, but in a structure of the event within a while loop, (same structure for event driven state machine):

    How can it be implemented?

    I thought by using the properties of value (signalling) to trigger the events of the buttons... but until now I'm stuck...

    some ideas?

    I would use a machine to States how to handle this correctly. In this way, you can add features later if you wish. If you have any questions please let me know.

  • How to reset a while loop based on a value change event?

    Hi all

    I work in a labview program that sends voltage to a laptop via USB 6008, tension is amplified by an op-amp, and then he comes back in the laptop. I created a program and a working circuit, but my current challenge is how to reset the average of the values of voltage coming into the laptop, after that the user changes the digital control (which controls the output voltage). In other words, I need to be able to reset the number of iteration and the sum to 0 each time this happens.

    I looked upward to reset the counters of iteration through shift registers, but I'm not sure it will work in this case, but I'm also not sure how to reset the sum of an array (if possible). I have spent a lot of time to read these forums and tutorials from various sites, so I think it can be done with the correct nesting of the case structures, structures of the event and while loops, but I don't know how. I am new to LV, just started to learn in mid-January, so any help is appreciated.

    Thanks in advance,

    Graeme

    You just need the structure of single event with the bargains.  Use the case of timeout to get your new values and find the average (100ms timeout value and get rid of the wait function (ms)).  Keep the amount and the number of items in the shift registers.  Wire these values through each case of the event.  In the event of changing the value: control, just set the values to 0.  Then add a Stop button value change event to stop your program.

  • Retrieves the number of iteration of the event structure

    Hello

    Is there a way to extract many times wherever a labview routine goes in a structure of the event?

    Thank you

    hiNi.

    I don't know what you mean by a routine in a structure of the event.

    If you have the structure of the event, in a while loop as usual, then the value of the final iteration will tell you how many times the structure has executed.  If you want the count for a particular case, use a shift register with a function of increment in the case of interest and other wired straight through.

    Lynn

  • Series of reading and DAQ in same While loop

    Hello world

    I have a while loop that has a DAQ reading and a reading series of VISA.

    DAQ readings slow while loop for series com & therefore the iterative nature of the measures to constantly check byte-by-byte (for the full range of the code: 22 bytes) does not work. (it will check 8 bytes, 24,.. etc. because more bytes is collected in a buffer before it can browse new loop.)

    Is it possible to synchronize these two data acquisition devices?

    Data acquisition speed is fast enough, so if there is a way to keep the series bytes in a queue and take only the first 22 bytes for every while loop iteration?

    Thank you for your help. I can't join VI, but I can give you a reference image.

    I recommend having separate loops of data acquisition and reading series.  If you simply connect the latest value, the local variable is great for sending to playback in series to the other loop for logging.

  • While loop and table

    I'm weak and I can't get up.
    I'm playing a series of clips in order, so movieClip2 does not play until the end of movieClip1 (label = 'end'). I started with a three separate movieClips, each with its own listening port. Because all three looked like, I thought me save time by using a table and while loops. I have a dozen of these total movieClips, then rather than cut and paste each individual listener and if statement, it seems that there is a better way. And you smart people are the people who know. The output I am receving is: TypeError: Error #1006: value is not a function.

    Thanks in advance for any direction.

    I tried to use another method successfully. In my previous attempt, I used too many while and loops enterFrame, which caused problems of circular logic. Using only a few statements seem to solve the problem, as below. Thank you all for taking a glance at the problem.

  • Reach target FIFO in the event structure will not achieve

    Hello

    I'm just counting the time in ticks between edges mounted on two digital channels. Therefore, I use a myRIO and LabVIEW 2013 SP1 on a Windows 7 PC.

    As you can see in the attached photo, I use a FIFO extended target to switch the number of ticks between two SCTLs events to a while loop, where I want to send them via DMA to host of the RT.

    I chose this model to limit the number of DMA channel and increase the SCTLs clock (allows greater accuracy in time). The number of ticks is determined using the DSP 32 bit - built-in counter.

    However, when I run the VI no data is written to the target FIFOs scope. 'Number of elements to write' is still 127 (128 requestet), 'Number of items to read' is always zero. "ch0 post" indicates that the "real" State of the structure of the case is actually entered.

    Edit: all indicators have been added for debugging purposes. Simulation on PC indicates no error either, but I realized that no data is written to the host of RT during actual use.

    I checked the cRIO programmers guide and the high Performace FPGA Developer's Guide and do not see where I was wrong. However, it will not work.

    I would be happy if someone could help me solve this problem!

    In the lower part while loop what do you do if one of the read FIFO has expired (zero cases in the structure of the case)?

    If you set the Boolean value False in any other case (1.3) then you'll only send something to the host when the two data FIFOs received in the same loop iteration.

    If she receives a number of cycles on a FIFO in an iteration, and a number of cycles on the other FIFO in the next iteration has expired will never be null.

    To debug you may store the value 'tick count ch0 fifo' in a shift register and update only when the delta_c_ch0 FIFO does not time-out. Then you can see if this value is always nonzero.

  • Detect the change of the value in While loop

    Hello

    I recently took a code example in examples of using Labview and I'm putting the analog output through my data acquisition card 4461 pxi. I want to have a continuous waveform, but being able to change the volume and the waveform will adjust automatically and be issued through the card.

    In the code, I have everything first to open a .wav file and write it. While playing continuously through the while loop, but I want the signal to change automatically when the volume is changed. I know that I should probably use a structure of the event but the while loop, I use to play the signal will never stop unless the user presses stop so it would play permanently in a structure of the event even when the value changes (I tried).

    So now I try to see if there is a way to make my time stop loop when the volume value.

    You must correct the issues (forget the events if you are not sure of them):

    1. If wire you the digital volume to the wall of the while structure, then the whole in structure only tell that one value that happens on the node and will not read new values.

    2. to read the new values, move the Volume Terminal inside any building (which will shock your other code that depends on it), or use a local Variable inside any node.

    3. to check if the value has changed, you must compare the value to the previous value. To do this, use a shift on the while loop register to store the previous value and then compare it to the new value with the function "not equal?". Wire the Boolean result of this to the conditional Terminal.

    A better way for you might be to wrap the multiplication and Analog Write function into the while loop so that you're constantly replaying the waveform and it's continuously being re-scaled by the volume value. This will mean your volume control is being continuously polled (once per waveform playback) and used to scale the waveform each time. You'll need to figure out how to stop, send and play the waveform once per iteration of the while loop by bringing the Stop VI inside too. 
  • CPU utilization while loop

    Manual LabVIEW declare a while loop must always contain a "wait for ms" vi to unlock the task for this period.

    However, I thought that it the same fate if I use the same timeout ms for the timeout of a structure event inside the while loop

    and omit the "wait for ms" vi.

    Unfortunately the time-out of the structure of the event does not seem to unlock the task so that the façade reacts very inert in this case, even if it reacts
    prompt in either case.

    Does anyone have an explanation more in depth of this behavior?


  • Event Structure Weirdness

    Last night, SAP posted an interesting question on his blog (The Daily CLAD).

    In short, we create a dynamic event, enter it and generate two events with the data being 1 and 2.  Then we travel a structure of the event that is registered for the dynamic event.  Inside of the event is another structure of event which is also on the dynamic event inside a loop set FOR to run twice.  The data of the event was autoindexed and went straight to the final output.  Now logic would state that the output should be {1,2}.  But when I run it, I get {1,1}.  I thought it was really strange.  So of course, I got to play.

    I changed the buckle FOR to run 3 times.  Oh, it is here and waiting for another event.  If it is to see two events, as it should be.  It's just that for the second event data is not transmitted correctly.

    But let's play others.  I put another LOOP around the external event structure and did run twice.  He does not see the second event at all (that is to say, is there and waiting for another event on the second iteration).  Why not?  It is registered for it?  He saw the first event?  Why wouldn't it the second event in its queue?

    Now if I remove the inside OF the loop and let my loop FOR external, everything works perfectly as I expect.

    Now, it becomes even more strange.  I added a button and changing the value for the button of my external event structure (the two structures event with loops to go twice).  The structure of the external event is also ignorant of my button value change event.

    OR, what the #* $& @* is happening here?

    The problem is not with nested structures event, but with the shared record refnum. An event record refnum should belong only to a single event structure. As soon as share you, you get undefined behavior. It could work very well, he might behave in a totally random way.

    Example of David is wrong for the same reason. He may have worked when he ran, but it is not something that must be invoked. The structure of substantive event should have a separate record node.

Maybe you are looking for