Publication 1756-RM004B-EN-P - October 2000
5-20 Serial Port API
Communications
MVIsp_Putch
Syntax:
int MVIsp_Putch(int comport, BYTE ch, DWORD timeout);
Parameters:
comport port to which data is to be sent
ch character to be sent
timeout amount of time to wait to send character
Description:
This function is used to transmit a single character across a serial port.
comport must be previously opened with MVIsp_Open.
ch is the byte to be sent.
All data sent to a port is queued before transmission across the serial
port. Therefore, some delay may occur between the time after this
function returns and the actual time that the character is transmitted
across the serial line. This function attempts to insert the character into
the transmission queue, and return values correspond accordingly.
timeout specifies the amount of time in milliseconds to wait. If timeout
is TIMEOUT_ASAP, the function will return immediately if the
character cannot be queued immediately. If timeout is
TIMEOUT_FOREVER, the function will not return until the character is
queued successfully.
If the character can be queued immediately, MVIsp_Putch returns
MVI_SUCCESS. If the character cannot be queued immediately,
MVIsp_Putch tries to queue the character until the timeout elapses. If
the timeout elapses before the character can be queued,
MVI_ERR_TIMEOUT is returned.
Note: If handshaking is enabled and the receiving serial device has
paused transmission, timeouts may occur after the queue becomes
full.
Return Value:
MVI_SUCCESS the character was sent successfully
MVI_ERR_NOACCESS comport has not been opened
MVI_ERR_BADPARAM invalid parameter
MVI_ERR_TIMEOUT timeout elapsed before character sent