Run a for loop for specified time period

Hello to everyone,
I am trying to create a data acquisition system for a NI 9162 board. I need to
acquire a certain quantity of data (for example 10 minutes) each half an hour
for example and repeat this process a lot of times. I am trying to do this with
a loop execution but this is not working well. The first data acquired  is
ok but in the rest there are a lot of problems. The times are not being
respected and the board is not acquiring anything. Does anyone can help me? I
am attaching the VI that I am using.
Thanks,
Attachments:
Consulta.vi ‏80 KB

You can either use an System.Timer event OR a timed loop in the Structures pallete.
Use the NI Example finder and search for timer to get an example of timed loops.
Or use a .NET constructor, go to System in the drop down, the select System timer for the timer control, register the event callback.
Use the rating system, otherwise its useless; and please don't forget to tip your waiters!
using LV 2010 SP 1, Windows 7
Attachments:
Timer.vi ‏11 KB

Similar Messages

  • How to write "for loop" for this block in as3?

    hello all, could you please help me to write a for loop for the following code?
    PS: bx1,bx,2bx3... are movie clips, xfir1,xsay1,xad1,xtip1,xdil1 are dynamic text boxes.
    var xmlLoader9:URLLoader = new URLLoader();
    xmlLoader9.addEventListener(Event.COMPLETE, showXML99);
    xmlLoader9.load(new URLRequest("spops.xml"));
    function showXML99(e:Event):void
    XML.ignoreWhitespace = true;
    var fir:XML = new XML(e.target.data);
    bx1.xfir1.text =  fir.sno[0].aa.text();
    bx1.xsay1.text =  fir.sno[0].bb.text();
    bx1.xad1.text  =  fir.sno[0].cc.text();
    bx1.xtip1.text =  fir.sno[0].dd.text();
    bx1.xdil1.text =  fir.sno[0].ee.text();
    bx2.xfir2.text =  fir.sno[1].aa.text();
    bx2.xsay2.text =  fir.sno[1].bb.text();
    bx2.xad2.text  =  fir.sno[1].cc.text();
    bx2.xtip2.text =  fir.sno[1].dd.text();
    bx2.xdil2.text =  fir.sno[1].ee.text();
    bx3.xfir3.text =  fir.sno[2].aa.text();
    bx3.xsay3.text =  fir.sno[2].b.text();
    bx3.xad3.text  =  fir.sno[2].cc.text();
    bx3.xtip3.text =  fir.sno[2].dd.text();
    bx3.xdil3.text =  fir.sno[2].ee.text();

    And for the second, try this:
    var stThings:Array = [st1, st2, st3];
    var bxThings:Array = [bx1, bx2, bx3]
    var globalURLRequest:URLRequest = new URLRequest ("tgs.aspx?st=1003")
    for each(var stWhat in stThings)
    stWhat.addEventListener(MouseEvent.CLICK, clickHandler);
    stWhat.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
    stWhat.addEventListener(MouseEvent.MOUSE_OUT , outHandler);
    function clickHandler(event:MouseEvent):void
    navigateToURL(globalURLRequest,"_blank")
    function overHandler(event:MouseEvent):void
    var index:int = stThings.indexOf(event.target);
    bxThings[index].visible = true;
    function outHandler(event:MouseEvent):void
    var index:int = stThings.indexOf(event.target);
    bxThings[index].visible = false;
    It's difficult to interpret your code--you may want to take some time to write more readable code.
    For example, what is an 'st1'? Is it a button? What does it do?
    Consider if it were a button made to load Story 1... a much more readable name would be btnStory1.
    Also, there really is no advantage to identifying events as eeeeevt, zeeeevt and changing those.
    Pick a convention and stick to it. I prefer 'event', others use 'e' or 'evt'.
    And try to use function names that mean something, "function a1003mo(zeeevt2:MouseEvent):void {" is much more easily read as "function outHandler(event:MouseEvent):void"
    I'd be interested to see what it is you're making, I believe there are some real opportunities to optimize it.
    HTH
    -Ted

  • How would I implement a FOR loop in real time?

    I am using a cRIO and would like to have several processes running in parallel.  A main functin will have a loop in it which will count up and an certain time intervals pass data to a parallel process.  I am not sure how LV will check the current time value and determine if it is time to send the parallel process information (it will send the parallel process a command to start at time X and stop at time Y).  I see the code in C as:
    for (i; i <= 60; i++)
         if (i==30)
            Function(1); //send "1" to function to  start action, equivalent of setting a variable in LV and continuously reading that variable in the parallel function
         if(i==45)
            Function(0); //send "0" to function to stop condition
        delay(1second);
    I am confused about how to create a loop that has a predetermined (changeable) time period that allows me to compare the timer to set times (i.e. 30 and 45) and perform a function if they are equal.  I can handle that compare part but I am not sure how to implement the loop.  Any help would be greatly appreciated.

    Hi,
    Why don't you use "Elapsed time.vi" ? Compare it with the time you require. Also you can use register event function to let the other process know a certain condition has occurred.
    Gaurav k:smileyhappy:
    Gaurav k
    CLD Certified !!!!!
    Do not forget to Mark solution and to give Kudo if problem is solved.

  • How to index a array to give it to for loop for one value at a time sequence to be ensured

    I need to give one number from a array at a time to a for loop. means the for loop have to execute one number at a time  from a array of numbers. How to do it

    Ranjeet,
    Ranjeet_Singh wrote:
    But question is same only. is in it ?
    With all due respect, NO.
    Please make sure you know what you are talking about before blatantly countering someone else's comment. Can you prove that your vi and TiTou's snippet will do the same thing?
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.

  • Parallel for-loop for FPGA

    The new parallel for-loop feature for multi-core CPU is great, but does it support FPGA as well?  Since everything runs in parallel onthe FPGA, it would seem natural to do parrallel for-loop there.  I'm doing some time-critical vector multiplications that can be done quickly with parralel process, and I know I can MANUALLY put several parallel loops to speedup the process.  However as the length of the vector change, so would the number of parralel loops.  I'm wondering if there is a automatic process that does this for me.

    Will this help?

  • How do I use an enhanced for loop / for each on my ViewObjectImpl ?

    Guys and Gals,
    With all of my newly acquired Java knowledge in tow, I spent this weekend cleaning up all of my code, dealing mainly with for loops. I converted them from a huge mess to a for each type loop using language such as ...
        RowSet priceUpdateRows = (RowSet)((PriceUpdatesViewRowImpl) priceUpdate).getPriceUpdateRowsView();
        for (Row priceUpdateRow: priceUpdateRows)
        { // do operations on row... which makes perfect sense to me. For each Row in the RowSet, do something. It doesn't, however, makes sense to the compiler. It pouts and gives me a "foreach not applicable to expression type" error. So I read up on iterators and such, messed with code examples, and still can't get the RowSet to iterate with the above code. Could I make RowSet implement Iterable? How would I do that? I tried to create a class called RowSetExt which extended RowSet and implemented Iterable, but then I got a class cast exception.
    I know I could implement something like the following or a while(hasNext()) but they're really not what I'm looking for.
    ViewObject vo = … < Get ViewObject > …
    RowSetIterator rsi = vo.createRowSetIterator("rowsRSI");
    while (rsi.hasNext())
         Row row = rsi.next();
         row.setAttribute("YourAttribute",your_value);
         rsi.closeRowSetIterator();How do I make the for(Row row : <RowSet>) example work? Or could someone point me in a direction?
    Will

    One thing I tried was to make a framework extension class for my ViewObjectImpls
    public class PcsViewObjectImpl
      extends ViewObjectImpl
      implements Iterable<Row>
      Set<Row> set = new HashSet<Row>();
      public Iterator<Row> getRows()
        return set.iterator();
      public Iterator<Row> iterator()
        return getRows();
    }AppModuleImpl
        PriceUpdateRowsViewRowImpl priceUpdateRows = (PriceUpdateRowsViewRowImpl)((PriceUpdatesViewRowImpl) priceUpdate).getPriceUpdateRowsView();
        for (Row priceUpdateRow: priceUpdateRows)
        {However, this gives me a class cast exception at runtime. But I would think some kind of extension class would be the way to go ... ?

  • Start FOR loop from specified iteration number

    Hi,
    I want to start a Foor loop from 2 and end it to 5. Meaning that any process inside the foor loop must start from second loop and end till 5th loop. This is how my question would like in Matlab.
    for i=2:5
    Help is appreciated. 
    Solved!
    Go to Solution.

    NapDynamite wrote:
    This is what I'm trying to do
    p=zeros(4,4);
    for i=2:4
    for j=2:4
    p(i,j)=i+j
    end
    end
    result should be
    p =
    0 0 0 0
    0 4 5 6
    0 5 6 7
    0 6 7 8
    You should be aware that in LabVIEW the first element has index 0, while e.g. in matlab the first element has index 1
    To get the above result, here's what you could do. (your elements are symmetric. If they are not, you might need to swap the index inputs, depending on what you actually want)
    Here's what you could do... (initialize array replaces the "zeroes" function.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    MakeArray.png ‏9 KB

  • How to run a for loop for an array value

    Hello
    I got an array of value(for ex 1,4,6,10),depending on the array value i need to run the porgram in the case structure(as the examaple values given earlier case1,4,6,10)the program needs to run once for all the values in the array(i mean the program needs to run 1st for case1,then case4 and so on)
    Any suggestions pls.

    Can you describe exactly what you want to do?  In most cases, you do not need a loop to deal with arrays.  Many functions are polymorphic and will deal with arrays directly. 
    R

  • For loop its taking time to execute if more records

    Hi
    I want to move the data with some condition and formatting which has 165000 rows in a table.
    I want use loop to fetch these records and move to another table. I am using for .. loop to execute, its taking long time .
    which way is better to execute fast?
    Thanks in advance,
    Maran

    user8732035 wrote:
    Hi
    I want to move the data with some condition and formatting which has 165000 rows in a table.
    I want use loop to fetch these records and move to another table. I am using for .. loop to execute, its taking long time .
    which way is better to execute fast?
    Thanks in advance,
    MaranLooping is bad... it is actually row-by-row processing of data(i.e. slow-by-slow processing).
    So, in place of using Pl/Sql, instead simply use a INSERT SQL query.
    insert into <table1>
    select col1,col2,... from <table2>
      where <condns>;HTH
    Ranit B.

  • Pulling time used for only a certain time period for 11 different fields.

    I have a report that pulls my OR room case times. Each room is set to different "open" times, ( rm1 open 12 hours, rm 2 open 12 hours, room 3 open 12 hours, room 4 open 7.5 hours, with Room 7 "off duty", etc.)  I only want to pull data for the times my rooms are open, so if room 1 starts at 7am and a case goes past 7pm, i dont' want it to return any data for after 7pm. I only want the times that exist, if any, from the time my room opens to the time it is suppose to close. Currently i have a subreport built in that is totaling "all" the times for each room individually. I need to set the times it pulls for each of my room to reflect my open times to see if we have 100% utilization of the rooms. Is it possible to do this for each room ( i have 11 OR Rooms) by writing a formula?  I am new to crystal report writing so i'm can't figure out how to make this work. Please help.

    Personally, I question the logic of cutting off the time at "closing time" for each room.  Regardless of the "normal open hours", I think it would be hugely beneficial to know if a OR is used outside of normal hours, and seeing a utilization of 110% would be a good indication.  (You might want to open another OR, or hire more doctors, or...)  If a triple organ transplant is gonna take 14 hours (made up data; I'm no surgeon!), I would think you'd want to see 116.7% utilization...
    That being said, if you're convinced that the cutoff is the right choice, you probably want to link the usage data to a table with the OR hours, then use the Time() function and compare the start/stop timestamps to the open/close times of the OR, and use the larger (start) or smaller (end) values.  Something like (basic syntax):
    if Time({oper.startTime}) < {or.openTime} then
      formula = {or.openTime}
    else
      formula = {oper.startTime}
    end if
    HTH,
    Carl

  • How to senda single alert for the similar error for the last specified time

    HI,
    We have configured alerts in OSB flow and alert destination as email.
    but we are receiving lot of emails.
    is there any possibility to consolidate alerts from past 30 mins and send as single alert in OSB

    Hi Alfredo Perez,
        Thank you for your reply.
               If payment done directly to the customer account , how this will effect for all invoices. If i have 3 invoices and the DocTotals of the Invoices are like this
            1st - 1,000/-
            2nd - 2,000/- and
            3rd - 3,000/-
      If i pay 3,000 to the customer account , for which invoice this payment is related. whether the 1st and 2nd will close or only 3rd will be closed?
                  I want to know that is there any way to pay for more than invoices from the Incoming Payment is Screen is Possible?
      Thanks & Regards,
    Ramu.

  • How can I check DATA in BSEG for PO date corresponding (time period)

    PO date (BSTDK)
    but in bseg I only can find BLDAT AUGDT
    and it is also can not find in bkpf
    only can find it in VBAK

    not every BSEG relates to a sales order so it does not have the field directly. You have to link back to VBAK (or maybe VBKD) maybe via the document flow table VBFA.

  • Re: Selecting multiple dates that are outside a specified time period

    Hi All,
    I have the following dataset/table structure:
    Order #     Customer ID     Order Date
    4     10     14-Jan-09
    3     10     25-Jul-08
    2     10     20-Jul-08
    1     10     15-Jul-08
    What I'm trying to do is a tad complicated for my skillset. I want to be able to select a particular order date for each unique individual but I need to apply a rule that if each subsequent order date falls within 180 days of the previous order date, the date gets ignored until it reaches an order date that is more than 180 days so it captures that particular order along with the initial (minimum) order. So for the example above the first order date for Customer ID #10 is 15-jul-2008, each subsequent order (Order #'s 2 and 3) are within 180 days so they get ignored until Order #4 comes along which is exactly 183 days after the first order date so this goes beyond the 180 day time limit and the record needs to get included so I need a query that will essentially pull the following two records:
    Order #     Customer ID     Order Date
    1     10     15-Jul-08
    4     10     14-Jan-09
    Thanks,
    Ed

    This works for your sample data
    SQL> with sample_data as (
      2    select 4 ord_no, 10 cust_no, to_date('14-Jan-2009', 'dd-mon-yyyy') dt
      3    from dual union all
      4    select 3, 10, to_date('25-Jul-2008', 'dd-mon-yyyy') from dual union all
      5    select 2, 10, to_date('20-Jul-2008', 'dd-mon-yyyy') from dual union all
      6    select 1, 10, to_date('15-Jul-2008', 'dd-mon-yyyy') from dual)
      7  select sd.* from sample_data sd
      8    join (select cust_no, min(dt) dt from sample_data
      9          group by cust_no) mo
    10      on sd.cust_no = mo.cust_no and
    11         (sd.dt = mo.dt or
    12          sd.dt >= mo.dt + 180);
        ORD_NO    CUST_NO DT
             4         10 14-JAN-2009
             1         10 15-JUL-2008This will also include all orders more than 180 days after the first order.
    John

  • For loop for text field

    5 check boxes are A, B, C, D, E and 3 text fields are Text1, Text2,  Text3.
    If any check box is marked, corresponding value(A,B,C,D or E) will be goes into Text1, Text2 or Text3.
    It may be output like this
    Text1= A
    Text2= E
    Text3= C
    I have placed a code under checkbox A: mouc up:
    var aList = new Array("Text1.0","Text1.1","Text1.2");
    for(i = 0; i < aList.length; i++)
    if(this.getField("CheckBox4").value = "1" && this.getField(aList[i]).value=="") {
    this.getField(aList[i]).value = "A";
    I do not get check mark when click on check box and "A" value is going into all text fields- Text1.0=A, Text1.1=A, Text1.2=A.
    What should I do?

    Yes A, B, C, D, E are check box. When I replace to this.getField("A").value == "1", it does not work. I have placed in the On Focus. I am not sure where is the perfect.
    Actuall issue is that there are 5 checkbox name A, B, C,D,E. and 3 text field named Text1.0, Text1.1, Text1.2.
    If user check A, textfield automatically filled with "A" (into any one text Field of three text Field)
    If user check C, textfield automatically filled with "C" (into any one text Field of three text Field)
    If user check D, textfield automatically filled with "D" (into any one text Field of three text Field)
    So output may be like this:
    Tex1.0= A
    Tex1.1= C
    Tex1.2= D
    again if user uncheck A, corresponding value will be removed automatically. How can I do this?

  • Track computer changes in a collection within a specified time period.

    I have a typical requirement where I need to find out list of computers that moved in and out of a query based Device Collection.
    The scenario:
    I have few collections, based on the OUs of Computers.
    Collection A lists all machines in OU A
    Collection B lists all machines in OU B
    Now if an administrator moves a machine from OU "A" to OU "B", the collection membership updates and the machine moves from Collection A to Collection B.
    I need a query to find out what machines moved form OU "A" to OU "B"  in last 7 days/1 Month what ever is feasible.
    Any help will be appreciated.
    Regards,
    Abhinav Nishant

    For that attribute no. the easiest way to determine if there is a history. Is look at the Resource Explorer, if there data you are looking for is there then there is a 99% chance
    there is a History view for that data. Software | file Details is an example of one without a history view.
    http://www.enhansoft.com/

Maybe you are looking for

  • Number is not in sequence?

    Dear all, When I am creating a Service Contracts, Number ranges are not getting in sequence. I have not assigned same No. range to any other transaction type. It is only for specific Transaction type. Pls reply Regards Jayesh

  • Purchase orders report

    hi experts, please give detailed purchase order interacitve report with tables,field and detale code ,and wich field we have to put in selection screen . what use of this report. thanks in advance.

  • MVC - Organizing models and managing GUI windows

    I'm having difficulty organizing my MVC models and basically controlling the whole application in general. My application works, but all the controlling logic is being dumped into the main class (Main.java). Here's a simple example of the problem I'm

  • Itunes restoring

    hiya guys, i want this issue to get resolved as soon as possible as i currently have no phone to use, basically my iphone 5c automatically turned off and the itunes cable was being displayed on the iphone 5c, i then connected the iphone to my itunes

  • Need info related to creating indexes on ODS.

    Hi All, I have transported manually created secondary indexes on my ODS to quality system. Now I have a requirement where i have to optimise the query performance. In quality, I activated the ODS.There was data in the ODS before creating of index. Bu