Timeout Amount Of Time To Wait To Receive Character; Comport Must Be Previously Opened With Mvisp_Open; Reception Queue, And Return Values Correspond Accordingly - 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_Gets
Syntax:
int
MVIsp_Gets(int comport, BYTE *str, BYTE term, int *len,
DWORD timeout);
Parameters:
comport
port from which data is to be received
str
pointer to array of bytes to receive data
term
termination character of 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.

str points to an array of bytes that will receive the data.
len points to the number of bytes to receive.
MVIsp_Gets retrieves bytes from the reception queue until either a
byte is equal to the termination character or the number of bytes
pointed to by len are retrieved. If a byte is retrieved that equals the
termination character, the byte is copied into the array str and the
function returns.
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_Gets. 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. If the queue is not empty,
these characters are removed from the queue and both the str and the
len return values correspond accordingly.
Serial Port API
Publication 1756-RM004B-EN-P - October 2000
5-25

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents