CS452 - Real-Time Programming - Spring 2010

Public Interest Announcements

  1. Assignment 0 Deadline
  2. More about serial I/O: pdf

Lecture 3 - I/O Devices

Overall System

Provided and maintained by CSCF


`COM' ports

Connected to UARTs

Only really two

Ethernet port

Reset switch



System on chip


Byte addressable, word size 32 bits

Separate instruction and data caches



GNU tool chain


Partial implementation

Returns when program terminates

Busy-wait IO

COM2 uses monitor; COM1 goes to train

  1. initialization
  2. output
  3. input

How Timers Work

Set them up

Start them counting

Whenever they count through zero they set a bit.

If they count through zero with the bit set they set another bit

Read the documentation carefully.

Data Communication using RS-232

Communication protocol existing since forever.

Why do we still use it in the age of USB, etc.

Very simple RS-232

Three wires

Wired like this

GND ---------- GND

XMIT --\ /---- XMIT
RCV----/ \---- RCV

What could be simpler?

Less Simple RS-232

Distinguish Data Terminal Equipment (DTE) from Data Circuit-terminating Equipment (DCE)

On the DE-9 connector we have for DTE

5 -- GND
3 -- XMIT
2 -- RCV

and for DCE

5 -- GND
3 -- RCV
2 -- XMIT

A very simple `straight through' cable connects these perfectly. But when we conect DTE to DTE we need the cable above, which is called a `null modem'.

Train RS-232

Three wire works fine as long as both ends of the wire are much faster than the wire itself. But the train controller is very slow. Why?

The train controller needs to be able to say STOP. How is this done?

Software Flow Control


Hardware Flow Control


DTR, DSRWhat Happens if You Omit Flow Control

Return to: