CS452 - Real-Time Programming - Fall 2010

Lecture 15 - Serial I/O

Public Service Announcements

  1. Fourth part of the kernel
  2. See pdf

The Electrical Environment of the Trains

Why 2400 bps?

1. Conversion of electrical signals into forces


Electric motors.

Power contacts

Switches (Turn-outs)


2. Conversion of forces into electrical signals



3. Magnification of electrical signals



4. Communication of locomotives et al with the controller

Track is a sort of primitive ethernet

5. What do you do when the electrical environment gets noisy?

Features of UARTs


Why do FIFOs exist in UARTS?

The Big Blunder

To use the FIFO effectively you must be able to turn off the transmitter & receiver independently.

But look at UARTE in UARTxCtrl

The Little Blunder

You may have already read the following.

`It is assumed that various configuration registers for the UART are not written more than once in quick succession, in order to insure proper synchronization of configuration information across the implementation. Such registers include UART1Ctrl and UART1LinCtrlHigh. ... In between the two writes, at least two UARTCLK periods must occur. Under worst case conditions, at least 55 HCLK periods must separate the two writes. The simplest way to due [sic] this is separate the two writes by 55 NOPs.'

Why does this occur?

Why doesn't anybody care about blunders?


Five interrupts in the device

  1. Transmit
  2. Receive
  3. Modem status
  4. Receive timeout
  5. Combined

Three inputs to the PIC

  1. Transmit
  2. Receive
  3. Combined

Easy way to use interrupts

Enable only combined; read UART registers to decide what to do.

Think of the receive and transmit parts of the UART as separate state machines

Handy Features

Return to: