Stopping a currently running DAQ task for m-series

I'm running a hardware timed analog input data acquisition task on a PCI-6229 m-series DAQ card that takes 200 us.  Every 250 us the program reads the data and restarts the task.  The difficulty is that the program sometimes has a late start and the next time the thread reads the task is still in progress.  I'd like to guarantee the task is stopped every time the program reads the data.  I've tried the following three sets of commands when the thread wakes up:
Attempt 1:
if( board->Joint_Status_2.readAI_Scan_In_Progress_St() )
     board->AI_Command_1.writeAI_Disarm(1);
     board->AI_Command_1.flush();
Attempt 2:
if( board->Joint_Status_2.readAI_Scan_In_Progress_St() )
     board->AI_Status_1.setAI_STOP_St(kTrue);
     board->AI_Status_1.flush();
Attempt 3:
if( board->Joint_Status_2.readAI_Scan_In_Progress_St() )
     board->AI_Mode_1.setAI_Start_Stop(kTrue);
     board->AI_Mode_1.flush();
They seem to randomly work.  Sometimes the task stops immediately, sometimes it reads a few more times, and sometimes it just keeps reading.  The positive part of these commands are that the task can be restarted by simply issuing the aiStart(board) command again -- most of the time.  Is there something that I can send to the card to reliably stop any currently running AI tasks and at the same time allow the aiStart(board) command to be used to start the next set of readings?
You may ask why I'm doing this.  I've had a lot of problems losing track of the inputs after 13 hr to several days at 250 kHz.  By restarting the task every loop and clearing the DMA buffer, I can guarantee the first element in the buffer is the first input read.  I'm using DMA so if the task is still running when I send the aiStart(board) command, it can screw up this balance.  You may argue that I should keep track of things more closely, but this system means that if the inputs somehow become switched the next time the thread runs it will automatically correct the problem.  This self-correction is a critical feature.
Thanks.
Aaron

Hi Aaron-
The bitfields you attempt to write are problematic for a few reasons.  First, AI_Disarm is only safe to use for idle counters and may not work reliably if the acquisition is currently running (which it sounds like you have observed).  AI_STOP_St is a read-only bit, so writing it will have no effect.  Finally, AI_Start_Stop controls an unrelated functionality (essentially, it decides whether an AI_Start -> AI_Stop cycle constitutes a "scan".  This is actually the only mode of the STC2 that makes much sense to use on M Series).
There are a couple of bitfields in AI_Command_2 that might help.  AI_End_On_SC_TC is a strobe bit that disarms the AI_SC, AI_SI, AI_SI2, and AI_DIV counters when an SC_TC event occurs.  AI_End_On_End_Of_Scan provides the same functionality for when an AI_Stop occurs.  So basically, you could determine a regular interval boundary number of scans to stop on (using End_On_SC_TC) or just stop at the end of the "current" scan (using End_On_End_Of_Scan). 
I haven't tested this, but it should work.  Let me know if you have problems using either of these methods.  Hopefully this helps- 
Message Edited by Tom W [DE] on 03-14-2008 03:21 PM
Tom W
National Instruments

