ProSoft Technology MVI69-ADM User Manual

Page 250

Advertising
background image

Serial Port Library Functions

MVI-ADM ♦ 'C' Programmable

Developer's Guide

'C' Programmable Application Development Module

Page 250 of 342

ProSoft Technology, Inc.

February 20, 2013

MVIsp_GetLineStatus

Syntax

int MVIsp_GetLineStatus(int comport, BYTE *status);

Parameters

comport

port for which line status is requested

status

pointer to BYTE to receive line status

Description
MVIsp_GetLineStatus returns any line status errors received over the serial port.
The status returned indicates if any overrun, parity, or framing errors or break
signals have been detected.

comport is the desired serial port and must be previously opened with
MVIsp_Open.

status points to a BYTE that will receive a set of flags that indicate errors
received over the serial port. If the returned status is 0, no errors have been
detected. If status is non-zero, it can be logically and'ed with the line status error
flags LSERR_OVERRUN, LSERR_PARITY, LSERR_FRAMING,
LSERR_BREAK, and/or QSERR_OVERRUN to determine the exact cause of the
error. The corresponding error flag will be set for each error type detected (Note:
The QSERR_OVERRUN bit indicates that a receive queue overflow has
occurred).

After returning the bit flags in status, line status errors are cleared. Therefore,
MVIsp_GetLineStatus actually returns line status errors detected since the
previous call to this function.

Return Value

MVI_SUCCESS

the line status was read successfully

MVI_ERR_NOACCESS

comport has not been opened

MVI_ERR_BADPARAM

invalid pointer

Example

BYTE sts;
if (MVIsp_GetGetLineStatus(COM2,&sts) == MVI_SUCCESS)
{
if (sts == 0)
printf("No Line Status Errors Received\n");
else if ( (sts & LSERR_BREAK) != 0)
printf("A Break Signal was Received\n");
else
printf("A Line Status Error was Received\n");
}

Advertising