09-21-2009 12:26 PM
Using PCI-6224, I am currently trying to output data using the freqout as a sample clock reference for a Digital Output channel. I hook up the scope to see the clock on the freqout pin. However, the data seems to be missing. How can I output the data correctly using the reference for timing? What am I missing that links the two signals together? Any help would be greatly appreciated. I am writing this code in MS VS C++ and here is what I have done so far:
int32 error=0; TaskHandle taskHandle=0; TaskHandle taskHandleFRQ=0; char errBuff[2048]={'\0'}; uInt8 data[8]={1,0,1,1,1,0,1,0}; /*********************************************/ // DAQmx Configure Clock /*********************************************/ DAQmxErrChk (DAQmxCreateTask("",&taskHandleFRQ)); DAQmxErrChk (DAQmxCreateCOPulseChanFreq(taskHandleFRQ,"Dev2/freqout","",DAQmx_Val_Hz/*Units*/,DAQmx_Val_Low/*IdleState*/,0/*Delay*/,10000/*Freq*/,0.5/*DutyCycle*/)); DAQmxErrChk (DAQmxCfgImplicitTiming(taskHandleFRQ,DAQmx_Val_ContSamps,8)); /*********************************************/ // DAQmx Configure Digital Output /*********************************************/ DAQmxErrChk (DAQmxCreateTask("",&taskHandle)); DAQmxErrChk (DAQmxCreateDOChan(taskHandle,"Dev2/port0/line0","",DAQmx_Val_ChanPerLine)); DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"/Dev2/PFI14",10000,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,8)); /*********************************************/ // DAQmx Write Code /*********************************************/ DAQmxErrChk (DAQmxWriteDigitalLines(taskHandle,8,0,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL)); /*********************************************/ // DAQmx Start Code /*********************************************/ DAQmxErrChk (DAQmxStartTask(taskHandleFRQ)); DAQmxErrChk (DAQmxStartTask(taskHandle));
Solved! Go to Solution.
09-22-2009 04:44 PM
Hi!
I believe that you're setting up your clock wrong, I would recommend following the instructions in this Knowledge Base article that explain how to use and program the FREQ OUT line. Have a good one!
09-23-2009 06:51 AM
09-24-2009 09:55 AM
I believe that the original code was operational. However, since the transmission of the data was set to finite, I was having a hard time viewing the data on my scope. By changing the value from DAQmx_Val_FiniteSamps to DAQmx_Val_ContSamps, I was able to easily see the data.
My mistake. I am still learning here. Thanks for the time.