Chapter 5 RS-232 Library
© National Instruments Corporation 5-23 LabWindows/CVI Standard Libraries
Note: The callback function may receive more than one event at a time. When using this
function at higher baud rates, some LWRS_RXCHAR events may be missed. It is
recommended to use LWRS_RECEIVE or LWRS_RXFLAG instead.
Note: Once the LWRS_RECEIVE event occurs, it is not triggered again until the input queue
falls below, and then rises back above, notifyCount bytes.
Example
notifyCount = 50; /* Wait for at least 50 bytes in queue */
eventChar = 13; /* Wait for LF */
eventMask = LWRS_RXFLAG | LWRS_TXEMPTY | LWRS_RECEIVE;
InstallComCallback (comport, eventMask, notifyCount,
eventChar, ComCallback, NULL);
...
/* Callback Function */
void ComCallback(int portNo, int evnetMask, void *data)
{
if (eventMask & LWRS_RXFLAG)
printf("Received specified character\n");
if (eventMask & LWRS_TXEMPTY)
printf("Transmit queue now empty\n");
if (eventMask & LWRS_RECEIVE)
printf("50 or more bytes in input queue\n");
}
Parameters
Input COMPort integer Range 1 through 32.
eventMask integer The events upon which the callback function
is called. See the Parameter Discussion for a
list of valid events. If you want to disable
callbacks, pass 0.
notifyCount integer The minimum number of bytes the input
queue must contain before sending the
LWRS_RECEIVE event to the callback
function.
Valid Range: 0 to Size of Input Queue.
eventCharacter integer Specifies the character or byte value that
triggers the LWRS_RXFLAG event.
Valid Range: 0 to 255.
callbackPtr ComCallbackPtr The name of the user function that processes
the event callback.
callbackData void *A pointer to a user-defined four-byte value
that is passed to the callback function.