Return Value: Mvi_Success; Mvi_Err_Noaccess Comport Has Not Been Opened; Mvi_Err_Badparam Invalid Pointer; Mvi_Err_Timeout - Rockwell Automation Allen-Bradley ControlLogix 1756-MVI Programming Reference Manual

Multi-vendor interface module
Hide thumbs Also See for Allen-Bradley ControlLogix 1756-MVI:
Table of Contents

Advertisement

MVIsp_GetData
Syntax:
int
MVIsp_GetData(int comport, BYTE *data, int *len, DWORD
timeout);
Parameters:
comport
port from which data is to be received
data
pointer to array of bytes to receive data
len
number of bytes to receive / bytes received
timeout
amount of time to wait to receive character
Description:
This function is used to receive an array of bytes from a serial port.
comport must be previously opened with MVIsp_Open.
data points to an array of bytes that will receive the data.
len points to the number of bytes to receive.
MVIsp_GetData retrieves bytes from the reception queue until either
the number of bytes pointed to by len are retrieved or the timeout
elapses.
All data received from a port is queued after reception from the serial
port. Therefore, some delay may occur between the time a character is
received across the serial line and the time the character is returned by
MVIsp_GetData. This function attempts to retrieve characters from the
reception 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 queue is
empty. If timeout is TIMEOUT_FOREVER, the function will not return
until an array of bytes is retrieved from the reception queue
successfully.
If the timeout elapses before the termination character or len bytes are
received, MVI_ERR_TIMEOUT is returned.
When MVIsp_GetData returns, it writes to the int pointed to by len the
number of bytes retrieved. len is written for successfully retrieved
bytes as well as timeouts.
Return Value:
MVI_SUCCESS
MVI_ERR_NOACCESS
MVI_ERR_BADPARAM

MVI_ERR_TIMEOUT

bytes were retrieved successfully
comport has not been opened
invalid pointer
timeout elapsed before bytes retrieved
Publication 1756-RM004B-EN-P - October 2000
Serial Port API
5-29

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents