int stop Stop bits setting
1, 2
(stop bit = 1 is for data bits = 5,6,7, or 8)
(stop bit = 2 is for data bits = 6,7, or 8)
For details, refer to RS-232 chip set data book
int cmd_type Received data format setting.
0: single byte mode. The data format is a single byte character.
User can use comm_get_rec_datas to receive single byte data.
1: command mode. The data format is a string. User can use
comm_get_rec_str to receive string data.
Return:
Returns a 1 if command succeeds. Returns a 0 if it fails.
comm_send
Syntax:
int comm_send(unsigned char c, unsigned char port)
Function Description:
To send a character to a specified communication port.
Parameter Description
unsigned char c Represents character to be sent.
unsigned char port Specifies communication port to which character is sent (COM1
or COM2)
1: COM1 port
2: COM2 port
Return:
Returns a 1 if command succeeds. Returns a 0 if it fails.
comm_get_rec_datas
Syntax:
int comm_get_rec_datas(unsigned *length, unsigned char **data, unsigned char port)
Function Description :
The function is called to receive a single byte of data. The function call returns a success flag if
the communication port receives any data. The function call returns a failed flag if the buffer of the
communication port is empty. The length of the data packet received (in bytes) is stored in
parameter "length". The contents of the data packet received are stored in parameter "data".
Parameter Description
unsigned *length Returns the length of the received data
unsigned char **data Returns the received data contents. User must first allocate a