02-19-2007 04:10 PM
02-26-2007 08:26 AM
@yttern wrote:Hi,Today I'm using a NI-PCI-6541 for generating the correct serial bus timing (Both generation and acquisition). What I do with the 6541 is to configure the correct output ports (0 to 15) and then download the serial data and handshake bits to the onboard memory. For generation I use the onboard clock to as source clock. I then configure an acquisition memory of the same size set up to use external clock as source (This is the output from the generation session NIHSDIO_VAL_DDC_CLK_OUT_STR connected to NIHSDIO_VAL_PFI2_STR ). I then trigger the board and it sends tree sequences of 16 bits serial clock and handshake bits where the two first 16 bits sequences are commands to the DUT and on the last 16 bit sequence the DUT responds with serial data back to the board memory. I then read out the memory and decodes the last 16 bits in memory.I now bough another high-speed DIO card, the NI PCIe-6536 for the same task. My question is then. Is it possible to both generate data and aquire data at the same time with this card? Sending serial clock to the DUT and at the same time stream the data returning from the DUT to disk ?For the NI 6541 there was an example showing how to do this but for the NI PCIe-6536 there are only examples of either generation sessions or acquisition sessions. I start to suspect that I should have bought a PCI-6541 instead of a PCIe-6536.Thanks
02-28-2007 05:04 PM
Hello Jeff and thank you for your response.
Yes I use the lower 16 bits for generation and upper 16 bit (Use only 2) for acquisition. I was able to create a sequence that clocks data in and out data on the same serial clock. Actually it turn out to be much easier than the code I had to generate for the NI 6541 Card.
For your information I use the code given below. This code initialise the card acq. and gen. sessions, sends and receive data and the at the end closes the handlers. I use a trigger from the acq. task to start the gen. task. That was the solution for me to syncronise the tasks.
Yttern
ViStatus SetupAndSendRec_GenAcqDev_6536( ViUInt32 *iGenWaveformData, ViUInt32 *iReadWaveformData, ViUInt32 iWaveFormSize, ViUInt32 *iActualRead) //, ViUInt32 waveformData[WAVEFORM_SIZE] )
{
int error=0;
uInt32 i=0,
iActualWritten = 0;
char errBuff[2048]={'\0'};
/*********************************************/
// DAQmx Generation Configure Code
/*********************************************/
// Create a task handler
DAQmxErrChk (DAQmxCreateTask("",&GenerationtaskHandle));
// Alloctae 16 bits for generation
DAQmxErrChk (DAQmxCreateDOChan (GenerationtaskHandle, "PXI1Slot3/port0_16", "",
DAQmx_Val_ChanForAllLines));
// Set Active clk edge, sampling frequency and number of samples.
DAQmxErrChk (DAQmxCfgSampClkTiming (GenerationtaskHandle, "OnboardClock",
dSampleClockRate, DAQmx_Val_Rising,
DAQmx_Val_FiniteSamps, iWaveFormSize));
// Set up sample clock to output pin PFI4
DAQmxErrChk (DAQmxExportSignal (GenerationtaskHandle, DAQmx_Val_SampleClock,
"/PXI1Slot3/PFI4"));
// Set up trigger to input pin PFI1
DAQmxErrChk ( DAQmxCfgDigEdgeStartTrig (GenerationtaskHandle, "/PXI1Slot3/PFI1",
DAQmx_Val_Rising));
// Set-up the buffer to be written
DAQmxErrChk (DAQmxWriteDigitalU32 ( GenerationtaskHandle, iWaveFormSize, 0, 10.0,
DAQmx_Val_GroupByChannel, iGenWaveformData,
&iActualWritten, 0));
DAQmxErrChk (DAQmxStartTask(GenerationtaskHandle));
/*********************************************/
// DAQmx Acquisition Configure Code
/*********************************************/
// Create a task handler
DAQmxErrChk (DAQmxCreateTask("",&AcquisitiontaskHandle));
// Allocate 8 bits for Acquisition
DAQmxErrChk (DAQmxCreateDIChan (AcquisitiontaskHandle, "PXI1Slot3/port2", "",
DAQmx_Val_ChanForAllLines));
// Set Active clk edge, sampling frequency and number of samples.
DAQmxErrChk (DAQmxCfgSampClkTiming (AcquisitiontaskHandle, "/PXI1Slot3/PFI5",
dSampleClockRate, DAQmx_Val_Rising,
DAQmx_Val_FiniteSamps, iWaveFormSize));
// Set up trigger to output pin PFI0
DAQmxErrChk (DAQmxExportSignal (AcquisitiontaskHandle, DAQmx_Val_StartTrigger,
"/PXI1Slot3/PFI0"));
// Set up read Task. This function automaticly starts the task.
DAQmxErrChk (DAQmxReadDigitalU32 (AcquisitiontaskHandle, iWaveFormSize, 10.0,
DAQmx_Val_GroupByChannel, iReadWaveformData,
iWaveFormSize, iActualRead, 0));
Error:
if( DAQmxFailed(error)){
DAQmxGetExtendedErrorInfo(errBuff,2048);
MessagePopup ("DAQmx Error", errBuff);
error = 1;
}
// Stop acquisition task if it is not already 0
if( AcquisitiontaskHandle!=0 ){
DAQmxStopTask(AcquisitiontaskHandle);
DAQmxClearTask(AcquisitiontaskHandle);
}
// Stop generation task if it is not already 0
if( GenerationtaskHandle!=0 ){
DAQmxStopTask(GenerationtaskHandle);
DAQmxClearTask(GenerationtaskHandle);
}
return error;
}