Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Export Clock NI9402 in cDAQ-9171 chassis and Read with SCB-68 card

 

Hi,
I have a NI9402 mounted on a cDAQ-9171 chassis and I want to generate a binary signal (1MHz) and export the clock that it is generating the binary signal.
After that I want to read the data.  I import the clock and the data line to a SCB-68 card. I want to use the imported clock as a reference for sampling the data.

Write Code (NI9402 mounted on a cDAQ-9171 Chassis) :
uInt8 dataWrite[8] ={1,1,1,0,0,1,1,1};
DAQmxCreateTask("",&taskHandle);

DAQmxCreateDOChan(taskHandle,"cDAQ1Mod1/port0/line1","dataOut",DAQmx_Val_ChanPerLine);

DAQmxCfgSampClkTiming(taskHandle,NULL,1000000.0,DAQmx_Val_Falling,DAQmx_Val_FiniteSamps,8);

DAQmxExportSignal (taskHandle, DAQmx_Val_SampleClock, "/cDAQ1Mod1/PFI0");

DAQmxWriteDigitalLines(taskHandle,8,1,30.0,DAQmx_Val_GroupByChannel,dataWrite,&sampsPerChanWritten,NULL);

 

Read Code (SCB-68 card and PCI-6534):
uInt8 dataRead[8];
DAQmxCreateTask("taskHandle",&taskHandle);

DAQmxCreateDIChan(taskHandle,"Dev1/port0/line0","",DAQmx_Val_ChanPerLine);

DAQmxCfgSampClkTiming(taskHandle,"/Dev1/PFI2",1000000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000000);

DAQmxReadDigitalLines (taskHandle, 8, 30.0, DAQmx_Val_GroupByChannel, dataRead, 8, &sampsRead, &numBytesPerSamp, NULL);
DAQmxStartTask(taskHandle);

 

1) With the scope I am only able to see the first pulse of the exported clock, not the 8 pulses that I should see. Am I exporting the clock correctly ? Please see the attached files: cDAQ-9171 and NI9402 connections diagram from NI MAX.
2) I am interested in using DAQmx_Val_ContSamps because in the future I would recieve a variable amount of data. When I execute this code looks like DAQmxReadDigitalLines () blocks the read program waiting for more data. How does exactly the buffer (set to ContSamps) and the ReadDigitalLines work together ?

Thank you very much

 

 

Download All
0 Kudos
Message 1 of 2
(4,959 Views)

Hi Coquivhdl,

Could you provide a bit more information regarding the functionality of your defined tasks? Are you trying to write data to 8 lines with each sample, or 8 pulses on one line? It might be helpful to add a few comments accompanying your code to answer these questions.

Thanks!

 

Rick C.
0 Kudos
Message 2 of 2
(4,908 Views)