serSendData (Function) |
Top Previous Next |
serSendData will send the contents of a buffer to the specified serial port. If the "sof" and "eof" variables are set (different from 0), the frame will be "framed". The "sof" character will be sent followed by the data pointed to by "data" with the length in "size" followed by the "eof" character. If the data pointed to by "data" contains either a "sof" or an "eof" character, the "stuffch" will be output first followed by the "sof"/"eof" character. If "stuffch" is part of the data stream, it will be duplicated. This means that the receiver can detect that a "sof", "eof", or "stuffch" is embedded within the data and therefore able to restore the original data.
Input: port : SINT (0..127) (default 0) Selects which serial port to use.
data : PTR The address of the buffer that contain the data.
size : INT This is the number of bytes to send from the buffer.
sof : SINT The start of frame character (indicates when a frame begins).
eof : SINT The end of frame character (indicates when a frame ends).
stuffch : SINT The character that will be inserted in the frame if the "sof" or "eof" characters are to be sent in the data stream (provided "stuffch" is part of the data stream, it will then be duplicated).
timeout : DINT (default -1) The number of milliseconds to wait (Only used when hardware handshake is enabled. See serSetHandshake).
Supported from firmware 4.68 / R1.10.00
Returns: INT
Declaration: FUNCTION serSendData;
Example: INCLUDE rtcu.inc |