02-05-2007 04:35 AM
Hello,
I am programming a data acquisition application in Visual Basic 6 using the DAQmx library (DAQmx ver. 8.3.0f3). The hardware used is a PCI 6251 M series.
The DAQ application is used to acquire analog and digital input signals. The tasks are initialized in a separate sub before the acquisition starts. The start of the acquisition is realized with a trigger that is active after the task has been started. The acquisition is stopped by calling the DAQmxStopTask command. As the timing settings are variable from run to run in my application, I need to clear the task defined before and run the initialization sub for the new task.
Content of Task initialization Sub:
DAQmxCreateTask("DI", DITaskHandle)
DAQmxCreateTask("AI", AITaskHandle)
DAQmxCreateDIChan(DITaskHandle,…..)
DAQmxCreateAIVoltageChan(AITaskHandle,…..)
DAQmxCfgSampClkTiming(AITaskHandle,…)
DAQmxCfgSampClkTiming(DITaskHandle, "/Dev1/ai/SampleClock",…..)
DAQmxCfgDigEdgeStartTrig(AITaskHandle, "/Dev1/PFI0", DAQmx_Val_Edge1_Falling)
DAQmxRegisterEveryNSamplesEvent
Content of main DAQ Sub:
DAQmxStartTask (starts both AI and DI task)
DAQmxStopTask (stops both AI and DI task)
DAQmxClearTask (only called if timing parameters have to be changed)
PROBLEM: After having cleared the task and created a new one the DAQmxStartTask does not work at the first call (Trigger is not reacting). No error or warning received. After having started and stopped the new task once it works as it should.
I already had a look at the taskhandle numbers. When creating a new after clearing the old task, the numbers for the two taskhandles used are just interchanged.
Does anybody know a solution for this?
Thanks in advance for your help!
Thomas
02-07-2007 06:54 AM
Hi Thomas,
Thank you for posting to the NI forums. There isn’t much documentation on this type of behavior, especially since you’re not receiving an error. Would you mind re-posting with an attachment of your code? Thanks!
Ed W.
Applications Engineer
National Instruments