03-23-2010 08:20 AM
Dear All,
I try to synch to PCI-MIO-16E-1 cards, I connected them with RTSI cable which is configured in MAX. I checked RTSI cable, no shorts nor opens.
Here is code :
DAQmxErrChk(DAQmxCreateTask("MuxTask1",&hMux1)); //master - voltage
DAQmxErrChk(DAQmxCreateAIVoltageChan (hMux1, "DAQ_A3/ai0", "", DAQmx_Val_Diff, -5.0, 5.0, DAQmx_Val_Volts, ""));
DAQmxErrChk(DAQmxCfgSampClkTiming(hMux1,"",reqSampRatePerChan,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,reqSampPerChan));
DAQmxErrChk (DAQmxCfgAnlgEdgeStartTrig (hMux1, "DAQ_A3/ai0", DAQmx_Val_RisingSlope, 2.0));
DAQmxErrChk(DAQmxCreateTask("MuxTask2",&hMux2)); //slave - current
DAQmxErrChk(DAQmxCreateAIVoltageChan (hMux2, "DAQ_A4/ai0", "", DAQmx_Val_Diff, -5.0, 5.0, DAQmx_Val_Volts, ""));
DAQmxErrChk(DAQmxCfgSampClkTiming(hMux2,"",reqSampRatePerChan,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,reqSampPerChan));
/* MasterTimebas synch
DAQmxErrChk (DAQmxGetTimingAttribute(hMux1,DAQmx_MasterTimebase_Src,strzChanList,1024));
DAQmxErrChk (DAQmxGetTimingAttribute(hMux1,DAQmx_MasterTimebase_Rate,&clkRate));
DAQmxErrChk (DAQmxSetTimingAttribute(hMux2,DAQmx_MasterTimebase_Src,strzChanList));
DAQmxErrChk (DAQmxSetTimingAttribute(hMux2,DAQmx_MasterTimebase_Rate,clkRate));
*/
//trigger synch
DAQmxErrChk (DAQmxCfgDigEdgeStartTrig(hMux2,/DAQ_A3/ai/StartTrigger,DAQmx_Val_Rising));
DAQmxErrChk(DAQmxStartTask(hMux2)); //slave
DAQmxErrChk(DAQmxStartTask(hMux1)); //master
DAQmxErrChk(DAQmxWaitUntilTaskDone(hMux1, 1.5));
DAQmxErrChk(DAQmxWaitUntilTaskDone(hMux2, 1.5));
DAQmxErrChk(DAQmxReadAnalogF64 (hMux1, reqSampPerChan, 10.0, DAQmx_Val_GroupByScanNumber, muxData1,
(reqSampPerChan*numOfChan), &readSampPerChan, NULL));
DAQmxErrChk(DAQmxReadAnalogF64 (hMux2, reqSampPerChan, 10.0, DAQmx_Val_GroupByScanNumber, muxData2,
(reqSampPerChan*numOfChan), &readSampPerChan, NULL));
DAQmxStopTask(hMux1) ;
DAQmxStopTask(hMux2) ;
Everything works fine, DAQ_A3 triggers DAQ_A4, but clocks are not shared.
Now if I unhash part with master timebase synch, I get following error:
Wait Until Done did not indicate that task was done within the specified timeout.
Increas the timeout, check program, and make sure connections for external timing and triggering are in place.
Status Code : -200560.
03-25-2010 09:48 AM
Dear mpankau,
First of all I would try to change the lenght of the char array You use as a variable to store the Master Timebase source from 1024 to 256.
char strzChanList[256];
.
.
.
DAQmxErrChk (DAQmxGetTimingAttribute(hMux1,DAQmx_MasterTimebase_Src,strzChanList,256));
This is a small change and but for the first sight I couldn't see anything that is incorrect in Your code.
Please make the changes and let me know about the results so we can move forward if needed!
Best regards,
David Varga
Applications Engineer
NIH