Real Time Systems |
Due Dates and Times: (See the Course Calendar.)
Summary:
You are to write a program to control the gizmo. It will be developed incrementally. The assignment is divided into the following three tasks, each of which task may be further divided into incremental stages:
You will be asked to demonstrate your progress at the end of each task.
Objectives:
Tasks (three stages):
Write a program to measure the natural period of your gizmo. The program should use a periodic task to poll the values of the two sensors. It should poll them frequently enough to get an accurate measurement. You can start from the state model described in class. If the state-machine model is not reliable enough to consistently determine a fixed point in each cycle, modify it.
When you have completed this stage, send an e-mail to me containing a message with the period you measured, in millseconds, with the source code of your test program attached.
Write a new program, using the information gained in the previous step, to make the gizmo swing back and forth smoothly, according to its natural harmonic period.
When you have completed this stage, arrange a meeting with me to demonstrate it, and give me a printed copy of your code at the same time, so that I can observe the motion and look at the code during our meeting.
Extend the program developed in Stage 2, by adding to it the capability of using the LEDs to display a text string. Ideally, the module should support long strings by scrolling the text, and should support modification of the text string at run time.
When you have completed this stage, arrange a meeting with me to demonstrate it, and give me a printed copy of your code at the same time, so that I can observe the motion and look at the code during our meeting. Then, send me by e-mail the entire code in digital form.
Advice:
Start by reading all of the notes on gizmos, including the advice there.
Apply the incremental and evolutionary development approach. Start with a simple solution, and add features on to an already working kernel module. Here are some suggestions:
Design your solution before coding it. Do a preliminary design of the whole system before you start coding Stage 1. Revise the design as you learn more.
There are several timing parameter what you will want to be able to tune easily. This tuning will be much easier, and your program will be simpler to read and debug, if you make good use of tables (arrays of numbers) rather than complex control structures (switches, nested if-statements).
Keep in mind that you have the following timing constraints:
Though these are conceptually different tasks, each with their own timing constraints, for this first assignment you should try to implement all of them in a single periodic task (a "cyclic executive"), which polls the sensors and then optionally turns the solenoid on or off. Later, you will be asked to re-program this assignment using multiple threads.
You will need a bit-mapped font to generate your images. You are only required to support the 26 letters of the Roman alphabet, and only required to support one version of each letter (no need for upper or lower case). Of course, supporting a larger set of characters is better. Since you have 8 vertical pixels to work with, you could use the 8-pixel font from the X-windows "clean" family. I don't want you to spend a lot of time on the font. The following was used by one student in a prior term. If you are satisfied with it, you may use it.
unsigned char letters[27][7] = { /* a */ {63, 72, 136, 136, 72, 63, 0}, /* b */ {255, 145, 145, 145, 106, 4, 0}, /* c */ {60, 66, 129, 129, 66, 102, 0}, /* d */ {255, 129, 129, 66, 102, 60, 0}, /* e */ {255, 145, 145, 145, 145, 145, 0}, /* f */ {255, 144, 144, 144, 144, 144, 0}, /* g */ {126, 129, 129, 137, 137, 142, 0}, /* h */ {255, 16, 16, 16, 16, 255, 0}, /* i */ {129, 129, 255, 129, 129, 129, 0}, /* j */ {129, 129, 129, 255, 128, 128, 0}, /* k */ {255, 0, 8, 36, 66, 129, 0}, /* l */ {255, 1, 1, 1, 1, 1, 0}, /* m */ {255, 64, 32, 32, 64, 255, 0}, /* n */ {255, 64, 32, 16, 8, 255, 0}, /* o */ {126, 129, 129, 129, 129, 126, 0}, /* p */ {255, 144, 144, 144, 144, 96, 0}, /* q */ {126, 129, 129, 133, 130, 125, 0}, /* r */ {255, 144, 152, 148, 146, 97, 0}, /* s */ {96, 145, 145, 145, 145, 142, 0}, /* t */ {128, 128, 255, 128, 128, 128, 0}, /* u */ {254, 1, 1, 1 , 1, 254, 0}, /* v */ {252, 2, 1, 1, 2, 252, 0}, /* w */ {255, 2, 4, 4, 2, 255, 0}, /* x */ {195, 36, 24, 24, 36, 195, 0}, /* y */ {192, 32, 31, 16, 32, 192, 0}, /* z */ {131, 133, 137, 145, 161, 193, 0} };
If you find a better font, and are wiling to share it with the class, please let me know.
References:
Delivery Method:
Assessment:
The solutions will be judged primarily on how well they perform, including both the quality of the blade motion (smooth, regular) and the robustness of the algorithm used. In particular:
Because of the cumulative nature of the project, if the overall score on the final delivery of this project (motion and image) is higher than that on the prior partial delivery, that score will stand for the entire project. If the score is lower, the average of the two scores will be used as the project score.
T. P. Baker ($Id$) |