# Serial Port Direct Access

At SINQ serial devices are connected to a UNIX/LINUX computer. On this machine runs a serial port server which allows to read and write data through TCP/IP sockets to a serial port connected to the machine. This document describes a simple interface for communicating with such serial devices.

## Invocation

The interface to a serial device connected to a UNIX/LINUX computer is initialised with the following command given at the Tcl prompt:
Controller name computer port channel
This command opens a connection to the serial port on the UNIX/LINUX machine and installs a new command in order to interact with it. The parameters:

- name is the name of the new command to generate for the connection in Tcl.
- computer is the computer name of the UNIX/LINUX machine.
- port: is the TCP/IP port number at which the UNIX/LINUX machine serial port server is is listening. Usually this is 4000.
- channel: is the number of the RS-232 port to connect to.

## Usage

Once the connection has been initialised name is available as a new command in Tcl. Let us assume, MC as the name for the purpose of this description. MC then can be used as follows:
MC -tmo value
Configures the timeout for the connection to value. Value is in microseconds.
MC arg1 arg2 ..... argn
Everything after MC is written to the serial port. The reply received from the port is returned.

All these commands can return errors. Mostly these refer to the wrong device being specified on initialisation. The others are network problems.