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.

Tags: NI Software

Similar Questions

  • What is READ the array returned by the DAQmx meter? How can I know the two functions DAQmx READ data stream in the same WHILE loop?

    I have a question about the order of execution.  In the WHILE loop, I have two things to measure, period and tension using the DAQmx READ functions for voltage and the meter.  In the end, I want to collect these data as points almost simultaneously as possible, as a pair and then send them together to another piece of code (not shown here) which them will result in some sort of command for an engine.  It would be run, and then I want to perceive the tension and the period at a time later and do the same thing.

    (1.) I'm a little confused on what the meter of the READ function is back because it's a table.  What is a picture of?  I thought that it was up to the value of the individual periods between rising edges.  The output of the counter 1 DBL d's a table. How many elements in this table, and what determines the size of this table?  Are the elements of the array the individual delays between the edges?  How many values are stored in the array by executing?   We take the AVERAGE of the last 15 items, but do not know if we are throwing some of the data or what.  How to understand the composition of this painting?  How can I change the composition of this painting?  Is it possible to measure only one period at a time, for example the time between TWO edges?

    2.) Will this WHILE loop execute as it gathers tension and a "period table ' (remains to be understood by me) by TIME running in a loop?  In particular, we want that the value of the tension associated with the value of the AVERAGE of the period "array", so we can use two data items to create orders of next control every time that the two values are reported.  The structure for the delivery of vi will be attached data in pairs like this?  I understand that one of the READING functions run not before the other function of READING in the WHILE loop.  I want that the period "means" and "strain (Volt) collected at the same pace. This vi will he?

    Thank you

    Dave

    Hi David,

    I suggest including the DAQmx Start Task function. If it does not start before the loop, it starts the loop and work very well, but it is not as fast and efficient. In the model of task status, task wiill go to run the checked each iteration of the loop and then back the time checked running when it restarts.

    The status of the task model: http://zone.ni.com/reference/en-XX/help/370466V-01/mxcncpts/taskstatemodel/

    Kind regards

    Jason D

    Technical sales engineer

    National Instruments

  • read from measure Makefile slow while loop

    Hello

    I'm using Labview for controlling a lower Member brace. What I did is to save in a spreadsheet, the values of two angles in a random walk. The control template is done well because I tested it by giving two sine waves with different frequencies and the system responds by following paths. The problems begin when instead of sine waves, I put the experimental values of the read angles and "the file of the measurement reading. I can't change the speed of the system by varying the time while loop. The speed is always the same.

    In the vi attached is possible to find this piece in the upper left corner of the while loop.

    I use windows 7, 2013 and cDaq-9178 labview.

    Thank you in advance for the answer.

    Best,

    Flavio


  • Need to re - register a completed form on in Acrobat Reader and keep the same file name.

    I did collect a form developed for our client in. They need to access and save it several times without making several versions.

    Now that they can open, fill out some fields and "save under" a different file name. They must then go back and edit or add additional information to train at a later date.

    He won't let not the re - save the file with the same file name, only "save under". It is not very practical because they will end up with many versions of the same shape and all earlier versions would be obsolete and useless for them.

    You must disable the preview in Windows Explorer or close Windows Explorer.

  • using the series to read and write, I get my orders echo



  • Visa read write on port series independently and at the same time!

    Hi all!

    I need to read and write data to and from a serial port (rs232) independently and simultaneously .

    I'm sorry that I can not put a picture of that, but it's very simple:

    I used "set up the serial port" and forwarded to two while loops, the resource reference.

    a loop is reading data and the other loop is writing data to the port.

    the problem is when the playback loop (function serial reading) waiting for data - it blocks the other loop to run (writing of the serial function is blocked).

    I searched the forum and find this visa open function has 'duplicate session' option - that's what I need?

    If true, can someone explain exactly how to wire and use it in the right direction?

    Thank you very much.

    Guy.

    OK, I found an example that solved my problem: a VI called   serialduplicatesessions.

    The file is associated.

    Here is the link for all cases: http://zone.ni.com/devzone/cda/epd/p/id/1727

  • Read and write of series Basic can't read a second time

    Hi, I'm developing my own VI to write and read an iRobot Create.  I based my vi off the coast of the basic series example write and Read.vi I found (on LabView 8.0).  When I run my vi I am able to read information from the beginning to create, but I am unable to read a second time (after a write command).  The second reading should be the same as the first (I checked with the help of another program that is linked to the creation).  I am new to using LabVIEW and I was wondering if there is a common mistake made by trying to implement a series of read and write.

    Thank you.

    First of all, to debug your orders with a program such as Hyperterminal. If it works there, then it should work in LabVIEW. You may need to send a carriage return and newline (\r\n). Your code is not currently set up to do.

    Only do something when a button is basic programming LabVIEW. You can use a simple while loop with a façade that Boolean connected to an instruction box. If you have anything other than the basic version of LabVIEW, you should use the structure of the event. Look at the examples that come with LabVIEW.

  • 8753xx series read and properly calibrated chart

    Greetings from the Greece,

    I have a Hp 8753D Network Analyzer that I would like to order via GPIB with labview. In fact, I want to build an interface where the data of the instrument are displayed on my laptop and export them after.  example "series 8753xx read and graph", does exactly what I want, but requires a file name of State as well as a calibration file name. Calibration I am used to doing so far is that manually, so I don't know what type of file to be inserted in the specific field. In addition, I have nothing but the parser, not even the calibration kit. Is there a way to create a path where the code automatically extracted labview saved state and calibration saved in the memory live Analyzer?

    Thank you in advance,

    For automatic playback of the files, you can code obviously hard paths in your VI. What I have done, is to have paths in an ini file which is read at the beginning.

  • Reads and writes?

    This will sound pretty ridiculous to many of you, but I do not know how to set up a continuous flow, which will also monitor the channels of analog input on the same device.

    I am generating two sinusoids permanently.  I want to add two analog inputs which will monitor continuously outputs on the scale.  The code I downloaded also an untested changes (setting of the range inside the while loop).

    I can't test anything until I travel on the site of the next week, but I would like to have the code compiled and ready to use, so I need help.

    Can I add a Read DAQmx for two analog inputs inside the same While loop and use the same task?

    The code is in LabVIEW 2010, incidentally.

    Thanks in advance,

    The f

    Reckless wiring!  You have not to connect the wires 'work out' and 'task' sine wave Data.vi, so the task entry is empty, causing an error at the level of the property node.  As connect you the wires of the error, the error is spreading.  The thread of task goes behind the Subvi rather than in and out of it.  Consider marking of these terminals as required so that the compiler will catch this problem for you (in fact, I think it's a good idea to set the preferences option that omits all the terminals 'required' in the new screws).

  • [begineer] reboot a 'while' loop reading the serial port

    Hello! I read some data from a COM port. I want to read my like this "%d S. the unit will send data continuously and depending on when I push the button run in labview, it can start to read data from the middle (%d is a four-digit number). as: 23 S 15'

    "whenever the first character of my data is not of", I need to restart playback. I read the data in a while loop. so I need to stop the while loop. From what I found on the internet, I used a case, another while loop and shift registers.

    but in some way I'm stuck inside the while loop. My VI is attached. Thanks in advance and sorry if my code is a mess!

    PS: what should I do if the bytes I get to the port is variable? use bytes to the port?

    The device sends a character at the end of the line at the end of each message?  You are currently Setup to do this by activating the stop character (currently set to end of line/10/0xA).  If this is true, then simply set the bytes to be read on the VISA to read something rediculously high.  It will stop playback when it finds this termination character.  From there, you just have to check for the correct format.  If this isn't the right format, ignore him.  Otherwise make your recording.

    I managed to clean up your code a bit on this basis.

  • Seen Truble reading and echoing using PHP in HTML. Variable scope problem possible?

    Hey guys,.

    Thanks for your help always well informed! Today, I work with the text to a text file in a table HTML with PHP. I can't get the data to display correctly, I think it has something to do with the scope of variables, but I'm not sure. Here's the code I'm struggeling with that:

    <table width="357" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td width="165">Pizza 1</td>
        <td width="186"><? echo  $price['0']; ?></td>
      </tr>
      <tr>
        <td>Burger 1</td>
        <td><? echo $price['1']; ?></td>
      </tr>
      <tr>
        <td>Drink 1</td>
        <td><? echo $price['2']; ?></td>
      </tr>
    </table>
    

    In the above PHP (not shown), the $price array is properly filled (I tested in echoing every bit line-by-line), but at the moment where we enter the HTML code, it seems that the table is empty or is not love how I am the appellant. Made in the scope of a PHP variable with the closing end '? ">" tag? Am I missing something? Below is the full code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    body {
        background-color: #333;
        color: #FFF;
    }
    </style>
    </head>
    
    <body>
    <?php
    $menu=fopen("prices.txt","r") or exit("Unable to open file!");
    $price=array();
    $priceposition=null;
    $tempstring;
    
    //This loop does all of the READING and populating of variables
    while(!feof($menu))
      {
        //Check to see if this is the first pass, if not add one to the array possition
        if ($priceposition==null){
            $priceposition=0;
            }
        else{ 
        $priceposition++;
        }
        
        //populate the temparary string
        $tempstring = fgets($menu);
        
        //Populate the array if the temporary string is not a comment
        if(substr($tempstring,0,2) != "//"){
            $price['$priceposition']= $tempstring;
            echo $price['$priceposition'];
        }
      }
      //End of reading loop
      
      
    fclose($menu);
    ?>
    <table width="357" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td width="165">Pizza 1</td>
        <td width="186"><? echo  $price['0']; ?></td>
      </tr>
      <tr>
        <td>Burger 1</td>
        <td><? echo $price['1']; ?></td>
      </tr>
      <tr>
        <td>Drink 1</td>
        <td><? echo $price['2']; ?></td>
      </tr>
    </table>
    </body>
    </html>
    

    and you can run the code on my server to test here: christianstest.info/phptest/readwritetesting/readtest.php

    Thank you guys!

    Try to change this-

    fclose ($menu);

    on this subject.

    fclose ($menu);

    ECHO '.

    « ; exit(print_r($price)) ;

    et voir ce que vous obtenez.

  • How to set up the execution in a way independent while loops?

    Hello

    I hope someone here can help point me in the right direction for that.  My system at this stage is still quite simple, I just data collection of 2 resistance probe and a pressure sensor, their output in the Panel before and sometimes to write.  I have put architecture in place to call parallel loops running at the frequency I would ideally like to do.  that is, I want the RTD to update every seconds and the pressure transducer for updating chaque.5s, I want to write to the file at a rate defined by the user and I want the Panel before updating a half second (correspondence with the pressure transducer).

    Now, in the structure, I wrote, it should run all the while loop once before it can restart the sequence.  Technically, the code works, but it takes ~1.5s to the RTD to collect and update and so the whole VI takes ~1.5s to complete.

    I don't care if the RTD is slow to update, but as I use the sensor as a gauge of the cell pressure I need to know at a high frequency that the pressure is in the cell, and I don't want to wait 2 seconds for the information.

    I know I'm starting to get into a much more advanced architecture for this and ive spent the last googler 6 hours trying to find a procedure for how it works but I can't figure out a way to have the whiles stop waiting for RTD loop finish.  I guess that this is to divide the VI in several screws and construction of a library, but the resources I could find about it were not very useful for a beginner like me.  If someone could point me in the right direction on where I should look then that would be great!

    Thank you

    Zach

    Zach,

    Because you created the tasks of data acquisition elsewhere, we do not understand how you have set up. Continuously, starting and stopping tasks may be slower than setting up of a permanent task and let it run.

    You have not indicated that you use the DAQ hardware.  It is often better to leave in the DAQ hardware clock set ignition rather than rely on software distribution. The pressure loop reads 1000 samples at a time and calculates their.  If you're not sampling at 2000 s/s or faster, the loop ends late due to waiting for data.  In two loops DAQ, you do not use the calendar information.  Acquire the data in tables rather than waveforms.

    The Dequeue functions in the loop at the bottom have no wait times for this loop will not iterate until all three queues have data. As the pressure loop runs faster than the loop of RTD, the queue of pressure slowly fills.

    The upper and lower loops are vying for the data.  The preview queue item does not delete data from the queue, but the functions of the Dequeue elements in the loop of the low fact.  If data is deleted form the queue before the upper loop resembles it, it will never be saved. With your installation there is no way to ensure that you get all the data or that you do not read and record the same data more than once.

    You don't have anything set up to stop one of the loops.  You use the Cancel button to stop your VI?  If Yes, STOP! Other aprticpant on the Forums said: "using the button abandon to stop a VI is similar to the use of a tree to stop a car.»  It works, but can have unintended consequences. "Things like closing of files, freeing up the queues, by closing the task of acquiring data, and other things can occur when the program is interrupted.  You do not shut down your computer by pulling the plug.  Stop your program also neatly.

    Ok.  I have highlighted some of the things that can keep your program to run as desired.  What can you do about them?

    1. you probably don't need call loops.  Normal so the loop should be good enough.

    2 put a stop button on the front panel. Put the terminal in loops (bottom) and connect it to a function to send a Notification and the status of the Terminal loop (stop sign).  Put wait Notification functions in each of the other loops.  Put a period shorter than the time loop minimum on all of them if the lops can work.

    3. see the comments above regarding the DAQ bed material.

    4 use the Dequeue timeouts to adjust the pitch of the loop the loop where the data is used.  Also make sure that all data is removed.  You need to think about your time together and what are the bottlenecks.  Except if you expect this system to grow to much larger dat sets, I probably acquire ALL data (pressure and RTD) at the same rate and reduce the displayed amount by the average like you do for pressure data now.  If you want different final data rates, just average different amounts of data.

    5. it might be useful to learn how to work the State machines.  Display, averaged and recorded files could be managed in a loop by a simple state machine while allowing for more flexibility in the calendar.

    6. Another good reason to consider a state machine is that initialization and shutdown processes can easily be handled in the corresponding States. At this point you do nothing with errors. A state machine would enable you to handle errors (for example, the cancellation of the selection of the user files) without stopping the program.

    Lynn

  • Updated entries on day of a Subvi with while loop

    Hi there guys! It's my first serious experience with LabVIEW, so the question may seem trivial to you, but it's not obvious to me how to solve this problem. So I do an installation that integrates a number of flow regulators, a temperature regulator, DAQ, some taps and a mass spectrometer basic tasks. All these must be automated using LabVIEW. I started by doing a VI for each separate task is going very well. Now I need to combine the latter in an experience of master VI, and of course I run into trouble.

    The problem is that I want of course to control this experiences with some selected buttons/dials/what is on the face before of the main VI. However, each of these VI runs a while loop in which fact acquisition of continuous/data communication / whatever. Of course, I want to change settings online. If I just naively tie them at the entrance to the Subvi these will be read only when the Subvi is started, not during each iteration of the while loop.

    I added a very basic example of the problem, so we are all on the same page. The main VI has a button, the State which should update something in the Subvi. However once the Subvi is started it takes control of the execution and the hand-VI seems to be ignored (appears to hang) even if the program has a lot of spare time to read the buttons and put on day of admission. What is the official solution for this kind of problem? My experience in programming that I prefer to keep the intact Subvi, so I can use it as a reusable standard library. Of course a similar question can requested the sub - VI output which will be updated only once the execution is completed (which is never during normal operation).

    PS. I'm using LABView 8.6 on XP

    The best way to set up a BT program must initialize first your settings, and then launch a while loop where you communicate/aquire data or whatever, then after the while loop is finished close and clean up your references.

    Inside the while loop, you can place your code in many of the screws and it is possible to run those in parallel, but I defenetly does not recommend the use of loops in slot face, especially without having to open the front panel or a stop test.

    If your code is completely executed up to your Sub - VI, the main.vi will wait for the sub - Vi ends before continuing the code.

  • While loop stops unexpectedly

    Hello world

    I have a problem with while loops.

    Im trying to write a program that allows me to control the temperature of a hot plate, using as a starting point one of the examples in LabVIEW (basic series writing and reading). So basically the program sends an order asking the real temperature of the heating plate and it then reads a response with the State, then the user writes a temperature (the sub - VI creates the command that is sent to the cooking plate), then he reads a confirmation response. the while loop is to monitor the temperature and change it if necessary

    Sometimes it works for about 30 seconds and sometimes for a few minutes, and then everything stops playback, I don't get the error messages, it stops just a response.

    The hot plate is a pro H550 MS7 and im using a USB to RS232 converter

    PD, I'm pretty new using labVIEW, sorry for my bad English.

    Greetings and thanks for the help

    Bob_Schor wrote:

    Found the manual.  Here is a summary (edition - in fact, it is essentially all of the manual, just condensed and without 'images'):

    • The statement format: prefix, Instruction, data frame, Checksum
    • Command: Prefix is 0xFE
    • Answer: The prefix is 0xFD
    • Add at least 50 msec between pairs of bytes
    • Data frame, send high and low bytes
    • Checksum = sum of the instructions, the frame data, but not prefix
    • Commands and responses seem to be mainly sequences of 6 bytes

    OK, this helps a lot.

    The first issue with the OP code: turn off the stop character.  The protocol uses binary communication protocols.  The stop character is only useful for communications ASCII protocols.  Nor if he was being a 0x0A in data, VISA Read stop reading right there because it's the stop character and it is enabled by default.

    Second, always do not have need of the bytes to the Port.  You know what you send and you know what should be the answer.  Therefore, suffice to say the VISA of reading to read the required number of bytes.  If your delay is long enough, you do also not waiting for him by saying the VISA must read the number of bytes to read.

  • Update an indicator of in while loop with event driven programs

    I'm trying to update a chart shared by several events within a Structure of the event. I would like a change in value of a button (NOPE or OK buttons in the attached example images) causes the structure of the event causes a switch between the various outputs for the chart. In the example attached, clicking the OK button will send the graph random matrices, while clicking on the button NOPE will send constant tables to the curve.

    As the process within the structure of the event is underway, I use a while loop within each of the different events in the event Structure. So there is a structure of the event, and each event have while loops in them which should update the chart outside the structure of the event (see attached images).

    This does not update the graph, the graph remains static instead, why is this? How can I configure it to work as I described above?

    In my view, a question is: How can I use the same stop button in both inside while loops. In the example images, I have two that are different, one for each of the different events.

    Thank you!


