ProSoft Technology MVI69-ADM User Manual

Page 242

Advertising
background image

Serial Port Library Functions

MVI-ADM ♦ 'C' Programmable

Developer's Guide

'C' Programmable Application Development Module

Page 242 of 342

ProSoft Technology, Inc.

February 20, 2013

MVIsp_SetHandshaking

Syntax

int MVIsp_SetHandshaking(int comport, int shake);

Parameters

comport

port for which handshaking is to be set

shake

desired handshake mode

Description
This function enables handshaking for a port after it has been opened. comport
must be previously opened with MVIsp_Open.

shake is the desired handshake mode. Valid values for shake are
HSHAKE_NONE, HSHAKE_XONXOFF, HSHAKE_RTSCTS, and
HSHAKE_DTRDSR.

Use HSHAKE_XONXOFF to enable software handshaking for a port. Use
HSHAKE_RTSCTS or HSHAKE_DTRDSR to enable hardware handshaking for
a port. Hardware and software handshaking cannot be used together.

Handshaking is supported in both the transmit and receive directions.

Important: If hardware handshaking is enabled, using the MVIsp_SetRTS and MVIsp_SetDTR

functions will cause unpredictable results. If software handshaking is enabled, ensure that the XON
and XOFF ASCII characters are not transmitted as data from a port or received into a port because

this will be treated as handshaking controls.

Return Values

MVI_SUCCESS

No errors were encountered

MVI_ERR_NOACCESS

comport has not been opened

MVI_ERR_BADPARAM

invalid handshaking mode

Example

if (MVI_SUCCESS != MVIsp_SetHandshaking(COM1, HSHAKE_RTSCTS))
printf("Error: Set Handshaking failed\n");

Advertising