Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

how to measure the time between two data arrive at the serial port

good afternoon
i have a question:
how to measure the time between two data arrive at the serial port,
can it be measured?
waiting for answering......
0 Kudos
Message 1 of 4
(3,139 Views)
It depends on how you check the timing of data arrival.  Assuming you are using Win32 environment, you can use ClearCommError() API function that receives COMSTAT structure.  The resulted COMSTAT has cbInQue member that indicates the byte count that was already arrived in the PC's COM receive buffer.  You can call this function repeatedly in a loop to observe the byte arrival.  This feature is also wrapped by VISA viGetAttribute() function with VI_ATTR_ASRL_AVAIL_NUM, however using VISA may cause some latency.
 
To measure the time, you can use GetTickCount() API function that returns the millisecond value since the PC was rebooted.  For more precise measure, you can also use QueryPerformanceCounter() function that allows microsecond measurement, though the function is bit difficult to use.
 

このメッセージは 09-28-2006 10:59 AMに Makoto が編集しています。

0 Kudos
Message 2 of 4
(3,122 Views)
I am appreciating for you reply
i am coding with Labwindows/CVI
and have solved the problem
Thank you for your help
Now i am learning the rs485
but i amnot sure about the function of pin
could you tell me how and where to find the information?
Thank you
waiting......
 
0 Kudos
Message 3 of 4
(3,095 Views)
Is this what you are looking for?
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 4 of 4
(3,083 Views)