Read single value within while loop

Hi,
I have a setup with one output, driving a coil.
I then have two inputs: one to measure the voltage of my coil (the actual voltage) and the second to measure the voltage of a sensor mounted close to the coil.
The setup works fine to monitor both channels continuously, however, I want to monitor the second value only once every 5 seconds.
How can I go about doing this? Every 5 seconds I just want a single measurement from the second channel.

You haven't given us any info on your device, but I assume it's not super-fancy and can change sample rates per channel.
This article here explains what you want to do. Your device has a single clock, so you're essentially limited to (forces to match?) your highest sampling rate requirement with all channels and then down-sample from there if you don't want all of the data for some of the other channels.

Similar Messages

  • Php recordset outputting last value from while loop

    Hi all,
    I have an issue with a site I am making which lists radio buttons which are a set of donation options (some with predefined prices some with user dependant).
    I used jQuery to populate a textbox with the value of the radio buttons so the person does not need to enter a price they want to donate.
    The issue I am having is that I want the page to carry across the fund_id (which is the primary key) to the next page.
    Currently the do / while loop goes through all of the recordset and passes across the last record's fund_id.
    Please see my code below:
    $(function () {
    $('input.radioButton').click(function () {
    var checkedradio = $('[name="fund"]:radio:checked').val();
      $('#totalPrice').val(checkedradio);
    And
    <h3>General</h3>
    <?php do { ?>
      <label><input class="radioButton" type="radio" name="fund" value="<?php echo $row_cat_general['fund_price']; ?>" id="<?php echo $row_cat_general['fund_name']; ?>" /><?php echo $row_cat_general['fund_name']; ?> <?php if ($row_cat_general['fund_price']!="") { ?>- &pound;<?php echo $row_cat_general['fund_price']; ?><?php } else {?> <?php };?></label>
      <br />
      <?php } while ($row_cat_general = mysql_fetch_assoc($cat_general)); ?>
    <h3>Sponsorship</h3>
    <?php do { ?>
      <label><input class="radioButton" type="radio" name="fund" value="<?php echo $row_cat_sponsorship['fund_price']; ?>" /><?php echo $row_cat_sponsorship['fund_name']; ?> <?php if ($row_cat_sponsorship['fund_price']!="") { ?>- &pound;<?php echo $row_cat_sponsorship['fund_price']; ?><?php } else {?> <?php };?></label>
      <br />
      <?php } while ($row_cat_sponsorship = mysql_fetch_assoc($cat_sponsorship)); ?>
    <h3>Seasonal</h3>
    <?php do { ?>
      <label><input class="radioButton" type="radio" name="fund" value="<?php echo $row_cat_seasonal['fund_price']; ?>" /><?php echo $row_cat_seasonal['fund_name']; ?> <?php if ($row_cat_seasonal['fund_price']!="") { ?>- &pound;<?php echo $row_cat_seasonal['fund_price']; ?><?php } else {?> <?php };?></label>
      <br />
      <?php } while ($row_cat_seasonal = mysql_fetch_assoc($cat_seasonal)); ?> 
    <br />
    <span id="sprytextfield1">
    <label>Enter Amount:
    <input name="total" type="text" id="totalPrice" />
    </label>
    <span class="textfieldRequiredMsg">A donation amount is required.</span></span><br />
    <input name="fund_id" type="hidden" value="<?php echo $row_cat_general['fund_id']; ?>" id="fund_id" />
    <input name="button" type="submit" value="Select" />      
    I hope this doesnt look weird, once I have post this.
    Is there a way I can populate "totalPrice" input box AND have "fund_id" hidden field populated with the fund_id of the selected radio button?
    Thanks for your help.

    Hi,
    I have tried this:
    $(function () {
    $('input.radioButton').click(function () {
    var checkedradio = $('[name="fund"]:radio:checked').val();
      var fundidbox = $('[name="fund_id"]').val();
      $('#totalPrice').val(checkedradio);
      $('#fund_id').val(fundidbox);
      alert($("#fund_id").val());

  • Accessing Data within while loops

    I have LabView 6.0
    I have a while loop for my GUI that accesses various sub VIs. One of the Sub VI is a LED on/off thing, which basically checks the communication with the PIC board that I have. For turning the LED on or off, I have to sent a unique command.
    Since the Sub VI for the LED on/off is inside a while loop it continuously executes. I want the SubVI to execute only when the status of the boolean controlling the LED has changed from the previous value. I tried giving a feedback from the SubVI to indicate whether there is a change, but Labview will not allow such loops.
    I then took the SubVI outside the while loop, keeping the boolean control (so that it continuously checks) inside the while loop. I would like the SubVI to execute depending on the boolean control change. I tried using occurances, but I think these execute only once. I tried accessing the boolean control through a local variable, but the value of the local variable would not change outside of the while loop. (even tried property indicators).
    Any solution would be appreciated.
    I could post the VI, but there are too many sub VIs... Dunno if it would be appreciated.
    Thanks!

    If you need to post a VI, it is best to strip out those parts which do not have any effect on the problem you are facing. With subVIs, do a Save with Options..>>Development Distribution. This will create an .llb file with your VI and subVIs.
    Queues and global variables can transfer data between independent nodes. I am not sure when the datatypes of queues changed. In LV6 you may need to flatten your data to string typpe before passing it to a queue. The functional global or LV2 style global is a subVI consisting of a loop which executes only once and which contains the data in an uninitialized shift register. Many threads on this forum have discussed these options.
    Lynn

  • If/Than function imbeded within While Loop with mulitiple outputs

    We are a Senior Design Group who is having much troubles with LV as none of us are programers and especially unfamiliar with all that LV has to offer. 
    Here is what we are thinking that the program we need needs to look like but have no real clue as to how to implement it in LV.
    WHILE Time Elapsed < 10 seconds
      {  IF Voltage = 1 V
         THAN Output Sound File 1 and Write "1" to Excel File in "A1" and Reset Time Elapsed
         IF Voltage = 1 V again
         THAN Output Sound File 2 and Write "2" to Excel File in "A2" and Reset Time Elapsed
         IF Voltage = 1 V again (for the 50th time)
         THAN Output Sound File 50 and Write "50" to Excel File in "A50" and Reset Time Elapsed
    Once 10 seconds elapses we need to break out and start the above program again (once 1 V is reconized again), except Write to Excel File in "B1....B50"
    Thank you for any help
    Struggling Students

    See here

  • Can we place Analog in Read(AI-RE​AD) Vi inside the while loop for high sample rate like 22ks/s?

    I am using E-series Card for data acquisition.My requirement is to sample the channel, and check the 10 samples for certain condition.both at a time.What should be done can we place the AI-READ vi inside for or while loop for this purpose?

    Hello,
    Yes, you can include the AI Read.vi inside the while loop, you would just need to specify the number of scans to read for every iteration of the loop. Then, after AI Read.vi has read the data, you can do what ever kind of manipulation of the data you would like, before the next iteration of the loop. The one thing to watch out for is what ever manipulation of the data you do, be sure that it doesn't take to long whereas the buffer holding the data starts to back up. That can be checked by looking at the scan backlog output of the AI Read.vi, which will tell you how many scans have been acquired but haven't been read into your program.
    Hope this helps!
    Regards,
    Steven B.
    Applications Engineering, NI

  • SQL to match a single value in a field with comma-delimited text

    I have a column that can contain none, one or many recordIDs
    (from another table) stored as comma-delimited text strings (i.e.,
    a list). I need to retrieve all records that match a single value
    within that list.
    For example, if I want to match all values that equal
    recordID 3, and I use ... WHERE MyColumn IN ('3') ... , I will get
    all records that have EXACTLY 3 as the value of MyColumn, but not
    any MyColumn records whose values include 3, if they are instances
    such as "3,17" or the like.
    Also using the LIKE operator -- as WHERE MyColumn LIKE '%3%'
    -- will get me unwanted records with values such as 35 or 13 ...
    Can I use some sort of intervening ColdFusion list processing
    to output only the desired records?

    Normalize your database so that your data becomes
    accessible.

  • How can I compare single value with multiple value...

    Hello,
    I want to compare one value with multiple values, how can it possible ?
    Here in attachment I tried to design same logic but I got problem that when I entered value in y that is compared with only minimum value of x, I don't want that I want to compare y value with all the x value and then if y is less then x while loop should be stop.
    I want to do so because in my program some time I didn't get result what I want, for example x values is 4,5,6,7,8  and y value is  suppose 6 then while loop should be stop but here it consider only minimum number and its 4 here so while loop is not stop even y is less then 7 and 8. So I want to compare y value with all the entered values of x and if y is less then any of x values then while loop should be stop and led should be ON.
    Please guide me how can I do so.....
    Solved!
    Go to Solution.
    Attachments:
    COMPARISON.vi ‏8 KB

    AnkitRamani wrote:
    Thank you very mach for your help..
    may be i have solved this ....i have made one change in my vi that instead of min. i select max and max. value is compare with the value of y and then if y is less then the max. while loop will be stop other wise its run continuously.
    this is working fine...
    any ways thanks again for your help and time...
    I have to agree with Lewis - his way is more efficient.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • How to stop while loop

    I can't figure out how to stop a while loop in my labview program. 
    When the user presses the Run arrow in the toolbar I want my program to begin reading the serial port for GPS messages.  These messages should be displayed on the front panel.  Currently I have this read/display in a while loop.  The program is also waiting for an extrenal trigger.  When that trigger arrives, I want to grab the current string from the serial port and save it and continue reading and displaying the serial/gps string.  This trigger starts the other parts of the program- signal generation, recording, and saving data which need to run concurrently with the serial/gps reading/displaying.  Once the AO and AI have finished and the data have been written to disk, I want the program to stop.  The serial/gps messages should be updating this whole time.  Only when the data are written to disk should the whole program end.  This whole sequence of events should only be done once when the user preses the Run arrow. 
    So far I'm unable to pluck the serial string when the trigger comes in if I'm watching the serial port all the time.  The program also doesn't stop when it finishes writing to disk because the read serial while loop is still running.  I don't want to use a front panel stop button.  The program should stop itself when the data havebeen written. 
    I'm really stumped on this one but I'm new to LabVIEW so I'm sure there's an easy solution to this. 
    Thanks for any and all help. 
    Attachments:
    SPoleLakeChirp.vi ‏199 KB

    Dennis and altenbach-  Thank you both for your patience. 
    I was trying to do just what Dennis suggested-"As I said, setting a local variable is one way." even before posting to this forum, but I couldn't get my local variables to reflect changes made elsewhere in the program and I wasn't able to wire from them because they were writes.  The critical part I was missing was how to change a local variable from a write to a read.  It was staring me in the face the whole time- just right click.  When I finally found it, my problems were solved. 
    altenbach- thank's for putting the figures together.  I do understand the logic and wiring there, but I was really trying to avoid stop buttons.  The program should be smart enough to figure out when to stop.  And using local variables turns out to be one way of solving this.  I still have some clean up to do, but I've included my current working version just so you can see how I implimented your suggestions.  There's still a lot of clean up to be done, but I'm delighted to be able to watch the serial/gps messages until I'm done reading in data.  At first I had this stop variable set in the final sequence frame.  That didn't work because I wasn't getting to the final frame because the loop wasn't finishing.  Once I placed the stop variable in the same frame as the while loop it began stopping when it should. 
    If you have other comments/critiques about the wiring diagram I'm earger to hear them.  I'm considering the structure finished, however.  It still needs cleaning up and commenting, but I'm satisfied with the functionality. 
    Thanks,
    Peter
    Attachments:
    SPoleLakeChirp.vi ‏210 KB

  • BPS: Possible to limit a variable to a single value?

    Hello,
    I have a BPS variable which is available in the planning folders so the user can change the value himself.
    For a planning layout, one and only one value is required, as the system otherwise wouldn't know which value to use when saving data. It is possible though for the user to select both a mix of values and ranges. I see the lowest value is always used. Consequently this is not technically a problem.
    I would like to limit the variable to a single value only, in order to not confuse the users. Is this possible?
    Best regards,
    Christoffer Owe

    Hi,
    The following link tells you about the variable type ;
    http://help.sap.com/saphelp_nw70/helpdata/EN/ac/789b3c4d4d8d15e10000000a114084/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/EN/22/1e9b3c334d8c15e10000000a114084/content.htm
    1. create variables with single values
    2.while creating variable tick the setting 'Restriction of values required by user'
    I think that will suffice your requirement .
    Thanks
    Pratyush

  • Making a connector in while loop

    I want to make a subvi with a while loop.
    For example, there is a indicator inside while or for loop as my attachment.
    Actually, the indicator will be used as a progress bar which need to be updated in realtime in main vi.
    In my first thinking, the subvi is used in a simple event-driven structure(main vi) to start by a button (for user interface).
    But I realized this method is not suitable for updating the indicator in realtime after pushing the start button.
    How to make a subvi for the indicator and use it?
    That is, how to extract the value inside while loop to outside the loop in realtime?.
    Lee
    메시지가 08-12-2007 07:30 PM에 labmaster에 의해 편집되었음
    Attachments:
    aaa.jpg ‏13 KB

    trivial example attached, two vis in labview 8.2.1
    Paul <--Always Learning!!!
    sense and simplicity.
    Browse my sample VIs?
    Attachments:
    mainVi.vi ‏7 KB
    subviThatUpdatesMainProgess.vi ‏10 KB

  • Does the inner while loop have to be stopped before the outer loop will run?

    too many while loops cause my controls to be very sluggish.

    Hello,
    The outermost while loop executes everything inside it over and over. Therefore, if you have a while loop inside another while loop, the first iteration of the outer while loop will execute the inner loop, and then the inner while loop will execute over and over again until it is stopped. At this time the outer while loop will perform another iteration, and the process will repeat until the outer loop is stopped. Generally, embedding while loops within while loops is not recommended.
    Please visit the below sites for more information on program efficiency.
    http://zone.ni.com/devzone/conceptd.nsf/webmain/b6605678ad7a09a8862568eb007a6d7a?OpenDocument
    http://zone.ni.com/devzone/learningcenter.nsf/03f7c60f17aad210862567a90054a26c/1b36040af87887078625
    6cbc006fe314?OpenDocument
    I hope this helps!
    --Liz F

  • Triggered finite acquisition in a while loop - speed limit ? (newbi)

    Hello,
    I suppose the question already asked and answered but I didn't find exactly what I was looking for, so I'm sorry if it exists somewhere here.
    Usil LV7 with NI 4474 (PCI) acquisition board, PCI-6601 as external trigger, I would like to perform a repeted finite acquisition, starting on external trigger.
    Trigger is working fine (I need up to 20 impulses /s), but the finite acquisition in a while loop doesn't seem to follow the speed. I was thinking it was a CPU proble m and I removed everything which was not absolutely useful.
    So I have a VI with
    1) External trigger output. (express)
    2) While loop with DAQmx Read Analogic Waveform 1 channel N sample, with a DAQmx task as an i
    nput (specifying 50000Hz sample rate, 1000 samples, external trigger start)
    I was able to climb up to 10 cycles/s but above, some ext. triggers are missed.
    Question : where is the problem ? On continuous acquisiton, I can acquire up to 100.000 samples/s but on finite acquisition, I cannot perform 20x1000 samples/s ? What actually specifies the while loop itteration speed ?
    Thank you for your ideas, I'm joining VI capture...
    Attachments:
    vi_ai_external_triggered.JPG ‏31 KB

    I did not the test, but first of all, I think it is not the good way to call your task at each iteration. It is better to configure all elements concerning your aquisition outside the while loop. (external trigger, sampling rate, number of samples.... After you start the DAQmx read (only) in the while loop.
    I think you'd better start from an example from the labview library (attached file)
    Hope it will help you
    Regards
    Attachments:
    Acq&Graph_Voltage-Int_Clk-Dig_Start.vi ‏71 KB

  • Sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loop

    sir i have given lot of effort but i am not able to solve my problem either with notifiers or with occurence fn,probably i do not know how to use these synchronisation tools.

    sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loopHi Sam,
    I want to pass along a couple of tips that will get you more and better response on this list.
    1) There is an un-written rule that says more "stars" is better than just one star. Giving a one star rating will probably eliminate that responder from individuals that are willing to anser your question.
    2) If someone gives you an answer that meets your needs, reply to that answer and say that it worked.
    3) If someone suggests that you look at an example, DO IT! LV comes with a wonderful set of examples that demonstate almost all of the core functionality of LV. Familiarity with all of the LV examples will get you through about 80% of the Certified LabVIEW Developer exam.
    4) If you have a question first search the examples for something tha
    t may help you. If you can not find an example that is exactly what you want, find one that is close and post a question along the lines of "I want to do something similar to example X, how can I modify it to do Y".
    5) Some of the greatest LabVIEW minds offer there services and advice for free on this exchange. If you treat them good, they can get you through almost every challenge that can be encountered in LV.
    6) If English is not your native language, post your question in the language you favor. There is probably someone around that can help. "We're big, we're bad, we're international!"
    Trying to help,
    Welcome to the forum!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How should I set up my VI so that I can use the linear fit coefficient data analysis program, when my values are coming from while loops within a sequence structure?

    I'm attempting to create a calibration program, using the printer port, and a Vernier Serial Box by modifying a calibration program designed for the serial box.
    There are six calibration points, and to collect them, I have it controlled by while loops so that the numbers are taken when a button is pushed, and this is inside a sequence structure so that I can get the six different points. I feed these numbers into two different arrays (for x and y values) and then try to use the linear coefficient analysis on these points, but the values for the slope and intercepts it returns are not correc
    t.
    If I cut out the array and coefficient analysis, and feed the same numbers in directly without the while loop and sequence structures, it produces the proper values... I don't know why the numbers it is producing are different, and I'd really like to know.
    Thanks,
    Karinne.

    I would use a data manager sub-vi that would be called by each from of the sequence structure that produced a data point. The data manager sub-vi could auto append new items or could place items in a specific entry of an array. Later on when you want to calculate the linear fit, call the sub-vi to return the array of values.
    Stu

  • Wait time within a While Loop

    I was always under the impression that Wait Timers (e.g. Wait and Wait Ms Multiple) always executed last within a while loop. As I'm reading up on timing of real-time loops I'm finding that NI suggested using a stacked sequence structure to force timing to run last. Has my assumption of wait timer execution been wrong all this time or do PC and RT systems differ in how loops handle timing?
    Thanks,
    Craig

    So, ok, coming back on this.
    Attached you find a small example to show my remarks in the previous post.
    How to use it:
    The main focus is in the first iterations once "Wait now!" is pressed. So it is usually not of interest to run the "waiting" for more than 5-10 iterations.
    In order to see an "understandable" behavior, i suggest to wait at least 100ms. I configured "Time To Wait" to be at least 10 (coercing).
    The second focus is "Time Value".
    For "Wait (ms)", the "Time Value" will have any number, but increase each iteration by the amount of "Time To Wait".
    For "Wait Until Next Multiple (ms)", "Time Value" will be initialized to a value, which is a integer multiple of the "Time To Wait" and will increase each iteration to the next multiple.
    My example does not contain parallel code, so it does not show the parallelism of the waiting functions!
    Nevertheless, understanding the shown behavior is the key. Because if the code running in parallel to the waiting requires less execution time than the wait function will wait, the behavior will be exactly as shown.
    If the parallel code requires more execution time than the waiting, "Wait (ms)" is already finished and therefore the loop will immediatly continue with the next iteration (high CPU load!).
    If the parallel code requires more execution time than the waiting, "Wait Until Nexty Multiple (ms)" will wait that long that the "Time Value" is again in line to an integer multiple of the "Time To Wait" (so this one keeps on running in parallel until waiting time is calculated and over). Hence, "Wait Until Next Multiple" will still introduce a waiting time (reduced CPU load), but you will "miss complete iteration slots".
    As you can see, using a single "Wait Until Next Multiple" outside the loop for initialization can make sense if the first iteration should also have a "close to normal" execution time.
    Please note that the Timed Loop does something similar once started. As it does it during the iterations, the first 1-3 iteration(s) are called "warmup iterations". Most often, the first single iteration is sufficient for this though....
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.
    Attachments:
    TimingVI_Behavior_2011.vi ‏29 KB

Maybe you are looking for

  • How can I find my serial number for re-installing

    Okay so I had problems when I originally bought both Dreamweaver and InDesign CS2 with the upgrade numbers so I had to phone Customer Support and get them to give me numbers so I could activate the software. Now I will soon be faced with having to re

  • Can you have 2 seperate iphone accounts on the same computer?

    Can you have two seperate iphone accounts on the same computer??? please help?

  • Why no suport page for msi p6n?

    is it me or does this motherboard even exist, nvidia have issued alot of fixes and currently msi are doing nothing for support for these fixes

  • How much data does an IP camera use?

    Hello all, So I have a fancy old muscle car that I have put a ton of work and would like to hook up an ip camera. I want it so that when the car is parked, I can monitor and record what is going on with it. I was planning on getting an ip camera with

  • Problem deploying ear file containing rar file

    Hi all, I am trying to deploy an ear on WAS 6.3 through a standalone application by using Deploy Service( with the help of File Transfer API). This ear contains rar file which has some jars, ra.xml and connector-j2ee-engine.xml. During deployment, th