MXSIO_OpenCommport

 

This function opens the local COM port of the host computer with communication parameters.

 

C/C++

int MXSIO_OpenCommport(char * szCommport,

DWORD dwBaudrate,

BYTE bytDataFormat,

DWORD dwTimeout,

Int * hCommport);

 

Visual Basic

Declare Function MXSIO_OpenCommport Lib "MXIO.dll" (ByVal sCommport As String, ByVal nBaudrate As Long, ByVal bytDataFormat As Byte, ByVal nTimeout As Long, hCommport As Long) As Long

 

Arguments:

szCommport

Name of the common port. I.E., COM3.

dwBaudrate

Baud rate value. E.g. 1200, 9600, 19200.

bytDataFormat

Transmission data format.

dwTimeout

Time out value for serial adapter communication. The unit is in milliseconds.

hCommport

Handle of the opened COM port.

bytDataFormat:

bit_cnt (bit 0, 1)

0x00 = bit_5
0x01 = bit_6
0x02 = bit_7
0x03 = bit_8

stop_bit (bit 2)

0x00 = stop_1
0x04 = stop_2

parity (bit 3,4 5)

0x00 = none
0x08 = odd
0x18 = even
0x28 = mark
0x38 = space

 

Return Value:

Succeed

MXIO_OK

Fail

Refer to Return Codes.