C Language Development Kit/Application development/Serial communication
From OptiWiki
It is possible to have bi-directional serial communications between the handheld terminal and a serial device through a number of serial communications ports on the handheld terminal.
Available ports on the handheld terminals
COM0 is always used for communication via the direct cable. However not all terminals have the option to connect a cable.
COM1 is for communication through an IrDA dongle, COM2 is for communication with the cradle, but since most cradles have IrDA hardware, there are hardly any differences between COM1 and COM2.
The table below show the available communication ports of each terminal.
| Terminal | Supported ports | Description |
|---|---|---|
| H13 | COM1 | IrDA dongle |
| COM2 | Cradle CRD13 | |
| OPH100x | COM1 | IrDA dongle |
| COM2 | Cradle CRD1001 | |
| PHL1300 | COM1 | IrDA dongle |
| COM2 | Cradle IRU1300 | |
| PHL1700 | COM0 | Direct cable |
| COM1 | IrDA dongle or IRU1700-SV | |
| COM2 | Cradle IRU1700 | |
| PHL2700 | COM0 | Direct cable |
| COM1 | IrDA dongle | |
| COM2 | IRU2700 | |
| DWT7133 | COM2 | Cradle DCW9133 |
| OPL97xx | COM1 | Cradle CRD9723 or IrDA dongle |
| COM2 | Same as COM1 | |
| COM3 | Bluetooth interface, using the SPP profile (OPL9724 only, connect as Master) | |
| COM4 | Bluetooth interface, usign the DUN profile (OPL9724 only, connect as Master) | |
| COM5 | Bluetooth interface, using the SPP profile (OPL9724 only, connectible as Slave) | |
| DCL153x | COM0 | USB direct cable |
| COM1 | Cradle CRD9723 or IrDA dongle | |
| COM2 | Same as COM1 | |
| OPN2002 | COM0 | USB-VCP (when connected by USB), Cradle (when in cradle) |
| bluetooth will be added soon | ||
| OPN2003 | COM0 | USB-VCP (Virtual COM port) |
| PX25 | COM1 | Cradle CRD9723 or IrDA dongle |
| COM2 | Same as COM1 | |
| COM3 | Bluetooth interface, using the SPP profile | |
| COM5 | Bluetooth interface, using the SPP profile, connectable as slave | |
| COM12 | Bluetooth interface, using the HID profile | |
| COM13 | Bluetooth interface, using the HID profile, connectable as slave | |
| PX30 | COM9 | USB-VCP |
Setting the communication parameters
The baudrate, the number of data bits, the parity mode, the number of stopbits and the handshaking modes, can all be selected via a systemsetting() function call.
comopen() uses the current settings when opening a communications port. The default settings of the handheld terminal are:
| Baudrate | 9600 (115200 for the OPH1003) |
| Parity | None |
| Databits | 8 |
| Stopbits | 1 |
| Hardware handshaking | No |
| Software handshaking | No |
The following table shows which communication parameters can be set depending on the terminal model. Click on the links for more details about the related menu-options of the systemsetting() function.
| PHLxxxx | DWT7133 | OPL97xx | DCL153x | OPH100x & H13 |
|---|---|---|---|---|
| Baudrates | Baudrates | Baudrates | Baudrates | Baudrates |
| Parity | Parity | Parity | Parity | Parity |
| Databits | Databits | Databits | Databits | Databits |
| Stopbits | Stopbits | Stopbits | ||
| Hardware handshaking |
The communication parameters set with the systemsetting() function apply to all communication ports. It is not possible to have different settings for different communications ports. Note, that when you change settings of a communications port while it is already open, the settings take not effect immediately. The settings only take effect when you close the communications port (with comclose()) and then open it again (with comopen()).
When a communications port is opened, it will consume more power. Therefore, when it is not necessary to have the port open, it is better to close the port to save power.
To communicate from a terminal to the host and vice versa, both the host and the terminal has to be set to the same baudrate, but also the cradle has to be set to this baudrate. (The DWT7133 cradle is an exception to this, setting of the baudrate is not necessary on this cradle). To set the baudrate on a cradle, use the DIP-switches located on the bottom of the cradle.
Click on your terminal or cradle model below for more details about:
- Setting of the DIP-switches
- Controlling the transmission speed
- RS485 networking
| Terminal | Cradle |
|---|---|
| PHL1700 | IRU1700 transceiver |
| IRU1700 transceiver charger | |
| IRU1700 SV | |
| OPH1004 | CRD13 |
| OPH1003 | CRD1001 |
| PHL1300 | IRU1300 |
| PHL2700 | IRU2700 |
| DWT7133 | DCW9931 |
| OPL97xx | CRD9723 |
| CRD9723 multi cradle | |
| CRD9725 | |
| DCL153x | CRD9723 |
| CRD9723 multi cradle | |
| CRD9725 |
