External Interfaces/API |
Finding Serial Port Information for Your Platform
The ways to find serial port information for Windows and UNIX platforms are described below.
Note Your operating system provides default values for all serial port settings. However, these settings are overridden by your MATLAB code, and will have no effect on your serial port application. |
Windows Platform
You can easily access serial port information through the Windows Control Panel. You can invoke the Control Panel with the Start button (Start -> Settings -> Control Panel).
For Windows NT, you access the serial ports by selecting the Ports icon within the Control Panel. The resulting Ports dialog box is shown below.
To obtain information on the possible settings for COM1, select this port under the Ports list box and then select Settings.
You can access serial port information for the Windows 98 and Windows 2000 operating systems with the System Properties dialog box, which is available through the Control Panel.
UNIX Platform
To find serial port information for UNIX platforms, you need to know the serial port names. These names might vary between different operating systems.
On Linux, serial port devices are typically named ttyS0
, ttyS1
, and so on. You can use the setserial
command to display or configure serial port information. For example, to display which ports are available
setserial -bg /dev/ttyS* /dev/ttyS0 at 0x03f8 (irq = 4) is a 16550A /dev/ttyS1 at 0x02f8 (irq = 3) is a 16550A
To display detailed information about ttyS0
setserial -ag /dev/ttyS0 /dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4 Baud_base: 115200, close_delay: 50, divisor: 0 closing_wait: 3000, closing_wait2: infinte Flags: spd_normal skip_test session_lockout
Note
If the setserial -ag command does not work, make sure that you have read and write permission for the port.
|
For all supported UNIX platforms, you can use the stty
command to display or configure serial port information. For example, to display serial port properties for ttyS0
To configure the baud rate to 4800 bits per second
Serial Data Format | Selected Bibliography |