
MVI-ADM ♦ 'C' Programmable Serial Port Library Functions
'C' Programmable Application Development Module Developer's Guide
ProSoft Technology, Inc. Page 255 of 342
February 20, 2013
MVIsp_PutData
Syntax
int MVIsp_PutData(int comport, BYTE *data, int *len, DWORD timeout);
Parameters
port to which data is to be sent
pointer to array of bytes to be sent
pointer to number of bytes to send / bytes sent
amount of time to wait to send byte
Description
This function transmits an array of bytes across a serial port. comport must be
previously opened with MVIsp_Open.
data is a pointer to an array of bytes to be sent.
MVIsp_PutData sends each byte in the array data to the serial port. len should
point to the number of bytes in the array data 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 this function returns and the
actual time that the bytes are transmitted across the serial line. This function
attempts to insert the bytes 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 any of the bytes cannot
be queued immediately. If timeout is TIMEOUT_FOREVER, the function will not
return until all the bytes are queued successfully.
If all the bytes can be queued immediately, MVIsp_PutData returns
MVI_SUCCESS. If the characters cannot be queued immediately,
MVIsp_PutData tries to queue the bytes until the timeout elapses. If the timeout
elapses before the bytes can be queued, MVI_ERR_TIMEOUT is returned.
When MVIsp_PutData returns, it writes to the int pointed to by len the number of
bytes queued successfully. len is written for successfully sent bytes as well as
timeouts.
Note: If software handshaking is enabled on the external serial device, sending data that contains
XOFF characters may stop transmission from the external serial device.
If handshaking is enabled and the receiving serial device has paused
transmission, timeouts may occur after the queue becomes full.
Return Value
the bytes were sent successfully
comport has not been opened
timeout elapsed before bytes sent
Comentarios a estos manuales