I'm trying to use the function below to pulse one of the PFI lines for 1 second. I'm doing this on a USB 6210 as well as a PCI-6034E neither of which I can get to work. When I start the task I get an error message saying that:
"Destination terminal to be routed could not be found on the device.
Make sure the terminal name is valid for the specified device. Refer to Measurement & Automation Explorer or your hardware documentation for valid terminal names.
Property: DAQmx_CO_Pulse_Term
Destination Device: Dev2
Destination Terminal: dev2/PFI6
"
Anyone have any ideas on what I'm doing wrong?
BOOL CNIAnalogInterface::SetTriggerSource(int nTriggerSourceIdx)
{
if (m_pSettings/* && m_pSettings->m_bTriggerSwitchRelayPresent*/)
{
char errBuff[2048];
int nError = 0;
if (m_hDigOutputTaskHandle)
{
nError = DAQmxStopTask(m_hDigOutputTaskHandle);
nError = DAQmxClearTask(m_hDigOutputTaskHandle);
m_hDigOutputTaskHandle = 0;
}
// create digital output task
nError = DAQmxCreateTask("DIG_OUT_Task", &m_hDigOutputTaskHandle);
char szBuf[256];
sprintf(szBuf, "dev%d/ctr%d", m_nDevice, 1);
nError = DAQmxCreateCOPulseChanTime(m_hDigOutputTaskHandle, szBuf, "", DAQmx_Val_Seconds, DAQmx_Val_Low, 0.001, .001, 1.0);
// route the pulse to the appropriate ping
char szSigOut[256];
sprintf(szSigOut, "dev%d/PFI%d", m_nDevice, (nTriggerSourceIdx) ? 5 : 6);
nError = DAQmxExportSignal(m_hDigOutputTaskHandle, DAQmx_Val_CounterOutputEvent, szSigOut);
// nError = DAQmxConnectTerms("Ctr1Out", szSigOut, DAQmx_Val_DoNotInvertPolarity);
if (nError != 0)
{
DAQmxGetExtendedErrorInfo(errBuff, sizeof(errBuff));
ShowDaqErrorMsg(errBuff);
return FALSE;
}
nError = DAQmxStartTask(m_hDigOutputTaskHandle);
if (nError != 0)
{
DAQmxGetExtendedErrorInfo(errBuff, sizeof(errBuff));
ShowDaqErrorMsg(errBuff);
return FALSE;
}
nError = DAQmxWaitUntilTaskDone(m_hDigOutputTaskHandle, 10.0);
return TRUE;
}
return FALSE;
}