DAQmx tasks for Subvi of good practices

Hello

I wonder about the best way to create the subVIs that don't repeatitive entry analog and digital output several times in a program. Specifically, should I create a new task using DAQmx create channel in the Subvi or should I create the task in the main VI and put the task in the subVIs? Create and delete a new string into a Subvi would affect the States of digital output line (for example to change a line in the default state) after that the program will stop at the Subvi?

I'll collect digital 6-channel analog inputs and 2 outputs to control a magnet. The program only collects analog inputs for 5 seconds each time (based on the user's selection) and active the magent or not based on the analog input.

I update an old program LV traditional data acquisition functions allowing to use the new DAQmx features. The old program was written in LV 8.6 and used the DAQCard-6036E card and I update it LV 2013 and the USB-6212 mass unit.

Thank you

Frank

If you call this VI a good amount, then I create the task in advance and pass it in.  Re-create the task just request in trouble, especially since I don't see you close either.

Tags: NI Software

Similar Questions

  • DAQmx task: MAX or lvproj?

    Experts,

    What are the benefits to declare tasks DAQmx either in the lvproj or Max?

    My question because I'm calling a VI of TestStand test, and when the DAQmx task constant is declared in the project (lvproj) which holds the criterion VI, it does not perform properly, saying can't find the reference or something.

    If I change the DAQmx task to be a global task in MAX everything works as expected.

    What is the best practice to do this kind of things?

    Thank you very much

    LR2

    TestStand does currently not support execution of VIs a project. So unfortunately, we expect the behavior that you see where to call a VI that uses a DAQmx task defined in a project does not work. For now, if you do want to keep your configuration of the task outside the source code and you want to use these task for TestStand, you must store the Max.

    We are looking for by adding support for the performance of screw a project in a future version of TestStand.

    David Rohacek

    National Instruments

  • Good practices of FIFO: updated old cluster or create new

    Hello world

    My question is more on "good practices" that really solve a problem.

    I use FIFO to send images and other data from a producer to a consumer.

    I created a cluster which includes all the data that must be sent through the FIFO.

    My question is: can I create a new cluster to each loop of the producer and put this cluster in the FIFO or should I set a shift and then register and update the data of this fallen registry change by sending in the FIFO?

    Below you will find two screenshots that sums up the idea (NB: these aren't the real VI.) We come here to show the general idea).

    If there is a difference (in the way that the computer uses memory for example, or something else...) between these two methods of programming, you will give me some details so that I can understand why to use one over the other, please?

    Thank you very much.

    Best regards.

    Luke

    I think that there is very little difference in terms of performance (perhaps the registry approach change is slower than sliiightly - but probably not noticeable in most cases).

    The main reason you want to use the shift register approach is that if you update only certain values before sending the data in the queue, those that would be lost if you created a new cluster each time. For example, if 'Directories' was constant, you could just power/updating that once the value to the registry to shift and just update the part "ImageAcquired" of the cluster before you send it in the queue. This also means that if you update your cluster to have more elements (using a type-def, of course), you can be less worried about having to update the individual elements.

    I think it is less a problem of performance (both are valid and effective) and more a matter of maintainability and flexibility.

  • Extract single channel DAQmx task

    Hello

    I created a task DAQmx output, which contains two channels.  Is it possible to extract the individual virtual channels of the task to be dealt with by two parallel processes?  I tried to bring out the ownership of channels using a task property node, but then I get the error that the channel is not part of an active task (see excerpt)

    Could someone advise on a better approach, or how to obtain this feature - if that's possible?

    Concerning

    Dave

    Sorry, that VI does not have much sense. You must use a unique DAQmx writing for both channels and 1 sample mode, simply build an array of signals as shown below.

  • Restarting a task for the acquisition of data inside a For loop

    Hello

    I need iterate through my acquisition of data. Currently, I'm doing this through the creation, implementation and tasks for the acquisition of data inside a loop For which is iterated according to the needs of compensation. Unfortunately, the creation of these DAQ tasks slow down my code.

    I would like to be able to create the tasks outside the loop, pass them in and revive the tasks at the beginning of each iteration. Is there an easy way to do this?

    Otherwise, is there a way to make the standard DAQmx digital startup trigger trigger several times (so that it starts each pulse data acquisition in a long pulse rather than just the first pulse train)?

    Thank you!

    -Evan

    I whent before and created this example for you (and many others.)

  • DAQmx task Read DAQmx with sampling frequency of 10 Hz produced much too much data

    I have a simple configuration with a strain of channel 4 OR-9237 amp holds a carrier of series C of WLS - 9163 (wired ethernet mode) - Details probably does not matter.

    I used MAX to create a DAQmx task associated with which all four gauges samples.  The calendar setting is "Scan Loads" is continuous sampling, 2 k buffer (read samples) and 10 Hz rate.  I guess that this task would generate 40 data values per second - 10 for each channel.

    I have a simple loop of reading using DAQmx Read.vi that works always (without any stimulation time).  Playback is set to read all available data and then pump it into a table.
    In the attached example, I also added a few words of debugging to stop the loop after N iterations.

    As the loop is programmed with a 0.2 second period, I expect each pass of the loop to read about 8 samples or 2 samples per sensor.  Instead, I get hundreds each passage.  It's like reading has substituted the sampling frequency specified in the task of the unit.  I absolutely need data to be material to the rhythm.

    Where have I lost?

    Thanks Adnan,

    I changed your example I selected 'Strain gage' entry analog and then lowered the minimum and maximum thresholds to +-1-2.  What happens is that each other in the loop, I 2048 samples or zero samples.  The display flashes a whole line and then it clears any other past.

    In response to your second post, I understand that the loop cannot run quite right that I select.  I think that, but at a sampling frequency of 10 Hz, I have to sleep on the software side for nearly a minute before I built 2 K samples.

    I played with the frequency of sampling, assigning to various values from 0.1 to 10000Hz.  The behavior is the same until I approach the high rates where available samples remains to 2048-4096 sometimes, the display becomes continuous.

    Ahhh, Darn.  Yet another search was this link that points to the root of my confusion.  The 9237 can taste arbitrary rates using its internal clock.  Duoh!  I wish that the pilots are smart enough to warn you if there is a discrepancy between the selected sampling rate and capabilities of the device

  • receiving exception "resource requested by this task has already been used by another task' for unknown reason

    Hi people.

    I am running in a bazaar error I'm not around.  I have a series of cDAQ chassis (9188) with a number of NOR 9208 each.  Everything I'm doing is the simplest of the simple acquisition of VI to extract data from each of the 16 channels of each 9208 and push values for the configuration UI.

    NOTE: the material is SIMULATED in MAX.

    I'm trying to create a task for each 9208, but DAQmx start Task.vi bombs out after the code creates the first few tasks successfully.  The exception:

    "Error occurred 200022 DAQmx = begin Task.vi; "Possible reasons: resource requested by this task has already been reserved by another task."

    Please see the attached screenshot.  I have provided two tables of physical constants Channel. Bombs currently wired table on 'AI_Module_07 '.  The unwired table bombs on the last "AI_Module_08".  It seems that I can move these constants in the table, so there is little or no motive behind the order.

    There are also segments of screenshot of MAX and the exception in the block diagram.

    Thanks to a bouquet.

    -Chris

    Hello Chris,

    Based on the screenshot you provided, it looks like you use too many independent tasks in a single chassis - I think that the timing engine can handle three (four memory), but based on this knowledge basethree simultaneous HAVE tasks - you can certainly use all eight locations to HAVE, but they will need to be divided into synchronized subsets.

    That said, if it is in fact the problem is that I feel, a more specific error would appropriate the "resource" referred in the present case is ostensibly the timing engine, but further clarification would be useful.

    Best regards

  • Now not DAQmx task correctly

    Hello

    I created a state machine structure that is designed to set up a number of different channels DAQmx data acquisition (the code with indication of analysis section is attached).

    The first time I run this vi, I get a table containing the names of specified job in (with a first line empty), but subsequent executions raise an error that the name of the task is already specified, leading me to believe that the tasks are not properly shut down, but I don't know how to set up the fence vi the task in this case.

    Also, in the State of the initialization, I placed an empty array that obviously gives me my first empty line, but if I withdraw this, he breaks the vi as one of the terminals of the enclosure is then unwired.

    Anyone would be able to guide me to a more correct solution, please?

    -dave

    Purely given this example, here are a few things I would change:

    Use a loop FOR instead of a while loop.  No point in the case of Initialize.  You want to use a shift register to add channels to your task.  It takes only a single task for thermocouples, a task for lubricating oil, etc.  See attachment for a quick example.

    In this example, I think that your error comes from the fact that you create a 2D tasks table.  Each line must have the same number of items, and you get a bunch of NULL tasks.

  • How to set up wizard DAQ or DAQmx tasks using an external text such as a CSV file?

    I work in an environment were we have a lot of users VI. I develop the VI and technical personnel using the GUI (cover Page) to collect the data. In order to control the input parameters used on multiple hardware platforms, I'd like to develop a generic VI which will import or read a text file I created, and configures the DAQmx tasks to perform data acquisition. In fact, I have the generic VI full and need to understand how to make configurations DAQmx more transparent for the end user as long as the end user has the text file to import. For example, to generate the wizard DAQ DAQmx tasks based on information from text file?

    I don't have time to do more than just a small example. The VI below contains a table with table fixed index functions. This would have changed to get automatically the correct rows and columns, but I hope that you have an idea. I does not have any code to define the type of temperature measurement or to set the correct configuration of Terminal. All of this plus all other possible options will be treated similarly to the definition of the type of channel and min/max which is located in the example.

    Edit-attach VI

  • SE AcceesViolationException NationalInstruments.DAQmx.Task.UnregisterAsyncWaitHandle

    Hello

    I use my own .net application which communicates with NationalInstruments.DaqMx.dll (version 9.7) in order to activate NiDaq in the following configuration:

    Chassis PXI-1033 at two locations PXI-6284, measure differential voltage. This app worked already for a few months and has been tested under high performance - high sampling rate and long hours, without no problems so far. Recently, we tried a new use case - short sessions (60 min) measures running in sample rate = 100 and samples per channel = 100 after a few iterations, we continue to get access violation exception:

    Exception info: System.AccessViolationException

    Battery:

    to NationalInstruments.DAQmx.Task.UnregisterAsyncWaitHandle (System.Threading.WaitHandle)

    at NationalInstruments.DAQmx.Internal.DaqAsyncResult.AsyncOpDone)

    at NationalInstruments.DAQmx.Internal.AnalogMultiChannelMemoryOptimizedMultiSampleReadAsyncResult.WorkItem (System.Object)

    at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object)

    at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)

    at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)

    at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem)

    at System.Threading.ThreadPoolWorkQueue.Dispatch)

    at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback)

    Keeping the sampling rate 100, but his definition of samples per channel at 1000 seems to solve this problem.

    Can someone explain to me what is the cause of this exception?

    Thank you

    Hadas


  • Convert DAQmx task IDS in a string

    I'm using LabVIEW to perform a generation analog DAQmx and I call my LabVIEW of CVI code via a dll.  I want to make two separate calls, one to start a task DAQmx and one to stop the task, so I need to either:

    (1) move a task ID DAQmx CVI and then again to LV

    or

    (2) convert a string of the ID for the task, pass it to CVI and then back to LV and then convert back to a task ID in LabVIEW.

    I'm sure that option 2 is the easiest option, but I don't know how to convert back and forth between a string and a task ID DAQmx.  Can anyone help with this?

    Thank you

    Joe

    Nathand is correct, it's pretty easy convert from/to the task DAQMX and String.  The two below

    Hmmmm is note expected or a bug?

    Feedback probably need an expert of DAQmx to answer that - I think it might be related to level DAQmx tasks

  • Problems with DAQmx - tasks missing when I run my application on another PC

    Hello

    I use a NI USB 6009 and my program use DAQmx and different tasks for the input and output signal.

    I created an application and I want to run this application on another PC, which doesn't have the development environment, but the runtime engine and installed MAX. This PC is connected to the NI USB 6009.

    Now, I have the problem that the tasks are missing on this PC and I get errors when I run the application.

    I wonder why these tasks are not put into the application automatically? What should I do now? Can I somehow export tasks in MAX and copy them to the other PC? Is not complicate it?

    Hi Johannes,

    Have you created your tasks of measurement and Automation Explorer?

    If this is the case, you must export the file of configuration of measurement and Automation Explorer and then import it on the other computer.

    With LabVIEW 2010, you can import a configuration via your Installer file, but I don't know if you can do it with LabVIEW 7.1

    Kind regards

  • How to store a DAQmx task properties effectively?

    Hello everyone and happy new year!

    I would like to be able to keep track of all the DAQmx task settings (and canals) in a file, regardless of the content of the DAQmx task / channel is. So far, the only way I've found is to use a task DAQmx / channel property nodes and treat every property possible. However, since they are so many properties, each being is not valid for any material or task / channel type, it's a really big job and I'm rather lazy

    So I ask here if someone has already dealt with THIS or have any idea?

    Hi Hillman,

    Thank you very much for the link. Related documents Silly me had neglected tdm... Your link is indeed very useful, as I do right now exactly the same way it's done the:

    • DAQmxTaskInfoQuery.vi
    • General info.VI DAQmx TEDS

    As part of the download in the link you gave.

    Exepted this code is much more readable than mine, so I guess I don't need to view my ugly code incomplete. Many things interresting, thank you very much. I'll be back if I have something better to give as a reference.

  • Need to task for DiskDiagnosticResolver information

    I was running AutoRuns by Sysinterrnals and clicked on the tab Scheduler.  I saw a red circle with an x in it.  I used the jump to feature and it took tasks me.  I could not find the task to be normal or store display hidden tasks.

    The entry is \Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticResolver.
    Description: Windows Disk Diagnostic user resolver.
    Image path: c:\windows\system32\dfdwiz.exe

    TechNet was searched and I read http://support.microsoft.com/kb/939039 it provides a description of the tasks installed by default.  Well, there's the task for Microsoft-Windows-DiskDiagnosticDataCollector.

    Also miss me the task for CrawlStartPages in the multimedia folder.

    You will provide triggers, actions, conditions, and settings for these two tasks?

    Thank you
    Christine

    Hello

    For starters, a red circle with the x is just the icon of this executable file. See this article on what both of these tasks are about and how to actually see: http://support.microsoft.com/default.aspx/kb/939039

    You should see dfdwiz.exe scheduled to run when the disk damage was detected. Good luck, Rick Rogers, aka "Crazy" - Microsoft MVP http://mvp.support.microsoft.com Windows help - www.rickrogers.org

  • Normal reboot a server DB is a good practice?

    Hi all

    Recently, I hit a bug "Bug 10194190 - Solaris: spin process and/or ASM and DB crash if RAC instance > 248 days ( Doc ID 10194190.8 )" "

    One solution is to restart the Server DB regularly.

    I would like to know if control restart a server DB is a good practice in a normal case without hitting the bug.

    In my experience, Unix platform is more stable than the Windows platform in

    end of time. Truth without papers we need to restart Windows

    Server for the services included in some cases.

    I heard not to restart a database regularly in the Unix platform.

    To my knowledge, a 7 x 24 reviews should have as more long availability possible.

    However, I share that a database must be restarted in some cases as

    patching and some other maintenance.

    In our case, I agree that we must take this workaround solution, restart regularly the DB server, to

    the problem at this point. However, I want to know, as a good practice, if a DB server must be restarted on a regular basis in the

    normal case without hitting the bug.

    Maybe a need to define "regular". To my knowledge, the bounce is not good because it has continuous setting on in the background, which is reset every rebound in memory. I am referring to the tuning that is associated with the presence of the SPFILE.

    I don't know how long it takes before this system is on the right track, it's an interesting question.

    But rebounding is good, because ultimately you will need a few days. Nothing like a test procedure and bounce a database is one procedure like the others.

    Obviously, 24/7 databases are a reality, which makes this exercise very difficult/impossible.

    Not many problems will be solved with bounce data well. But if a problem appears as it does, it is not impossible. I saw only once (on a Unix system). In the end, no one was able to explain the cause, and bounce was unsalted solution. The dirty fix was: kill the production process. And the problem disappeared with the upgrade (11g). Just a fact.

Maybe you are looking for