Maybe you are looking for

  • WINDOWS hotmail, (outlook) collapsed openning messages or emails, I can not yet send a new e-mail. What should I do

    I opened the hotmail page and sign in. All messages and new messages appear as usual. When I click on any email my small twrill windows clock starts and never opens anything. Same thing if I click on the sending of new e-mail messages.

  • Disorders of printing HP Deskjet 3520

    Hello Running Win 7 and used to have an all-in-one HP Deskjet 4200. All print very well, but was not really happy with the photos. In any case, recently bought a HP 3520 and am having problems printing. Still using the same computer (Asus) and Micros

  • SQL server management studio 2008 Express intall error

    When you try to install SQL server management studio Express 2008 I get this error: TITLE: Default the SQL Server installation program.------------------------------ Setup of SQL Server encountered the following error: Invoke or BeginInvoke cannot be

  • Recipients receive e-mail with Hotmail e-mail ID unknown.

    Original title: Windows Mail I have set up my Road Runner e-mail to receive through Windows Mail and my recipients receive my email but with a weird Hotmail email on my name. How can I get the email address show correctly? I checked the settings and

  • Help, please! UNEXPECTED KERNEL MODE TRAP!

    Hi, I had problems with unexpected_kernel_mode_trap for awhile. I bought my pc in a store, but I had the view model, because it was the only one to the that have left. I used the pc normally, but there is no reinstall it when I got it. After a while