Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous I/O with 6537

I am attempting to simultaneous run pattern generation and aquire data on two channels with the PCIe-6537. Below is a segment of the relavent code. The pattern generation section works perfectly. The issue is that I get no data backe from the input section. I have tried configuring the clock and pause trigger input in numerous ways, none work. I finally decided to simplify it by running a signal from the pattern generator back into the card as a clock and then just do simple external clock timing. Still no go. When I check value of SamplesRead it is always 0. The DataBuf array is always at the preinitialized value. The wierd thing is the routine does not seem to time out. It seems to think it aquired enough samples.
 
Any help would be most appreciated. Thanks
 
/* Configure DAQmx for output on port0*/
 DAQmxErrChk (DAQmxCreateTask("RunConversion_Out",&OutTaskHandle));
 DAQmxErrChk (DAQmxCreateDOChan(OutTaskHandle,"Dev2/port0_16","",DAQmx_Val_ChanForAllLines));
 DAQmxErrChk (DAQmxSetDOLogicFamily(OutTaskHandle, "Dev2/port0_16",DAQmx_Val_3point3V));
 DAQmxErrChk (DAQmxCfgPipelinedSampClkTiming(OutTaskHandle,"",10000000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,OutBufPnt));
 DAQmxErrChk (DAQmxSetPauseTrigType(OutTaskHandle,DAQmx_Val_None));
 
/* Configure DAQmx for input on port2*/
 DAQmxErrChk (DAQmxCreateTask("RunConversion_In",&InTaskHandle));
 DAQmxErrChk (DAQmxCreateDIChan(InTaskHandle,"Dev2/port2_16","",DAQmx_Val_ChanForAllLines));
 DAQmxErrChk (DAQmxSetDILogicFamily(InTaskHandle,"Dev2/port2_16",DAQmx_Val_3point3V));
 DAQmxErrChk (DAQmxCfgInputBuffer (InTaskHandle,DataPerSequence));
 DAQmxErrChk (DAQmxCfgSampClkTiming(InTaskHandle,"/Dev2/PFI5",10000000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,DataPerSequence));
// DAQmxErrChk (DAQmxCfgPipelinedSampClkTiming(InTaskHandle,"",10000000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,DataPerSequence));
// DAQmxErrChk (DAQmxCfgBurstHandshakingTimingExportClock (InTaskHandle,DAQmx_Val_FiniteSamps,DataPerSequence,10000000.0,"PFI5",DAQmx_Val_ActiveHigh,DAQmx_Val_High,DAQmx_Val_ActiveHigh));
// DAQmxErrChk (DAQmxSetPauseTrigType(InTaskHandle,DAQmx_Val_None));
// DAQmxErrChk (DAQmxSetPauseTrigType(InTaskHandle,DAQmx_Val_DigLvl));
// DAQmxErrChk (DAQmxSetDigLvlPauseTrigSrc(InTaskHandle,"/Dev2/PFI2"));
// DAQmxErrChk (DAQmxSetDigLvlPauseTrigWhen(InTaskHandle,DAQmx_Val_Low));
// DAQmxErrChk (DAQmxSetReadOverWrite(InTaskHandle,DAQmx_Val_OverwriteUnreadSamps));
// DAQmxErrChk (DAQmxSetPauseTrigType(InTaskHandle,DAQmx_Val_None));
// DAQmxErrChk (DAQmxSetDigLvlPauseTrigWhen(InTaskHandle,DAQmx_Val_High));
// DAQmxErrChk (DAQmxSetExportedRdyForXferEventOutputTerm(InTaskHandle,"/Dev1/PFI1"));
// DAQmxErrChk (DAQmxSetExportedRdyForXferEventLvlActiveLvl(InTaskHandle,DAQmx_Val_ActiveLow));
// DAQmxErrChk (DAQmxSetExportedRdyForXferEventDeassertCond(InTaskHandle,DAQmx_Val_OnbrdMemCustomThreshold));
// DAQmxErrChk (DAQmxSetExportedRdyForXferEventDeassertCondCustomThreshold(InTaskHandle,1));
 
/* Start Conversions and Loop through all DAC codes */

   for (count1=0;count1<TotalSequencesInAquisition;count1++)
   {
 
/* DAQmx Start Pattern Generation */
  DAQmxErrChk (DAQmxWriteDigitalU16(OutTaskHandle,OutBufPnt,0,0,DAQmx_Val_GroupByChannel,OutBuf,NULL,NULL));
  DAQmxErrChk (DAQmxStartTask(InTaskHandle));
  DAQmxErrChk (DAQmxReadDigitalU16(InTaskHandle,DataPerSequence,0,DAQmx_Val_GroupByChannel,&DataBuf[DataPerSequence*count1],DataPerSequence,&SamplesRead,NULL));
  DAQmxErrChk (DAQmxStartTask(OutTaskHandle));
  DAQmxErrChk (DAQmxWaitUntilTaskDone(InTaskHandle,10));
//  DAQmxErrChk (DAQmxWaitUntilTaskDone(OutTaskHandle,10));
  DAQmxErrChk (DAQmxStopTask(InTaskHandle));
  DAQmxErrChk (DAQmxStopTask(OutTaskHandle));
   }
0 Kudos
Message 1 of 2
(2,767 Views)

Abort this request. I figured out my own mistake. Turns out I was calling

  DAQmxErrChk (DAQmxReadDigitalU16(InTaskHandle,DataPerSequence,0,DAQmx_Val_GroupByChannel,&DataBuf[DataPerSequence*count1],DataPerSequence,&SamplesRead,NULL));

before waiting until all of the data was aquired. By just moving this call after

  DAQmxErrChk (DAQmxWaitUntilTaskDone(InTaskHandle,10));

all works fine.

 


 

0 Kudos
Message 2 of 2
(2,760 Views)