Advantech ADAM-4500 Network Card User Manual


 
Syntax:
int comm_init(int buf_size)
Function description:
Initializes the communication port and interrupt routine before other function calls use the
communication port.
Parameter Description
int buf_size Sets the buffer size of every communication port for storage of
received data. The unit of size is bytes.
Return:
Returns a 1 if command succeeds. Returns a 0 if it fails.
comm_exit
Syntax:
int comm_exit()
Function Description:
If a user calls the comm_init function, the user must call this function to release the
communication port before the user's program terminates.
Return:
Returns a 1 if command succeeds. Return a 0 if it fails.
comm_open
Syntax:
int comm_open(unsigned char port, unsigned long baud, int parity, int data, int stop, int
cmd_type)
Function Description:
To open a communication port for user to send and receive data.
Parameter Description
unsigned char port Specifies communication port.
1: COM1 port
2: COM2 port
unsigned long baud Baud rate setting. The eight allowable baud rates are: 1200,
2400, 4800, 9600, 19200, 38400, 57600, and 115200. Sized in bps
(bits per second).
int parity Parity setting.
0: no parity, 1: odd, 2: even
int data Data bits setting. There are four allowable data lengths: 8, 7, 6,
and 5. Sized in bit units.