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.

Tags: NI Software

Similar Questions

  • Need help with LabVIEW code for motor control.

    Hello

    My name is Sasi. I'm a grad student BME working on my thesis topic of assessment for back pain spine implants. To do this, I'm building a test machine that would apply pure moments of a specimen of the spinal column. I use LabVIEW 8.5 to implement the control of a brushless AC servo motor. My requirement is

    Step 1: Initialize the engine.
    Step 2: Start moving it to a uniform to the right PLAN (this value of RPM too user can enter).
    Step 3: while doing step 2; at the same time read the couple cell data (acquisition of data using Asst.). DAQ o/p is 0 v to 10 V; 0 v is 10 Nm n
    10 v is + 10 Nm
    Step 4: What torque reached + 10 Nm, i.e. 10 V, the engine stops.
    Step 5: from the position where the motor stopped (IE not need to return to the initial position) start moving in the opposite direction to the same
    Uniform rpm as in step 2 at the reading of data in the cells of the couple.
    Step 6: once more what torque reached-10 Nm, i.e. 0 V, the engine should stop.
    Step 7: Repeat "Step 2" to the "step 6' 3 times.
    Step 8: Reset engine position.

    So far, I managed to get the engine to move backward @ a desired vel, the accl, deceleration for 3 cycles before n n. I enclose my code. I have a problem inserting the code for reading DAQmx amidst all this. Can someone help me.

    Thnks,

    Sasi.

    Hi Sonia,.

    I took a quick glance to your problem and I think I have a solution for you.  I certainly agree with the suggestion of the use of parallel loops Lynn.  This will allow the portion DAQmx run uninhibited by the part of the motion, and vice versa.  In addition, you need only perform an iteration of the loop of the movement whenever the voltage level exceeds a threshold.  Thus, by performing an iteration on the code of movement in the same loop are you iterate over DAQmx code, you essentially waste processor.

    I created a VI that should do what you are wanting.  I tested it on me and it works very well.  You have a tweak a few things to apply to your system (such as motion Council DAQmx and physical channel ID, etc.).  I used two parallel loops and event programming.  Basically, the loop of movement starts the engine turns at the specified speed.  Once the engine is running, he expects the DAQmx loop to tell him that the voltage value has crossed the threshold.  When the voltage value exceeds the maximum threshold (I put a value slightly less than 10 to jitter and saturation), the DAQmx loop indicates the loop of the motion that it may end its iteration.  The motion loop stops the motion, causes a reversal and repeats the motion.  Once the movement has begun, he expects the DAQmx loop once again to tell him that a threshold was held, but this time, it's looking for a minimum threshold.  I used "Occurrences" to implement the event programming in LabVIEW.

    I've commented the code pretty thoroughly, so I hope that comments will answer all remaining questions.  The advantage of using programs that focus on the event for this is that you save time processor, and your movement is more closely synchronized with the DAQmx.  Instead of one iteration of the loop of movement as fast as you can, updates every hour, you just put in pause and wait for the other loop to tell you when to start up again.  Meanwhile, the processor doesn't have to worry about an iteration of this loop over and over again.  In addition, when the accident occurs, you catch him immediately, instead of having to wait until the next iteration.  Thus, you are more closely synchronized with the DAQmx code portion.

    I hope this will help you.  Please report if you have any questions about the code or its implementation.  Good luck!


  • Should I use the design of producer/consumer model (Instead of Globals)?

    Hello everyone.

    I have a request including several loops in it. A loop reading data series and he analyses for use in the other loops, another loop acquires via DAQmx data and performs calculations on it for use in other loops, the other formats the data from two loops and poster and one last test data. I was wondering if this is a good candidate for the design of producer/consumer model.

    For now, I use global variables to send data from the series and DAQmx loops to other loops. I use motors of the action for the different parts of the program that should be used everywhere, as the serial port. The test loop needs than the most recent data to run his test.

    Thanks for your suggestions!

    The short answer is Yes. If nothing else using queues to pass data will allow your various loops inactive if no data is present. By using globals your curls must continuously survey to see if the data has changed. You always are beter off if you can make your request, driven by events rather than to use the polling stations.

  • 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

  • What happens when DAQmx - searches read more timed period loop?

    Hi all!

    I'm not sure how Labview manages the following situation:

    I have a loop that is timed with a period of 1000 m, it is configured to ignore the lost iterations and keep the initial phase. I created a task that needs to be read continuously at a frequency of 1 kHz. In the timed loop, there are the DAQmx - read function (analog signal, 1 channel, N samples)

    Now, if I put the number of samples per channel at 1500 for example (while it takes 1500 * 1 ms = 1500 ms > timed_loop_period to read), I noticed that the timed loop takes ~ 1500 ms to complete. The same phenomenon occurs with any other number greater than the period of the loop.

    This means that the period of the loop passes to 1500 ms? Or something different?

    Thank you!

    Best wishes

    Samuel Lopez Santamaria

    You go winding with an iteration of the loop of 2000 msec.

    An iteration of the loop will always be until he has to do.  If you tell him to keep the first phase and it works for a long time, then it will wait until the next 1000 msec happen before going to the next iteration of the loop.

    Now with your situation, later iterations cannot take it any longer.  If you are permanently data acquisition, DAQ mx buffer fills while the loop is still pending.  So when he runs again, there may already be 500 msec value of data in the buffer, and he just needs to wait another 1000 ms up to what you have acquired the total of 1500 milliseconds of data you have requested.

    The situation for the third iteration of the loop will depend on whether the other was done within the 1000 msec, or ran just a bit long.  It behaves more like the first iteration, or the 2nd iteration.

    My question is why you use it timed while loop?  What characteristic of it you need that a regular while loop is not?  I think that mixing and matching the characteristics of a timed, while the loop with your DAQ acquisition will cause a continuously variable behavior time loop which is probably not what you want, or could cause you problems down the road if you're trying to do is to get the continuous acquisition of your DAQ hardware.

  • Error 200077 (frequency) and 200452 (task control loop) error occurred DAQmx create calendar Source.vi

    Hello

    I'm trying to control the timing of a timed loop. So far, I have tried several approaches via the software and which worked very well except the time loop in some missed cases 1-2 Ms I want to make sure the timing is right. I tried to provide an external clock through the acquisition of data I. The system I use is NI USB-6212. It has two counters and DIO and AIO, but I keep getting errors. I tried two different approaches. One was to use directly the game 'DAQmx create calendar Source.vi' in frequency mode, and when I did, I got error 200077. Then I found a post of somone saying that sometimes it is not possible and an alternative method is to use the same vi but set task of loop control mode. This one gave me Error200452. For this one you will see in my attachment the suggestion was to use an AI then the moment of him and then use this task for Creat DAQmx synchronization Source.

    I don't know what the problem is or if I need to put something differently.

    Please let me know if you can help me with this.

    I'll try to continue to work on that, but if anyone of you a suggestion I'll be very happy to consider the issue.

    Thank you in advance,

    Best, Massimo.

    Massimo,

    In my view, the errors that you see are the result of your hardware USB-6212 is supporting the functionality of the task control loop.  I have a M Series PCI card that is capable of operating both of your screws attached without problem (although they still +/-1ms variation on occaision).  When I try to use a USB-6212 simulation, I get the same error codes that you do.  Unfortunately, it's just a case of a lack of equipment.

    Kind regards

  • Slow loop with DAQmx read

    Hello

    I'm reading 8 channels at once using the NI9213 and DAQmx (see attached image). With this configuration, the loop takes ~ 500ms each iteration. What can I do to improve this?

    Thank you

    JP

    You have not coded anywhere, anytime, so it runs at default speeds.  Look at the examples DAQmx as Thermocouple - continuous Input.vi.  Your module even has a mode high speed, that you can use for a very fast acquisition.  Read the manual.

    BTW, the wires DO NOT your mistake byte of WILL in the end to end eventually.  Always connect them so you can control the errors during debugging.

  • 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

  • How to coordinate DAQmx sampling with TDMS in while loop?

    I tried to connect the functions DAQmx data to the conventional method of flow TDMS a while loop. The problem is that I can never synchronize the sampling frequency of DAQmx data and the function of the elapsed time. In fact, change the sampling clock service rate does not affect the sample rate in the PDM. The data saved in the TDMS file remain at a constant speed.

    This causes me a massive problem when come to process the data.

    I join the labview code and one of the data.

    Can someone tell me what I did wrong here?

    tonger wrote:

    Thanks for the reply, Norbert.

    Reading in the 1 d waveform can save only 1 channel data. Potentially, I would like to save the data of multi and accelerometer strain gauges at the same time.

    Also, I can not always change the sampling frequency...  I think that it is still in 0.000620, which is not good for the subsequent analysis of the data.

    Is there another way to solve this problem?

    This statement on the record only one channel is absurd. And your solution two loop is just as wrong. A 1 d waveform contains so many channels that you specify and it has a current timestamp inside - not number asychronous since a different loop.

  • 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

  • Loop root, time travel and DAQmx Watchdog

    I just ran into the issue where time travel calendar control blocks the execution of my system.  See here to discuss this problem.

    I have a data acquisition loop race which uses the DAQmx watchdog and open this browser window is causing my dog die of hunger, which causes the stop of my application.  Curiously, when I opened the drop-down menus, as shown in the above thread Jack, I don't see the same behavior.  It is not really clear to me what the original block, but do not have drop-down menus.

    I wonder if anyone has suggestions for workarounds in addition or explanations.

    One solution, I did it in the past to solve this problem was to create my own dialog box Date/Time in LabVIEW and hide the native button and add a normal button to the face before that this dialog box was invoked. Given that this makes the dialog a normal VI the problem of root loop is not present with it. There is a VI in resource/dialog/picktime.vi that looks like the dialog box used in the date/time picker, but it isn't since changes to the present VI appear not in the native dialog box. LabVIEW seems to use an internal C implementation of dialogue which is the root cause of the loop of the root being blocked since the message of dialogue Manager is running in the same thread as the loop of the root.

    Create a copy of this VI into your own project and adding it through your own browse custom time should solve the problem.

  • Reading loop DAQmx only reaches the speed of Communication series

    Hello everyone,

    This is my first post in this Forum. I have a program with 4 loops, 2 separate and 2 connected by a queue. The first loop (see attachment loop PID) runs at maximum speed, the second a (serial communication) works at maximum speed (very slow because of the speed of series).

    To find the error I deleted from the queue to get 4 separate loops. The loop with the calculations (calculate loop) now also runs at the maximum speed, but the analog read loop just past the loop of serial communication speed. On the inside of the Sub - VI is just the configuration for the DAQmx with internal sampling. I have no connection between the loop of serial communication and analog playback loop. Is it possible that the DAQmx is slowed down because of the serial communication? Serial communication also uses a windows DLL.

    I hope you can help me.

    Best regards

    Jannik

    Thank you for your quick response. I found the answer, I guess that: I deleted the Subvi and the use of the DAQmx in the loop directly, it has worked. I think that the Subvi took too long because of the additional options to run at 1 kHz.

  • Strange DAQmx Timing delay home error loop

    I have a digital dashboard introduced in a timed loop counter. Everything works fine until I have stop the loop and stop the task of data acquisition. Once I restart the loop that it fails with 'resource is reserved. My code is attached.

    Thank you

    I think the problem is that when you set up a timed loop to use DAQmx task as its source of the time, the timed loop is automatically set to start the task at the start of the loop. Here, you never seem to stop the task of counter before restarting the timed loop. For the second time that you run the loop timed, it tries to restart the task of Counter and sees that a task is already running with this resource (from the first timed loop run).

    If you use the function of the task to stop the task of counter after the timed loop, you should be able to restart things.

  • How can I autoindex looping for to create several channels daqmx

    I'm trying to autoindex create a loop FOR containing the DAQmx vi to create AI multi-channel voltage with identical settings, except that I need to apply specific channel names using a constant and specific physical channels using a constant of channel. Wiring of a constant DAQmx of physical channel does not work because the data type is incorrect. Similarly, I don't understand how to use a string constant to autoindex through the channel names is or how to configure the constant string (s) to assign names. Also, when I try to make one of these, I get a tunnel to exit the DAQmx autoindex create channel, rather than a task out. I can achieve my goal using several explicit DAQmx create calls to channel, but for high channel count, it is very time consuming.

    I use LV 8.5.

    I'm hoping to find the code showing how to perform the conversion type, flattening, or what to do.

    Diane has.

    I have an array of clusters.  Each element of this array is a cluster.  The cluster consists of a (scalar) string and input/output (also scalar).

    In addition, my TI attachment extracted.  I think that your file has been LV2009.  If so, you can drag the image from the browser and drop it onto a diagram.

  • DAQmx feedback loop

    Hello

    I write a VI in which an output voltage signal is sent initial (for example 10 cycles of a wave of fishing) in an electronic device. At the same time, another channel reads the voltage. In the next iteration of a loop, I want the voltage signal recorded to read to write to the output of the initial channel, such as entry becomes output and so on.

    Here's my vi at the present time, it works in the most generous sense, but I got some errors that I can't fix.

    Initially, the first iteration is registered without problem, but then, in the reading part, I get error-200279, then 200462 of error in the passage of Scripture. These are related to overwrite data in the input buffer and an empty output buffer, respectively.

    My .vi is attached. All the words of advice or encouragement?

    Thank you very much!

    OK thanks Kira T and Ye Yongqing for helping me through this, and I think I found a solution that I wanted to put in case it helps other people with their projects.

    Kira, I took your vi and, as suggested, exchanged the data record for a manual recording of data in the .tdms and that solved the 2525 error problem. However, when I have read the data (see data1.jpg), there are 2 immediate problems:

    The beginning of the initial wave of sin was being cut. I attributed this to the fact that the first task of writing Daq starts before reading inside the loop, so the first bits of the wave of fishing through the system until the task of reading can begin. I fixed that by placing the start task for writing vi inside the while loop, in a case statement that would run only on the initial iteration. Now reading and writing tasks have been synchronized.

    The second problem is quite strange - it seems that only a part of the 'i' iteration data is returned in the task of writing for iteration i + 1, and so the signal becomes gradually slowed down or expanded with each iteration since the writing task writes a progressively smaller chunck of the initial wave of fishing. By trial and error, I found that, in re-introducing the calendar than VI on the task of reading, this problem has been resolved.

    In the feedback v1_3. The desired effect is achieved: the signal is sent on itself, the noise level increases regularly with each iteration, and it doesn't seem to be cutting or the shortening of the wave of fishing.

    Thanks again to you both for your help!

    -gim

Maybe you are looking for

  • Key board does not work in Firefox

    When I type the characters come to the top in order from the top left corner no matter what key use

  • The crashing apps and battery drains quickly after updating iOS 9.2

    Well, that's what's happening: before upgrading to iOS 9.2, no app crashed, my battery lasted all day and everything was fine, but after update, applications such as Facebook, YouTube, Maps, even (Yes, stock cards, no Google or whatever it is) kept c

  • 3 Yoga does not connect to wifi

    Hello, I got of my 3 Yoga a few months now and have had a recurring problem with the WiFi. Often, when I close my laptop and he goes to sleep, the next time I try to use WiFi not connecting. This happens sometimes when I'm in the middle of using it.

  • DV6-6c65el: installation network and another unknown controller

    Hello!! I am trying to use my hp pavilion dv6-6c65el Entertainment Notebook PC and use the internet, but I can't use internet. I can't connect to the internet. I need to install the network and the other unknown controller for this computer. This is

  • Memory max freq possible?

    Hi all Having x 201 Tablet with 3Gigs and want to do an upgrade. Check memory size max for my 8 GB model but what should the frequency be? Have a 3093AA8 motherboard and a QM57 chipset. Thanks in advance! You will enjoy if recommend you a brand? King