EXOS 2.1 Serial/Network Driver Specification

3. Serial Device

3.1 Low­level Operation

The serial device uses five wires - data­in, data­out, status­in, status­out and ref (which may be used as an offset signal reference instead of the 0 volt ground line). This allows independent handshaking on input and output. The device supports both read and write EXOS calls. When it is called with a read character function call it sets the status­out line high (it is normally held low). This signals the sending device that it can send a character. It then monitors the data­in line (which is also normally low) until it goes high signifying a start bit. The bits of the character can then be read in, possibly with a parity bit if that is selected (see later).

The serial driver handles a small buffer for incoming characters. After one character has been read, the data­in line is monitored for a short time to see if the sending machine has any more to transmit. If another character is sent, it will be read in and buffered. Up to sixteen characters may be read in and stored if they are immediately available. Once the buffer is filled, or if no further start bit is detected within the timeout period, the status­out line is pulled low again preparatory to returning to the user program. However, some devices are rather slow in responding to handshaking lines, so the data­in line is checked for a short time afterwards to ensure that no more characters are being sent. Any spurious characters which are received can be buffered (there is an additional 8 byte overflow in case the main buffer is full). Stored characters are supplied to the user one at a time when read character is called, so this buffering is transparent.

Write character is simpler than read character since there is no problem of the other end of the connection misbehaving (i.e. sending extra characters). To send a character the serial driver monitors the status­in line until it is high (which it may be already if the receiver is ready). Then the data­out line is changed from its quiescent low level to high for the start bit. The bits of the data are then sent, followed by a parity bit (if parity is selected) and then the required number of stop bits (data­out low).

3.2 Use of the Serial Device

3.2.1 Read and Write Instructions

The serial device supports the normal EXOS read and write instructions for single characters or blocks. Data is not interpreted in any way, so machine code can be sent just as easily as ASCII text.

3.2.2 Baud Rate Selection

The EXOS variable BAUD_SER governs the baud rate, which applies both to input and output. Before opening the serial channel the user should set it to the appropriate value for the required rate, according to the following codes:

       0  -    50 baud           1  -    75   baud
       2  -   110 baud           3  -   134.5 baud
       4  -   150 baud           5  -   200   baud
       6  -   300 baud           7  -   600   baud
       8  -  1200 baud           9  -  1800   baud
      10  -  2400 baud          11  -  3600   baud
      12  -  4800 baud          13  -  7200   baud
      14  -  9600 baud          15  -  9600   baud

The default setting is 15 (9600 baud). Numbers greater than 15 are reduced modulo 16 before interpretation.

3.2.3 Word Format Selection

The EXOS variable FORM_SER, defines the word format which is used for both input and output. Certain bits are interpreted as follows:

        b0 - Number of data bits   : clear - 8 bits
                                     set   - 7 bits
        b1 - Parity enable.        : clear - no parity
        b2 - Parity select         : clear - even parity
             if b1 set               set   - odd parity
        b3 - Number of stop bits   : clear - two stop bits
                                     set   - one stop bit
    b4..b7 - Not used, must be zero.

The default setting is zero which selects 8 data bits, no parity and two stop bits.

Note that the data bits are sent least significant bit first, and if 7 data bits are selected then bits 0 to 6 of the byte will be sent and bit 7 will be ignored. On reception bit 7 will be cleared.

Next Chapter: Network Device.

David Bouman. (dsbouma@cs.vu.nl)