Similar Messages

  • DAQ task update during running task

    Hi,
    I hope sombody can answer this question.
    Is it possible to update a running DAQ task without stopping the task?
    In my task I have an analog output and I want to change the amplitude and/or the duty cycle of the output waveform.
    Stopping the task and starting again with new parameters needs to much time.
    Thank you,
    Robert

    If you're just looking to write new data to the task then there shouldn't be any need to restart it (you can use AO with non-regeneration like DianeS mentioned).  I wanted to make sure to mention that we have an online example that does just this:
    Update Multiple Channels of Analog Output On-The-Fly
    Additionally, there are some properties that are settable while the task is still running (e.g. AO Sample Rate can actually be changed on-the-fly on many of our Multifunction Boards).  Other properties (e.g. AO Voltage Range) cannot be modified without first stopping the task.  If you need to stop the task and reconfigure, Ben's method is a good idea.  I am aware of an example that does this for Analog Input tasks but I don't think we have one for AO.  Here's the link to an AI version in case anybody is interested (unlike AO, the AI Sample Clock is not changeable on-the-fly):
    Switching Between Multiple Analog Input Tasks in DAQmx
    From what it sounds like, the first link should be exactly what you need and you shouldn't need to worry about restarting your task.  Just add Duty Cycle to the control cluster and wire it into the
    correspnding input of the Basic Function Generator.  If you have any questions about it or run into any issues don't hesitate to let us know!
    Best Regards,
    Message Edited by John P on 03-25-2010 06:35 PM
    Message Edited by John P on 03-25-2010 06:36 PM
    John Passiak

  • Is it possible for a DAQ task to just stop responding to commands?

    The software I am working on controls a NI USB-6501 digital I/O device using the NI-DAQmx library.  When the software initializes, it attempts to create 10 "tasks" (for different I/O lines of the device) using DAQmxCreateTask().  If any of the tasks cannot be created, the software should close with an error message. 
     if ((!CreateTestModeTask(&TestModeTask, USBdevname)) &&
         (!CreateChooseDUTTask(&DUTSelectTask, USBdevname)) &&
         (!CreateChargeStatusTask(&ChargeStatusTask, USBdevname)) &&
         (!CreateInitLinesTask(&InitLinesTask, USBdevname)) &&
         (!CreateChargeEnableTask(&ChargeEnableTask, USBdevname)) &&
         (!CreatePassFailEnableTask(&PF_EnableTask, USBdevname)) &&
         (!CreatePassFailResetTask(&PF_ResetTask, USBdevname)) &&
         (!CreatePassFailStateTask(&PF_StateTask, USBdevname)) &&
         (!CreatePassFailWriteTask(&PF_WriteTask, USBdevname)) &&
         (!CreateResetDUTTask(&ResetDUTTask, USBdevname)))
         continue running the software
    else
         show error message and close software
    Once the tasks are created, the software goes on to use them to manipulate the I/O signals of the NI USB-6501 device with DAQmxWriteDigitalLines() or DAQmxWriteDigitalU8().  The software does not check whether these functions return an indication of success or not... The assumption is that it works every time.
    This is my question:
    At run time, is it possible for a successfully created DAQ task to simply stop responding to commands?  This is what I believe happened.  I observed it only once out of hundreds of trials, but it is still a great concern.  Only 1 task stopped properly controlling the NI USB-6501.  All of the other ones continued to work properly. It continued to misbehave until I closed and re-started the software (thus re-creating all tasks).
    And if it is possible for a task to simply stop responding, is there any way to prevent it?
    -Mike

    Your assumption that instructions will work every time without facing errors is excessive in my opinion. I never observed a daqmx task simply stopping responding to commands: every time it happened, an error condition was raised explaining the misbehaviour.
    I would add some error checking where you are manipulating the daq board and look into the informations the error message gives you.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Custom Scale behavior with DAQ Task running

    Hi to everyone, I am implementing a Polynomial Custom Scale for a sensor, but I have doubt about what happens if I change a Custom Scale and my DAQ Task is running, I suppose that the Custom scale does not change on the fly but my questions is if I have to clear the Task to apply the new custom scale or is enough with Stop the Task and Start the Task again.
    I am using the DAQmx functions for the code. Thanks for your help.

    Hi AYanez!! 
    Thank you very much for using NI Discussion Forums!!  I found a post that deals with the same issue you are trying to solve for your application.  It seems that you have to stop the task for the new scaling properties to be applied.  Take a look into this thread:
    Programmatically applying a custom scale in an active VI
    Hope this helps!
    Regards,
    Anuar R.
    National Instruments México y Latinoamérica
    Ingeniería de Aplicaciones
    www.ni.com/soporte

  • LV 8.21: strange behavior with DAQ tasks, parallel running VI's and shift registers

    Hello,
    I have made a VI using DAQmx vi's. The VI uses shift registers to store DAQ tasks and other (internal) information. I have implemented  several modes of operation (enum control with a case structure) like 'init', 'read AD', 'config AD' etc. If I use this multi mode VI in a single main VI everything work as expected. I have attached a jpg that shows one example where the DAQ VI is called from 2 parallel running while loops. One loop aquires the data (LOOP 1) while the other loop configures the aquisition task (LOOP 2). If I implement the same thing by putting LOOP2 in a different VI that runs seperately from the first VI I get an error message (200428):
    Possible reason(s):
    Measurements: Value passed to the Task/Channels In control is invalid.
    The value must refer to a valid task or valid virtual channels.
    Task Name: EasyDAQ_AD
    Of course, the second VI is started manually after the 1. VI has passed the initialization part. The error message is triggered from the 1. VI that executes the DAQ task. From my understanding of the LV execution system this seems like a bug to me. Does anyone have an idea what could go wrong here?
    klaus
    Attachments:
    problem.jpg ‏30 KB

    1. In general, this kind of technique is something I've been using successfully for years.  (Ben recently wrote up a very nice treatment of these "Action Engines" as a "Community Nugget.")  So I don't start by expecting this to be a bug in the LV execution system.
    2. Your description of the problem sounds almost backwards.  You say you manually start the 2nd vi ("Config AD") *after* running the 1st vi ("Read AD").  Seems like you'd need to do the Config 1st and then do the Read, right?   I kinda suspect you actually did it in the right order, but described it wrong.
    3. The next likely scenario is that the Config failed, but you didn't trap the error and were unaware of it.  Then it makes sense that the Read would also fail.
    4. A couple issues I regularly deal with in these DAQ Action Engines is internal error handling.  I often keep a shift register inside to store errors generated inside the Action Engine.  But it can get a little tricky doing sensible things with both the internal error and any other error being wired in as input.
    I said all that so I can say this: if you have complex nested case statements, or lots of different action cases to handle, double check that the task wire makes it from all the way from left shift register to right.  Sometimes they get lost if they go through a case statement, the output tunnel is set to "use default if unwired", and 1 or more of the cases don't wire the output.
    -Kevin P.

  • How to stop a process chain after the current running process

    Hi experts,
    I try to stop a running process chain, but only at the end of the current process load.
    I try to unscheduled process chain : the job of the current process is killed and the process stop
    I try to execute the programm rspc_process_finsh : same result.
    Actually, I aim at waiting of the current process completion and stop the chain.
    Thanks and regards,
    Bobby

    Hi all,
    Thanks for answer.
    If I resume the situation :
    - Click on Unschedule process chain stop the current process. We have to change the status of the process in Yellow to Red.
    - Go to sm37 to kill the job change the statut in red.
    So there is no way to stop the running of a process chain only after the good or bad end of the last runnning process ?
    Example :
    My chain is running. The process which is running is a DTP loading process. There are 50 packages to load. I decide to click on Unschedule process chain when the package 18 is running.
    If I do that, the loading of package 19 will not start right ?
    So is there a way to wait that the 50 packages are loaded before that the system stop the chain ?
    Thanks in advance,
    Bobby.

  • Problems saving a DAQ task in Labview and running elsewhere

    I am attempting to use DAQmx Save Task.vi in LabView to save a simple signal generation task, so I can open it later / elsewhere. The problem I am having, though, is when I attempt to open the task in MAX. The task is brought into MAX, but when I attempt to run the task error -200552 occurs at DAQ Assistant.
    Error -200552 occurred at DAQ Assistant
    Possible Reason(s):
    Specified string is not valid, because it contains an invalid character.
    Position of Invalid Character: 4
    Invalid String: Dev1/port0/line0
    It looks as though the problem has to do with the '/' character, but I am not sure how to create an output line in LabView that does not include the '/' character. Is there anyway around this problem in either LabView or in MAX?
    I have attached my LabView program. Thank you for your help and patience.
    Solved!
    Go to Solution.
    Attachments:
    saving_generation_task.vi ‏19 KB

    Where is your program where you are trying to run the task? I don't understand what an existing task has to do with the DAQ Assistant. You would simply have to wire the task to a DAQmx Write.

  • What tasks are currently running?

    I have a system that involves quite a few CF programs that
    may run for several minutes. These are graphics generators, large
    file processors, as well as some lengthy database queries. Windows
    Performance Monitor often shows two or three CF tasks running with
    several more queued up.
    Is there any utility for displaying WHICH tasks are currently
    running? Maybe something in JRun?
    Thanks,
    Dave

    The easiest way is this:
    Log into the CFIDE
    Click to Debugging and Logging
    Click Log Settings
    Check "Enable logging for scheduled tasks "
    (Submit to save the setting)
    Click Log Files
    Select scheduler.log
    Any entries in there that started but haven't yet finished
    would be the ones still running.
    If you are on UNIX-based system, you can tail -f
    $CFROOT/logs/scheduler.log (much easier if you have that option),
    but you still have to make sure you enable the logging, as stated
    above.
    HTH;
    &laz;

  • Separate Analog Input/Output Tasks for Multiple USB-Daq 6008

    Hello, In my application I'm using two separate USB-6008 DAQ devices, they are to be used simultaneously,
    i.e both tasks will start in a same loop, there are both writing to some channels and sampling some data from
    some channels, the problem is, when I'm trying to define a task, via Daqmx base Configuration Utility, I
    sucseed at defining the task, for the first Device, but unable to define nearly same task but for the
    different Device, since the OK button is grayed out (Disable).
    I'm using Labview 7.1 and a NI-Daqmx base ver. 2.0
    Following attachment shows what I'm talking about.
    Attachments:
    daqmxbase.JPG ‏59 KB

    Actually it is not the easiest to use the full version of daqmx is easier, It is also very easy to set this up in MAX (measurement and automation explorer) What version of labview are you using. have you made sure that the device is recognised in MAX and that the device number is correct. i have a couple of 6008 and have run them alot without any trouble so it must be the way you have things setup. Could you post a section of the code that gives  you the error. also try running each device in max with the test panels for each one and see if it works there.
    Joe.
    "NOTHING IS EVER EASY"

  • I have a MacBook Pro (15-inch, Late 2008) and am currently running Snow Leopard 10.6.8. I would like to know which is the most stable upgrade for my model. I have read some reviews of Maverick and Yosemite making the older macs slower. Is this true?

    I have a MacBook Pro (15-inch, Late 2008), Intel Core 2 Duo 2.53 GHz, 4GB Memory. and am currently running Snow Leopard 10.6.8.
    I would like to know which is the most stable upgrade for my model? Mountain Lion, Mavericks or Yosemite?
    When I had gone to the apple care centre in India a few months ago to upgrade my OSX to Mountain Lion, I was told that considering my macbook pro's specs, upgrading it would just make it less efficient, and that I should stick to Snow Leopard unless I consider buying a newer mac that would benefit from it. Is this true? I find it a bit hard to believe. Which update is most recommended?
    I also notice that my mac has gotten considerably slower. While using chrome, it buffers and struggles with even just 5 tabs open. Could this have something to do with my current ios? As a precaution, I have always been making sure I have enough free space on disk i.e around 70 - 100 free out of 250GB.
    Any advice is appreciated.
    Thanks in advance.

    Mavericks is no longer available from the App Store, so your choice is Yosemite. One option is to create a new partition (~30- 50 GB), install the new OS, and ‘test drive’ it. If you like/don’t like it it, you can then remove the partition. Do a backup before you do anything. By doing this, if you don’t like it you won't have to go though the revert process.
    Check to make sure your applications are compatible.
    Application Compatibility
    Applications Compatibility (2)

  • I am currently running a trial version of indesign. i am trying to make a cd booklet. when i open a new document and try to find 'compact disc' in the document presets, it isn't there. all i have for options are 'default and custom'. is it possible to ope

    i am currently running a trial version of indesign. i am trying to make a cd booklet. when i open a new document and try to find 'compact disc' in the document presets, it isn't there. all i have for options are 'default and custom'. is it possible to open the 'compact disc' preset from a trial version?

    Are you sure, Eugene? I have this option:

  • How to change the explain plan for currently running query?

    Hi All,
    I am using Oracle enterprise 9i edition. I have a query which frames dynamically and running in the database. I noticed a table with 31147758 rows
    in the query which has no indexes and taking more time to process. I tried to create an INdex on that table. I know the query is already running with a FULL table scan. Is it possible to change the explain plan for the current running query to consider the INDEX?
    [code]
    SELECT /*+ USE_HASH (c,e,b,a) */
    d.att_fcc extrt_prod_dim_id,
    d.att_fcc compr_prod_dim_id,
      a.glbl_uniq_id glbl_uniq_id,
      to_date(c.dit_code,'RRRRMMDD')STRT_DT,
      (to_date(c.dit_code,'RRRRMMDD')+150)END_DT,
      a.pat_nbr pat_id,
      a.rxer_id       rxer_id,
      e.rxer_geog_id  rxer_geog_id,
      a.pharmy_id pharmy_id,
      a.pscr_pack_id pscr_pack_id,
      a.dspnsd_pack_id dspnsd_pack_id,
      DENSE_RANK () OVER (PARTITION BY a.pat_nbr ORDER BY c.dit_code) daterank,
      COUNT( DISTINCT d.att_fcc ) OVER (PARTITION BY a.pat_nbr, c.dit_code) event_cnt
      DENSE_RANK () OVER (PARTITION BY a.pat_nbr,
    d.att_fcc
      ORDER BY c.dit_code) prodrank,
      DENSE_RANK () OVER (PARTITION BY a.pat_nbr,
    d.att_fcc
      ORDER BY c.dit_code DESC) stoprank
      FROM
      pd_dimitems c,
       pd_pack_attribs   d ,
        lrx_tmp_rxer_geog e,
        lrx_tmp_pat_daterank p,
        lrx_tmp_valid_fact_link     a
        WHERE c.dit_id = a.tm_id
        AND   e.rxer_id = a.rxer_id
        AND   a.glbl_uniq_id = p.glbl_uniq_id
        AND   p.daterank > 1
      AND   a.pscr_pack_id = d.att_dit_id
    [/code]
    The table lrx_tmp_pat_daterank is having that 31147758 rows. So I am wondering how to make the query to use the newly created index on the table?

    Why do you think using Indexes will improve the performance of the query? How many rows this query is returning? Optimizer might chose a Full table scan when it finds out that Index plan might not be useful. Why are you using /*+ USE_HASH (c,e,b,a) */ hint? This Hint will force oracle to use Full table scan instead of using the index. Try removing it and see if the plan changes.
    Regards,

  • Can anyone offer some advice i am looking to upgrade the OS system on one of my macbook pro's, currently running os10.4.11, I would like to upgrade to OS10.5? how would I go about this, and is there a cost, for what is an old operating system now?

    Can anyone offer some advice i am looking to upgrade the OS system on one of my macbook pro's, currently running os10.4.11, I would like to upgrade to OS10.5? how would I go about this, and is there a cost, for what is an old operating system now?

    Since your Mac probably came with 10.4, there is no longer a way to get 10.5 Leopard install media. IF it has the requirements, you may be able to upgrade to 10.6 Snow Leopard by buying the boxed install media at the Apple Store for $30.
    System requirements are found here: http://support.apple.com/kb/SP575
    General support can be found here: http://www.apple.com/support/snowleopard/

  • I have a MAC Pro from 2011 currently running MAC OS 10.9.5.  This weekend I cloned the MAC HD drive to a new SSD drive for improved performance.  The clone was completed successfully with no errors.  After the clone completed I successfull restarted my sy

    I have a MAC Pro from 2011 currently running MAC OS 10.9.5.  This weekend I cloned the MAC HD drive to a new SSD drive for improved performance.  The clone was completed successfully with no errors.  After the clone completed I successfully restarted my system using the SSD as the boot device.  I then successfully tested all of my products, including Photoshop CS6 and all of its plug-ins.  I successfully tested the key features that I frequently use.  Today while attempting to launch Photoshop CS6 a message is being displayed indicating that a scratch disk cannot be found.  All drives are available on the system via the Finder and Disk Utility.  I can access all drives including the old MAC HD which is no longer the boot device.  I've even attempted to launch Photoshop from the old device yet the same error persist.  Is there a way to review/edit/change Photoshop preferences if Photoshop doesn't launch?  I've even restarted my system several times to see if that would resolve the issues.  Does anyone have any recommendations for this issue?  Have you previously address this issue? 
    Thank you Gregg Williams

    Boilerplate text:
    Reset Preferences
    http://forums.adobe.com/thread/375776
    1) Close the program and press Ctrl+Alt+Shift/Cmd+Option+Shift during startup (not reversible)
    or
    2) Move the Folder. See:
    http://www.bugge.com/Family-and-friends/Illy/illy.html
    --OB

  • I am currently running OS 10.6.8 on my iMac and plan to upgrade to OS Mountain Lion. Will MS Office 2008 for Mac still run on the new OS?

    I am currently running OS 10.6.8 on my iMac and plan to upgrade to OS Mountain Lion. Will MS Office 2008 for Mac still run on the new OS?

    Check compatibility for all your software
    http://roaringapps.com/apps:table

