Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5374

PCI1588 DaqMx NiSync CreateFutureTimeEvent

$
0
0

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);

 


Viewing all articles
Browse latest Browse all 5374

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>