Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

pause data acuisition

I am using Visual VC++ and Mesurement Studio V8.0 and USB-6009 for data acquisition.

I have configured the data acuisition to run in contineous mode but I want to pause the data acquisition for short amount multiple times in between.

The m_Task -> Stop() function does not stop the task. Is there any other function that I can use to pause the acquisition? ( I just want to ignore those chunks of data but the pause period varies so I can not hardcode a fixed time)

Thanks in advance.

AJ
0 Kudos
Message 1 of 6
(4,741 Views)

Hello AJ,

Are you working off of the shipping examples installed with NI-DAQmx at \Program Files\National Instruments\MeasurementStudioVS2003\VCNET\Examples\DAQmx?  That call should work to stop the task.  How are you determining that the task is not stopped?

In order to "pause" your analog input, you can stop the task and then start it again. 

The other method is to use a counter as a sample clock for your analog input operation and set the counter up to use an external pause trigger.  The problem with this method is that you need to provide an external pause trigger.  You could use one of your digital lines to create the trigger signal.  However, you cannot create a pulse train with the counter of the USB-6009, so you would need to have different hardware, such as an M Series device.

Regards,

Laura

Message Edited by Laura F. on 06-15-2006 05:03 PM

0 Kudos
Message 2 of 6
(4,730 Views)
I am using a midified version on the example code.

To pause the task I call m_Task->Stop() function & to restart it I explicitly call the read function ReadUInt16Async on Reader defined for that task.

I have a NI graph on the screen and even after I call the Stop() function it keeps updating so I know that the acquistion has not stopped.

PauseData Acuisition() {
         m_AnalogTask1->Stop();
}

ResumeDataAcuisition {
         m_AnalogReader1->ReadUInt16Async(50, m_matAnalogData1, NULL);
}

// Defination :
    std::auto_ptr<CNiDAQmxAnalogUnscaledReader> m_AnalogReader1;
    CNiUInt16Matrix     m_matAnalogData1;

// Code :

            // Create voltage input channels
            m_AnalogTask1->AIChannels.CreateVoltageChannel("Dev1/ai0:3","",DAQmxAITerminalConfigurationRse,
                -10, 10, DAQmxAIVoltageUnitsVolts);

            // Setup sampling clock ... 250 samples / sec / channel
            m_AnalogTask1->Timing.ConfigureSampleClock("", 250,
                DAQmxSampleClockActiveEdgeRising, DAQmxSampleQuantityModeContinuousSamples, 250);

            // setup unscaled channel reader
            m_AnalogReader1 = std::auto_ptr<CNiDAQmxAnalogUnscaledReader>
                (new CNiDAQmxAnalogUnscaledReader(m_AnalogTask1->Stream));

            // Set up event handler for Buffer Read event
            m_AnalogReader1->InstallEventHandler(*this, OnBufferReadDev1);

          // read 50 samples / channel at a time
           m_AnalogReader1->ReadUInt32Async(50, m_matAnalogData1, NULL);

Thanks.

AJ
0 Kudos
Message 3 of 6
(4,727 Views)

Hi AJ,

In the code that you posted, I don't see what sort of delay you have between the stop function and the read function.  If the delay is not long, you may not be able to see this on your graph.  When you run the example ContAcqVoltageSamples_IntClk, does the stop button work to stop the acquisition? 

Thanks,

Laura

0 Kudos
Message 4 of 6
(4,712 Views)
Laura,

The code in ContAcqVoltageSamples_IntClk sample actually "stops" the data acuisition than "pausing" it. They are removing all the event handlers by calling RemoveEventHandler() function on the reader.

I just want to "pause" the acuisition and that pause can be as short as 1 sec and as long as one hour. Otherwise to restart the acuisition, I will have to re-install the EventHandlers again in a short time period of 1 sec.

Do I have to remove all the event handlers before I Stop the task ? Is there any other way to pause the data acuisition?

Thanks.
0 Kudos
Message 5 of 6
(4,709 Views)

Hi AJ,

You do have to remove the event handler, like in the example, or the event that indicates data is ready will still occur and your program will still acquire data.  One second does not seem too short to reload the event handler if needed.  Have you found that this is not the case?  You do not need to create the channels or setup the sample clock timing again until you clear the task.

The other way to pause an acquisition is to use a counter the way I described in my first post, but you would need different hardware. 

Regards,

Laura

0 Kudos
Message 6 of 6
(4,693 Views)