Real-time
Linux (Xenomai)
Radboud University
Nijmegen
Exercise #11: Programmable LED Clock
Note: This
exercise cannot be done on a simulated version of Xenomai in
VMware, but only
on a real hardware platform, and you need an adapted Fascinations XP3 Ultra clock.
Introduction
In
previous exercises we learned how to program realtime programs with
Xenomai. In this exercise we want you to use the learned techniques to
program a piece of real hardware : a programmable LED clock.
Objectives
The primary objectives of this
exercise are:
- To get experience with
realtime programming with real hardware.
- To read the hardware specs and use this to correctly control the hardware to do what is desired according the program specs.
Description
The company "Fascinations" makes a programmable LED clock : the Fascinations XP3 Ultra. There is an description of the science of this clock at the Fascinations website.
D0
D1
D2
D3
D4
D5
D6
The clock exist of the following hardware :
- a
pendulum which contains 8 leds at its top, and is connected on a metal
plate on its bottom. The metal plate acts like a spring which
makes the pendulum oscilate when you give it a sweep.
- a magnet which drives the pendulum to oscillate. Note: on the pendulum is a small magnet attached.
- a
led combined with a light sensor. The led-lightsensor combo is placed
at the left side of the trajectory of the pendulum. When the pendulum
swings and it passes the led-lightsensor combo it interrupts the led
light. This interruption causes the light sensor to go from an high
signal (lots of light) to a low signal (no light).
Technical details :
- The magnet makes the pendulum oscilate at a frequency around 9 Hertz.
- The light sensor signal is connected to S6 of the parallel port.
- Because the light sensor is interrupted for a small time, the S6 signal will be like : ---------___---------
And
since an interrupt is only generated when going from low to high we
only will see the interrupt at the end of detection. Thus the
led-lightsensor combo has a inaccuracy in detecting the position of the
pendulum. - The leds are connected to the parallel
port's data port as shown in the figure above. Note Dx=1 means led on,
and Dx=0 means led off.
- The magnet is driving the oscilation. But when
the pendulum is oscilating at high speed the magnet is only turned on
for a small time of the period just to keep the pendulum going.
- The
magnet is driving (turned on) only when the pendulum is going from
right to left. Thus we would expect the motion from left to right go
faster than the motion from right to left. However when the pendulum is
oscilating at high speed the magnet is only turned on for a small time
of the period, thus than we neglect that effect. Thus at high speed we
have a symmetric oscilation.
Exercises
Exercise 11a.
Write a program to write a X on the LED clock. To keep it simple only write the X when the pendulum is going from left to right.
Exercise 11b.
Center the X.
To do this you need to calculate the light sensor delay!
Exercise 11c.
Write a program which writes the X in the
center both when the pendulum is going from left to right and going
from right to left.
Last Updated: 9 October
2008 (Harco Kuppens)
Created by: Harco Kuppens
h.kuppens@cs.ru.nl