Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ and DMM Synchronization

When attempting to synchronize a 4071 DMM and a 6255 DAQ, The DMM seems to have inconsistant start delay. I have several bits of code that turn on and off voltages and I am attempting to align the rise and fall in current with the rise and fall in voltage. I'm measuring two DAQ channels and comparing that to the DMM. The rise and fall times are on the order to 5ms and the entire on-off plateau takes around 1second. I'm reading at 4000 samples/second.

 

The first time I run the measurement the DMM start delay appears to always be ~4.75ms (hence the 5ms delay in the code below). After the first run, the delay can be between 4-9ms.

 

1. Am I setting up the instruments correctly?

 

2. Is there a better way to do synchronization?

 

if(!firstTime){
	DAQmxErrChk("DAQmxClearTask", DAQmxClearTask(&taskHandleAtoD));
	DAQmxErrChk("DAQmxResetDevice(AtoD)", DAQmxResetDevice("AtoD"));
}

DAQmxErrChk("DAQmxCreateTask", DAQmxCreateTask("", &taskHandleAtoD));
DAQmxErrChk("DAQmxCreateAIVoltageChan", DAQmxCreateAIVoltageChan(taskHandleAtoD, "AtoD/ai0:23", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL));
if(!firstTime)
	DmmErrChk("niDMM_reset", niDMM_reset(SesDMM));	
DmmErrChk("niDMM_init", niDMM_init("DMM", VI_TRUE, VI_TRUE, &SesDMM), false);
DmmErrChk("niDMM_ConfigurePowerLineFrequency", niDMM_ConfigurePowerLineFrequency(SesDMM, NIDMM_VAL_60_HERTZ));

DAQmxErrChk("DAQmxCreateAIVoltageChan", DAQmxCreateAIVoltageChan(taskHandleAtoD, sChannels, "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL));

DAQmxErrChk("DAQmxCfgSampClkTiming", DAQmxCfgSampClkTiming(taskHandleAtoD, "", dRate, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, nSamplesPerChannel));
DAQmxErrChk("DAQmxExportSignal",DAQmxExportSignal(taskHandleAtoD,DAQmx_Val_StartTrigger,"PXI_Trig0")); 
DAQmxErrChk("DAQmxSetStartTrigDelayUnits",DAQmxSetStartTrigDelayUnits(taskHandleAtoD, DAQmx_Val_Seconds));
DAQmxErrChk("DAQmxSetStartTrigDelay",DAQmxSetStartTrigDelay(taskHandleAtoD,0.015));


DmmErrChk("niDMM_ConfigureWaveformAcquisition", niDMM_ConfigureWaveformAcquisition(SesDMM, NIDMM_VAL_WAVEFORM_VOLTAGE, 60, dRate, nSamplesPerChannel));
DmmErrChk("niDMM_ConfigureTrigger",niDMM_ConfigureTrigger(SesDMM,NIDMM_VAL_TTL0, 0.010));
DmmErrChk("niDMM_ConfigureTriggerSlope",niDMM_ConfigureTriggerSlope(SesDMM,NIDMM_VAL_POSITIVE));
DmmErrChk("niDMM_Initiate",niDMM_Initiate(SesDMM));

Sleep(50); //do some other non-NI tasks

DAQmxErrChk("DAQmxStartTask", DAQmxStartTask(taskHandleAtoD));

DmmErrChk("niDMM_FetchWaveform",niDMM_FetchWaveform(SesDMM, nAtoDTimeout*1000, nSamplesPerChannel, dAtoDValues, &sampsPerChanRead));

DAQmxErrChk("DAQmxWaitUntilTaskDone", DAQmxWaitUntilTaskDone(taskHandleAtoD, nAtoDTimeout));
DAQmxErrChk("DAQmxReadAnalogF64", DAQmxReadAnalogF64(taskHandleAtoD, nSamplesPerChannel, nAtoDTimeout, DAQmx_Val_GroupByChannel, nAtoDOffset, nSampleCount, &sampsPerChanRead, NULL));
DAQmxErrChk("DAQmxStopTask", DAQmxStopTask(taskHandleAtoD));

 

 

0 Kudos
Message 1 of 3
(4,707 Views)

Hi GoodSirEric,

 

Have you checked out some of the synchronization Measurment Studio examples at all? When you install the Measurement Studio DAQmx .NET library, the example programs are automatically installed on your machine. Check this out, I think it may help:

http://zone.ni.com/reference/en-XX/help/370473H-01/mstudiowebhelp/html/daqmxexamplesnet2008/

 

specifically the synchronization examples.

0 Kudos
Message 2 of 3
(4,673 Views)

I did review the examples, and that's how I came up with most of the code. Unfortunately there isn't an example that does exactly the same thing I'm trying to do. I've resorted to doing post-measurement alignment in software via sending in a sharp edge to both DAQ and DMM.

 

What factors could cause a delay in the start of the DMM? The obvious things I can think of are:

 

Delay of start trigger signal across backplane (should be minimal, not 1ms+)

DMM internally taking a moment to start recording (which I hope would be consistent)

0 Kudos
Message 3 of 3
(4,644 Views)