Escolar Documentos
Profissional Documentos
Cultura Documentos
00
Printed in Great Britain. # 1998 TEMPUS Publications.
289
290 T. Tuma et al.
end the download utility converts the S-code to Some core routines like a simple task scheduler are
machine code and places the latter into the user already included in assembler source code while
EPROM, which is in fact a write-locked RAM. At others are just described from the caller's point of
this moment a standard terminal emulator is run view. The keyboard driver, which has just been
on the PC to communicate with the onboard developed collectively is of course part of this mini
debugger. The program is then traced in single- operating system.
step mode with only four basic commands: At that point the laboratory curriculum changes
T[num]Ðtrace num instructions, P[num]Ð dramatically. The students are grouped into teams
proceed `num' instructions; R[num]Ðrun `num' of three to five and each team is assigned a
instructions; D[addr]Ðdisplay 256 memory practical project. Although the operating system
locations starting at `addr'. The onboard single conception is being recommended it is made clear
stepping enables the students to monitor every- that the project functionality is all that matters.
thing that is happening inside the registers and After an initial briefing the teaching assistants start
memory locations. At the same time all I/O devices behaving as consultantsÐthe teams have to make
can be observed, working in a `slow motion' mode. their own decisions.
Let us now take a closer look at the assigned
projects. All projects are complete applications
well known to every lay person and not just parts
THE LABORATORY SCHEDULE of some sophisticated application [4]. We all know
what a remote control, a credit card reader, a
At the beginning of the laboratory, every railway crossing, a code lock or an elevator do.
student is working on his own PC with an attached It took us quite some time to design small toy-like
target system. The fist task is to get familiar with models for each application. These models are
the development system. For this purpose every- connected directly to the digital and analog inter-
body is asked to write a simple keyboard driver for faces of our target systems. By successfully
the target system. At this stage the students are still completing their projects, the students can actually
guided by the teaching assistants. Many potential read the code from their father's credit card, they
real-time problems, like the bouncing of mechani- can analyse the pulses of an infra-red car key, see
cal contacts, are being brought to their attention. the movable arm of the mini-railway crossing go
The students are led rather strictly to a uniform up while lights are flashing and so forth.
and optimal solution for the keyboard driver. Although this may seem a little childish it is most
In the next phase the conception of a small real- important for the students' motivation! Beside
time operating system is handed out and discussed. that, the innocent looking toy-like models make
A Microcontroller Laboratory for Electrical Engineering 291
Fig. 3. The principle of time slicing. All numbers are in machine cycles.
2. All time slices are of exactly the same size of Jack's serial communications task SCI and an
1200 machine cycles. independent real-time clock task TIM. The latter
3. Each task must terminate before its time slice tasks are each occupying four positions in the
expires. scheduler data structure, thus running with a
4. The cyclic task schedule is composed of exactly 1/256 s duty cycle.
16 entries. By following this scheme our three students were
able to split their problems into five independent
The four radical simplifications render an extre- tasks, all running quasi-concurrently. It was
mely simple scheduler, which will fit together with actually impossible for them to divide the problem
its task schedule into a few lines shown in Fig. 4. between themselves until they have reached this
The students only need to include these lines of level of planning, which is why we insist on
assembler code and set up the scheduler data teamwork.
structure according to their needs. Since they As soon as the students have grasped the
have heard all the basic theory of multitasking in advantages of this simple but effective scheduler,
earlier courses they certainly are capable of under- the only tricky obstacle left is the communi-
standing this extremely simple scheduler just by cation between individual tasks. Our three students
studying the commented source code in Fig. 4. have to deal with some classic arbitration and
After discussing the proposed scheduler the synchronization problems.
students have configured the task schedule in
Fig. 4 for their particular pedestrian crossing. We
can see Paul's light controlling task LIGHT running CONCLUSIONS
concurrently with Suzanne's beeper driver AUDIO,
both with a 1/64s duty cycle. Suzanne has even We have introduced an unusual alternative to
decided to grant the pedestrian button its own laboratory work in the forth year of the electrical
concurrent scanning routine BUTTON. There are engineering curriculum. Of course we realize that
also two high-speed tasks in the system, namely most important for any laboratory concept is its
Fig. 4. The task schedule data structure and the scheduler code.
A Microcontroller Laboratory for Electrical Engineering 293
pedagogical efficiency, which can be seen from the three times larger than before we introduced our
students' feedback. `experience-bad-programming' laboratory. Several
So far five student generations have passed our graduating students are currently designing new
new laboratory course. The students programming and interesting model applications, which will
skills have definitely improved in this period. be used as laboratory assignments of future
ThoughÐin our opinionÐthis is not the most generations.
important achievement. Amazingly, the laboratory Each year some students decide to build their
has become extremely popular. In an anonymous own target systems to work with after having
questionnaire every third student claims to have passed the examination. Our integrated debugger
learned more about programming than in all actually makes an expensive development system
previous courses together. This means of course superfluous, which is very important for inquisitive
they have gained deeper understanding of students who want to do some amateur controlling
previously learned methods. at home.
Another feedback is the number of students As a matter of fact, the enthusiastic feedback
who choose microcontroller software as their from our students has inspired us to write this
graduating thesis subject. This number is currently article in the first place.
REFERENCES