Chapter 3 Terminal Specific Function Library
105
read_com
Purpose
To read one character from the receive buffer of a specified COM port.
Syntax
int read_com (int port, char *c);
int port; /* receive buffer of a specified COM port */
char *c; /* pointer to character returned */
Example
char c;
if (read_com (1,c))
print ("char %c received from COM 1", *c);
Description
This routine reads one byte from the receive buffer and then removes it from
the buffer. However, if the buffer is empty, it will return 0 for no action is
taken.
Return
If successful, it returns 1.
Otherwise, it returns 0 to indicate the buffer is empty.
See Also
nwrite_com, write_com
SetCommType
Purpose
To set the communication type of a specified COM port.
Syntax
int SetCommType (int port, int type);
int port; /* COM port to be set */
int type; /* the following communication types are available */
COMM_DIRECT
0
Direct RS-232
---
1
Reserved
COMM_IR
2
Serial IR (via IR transceiver)
COMM_IrDA
3
Standard IrDA
COMM_RF
4
Bluetooth (SPP/DUN)
Example
SetCommType (1, 2); /* set COM1 to IR communication */
Description
This routine needs to be called BEFORE opening a COM port.
Note that the COM port mapping is different for each model of terminal, and a
COM port may not support all the communication types.
Return
If successful, it returns 1.
On error, it returns 0 (i.e. invalid setting).
See Also
open_com
Summary of Contents for Optimus R
Page 1: ...Printed on 20 March 2006 C Programming Guide Version 3 04 02 Optimus S Optimus R...
Page 6: ......
Page 8: ...2 C Programming Guide For Optimus S R...
Page 12: ...6 C Programming Guide For Optimus S R The flow is illustrated as shown below...
Page 23: ...Chapter 2 Development Environment 17 Different types signed unsigned Different types same size...
Page 24: ...18 C Programming Guide For Optimus S R...
Page 220: ...214 C Programming Guide For Optimus S R See Also FlashSize free_memory...