Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to generate a single pulse output from ctr1 and route it to PFI5 or PFI6

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;
}

0 Kudos
Message 1 of 3
(3,205 Views)
sonar,

The issue seems to be with the syntax of the terminal name.  Terminal names should be specified in the following manner:

/devicename/terminalname

I believe you left off the first forward slash.  If you leave off this forward slash you will get this error.

Regards,

Neil S.
0 Kudos
Message 2 of 3
(3,196 Views)
Neil,

Thanks so much!  That did the trick. 

The funny thing is that the DaqMx channel creation methods like DAQmxCreateCOPulseChanTime and DAQmxCreateAIVoltageChan don't seem to care about the leading forward slash.

Anyway thanks again and happy new year.

sonar
0 Kudos
Message 3 of 3
(3,194 Views)