Hello,
Our requirement is to measure analog signals triggered by CAN frames sended from an ECU.
The environment is nearly like descriped in the NI example 'Synchronizing CAN and Analog Signals for Device Validation'
However, we have to implement this function in C-Extension using DAQMX,
so we cannot use the LabView example.
We are using a CAN 2 Port Series 2 and one 6621 card.
I build to programs the can.exe and the analogin.exe
The can objects attributes are set to this parameters:
NC_ATTR_RTSI_MODE NC_RTSI_OUT_ON_RX
NC_ATTR_RTSI_SIGNAL 1
NC_ATTR_RTSI_SIG_BEHAV NC_RTSISIG_PULSE
NC_ATTR_RTSI_SKIP 0
The CAN frames will be send by the ECU all 1ms (1kHz)
The analogin was implemented as follows:
iStatus = DAQmxCreateTask("TASK_AnalogIn", &TaskHandle);
iStatus = DAQmxCreateAIVoltageChan(TaskHandle,
"Dev1/ai0:4",
"",
DAQmx_Val_RSE,
-10.0,
10.0,
DAQmx_Val_Volts,
NULL);
iStatus = DAQmxCfgInputBuffer( TaskHandle, 10000 );
iStatus = DAQmxCfgSampClkTiming(TaskHandle,
"RTSI1",
10000,
DAQmx_Val_Rising,
DAQmx_Val_ContSamps,
2);
iStatus = DAQmxStartTask(TaskHandle);
ReadStatus = DAQmxReadAnalogF64( TaskHandle,
1, // DAQmx_Val_Auto, // Lese Anzahl Samples pro Kanal
5.0, // Timeout - Wir geben hier einen Timeout an, falls der
// RTSI Trigger mal eine Zeitlang nicht ansteht
DAQmx_Val_GroupByChannel, // zuerst alle Samples eines Kanals dann den naechsten
ReadBuffer,
READ_BUFFERSIZE, //
&ValuesRead,
NULL);