01-15-2007 07:50 AM
01-16-2007 03:00 AM
Hello phoei,
basically there a two ways to achieve this:
1. Both tasks use the same timing:
In this case the analog output task generates the masterclock and the second task uses this as reference. The tasks should be started in the following order: First start the task that depends on a clock and then the one that generates the clock. in doing so, the two tasks on separate devices are automatically synchronized and triggered, as the slave task can be run, but it won't acquired data, before the mastertasks starts, because it depends on this clock as a reference.
This is what I can see from your excerpt of code. You started the ao task, but you didn't start the second tasks, that want's to use this clock. Remember to do this in the following order: Slave task (steady) master task (go).
error = DAQmxStartTask(ao6733TaskHandle);
error = DAQmxStartTask(ao6259TaskHandle);
2. Specification of an additional Trigger Signal
RTSI cannot only be used to share clocks, but also trigger signals. In this case also a RTSI cable is used to interconnect the boards, and one can directly refer to signals of the other devices.
Let me know if you have any queueries.
Regards,
C.L. - National Instruments Germany
01-16-2007 04:36 AM
01-16-2007 05:40 AM
01-19-2007 07:05 AM
01-19-2007 07:30 AM
Hello Pascal,
if non of the following ideas work, I would suggest to post your sample here, so we can take a look at it.
Just some questions:
1. Did you use the following order?
error = DAQmxStartTask(ao6733TaskHandle);
error = DAQmxStartTask(ao6259TaskHandle);
2. Instead of the DAQmx_Val_StartTrigger try the DAQmx_Val_SampleClock as the start trigger.
3. I assume the RTSI cable is not just plugged in, right. If you use the measurement and automation explorer to configure the cable, you can directly access any sourc of adjacent devices without the neccesity to use the export signal function.
If non of these work. Please post your sample so I can take alook at it.
Regards, C.L.
01-19-2007 08:07 AM
01-22-2007 03:09 AM
Hello Pascal,
I took a look at your code and it ran perfectly on my machine. As I already told you: You need to start the slave task in advance!
I just added the red line of code.
#include <ansi_c.h>
//#include "stdafx.h"
//#include "windows.h"
#include <NIDAQmx.h>
#include <math.h>
#define false 0
#define true 1
int main(int argc, char* argv[])
{
// PCI 6251 master, PCI 6733 as slave
int32 error = 0;
TaskHandle ao6251TaskHandle = 0;
TaskHandle triggerHandle = 0;
TaskHandle aiTaskHandle = 0;
TaskHandle ao6733TaskHandle = 0;
char errBuff[2048]={'\0'};
const int32 nPoints = 10000;
short dataBuffer[10000];
float64 dummyBuffer[10];
uInt32 digiData[10]={0xFFFFFFFF,2,4,8,16,32,64,128,256,0xFFFFFFFF};
// Init analog dataBuffer
int i=0;
for (i=0; i<nPoints; i++) {
dataBuffer[i] = floor(15000.0*sin(((double)i)/707.0)+15001.0);
}
//PCI 6251 (Dev4): AO master, export StartTrigger to RTSI0
error = DAQmxCreateTask("",&ao6733TaskHandle);
error = DAQmxCreateTask("",&ao6251TaskHandle);
error = DAQmxCreateAOVoltageChan(ao6251TaskHandle, "Dev4/ao0", "", -5.0, 5.0, DAQmx_Val_Volts, "");
error = DAQmxCfgSampClkTiming(ao6251TaskHandle, "OnboardClock", 1000.0, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, 10000);
error = DAQmxExportSignal (ao6251TaskHandle, DAQmx_Val_StartTrigger, "RTSI0");
error = DAQmxWriteRaw(ao6251TaskHandle, 10000, false, 10.0, dataBuffer, NULL, NULL);
//PCI 6733 (Dev1): Slave device (only triggered)
error = DAQmxCreateAOVoltageChan(ao6733TaskHandle, "Dev1/ao0", "", -5.0, 5.0, DAQmx_Val_Volts, "");
error = DAQmxCfgSampClkTiming (ao6733TaskHandle, "OnboardClock", 1000.0, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, 10000);
error = DAQmxCfgDigEdgeStartTrig (ao6733TaskHandle, "RTSI0", DAQmx_Val_Rising);
error = DAQmxWriteRaw (ao6733TaskHandle, 10000, false, 10.0, dataBuffer, NULL, NULL);
DAQmxGetExtendedErrorInfo(errBuff,2048);
error = DAQmxStartTask(ao6733TaskHandle);
error = DAQmxStartTask(ao6251TaskHandle);
getchar();
DAQmxClearTask(ao6733TaskHandle);
DAQmxClearTask(ao6251TaskHandle);
return 0;
}
Hope this helps, regards, C.L.
01-24-2007 12:10 PM
01-25-2007 04:47 AM