05-07-2014 06:36 AM
Hi everyone,
I'd like to configure two NI PXI-4204 devices (one as master and one as slave) so that these two devices measure a bunch of samples.
Therefore I've exported the start trigger signal from the master device and set an trigger on this signal for the slave device.
Actually both devices are connected to a frequency generator.
When I'm looking at the measured values I got two data arrays that are NOT synchron.
TaskHandle thMaster = NULL; TaskHandle thSlave = NULL; double masterData[SamplesPerChannel*ChannelMax]; double slaveData[SamplesPerChannel]; long readMasterData = 0; long readSlaveData = 0; long err = 0;
if(!err) err = DAQmxCreateTask ( "Master", &thMaster ); if(!err) err = DAQmxCreateAIVoltageChan ( thMaster, "PXI1Slot7/ai0", "", DAQmx_Val_Cfg_Default, 0, 20, DAQmx_Val_Volts, NULL ); if(!err) err = DAQmxCfgSampClkTiming ( thMaster, "", SampleRate, DAQmx_Val_Rising, DAQmx_Val_ContSamps, SamplesPerChannel ); if(!err) err = DAQmxExportSignal ( thMaster, DAQmx_Val_StartTrigger, "PXI_Trig0"); if(!err) err = DAQmxTaskControl ( thMaster, DAQmx_Val_Task_Verify ); if(!err) err = DAQmxCreateTask ( "Slave", &thSlave ); if(!err) err = DAQmxCreateAIVoltageChan ( thSlave , "PXI1Slot8/ai0", "", DAQmx_Val_Cfg_Default, 0, 20, DAQmx_Val_Volts, NULL ); if(!err) err = DAQmxCfgSampClkTiming ( thSlave , "", SampleRate, DAQmx_Val_Rising, DAQmx_Val_ContSamps, SamplesPerChannel ); if(!err) err = DAQmxCfgDigEdgeStartTrig ( thSlave , "/PXI1Slot7/PXI_Trig0", DAQmx_Val_Rising);
if(!err) err = DAQmxTaskControl ( thSlave, DAQmx_Val_Task_Verify ); if(!err) err = DAQmxStartTask ( thSlave ); if(!err) err = DAQmxStartTask ( thMaster ); if(!err) err = DAQmxReadAnalogF64 ( thMaster, SamplesPerChannel, 3.0, DAQmx_Val_GroupByChannel, &masterData[0], sizeof(masterData), &readMasterData, NULL ); if(!err) err = DAQmxReadAnalogF64 ( thSlave , SamplesPerChannel, 3.0, DAQmx_Val_GroupByChannel, &slaveData[0], sizeof(slaveData), &readSlaveData, NULL );
Can anyone point out my mistake within the posted code?
Thanks,
Matthias
05-22-2014 05:27 AM
Hello,
which delay is between the values? Do you see an only one value shifted delay?
Have you tried to export the 10 MHz backplane clock?