Embedded Systems Assignment 05: On-Off Sound Driver for Melody Program, Assignments of Computer Science

An assignment for creating an on-off sound device driver for an embedded system, allowing the melody program to generate sounds based on frequency and duration. The assignment includes four tasks: completing the driver design, making the melody program work with the driver, explaining the system organization, and displaying melody execution with the serial communication driver. Students must document their software and provide a demonstration and report.

Typology: Assignments

Pre 2010

Uploaded on 08/19/2009

koofers-user-lkt
koofers-user-lkt 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Embedded Systems – Assignment 05
Making the Melody Roll-On
Introduction
You have now used three device drivers, the Ticker, the Real-Time Clock, and the Serial
Communication interface. It is time to jump in and do some internal design tasks. In this
project, you will complete the On-Off Sound device driver to make the sounds of the
melody program studied earlier.
Task 1
The OOSound.cpp device driver is based on the template consisting of (a) a hardware
ISR, (b) a software ISR, and (c) a data structure. Its basic operation should be something
like this –
1. The melody program wants to make a sound, corresponding to a musical note for a
certain time duration. It generates a call to the software ISR, passing the two arguments
of (a) the note’s frequency and (b) the time duration. The software ISR enqueues the two
pieces of information. Also, it checks to see if the hardware ISR is running. If it is not,
then it starts it. Thus, a queue is constructed consisting of all of the notes to be played.
2. The melody program can run a fast as allowed to enqueue all of the notes, and then it
will quit [a while( 1 ) loop].
3. Meanwhile, the hardware ISR is driven by a timer, being executed every n mSec. The
hardware ISR removes the information from the queue and causes a sound to be
generated on the speaker for the required amount of time. When it has run for the
specified time, then it removes the next note from the queue and does the same thing.
When the queue becomes empty, the hardware ISR shuts itself off by stopping the timer.
The driver, as presented in the text, is not complete. Several pieces of code have been
commented but not included. Complete the design of this driver, to make it work.
Carefully document all of your software and explain how it works.
Task 2
Make the melody program operate with your completed device driver. Demonstrate the
program’s execution. What happens if the queue is not big enough to hold the whole
melody? Show that your program works ok regardless of queue size.
Task 3
Carefully explain the organization of the whole system – the L0S and the L1S. Be sure to
discuss the content of the .h files associated with each.
Task 4
Modify the PlayMelody function and use the serial communication driver to show where
the melody is in execution, displaying the information (note, measure, phrase) with
hyperterminal. Carefully document and explain all that you must do to implement this
task.
pf2

Partial preview of the text

Download Embedded Systems Assignment 05: On-Off Sound Driver for Melody Program and more Assignments Computer Science in PDF only on Docsity!

Embedded Systems – Assignment 05 Making the Melody Roll-On

Introduction You have now used three device drivers, the Ticker, the Real-Time Clock, and the Serial Communication interface. It is time to jump in and do some internal design tasks. In this project, you will complete the On-Off Sound device driver to make the sounds of the melody program studied earlier.

Task 1 The OOSound.cpp device driver is based on the template consisting of (a) a hardware ISR, (b) a software ISR, and (c) a data structure. Its basic operation should be something like this –

  1. The melody program wants to make a sound, corresponding to a musical note for a certain time duration. It generates a call to the software ISR, passing the two arguments of (a) the note’s frequency and (b) the time duration. The software ISR enqueues the two pieces of information. Also, it checks to see if the hardware ISR is running. If it is not, then it starts it. Thus, a queue is constructed consisting of all of the notes to be played.
  2. The melody program can run a fast as allowed to enqueue all of the notes, and then it will quit [a while( 1 ) loop].
  3. Meanwhile, the hardware ISR is driven by a timer, being executed every n mSec. The hardware ISR removes the information from the queue and causes a sound to be generated on the speaker for the required amount of time. When it has run for the specified time, then it removes the next note from the queue and does the same thing. When the queue becomes empty, the hardware ISR shuts itself off by stopping the timer.

The driver, as presented in the text, is not complete. Several pieces of code have been commented but not included. Complete the design of this driver, to make it work. Carefully document all of your software and explain how it works.

Task 2 Make the melody program operate with your completed device driver. Demonstrate the program’s execution. What happens if the queue is not big enough to hold the whole melody? Show that your program works ok regardless of queue size.

Task 3 Carefully explain the organization of the whole system – the L0S and the L1S. Be sure to discuss the content of the .h files associated with each.

Task 4 Modify the PlayMelody function and use the serial communication driver to show where the melody is in execution, displaying the information (note, measure, phrase) with hyperterminal. Carefully document and explain all that you must do to implement this task.

As always, carefully documented software is required along with a demonstration of your work and a web site based report. Include a view of your project window, showing the files you have included in the design.