Rockwell Automation Allen-Bradley ControlLogix 1756-MVI Programming Reference Manual page 120

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

Advertisement

5-32
Serial Port API
Publication 1756-RM004B-EN-P - October 2000
MVIsp_GetCountUnread
Syntax:
int
MVIsp_GetCountUnread(int comport, int *count);
Parameters:
comport
desired communications port
count
pointer to int to receive unread character count
Description:
MVIsp_GetCountUnread returns the number of characters in the
receive queue that are waiting to be read. Since data received from a
port is queued after reception from a serial port, the application may
need to determine if all characters have been read or how many
characters remain to be read.
comport is the desired serial port and must be previously opened with
MVIsp_Open.
count points to an int that will receive the number of characters that
have been received from the serial port but not read by the
application. If the returned count is 0, all received data has been read.
If it is non-zero, it contains the number of characters placed into the
receive queue after reception from a serial port but that have not been
read from the queue with MVIsp_Getch, MVIsp_Gets, or
MVIsp_GetData.
Return Value:
MVI_SUCCESS
MVI_ERR_NOACCESS
MVI_ERR_BADPARAM
Example:
int
count;
if (MVIsp_GetCountUnread(COM2,&count) = = MVI_SUCCESS)
{
if (count = = 0)
printf("All chars read\n");
else
printf("%d characters remaining\n",count);
}
See Also:
MVIsp_Getch
MVIsp_Gets
MVIsp_GetData
count retrieved successfully
comport has not been opened
invalid pointer

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents