MICROPROCESSOR SYSTEMS

MICROPROCESSOR SYSTEMS PROJECT

There are two parts to the assessment of this project: a demonstration of the solution during class and a project report
IMPORTANT: Report Submission Instructions
1) a technical report on all tasks completed containing:
a) A circuit diagram / schematic diagram showing the processor and the connections to all components of your solution. You do NOT need to show ‘standard kit’ elements like power regulator, oscillator, LCD interface etc.
b) A brief description of the principles of operation and the algorithms used (in the form of pseudo-code, flow charts or similar), explanations of why those methods were used, any relevant assumptions made, and any special features of the solution
2) the commented source code files in an appendix

PROJECT DESCRIPTION
Sound is a useful feedback mechanism to incorporate into many microprocessor systems, so the capability to generate different sounds in order to indicate different conditions can be very useful.
The project is to design a system that can generate a variety of sounds from a small dynamic speaker, along with the capability to control which sounds are produced using a keypad.
Task 1: (Demonstration – 20 marks, Report – 10 marks)
Using the lab kit, design a circuit for the processor to be able to output tones of a designated frequency from a small dynamic speaker. You will be provided with a speaker with following specifications:
Type: Mylar Cone
Output Power: 0.25 WRMS Impedance: 8 Ω
Dimensions: 27(Dia) x 8(H) mm
You will also be provided with an LM386N-1 Low Voltage 1W Amplifier IC (datasheet), and a 10kΩ potentiometer. Your first task will be to design a suitable interface between the microcontroller and the speaker using the LM386N Amplifier chip and any other necessary components (noting that you will be responsible for replacing any components damaged as a result of inappropriate interfacing). Note that the volume of the sounds generated by the speaker should be controllable via the provided potentiometer.
You should then write a program for the microcontroller that will enable a sequence of tones to be output from the speaker according to user selection. When the system is started the speaker should initially be silent and a menu should be displayed on the NerdKit LCD display. This menu should allow the user to select between two functions:
Function 1: The first menu option should enable the numbers 1 – 7 on the keypad to be able to be used to generate tones corresponding to the musical notes C4 (middle C) through to B4 (C4, D4, E4, F4, G4, A4, and B4), i.e. pressing the number ‘1’ should generate the note C4, ‘2’ the note B4 and so on. The tone should continue to be output for as long as the key is kept pressed, and should stop as soon as it is released. If the ‘9’ key is pressed at any point, then the LCD display should return to showing the main menu.
Function 2: Selecting the second menu option should prompt the user to enter a sequence of 5 single digit numeric values in the range 1 – 7. Once the 5 values have been entered, the notes corresponding to these values (as per Function 1) should be played sequentially in a loop, in the same order in which they were entered by the user, until any key is pressed, at which point the sound should immediately stop, and the LCD display should once again show the main menu. Note that each tone should be played for a duration of 1s.
Hint: You will need to create an array data structure to store the keypresses as they are entered.
Even though the ‘user interface’ is limited to the LCD screen and keypad, marks will be given for making this as ‘user-friendly’ and intuitive as possible.

Task 2: (Demonstration – 14 marks, Report – 6 marks)
For this task you will need to add an additional menu option (function) to the program developed for Task 1.
Function 3: This function will be a sound effect generator. When this menu option is selected the LCD display should indicate that the user can play one of three 8-bit sound effects, a zap, a ray gun or a blast, by pressing a designated keypad key corresponding to each. A set of 8-bit, 8 kHz datafiles that provide the sample sequence for each of these sound effects can be downloaded from the project section on the unit Blackboard site and added as includes to your main program file. When the keypad keys ‘1’, ‘2’ or ‘3’ are pressed then the corresponding sound effect should be played once. When the keypad keys ‘4’, ‘5’ or ‘6’ are pressed then the corresponding sound effect should play in a continuous loop for as long as the key is held down, and should stop as soon as the key is released. The repeat rate for the looping sound effects should additionally be user configurable. The ‘*’ and ‘#’ keys on the keypad should be able to be used to raise or lower the repeat rate from a minimum of a 0s gap between repeats, to a maximum of a 0.9s gap, in 0.1s increments. Some kind of indication of the current repeat rate setting should be shown on the LCD screen. If the ‘9’ key is pressed at any point, then the LCD display should return to showing the main menu.
Hint: To read the sample data from the included data header files you should use the pgm_read_byte function from the pgmspace.h library, e.g. to read an 8-bit sample value from the blast.h file you would use:
pgm_read_byte(&blast_data[sample])
where ‘sample’ is a variable or value designating the sample number to be read.Note that the number of samples in the file is provided by the blast_length integer variable and the value of ‘sample’ should not exceed this.

Leave a Reply

Your email address will not be published. Required fields are marked *