CS452 - Real-Time Programming - Fall 2011

Lecture 2 - Introduction

Pubilc Service Annoucements

  1. Due date for assignment 0
  2. Combination to trains lab
  3. Ubuntu 10.10
  4. How to compile and run your first program

Practical Details: pdf


Embedded Systems

Artifacts that use computation to manipulate the real-world, including user interfaces, have a structure that can be described in one of two different ways.

  1. Computation measures the response of sensors to determine the correct state for its internal model of the world, and that model is used to calculate appropriate activator responses.
  2. Actvators are manipulated according to the state of the artifacts internal model of the world,after which computation reads sensors to calculate the effect of their action on the world.

Most of the mediation between the internal representations and the real-world is done by embedded systems


What is real-time programming?

Actually real-world programming, which means

What is important for real-time?

  1. Throughput
  2. Response time

In cs452 we take guaranteed response time as the defining quality of real-time computation.


Assignment 0

Objective

Go beyond busy-waiting to maintain several synchronized activities simultaneously.

To be specific

Output to the terminal

  1. Write the current time on the display of the terminal
  2. Display of the state of the train-set on the display of the terminal
  3. Prompt and echo for input

Input from the terminal

  1. User commands for the train-set

Output to the train-set

  1. Give speed commands
  2. Switch turn outs
  3. Request sensor data

Input from the train-set

  1. Sensor reports

Output to the timer

  1. Initialization

Input from the timer

  1. Current count

Software Design

No operating system services available, including

  1. input output
  2. dynamic memory
  3. hardware abstractions
  4. file system

Polling loop design

Generalization of busy-waiting

Sending a byte onto a 115,200 bps serial line

The polling loop

while( true ) {
    if( transmit ready bit set )
        if( NOT output buffer empty )
            write next byte
    if( receive ready bit set )
        read next byte into buffer
    if( timer has counted down )
        increment time
    ...
}

This generalizes to

while( true ) {
    if( condition1 )
        do action1
    if( condition2 )
        do action2
    ...
    if( condition-n )
        do action-n
    ...
}

Attractive feature of a polling loop

Unattractive feature of polling loop

Hardware Available

Timers

Generic timer

Three registers

  1. Command register
  2. Load register
  3. Read register

The generic timer

In a polling loop the interrupt is not used.

Find out the details in the EP9302 documentation. Of the five, or is it six, timers on the EP9302 SoC use the 32-bit one.

UARTs

Generic UART

Three wires

  1. transmit (XMIT)
  2. receive (RCV)
  3. ground

(Transmit and receive must be crossed.)

Two registers

  1. Command/status register
  2. Data register

Common added features

Generic UART with hardware flow control

Two extra wires, usually

  1. request to send (RTS) an output
  2. clear to send (CTS) an input

(Like XMIT and RCV, RTS and CTS must be crossed.)

Assert RTS when you are ready to receive a character. Read CTS to ensure that the receiver is ready before you transmit a character.

Notes.

  1. Find the details in the EP9302 documentation.
  2. If you examine the TS-7200 circuit diagram you will see that there is a third UART available. The connector called COM3 does not have this UART attached to it, but rather some digital I/O bits and some other random stuff.

Return to: