Serial port api initialization functions – ProSoft Technology MVI69-ADM User Manual

Page 235

Advertising
background image

MVI-ADM ♦ 'C' Programmable

Serial Port Library Functions

'C' Programmable Application Development Module

Developer's Guide

ProSoft Technology, Inc.

Page 235 of 342

February 20, 2013

9.1

Serial Port API Initialization Functions

MVIsp_Open

Syntax

int MVIsp_Open(int comport, BYTE baudrate, BYTE parity, BYTE wordlen,
BYTE stopbits);

Parameters

comport

Communications Port to open

baudrate

Baud rate for this port

parity

Parity setting for this port

wordlen

Number of bits for each character

stopbits

Number of stop bits for each character

Description
MVIsp_Open acquires access to a communications port. This function must be
called before any of the other API functions can be used.

comport specifies which port is to be opened. The valid values for the module are
COM1 (corresponds to PRT1 (CFG on MVI69)), COM2 (corresponds to PRT2
(PRT1 on MVI69)), and COM3 (corresponds to PRT3(PRT2 on MVI69)).

Note: PRT3 is available on MVI46 and MVI56 only.

baudrate is the desired baud rate. The allowable values for baudrate are shown
in the following table.

Baud Rate

Value

BAUD_110

0

BAUD_150

1

BAUD_300

2

BAUD_600

3

BAUD_1200

4

BAUD_2400

5

BAUD_4800

6

BAUD_9600

7

BAUD_19200

8

BAUD_28800

9

BAUD_38400

10

BAUD_57600

11

BAUD_115200

12

Valid values for parity are PARITY_NONE, PARITY_ODD, PARITY_EVEN,
PARITY_MARK, and PARITY_SPACE.

wordlen sets the word length in number of bits per character. Valid values for
word length are WORDLEN5, WORDLEN6, WORDLEN7, and WORDLEN8.

Advertising