
98
D3
data bits
0 : 7bits 1 : 8bits
D4
Parity enable
0 : disable 1 : enable
D5
even / odd
0 : odd 1 : even
D6
flow control
0 : disabe 1 : enable
D7
flow control method 0 : CTS/RTS 1 : Reserved
Returns
:
0 : Open fail
1 : Open success
Remark
:
When flow control set up disable and flow control method set up
CTS/RTS. The maximum of transmitting information restricts to 2KB
for each time. You must wait this transmitting over, that can start next
one, or be error.
read_com
Purpose
:
Read 1 byte from the RS232 receive buffer
Syntax
:
int read_com(int port, char *c);
Example call
:
char c;
int i;
i = read_com(1,c);
if (i) _printf(“char %c received from COM1”,*c);
Includes
:
#include “LIB_CL.h ”
Description
:
This routine is used to read one byte from the receive buffer and then
remove it from the buffer. However, if the buffer is empty, no action is
taken and 0 is returned. Use the argument “port” as the connect port
which is chosen to open. Now we only can choose 1(COM 1).
Returns
:
1, available or 0 if buffer is empty
SetCommType
Purpose
:
Set the communication type of the port specified.
Syntax
:
int SetCommType(int port, int type);
Example call
:
SetCommType(1,0);/*set up the connect type is RS232*/
Includes
:
#include “LIB_CL.h ”
Description
:
This routine is used to set the communication types for the COM ports.
Before opening the COM port, please call this function to assign
communication type. Use the argument “port” as the connect port which
is chosen to open. Now we only can choose 1(COM 1). The argument
“type” is for setting up the connect type, 0 is the RS232 cable
transmitted; 1is the Cradle transmitted. If you choice Cradle, the
transmitted type forces to setup to 8 data bits
,
no Parity
,
1 stop bit
,
115200bps
,
no parity
。