serSetDataReceiver (Function) |
|
serSetDataReceiver registers a callback function that is called when raw data is received on a serial port. The serial port must be opened with serOpen before the callback receiver is enabled. The callback receives the VPL port number, an ACCESS ARRAY containing the received bytes, and the number of valid bytes in the array. The received data is delivered in blocks of up to 255 bytes. The data array is valid only while the callback function is running. If the application needs the data after the callback has returned, copy the bytes to application-owned storage. serSetDataReceiver cannot be used at the same time as serFrameReceiver on the same serial port.
Input: port : SINT (default: 0) The serial port to configure.
cb : CALLBACK The callback function to call when data is received. Set to 0 to disable the data receiver.
Returns: INT
Declaration: FUNCTION ALIGN serSetDataReceiver:INT; The callback function must use the serDataReceiver declaration shown above.
Example: INCLUDE rtcu.inc |