
Serial Port Library Functions MVI-ADM ♦ 'C' Programmable
Developer's Guide 'C' Programmable Application Development Module
Page 240 of 342 ProSoft Technology, Inc.
February 20, 2013
9.2 Serial Port API Configuration Functions
MVIsp_Config
Syntax
int MVIsp_Config(int comport, BYTE baudrate, BYTE parity, BYTE wordlen, BYTE
stopbits);
Parameters
Communications port to configure
Parity setting for this port
Number of bits for each character
Number of stop bits for each character
Pointer to DWORD to receive baudrate
Description
MVIsp_Config allows the configuration of a serial port to be changed after it has
been opened.
comport specifies which port is to be configured.
baudrate is the desired baud rate.
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.
The number of stop bits is set by stopbits. Valid values for stop bits are
STOPBITS1 and STOPBITS2.
Note: If the console is enabled or the Setup jumper is installed, the baud rate for COM1 is set as
configured in BIOS Setup and cannot be changed by MVIsp_Open. MVIsp_Config will return
MVI_SUCCESS, but the baud rate will not be affected.
Return Value
No errors were encountered
comport has not been opened
Example
if (MVIsp_Config(COM1,BAUD_9600,PARITY_NONE,WORDLEN8,STOPBITS1) != MVI_SUCCESS)
{
printf("Config failed!\n");
} else {
printf("Config succeeded\n");
}
Kommentare zu diesen Handbüchern