Is there any way, other than DAQmxResetDevice, to "cancel" a DAQmxExportSignal?
Here's some code that demonstrates my problem:
xxxxxxxxxxxx
#include <stdio.h>
#include <NIDAQmx.h>
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
int main(int argc, char **argv)
{
TaskHandle taskHandle;
char errBuff[2048]={'\0'};
int32 error=0;
DAQmxErrChk(DAQmxResetDevice("dev1"));
printf("1 Press Enter to emit a 500ms pulse on both /dev1/pfi12 (ctr0) and /dev1/pfi1\n");
getchar();
DAQmxErrChk(DAQmxCreateTask("",&taskHandle));
DAQmxErrChk(DAQmxCreateCOPulseChanTime(taskHandle, "/dev1/ctr0", "",
DAQmx_Val_Seconds, DAQmx_Val_Low, 0.001, 0.001, 0.50));
DAQmxErrChk(DAQmxExportSignal(taskHandle, DAQmx_Val_CounterOutputEvent, "/dev1/pfi1"));
DAQmxErrChk(DAQmxStartTask(taskHandle));
DAQmxErrChk(DAQmxWaitUntilTaskDone(taskHandle,10.0));
/* My problem: I'd like to emit the pulse on /dev1/pfi12 and
/dev1/pfi2 and not on /dev1/pfi1. (Actually, I'd like to emit it
only on /dev1/pfi2, but I can live with both /dev1/pfi12 and
/dev/pfi2).
I know that if I invoke DAQmxResetDevice("/dev1") here I'll get the
behaviour I want. But my ultimate application will have other tasks
running, and resetting the device will disrupt those other tasks,
so I'm looking for another way ... */
printf("2 Press Enter to emit a 500ms pulse on /dev1/pfi12, /dev1/pfi1, and /dev1/pfi2\n");
getchar();
DAQmxErrChk(DAQmxClearTask(taskHandle));
DAQmxErrChk(DAQmxCreateTask("",&taskHandle));
DAQmxErrChk(DAQmxCreateCOPulseChanTime(taskHandle, "/dev1/ctr0", "",
DAQmx_Val_Seconds, DAQmx_Val_Low, 0.001, 0.001, 0.50));
DAQmxErrChk(DAQmxExportSignal(taskHandle, DAQmx_Val_CounterOutputEvent, "/dev1/pfi2"));
DAQmxErrChk(DAQmxStartTask(taskHandle));
DAQmxErrChk(DAQmxWaitUntilTaskDone(taskHandle,10.0));
Error:
if (DAQmxFailed(error)) {
DAQmxGetExtendedErrorInfo(errBuff,2048);
printf("Error: %s\n", errBuff);
}
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
}