0% found this document useful (0 votes)
27 views

Microprocessors Final Project Musical Doorbell - Coded Bu8on Inputs

This document describes David Rubenstein's microprocessors final project of a coded button musical doorbell. It includes 4 buttons where the first button indicates the song and LEDs will light up indicating the next 2 buttons to push to play the song. It then describes the 4 songs programmed and how the songs were programmed using a timer interrupt and lookup table to play notes for set durations with rests in between. It also discusses how repetition was implemented using loops to save space. The document concludes that the project is a working coded button musical doorbell.

Uploaded by

David R
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Microprocessors Final Project Musical Doorbell - Coded Bu8on Inputs

This document describes David Rubenstein's microprocessors final project of a coded button musical doorbell. It includes 4 buttons where the first button indicates the song and LEDs will light up indicating the next 2 buttons to push to play the song. It then describes the 4 songs programmed and how the songs were programmed using a timer interrupt and lookup table to play notes for set durations with rests in between. It also discusses how repetition was implemented using loops to save space. The document concludes that the project is a working coded button musical doorbell.

Uploaded by

David R
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Microprocessors

Final Project
Musical Doorbell Coded Bu8on
Inputs
By David Rubenstein
How to get songs to play
4 bu8ons
First bu8on push indicates which song will play
LEDs will light up indicaDng the next switches to
push (two at a Dme)
Cancel by pushing the opposite of the bu8ons
indicated
Push original bu8on again
If you push any other bu8on the board makes a noise
indicaDng the wrong bu8on was pushed
The Songs
PorDons of the following songs were wri8en
to the AT90S4414 microcontroller
Bu8on1 Three Li8le Birds Bob Marley
Bu8on2 Tessellate Tokyo Police Club
Bu8on3 Thunderstruck AC/DC
Bu8on4 Game of Thrones theme song
How song was programmed
Timer interrupt compliments speaker bit
Calculate reload values for notes
Create lookup table of reload values in
program memory
Note played for set duraDon. Brief period of
rest aWer each note played

tone = pgm_read_byte(&notes[16]); _delay_ms(200); //b4 1/8


tone = 0; _delay_ms(25);
Interrupt Service RouDne
ISR (TIMER0_OVF_vect)
{
TCNT0 = tone;
if (tone != 0) PORTC ^= SPKR;
else PORTC &= ~SPKR;
}
RepeDDon
Many songs have repeDDve note pa8erns. This is very easy to
implement with loops
Saves space in program memory
for ( int i = 0 ; i < 4 ; i++ )
{
tone = pgm_read_byte(&notes[12]); _delay_ms(400); //g4 1/4
tone = 0; _delay_ms(25);
tone = pgm_read_byte(&notes[5]); _delay_ms(400); //c4 1/4
tone = 0; _delay_ms(25);
tone = pgm_read_byte(&notes[8]); _delay_ms(200); //e4b 1/8
tone = 0; _delay_ms(25);
tone = pgm_read_byte(&notes[10]); _delay_ms(200); //f4 1/8
tone = 0; _delay_ms(25);
}
ImplementaDon of bu8on code
Result: Working Project

You might also like