DAQmx behavior in a "loop"

Hi all

In our laboratory, we have inherited previous code for the acquisition of data from a source of tension. It consists of data acquisition in a loop for.)

However, there seems to be no way to put the creation of jobs and tasks outside of the loop cleaning for: the thread of tasks becomes a table, unlike this situation:

http://forums.NI.com/NI/attachments/NI/250/30849/1/Acq&graph%20Voltage-int%20Clk.VI

http://forums.NI.com/NI/board/message?board.ID=250&message.ID=30907&query.ID=552736#M30907

I would like to have only the acquisition of data within the for loop, (instead of wasting time creating tasks over and over again), but there seems to be a trick to clean the stain later that escapes me (task thread becomes a see table).

Right click on the tunnel exit on the loop where the wire is broken and select 'replace with register shift. " This tunnel has been set at autoindex if you create a table. As you may be cleaning up this review if you need all the structures of the sequence inside this loop.

I hope this helps.

Tags: NI Software

Similar Questions

  • best type of measure daqmx for several closed loop control system

    Hello

    I wonder what kind of type of measure daqmx which are suitable for the control system of closed loop with control about loop 128?

    I design unique loop with continuous sample and sample application. The two correct answer. But I don't know if the control loop number increases.

    Another question is, clock synchronization of time needed for such a system?

    taov,

    I recommend you to use continuous sampling because it is time of material while on demand collection is software time.

    As for the RTOS system, please see this link.

    CarmenC

  • For the behavior of the loop in OSB

    Hi, I have a step in the proxy request pipeline that has an error handler.

    Inside of this point, I have an action "for". My request is if an error occurs during the iteration of the loop for and if I use the action back in the error handler it will return to the same loop iteration for?

    Thank you

    Published by: 04111986 on November 30, 2012 19:35

    Nope, he abandoned the current scene altogether and continue to the next step...

  • Very odd behavior of 'for' loop with configurable class

    Who can explain to me two compile errors in this fragment?
    -----
    public class JavaBug
    {
    Public static interface bugs < TBug extends JavaBug >
    {
    Iterable < TBug > getTBugs();
    Iterable < JavaBug > getBugs();
    }


    public static why (Bugs bugs) Sub
    {
    for (bug JavaBug: bugs.getTBugs ())
    {

    }

    for (bug JavaBug: bugs.getBugs ())
    {

    }
    }
    }

    -----

    Sorry if an example like that was allredy displayed, just give me a link in this case.

    Published by: 816877 November 30, 2010 07:00

    If* 1.4 compatibility is your goal. First, you mentioned here. If this isn't a goal, it's the worst answer because you transfer all the insecurity of the run-time type.

  • loop of two producers for quick DAQmx and the user controls?

    Hello

    Sorry if my question is maybe a bit too general (I don't have a VI implementation yet).

    I think about the solutions for a Structure of producer-consumer with event loop in the part of the producer.

    So far, if I had to do a project with DAQ, data analysis, data recording and enter the user controls, I've followed usually this kind of approach:

    I used the producer part to capture interactions with the user, and I also had a state machine in the part of the producer, with registry change. I also buy (any faster then 10ms) DAQmx device data in the part of the timeout of the structure of the event in the loop of the producer. I have several consumer loops down, such as data analysis, data recording, etc... I send the data measured in a cluster with the enumerations of the State of the loop from producer to consumer with queue loop.

    I'm not happy with my approach for the following reasons:

    1,

    If I need device acqure faster DAQmx data that the operating system clock can handle (like 1 MHz), so I can't put it in the part of time out of the structure of the event of the producer loop, because here I can go through the while loop with minimum 1 ms.

    2,

    If I put this part DAQ in a loop for quick consumption, it is not admissible for orders from the QUEUE line after that it starts to run (assuming that I use the standard structure of producer-consumer, so consumer loop every time iterates once, when a package comes from the Dequeue).

    Then say, how can I control a young (timed by DAQmx device internal clock) loop of data acquisition of the structure of the producer of the event loop? As loop DAQ to start, stop, restart, etc...

    Thank you very much for the advice!

    You can certainly have several loops of producer.  Have a User Interface, loop driven events to send commands and a separate data acquisition loop to send data are not a problem.  Each loop has a separate queue. (You might be able to make it work with a single, but using two queues avoids many problems).  Often, I used a system of three loops long before that everyone was talking about calling it a producer/consumer.

    Lynn

  • DAQmx loop

    Hello everyone.

    I have 2 questions.

    1. when I do a continuous supply with DAQmx, I put a DAQmx read in a while loop.

    I can't understand why I can't put all the codes DAQmx in a while loop.

    2. what type of data it carries the 'task' to 'work out '?

    I looked for days, still can not find any explanation on these two issues.

    Please help me.

    1. Once you configure a task with the numbers of channels, type, range, sampling frequency, etc., this information is retained until the task is disabled, then there is no reason to repeat this information. If you have experience with basic instrumentation, there is no difference. If you used a Pocket DMM Volt nec computer, you he would not turn market whenever you wanted to take a new measurement.

  • Error 200088 using the DAQmx reading VI in a case structure

    Main problem: I'm writing a VI that will read data from a data acquisition and write to a text file when I hit a button "registration". To do this, I use the VI of reading DAQmx in a while loop, which is located in a case statement (I hit the 'Save' button for the case of true), which is in another while loop. My DAQmx create Virtual channels screws are outside of the loop, so a wire goes through three structures to connect these screws to the VI DAQmx Read.

    After clicking on 'Save', my VI works until I hit the "Stop" button, how I get error 200088: ' specified is not valid or does not exist. " If anyone can help me get rid of this error, that would be greatly appreciated!

    I enclose my VI and an image of the error.

    Secondary problem: currently, I use two different DAQmx read live: one mentioned above, which lays down: after clicking 'Save' and the other who reads data continuously to display on maps. I want to combine these two, but I don't know if this is possible given the case statement.

    Thank you!

    Hi Alexwright,

    I made some quick changes to demonstrate the producer consumer loop that would be effective in your case. You want to loop of producer in the first while loop so that you use and the same closing DAQmx task. Moving a forwardthis will require some trial and effective change for your application. Please also make sure you use our debugging tools: http://www.ni.com/gettingstarted/labviewbasics/debug.htm.

    I hope this helps.

  • Can not on the button while loop

    Hi all... hoping to get a few design tips as I am very, very new to LabVIEW. I got a project that someone else had started and I've encountered a problem that I don't know how to solve.

    I'm using LabVIEW version 8.0.1 and I think my problem has to do with the help of DAQmx in a while loop. In "Working.vi" (including the Sub - VI 'Temp data to CSV.vi'), I copied - and stuck the while loop in a vacuum VI for testing. In this VI, with nothing else, it works - slowly, but it works.

    In the real VI, I can see the data of temperature updated every 4 seconds, so I know that the program is not frozen or something like that. However, by pressing the button "Return to main Menu" does nothing - the image of the button does not show that it is to be depressed, regardless of how many times you click or click and hold the button. I've attached a screenshot of the while loop inside the real VI; I prefer not to fix the real VI (especially because it contains references to many of the Subvi, and it is not currently contained within a LAW degree).

    I'm this coding the wrong way? I have the feeling that it might be caused by my settings DAQmx (continuous samples, 2 samples to read, 250 mHz). The very low rate would be the cause? Is there a better way to have readings of temperature taken every 4 seconds (approximately)?

    You have your case of event the value "lock the front panel" until full?  If so, then no other presses the button will be recognized until the ongoing case event complete.

    It is never a good idea to have a code in an event business that takes a long time to run.  It will make your UI seems to lag or even functional.  Any time I see someone with a while loop inside a case of the event, I'm afraid.  (By the way, I am also concerned all nodes comments hovering over the structure of your event?  What are doing?  Why some operate on the default data?)

    In general, events should take is no longer running then what ordinary person could be expected until they feel like the user interface is delayed.  Perhaps at the top of 1-2 seconds.  You should look at a model of design of producer/consumer with events.  The structure of your event should respond to UI events, then pass orders by a queue path to the part of your program that does the real work.

  • acquisition of continuous data from Ni-DAQmx

    Hello

    I use LV 8.0 and am acquire signals of an ecg machine using the NOR-DAQmx with a sampling rate of 1000smpls/s... the thing I want to do is, get the table with the complete information and move on to another VI for analysis... But the problem I am facing is, as the sampling rate is 1000 and my DAQmx is a while loop I get just 1000 values in the table and not the complete table with the record for more than 60 seconds...

    Can someone tell me please a method to get all the values in the table, I mean for the session of any acquisition (maybe 5 minutes)...

    Kind regards

    Nitzy...

    Hello!

    Use something like this:

    But the DAQ Assistant, putting your own code DAQmx (for something as simple as buying 1000 samples, DAQ Assistant is good!)

    Make sure the Array function to build is set to concatenate entries, also convert Dynamic Data has the value table 1 d of scalars-automatic (but this is only important with the DAQ Assistant)

    I hope this helps!

  • DAQmx writing

    Hello

    I am trying to simultaneously acquire a signal while generating / writing a signal chirp (swept sine wave), which varies from 0 to 800 Hz. before, I was able to do it using a loop timed with 1 KHz clock and 100 msec period. The sampling rate for the moment for generation DAQmx was 4000 Hz, and the number of samples per channel was set at 400. In the timed loop samples per channel for the DAQmx write that VI is set to 400. I used "Creat an analog Signal" express VI into the loop timed to generate the beep signal using a 4000 Hz sampling rate and number of samples of 400. The FFT of the acquired signal was clean with almost no noise inside.

    Now, I changed the above parameters such as the VI can be used for real-time closed loop control. So I reduced the samples per channel in all cases to 1 and use the clock 1 MHz with 200 micro-sec period, acquisition and generation at 4000 Hz. However, evaluating the acquired signal FFT, I realized that it contains a lot of noise, while the previous code with 400 samples per channel contained no noise for a frequency to 1000 Hz band.

    I think that the problem comes from the high sampling rate with the small number of samples per channel for the writing VI DAQmx. My feeling is that the DAQmx doesn't have enough time to write all of the samples in the buffer. I tried different values for the timeout for DAQmx VI (reading and writing DAQmx) in the timed loop, but it did not work... I gave the last VI here. Can someone help me where the problem is?

    Also, is it possible that I can monitor the actual values of the data written (i.e. the output of writing DAQmx)?

    Thank you

    You mentioned the loop is expected to completed in 330 microseconds. If it is not designed to finish at 200 microseconds based on the period of your timed loop? It would be the best way to control real time loop to connect an indicator to the duration of the iteration inside the timed loop.

    It seems that you have configured your VI DAQmx of Timing to get a sampling rate of 4000. You then write a signal with respect to 12000 s/s from the node to create an analog Signal. I recommend you keep these two consistent values. If you are wanting to read/write data at 4000 Hz, which would be linked to a period of 250 microseconds. You can increase the length of your timed loop 250 or more.

    You can attach a screenshot of some data that you had who had less noise for comparison purposes?

  • on the timing and the GUI control loop

    Hi all

    I have a code with two buttons placed on the Panel, one is EXECUTED, another is STOP. Initially, STOP is disabled and when I launch RUN, the JUDGMENT will turn off. But when the JUDGMENT is made, the RACE will be activated.

    #include "testimg.h"
    
    #include 
    #include 
    #include "asynctmr.h"
    #include 
    #include 
    #include 
    #include 
    #include "toolbox.h"
    
    static int panelHandle = 0;
    
    static int stoprun = 0;
    
    int main (int argc, char *argv[])
    {
        int error = 0;
    
        nullChk (InitCVIRTE (0, argv, 0));
        errChk (panelHandle = LoadPanel (0, "testimg.uir", PANEL));
    
        SetCtrlAttribute(PANEL, PANEL_STOPBUTTON, ATTR_DIMMED, TRUE);
    
        errChk (DisplayPanel (panelHandle));
        errChk (RunUserInterface ());
    Error:
        if (panelHandle > 0) DiscardPanel (panelHandle);
        return 0;
    }
    
    int CVICALLBACK MainPanelResponse(int panel, int event, void *callbackData, int eventData1, int eventData2)
    {
      if (event == EVENT_CLOSE) QuitUserInterface (0);
      return 0;
    }
    
    int CVICALLBACK RunButtonResponse (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
    {
      if (event==EVENT_COMMIT)
      {
        int N=20;
    
        stoprun = 0;
        SetCtrlAttribute(panel, PANEL_STOPBUTTON, ATTR_DIMMED, FALSE);
        SetCtrlAttribute(panel, PANEL_RUNBUTTON, ATTR_DIMMED, TRUE);
        for (int i=0; i0) break;
        }
        SetCtrlAttribute(panel, PANEL_STOPBUTTON, ATTR_DIMMED, TRUE);
        SetCtrlAttribute(panel, PANEL_RUNBUTTON, ATTR_DIMMED, FALSE);
      }
    
      return 0;
    }
    
    int CVICALLBACK StopButtonResponse (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
    {
      if (event==EVENT_COMMIT)
      {
        stoprun = 1;
      }
      return 0;
    }
    

    My code is a repeat for N times, once the START button is kicked. And if the STOP button is started until the task has finished running. Stop the current application and returns the value false. I wrote the code, but it seems does not work. It seems that the application cannot be interrupted before the file for the task. I don't know what's wrong with my code. If you have any experienence with this, could you please tell me what is the problem with my cdoe? Thank you.

    What you see is the expected behavior: in your loop inside the run key, you have a 5 second wait in which the system is frozen, then another 2 sec with the system frozen again. For the simulation need, you must change the code this way:

    double tini;
    
    tini = Timer ();requestToStop = 0;
    while (Timer () - tini < 5.0 || requestToStop) {
      ProcessSystemEvents ();
      sleep (50);
    }
    

    The stop button then must trigger a global variable that stops the loop (requestToStop in my example above).

    In actual code, such a long-term process should not be handled within a control reminder: you will need to place it elsewhere depending on how you want to structure your code in order to let the user interface responsive. Available alternatives are:

    -A reminder of timer UI

    -A reminder asynchronous timer (similar to the preceding but executed in a separate thread)

    -A separate thread issued with CmtScheduleThreadPoolFunction

    If this date is the solution, the stop button must be manipulated inside the code by triggering a signal enabling the treatment stop securely.

  • Significantly to identify the steps performed in a loop?

    Hello

    I have a series of tests, where I apply a voltage to the many different pins (sequential) while checking the response for each pin on a CAN bus. I set up the tests in a loop, like this (pseudo code):

    paramsArray = initParamsFromFile()
    
    For_each (params in paramsArray)
        Apply params.voltage to params.pinId
        Test canValue == params.expectedResponse
    End
    

    paramsArray is an array of 50 containers (clusters of LabVIEW), that is populated with values in a file. Each element of the array contains a pin code, a tension to be applied and a value to wait of the CAN bus.

    However, the newspaper tests for 50 pins end up with exactly the same name of the step and the step ID (I use the default table TestStand schemas).

    So my questions are:

    1. What is a good way to implement a repetitive set of tests?
    2. What is a good way to distinguish the (repeated) steps in my journal?

    Thank you!

    Hello

    1.) it is ok, you can do because it will keep your small sequence as possible and (fast).
    But you can also use the StepType For-Each while others will see more better the behavior of the loop
    The looping function is a little more 'hidden' in the parameters field. It comes in large sequences
    is often overlooked. It's just your choise. I use two things.

    2.) just rename the name of the step in the field of PreExpression using the LoopIndex
    Step.Name = "MyName:" + Str(RunState.LoopIndex+1)

    Hope this helps

    Jürgen

  • Counter the acquisition and generation of simultaneous signals of Daqmx triggered

    I am writing a vi that collects the data of a specific length (1000 points) when writing the data of the same length on another port on the same card (PCI-6052e). Collection and production are both triggered by a pulse of a counter on another Board (PCI-6711). I am able to trigger both successfully, but not at the same rates and not to the desired resolution. The generation of waves and the collection forms should be 8 msec in duration. I have attached the screws. Any ideas would be appreciated.

    Thank you

    Jordan

    Eventually clocked continuous generation, but the displacement of the wave write vi DAQmx out of the loop (just before the beginning of vi), and this fixed the calendar.

  • While and loop output conditionally scenario

    Hi all

    I have a loop that I want to go 5 times (for or while loop), GOLD output conditionally using a button at any time. that each iteration takes 5 minutes to complete, and to Midway through the iteration 2 I decided that I wanted to stop the process, which is currently (and I appreciatte it is normal behavior) is the loop ends the iteration 2 and then continues for a for an iteration. Therefore, stopping after iteration 3.

    Is it possible to keep it from begin iteration 3 at all?

    Thank you very much

    Force your stop command to read when the process is complete.

  • First iteration of a loop problem

    I'm having a problem with the first iteration of a while loop. I want to save all the data a data acquisition over a period of time. In order to keep the unique 'small' file, I'm doing a VI that produce a new file every 10 min. about. But the first file I want to do is not due to the following problem:

    The first time I use the DaqMX read in the loop, it returns a blank. Why does do that?

    I'm not entirely sure why, but I just set the number of samples to a specific value so that you do not need the function of Ms. wait 100 in the loop.

    Tone

Maybe you are looking for