Maybe you are looking for

  • How can i run a reports from forms

    Oracle forms 9i Hai All I am using oracle forms 9i. From the forms i need to generate a reports how can i generate a reports from there Regards Srikkanth.M

  • FromPane ToPane when using 2 Forms at the same time

    Hi, I have built 2 forms in 1 Add-On, Form A with 4 tabs and Form B with 2 tabs. I open both Form A and B If I click on Form A tab 1, Form B display tab 1 (they work together...???) If I click on Form A tab 2, Form B display tab 2 (Form A has control

  • Source system 8(ODS name) does not exist

    Hi experts! When I transport some Process Chane from DEV to PRD I faced with issue that the source system 8(ODS name) does not exist. Is anyone faced with same error? Thx!

  • Trouble in executing RMI from servlet

    hello everybody.. I have trouble in invoking RMI from the servlet.. i get an exception saying connection refused to 192.168.16.65 (my RMI server is running on this system) . Later i tried running RMI on the same system and got the exception saying co

  • Re:  CS 5 Design Standard:  "Photoshop will now exit" after installing Yosemite

    I just upgraded to Yosemite, and when I went to open photoshop (following instructions from Apple to make CS5 work, it said:  "an unexpected and unrecoverable problem has occurred.  Photoshop will now exit.  I tried putting in the CS 5 number from my