01-09-2008 09:06 AM
01-11-2008 02:21 AM - edited 01-11-2008 02:22 AM
__int64 freq, t0, t1;
DWORD time_elapsed;
/* Freq : Clock frequency
t0 : initial time
t1 : time juste after edge rising
time_elapsed : variable containing the time elapsed
*/
// We retrieve the clock frequency of the computer
QueryPerformanceFrequency((LARGE_INTEGER*)&freq);
// We retrieve the initial count of the performance counter
QueryPerformanceCounter((LARGE_INTEGER*)&t0);
/*
Here is the code containing the trigger function
*/
// Just after the egde rising trigger we retrieve the counts of the performance counter
QueryPerformanceCounter((LARGE_INTEGER*)&t1);
// We convert the counts of the performance counter in time
unit = Ns;
time_elapsed= (DWORD)(((t1 - t0) * unit) / freq);
Best regards,
01-11-2008 03:05 AM
01-15-2008 08:38 AM
Hi,
I was looking at your problem since you posted, and I finally found a piece of answer that could help you.
A way, to know when the trigger occurs is to use the DAQ Events with a callback function.
In this case, you should use the function Config_ATrig_Event_Message whose purpose is :
"Notifies NI-DAQ applications when the trigger channel signal meets certain criteria you specify. NI-DAQ sends your application a message or executes a callback function that you provide."
You'll be able to find more informations about this function in the PDF Manual here : http://www.ni.com/pdf/manuals/321645e.pdf and more information about DAQ Events and callback functions here : http://zone.ni.com/devzone/cda/tut/p/id/3010#toc2.
Hope this helps,
01-17-2008 06:38 AM