Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you use the freqout as the sample clock for writing data to DO of 6224 PCI

Solved!
Go to solution

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

 

 

 

 

0 Kudos
Message 1 of 4
(7,196 Views)

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!

 

0 Kudos
Message 2 of 4
(7,187 Views)
The reference is to a LabVIEW example. Is there an example done in C/C++ that would be helpful?
0 Kudos
Message 3 of 4
(7,179 Views)
Solution
Accepted by topic author VJohnson

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.

Message 4 of 4
(7,167 Views)