Home >

FM SDK Programming Guide > HSM Functions Reference > Serial Communication functions > SERIAL_SetMode

SERIAL_SetMode

Used to set the serial port communication parameters.

Synopsis

int SERIAL_SetMode( int port, 
int baud,
int numBits,
SERIAL_Parity parity,
int numStop,
SERIAL_HSMode hs);  

Parameters

Parameter

Description

port

Serial port number (0 based). Specify port 0 to redirect the output to the hsmtrace log.

baud

Baud rate.

numBits

Number of bits in a character. Should be 7 or 8

parity

One of the following:

SERIAL_PARITY_NONE

SERIAL_PARITY_ODD

SERIAL_PARITY_EVEN

SERIAL_PARITY_ONE

SERIAL_PARITY_ZERO

numStop

Number of stop bits in a character. Should be 1 or 2

hs

Handshake type. Should be one of the following:

SERIAL_HS_NONE

SERIAL_HS_RTSCTS

SERIAL_HS_XON_XOFF

Note:  Serial flow control is not implemented in the current HSM firmware. This value should be set to SERIAL_HS_NONE.

Return Code

0: Mode changed successfully

-1: There was an error