12-14-2016 09:46 AM
My application uses a PCI1588 and a PCI4661 (DaqMx) in the same PC. My PCI 1588 is connected to a PTP grand master and I wish to trigger the 4661 to start AI0 AI1 and AO0 and AO1 from the RTSI bus. I wish to trigger from a future timed event.
I have downloaded niSync and Ni Max and all cards are present.
I have added the RTSI cable in NI Max and left the routing to auto.
I have started an NiSync process.
I have added a trigger to the analog write process and this is waiting for the trigger.
I have found the examples installed with Ni Sync (C:\Users\Public\Documents\National Instruments\CVI\samples\NI-Sync).
What I am seeing is that the Daq starts a write, but then waits for the timed event. This occurs after 10 seconds as expected and then the NSamplesWritten event occurs, allowing the rest of the data to be transmitted.
I have not configured any trigger terminals. I did try but these seem to return errors as all of the constants for trigger terminals are for the PXI board and return error codes explaining that the function is not valid for the hardware.
Has anybody had any experience in this and can advise the correct procedure to generate the trigger.
Thanks in advance.
My code is (snips from different functions)
status = niSync_init (instDesc665x, VI_TRUE, VI_TRUE, &session665x);
CheckSyncError(status);
status = niSync_Start1588(session665x);
CheckSyncError(status);
// ---- setup DAQ ---
result = DAQmxSetTimingAttribute(NiDaqDevice.gTaskHandle, DAQmx_SampClk_Rate, pSampleSet->SampleClockRate);
CheckError(result);
result = DAQmxGetTimingAttribute(NiDaqDevice.gTaskHandle, DAQmx_SampClk_Rate, &resultingSampClkRate);
CheckError(result);
int32_t WriteBufferSize = pSampleSet->ChanSamplesInABuffer * 8;
result = DAQmxCfgSampClkTiming(NiDaqDevice.gTaskHandle, "", resultingSampClkRate, DAQmx_Val_Rising, DAQmx_Val_ContSamps, WriteBufferSize);
result = DAQmxCfgDigEdgeStartTrig(NiDaqDevice.gTaskHandle, NiDaqDevice.TriggerName, DAQmx_Val_Rising);
DAQmxRegisterEveryNSamplesEvent(NiDaqDevice.gTaskHandle, DAQmx_Val_Transferred_From_Buffer, pSampleSet->ChanSamplesInABuffer, 0, ReloadCallback, (void*)pSampleSet);
DAQmxRegisterDoneEvent (NiDaqDevice.gTaskHandle, 0, DoneCallback, NULL);
result = DAQmxWriteAnalogF64(pDevice->gTaskHandle, pSampleSet->ChanSamplesInABuffer, FALSE, 2.10F, DAQmx_Val_GroupByScanNumber, pSampleBuffer, &written, NULL);
// --- set the time event
status = niSync_GetTime(session665x, &(pTime->Seconds), &(pTime->NanoSeconds), &(pTime->FractionalNanoSeconds));
pTime->Seconds += 10;
int32_t status = niSync_CreateFutureTimeEvent(session665x, terminal, NISYNC_VAL_LEVEL_HIGH, pTime->Seconds, pTime->NanoSeconds, pTime->FractionalNanoSeconds);
CheckSyncError(status);
result = DAQmxStartTask(NiDaqDevice.gTaskHandle);
12-15-2016 02:45 AM
Update:
My problem with double triggers is an application problem and nothing to do with NI Sync.
I would apreciate if anybody has experience with Ni Sync, 1588 and CVI if you could offer any comments on my code WRT the ni sync then I would be grateful.
Thanks for your views.
12-15-2016 10:39 AM - edited 12-15-2016 10:40 AM
Hi Stephen,
Thanks for submitting to the forum. Just to clarify, the issue you're currently having is to do with implementing the triggering of the DAQmx functions?
Also, have you come across the NI-DAQmx C Reference Help web page: http://zone.ni.com/reference/en-XX/help/370471AA-01/
Best Regards,
James Kinch
Applications Engineering