In this tutorial , i will show how to create melody using microcontroller and in this tutorial i will use pic18f2550 microcontroller .So let's create a project in proteus .
Proteus Project :
Please follow the instructions given below :
Now pick pic18f2550, sounder, crystal,22pf capacitor,VDD and ground according to the instructions given below :
Now complete the circuit as given below :
MikroC Code :
Source Code :
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Tone1() {
Sound_Play(659, 250); // Frequency = 659Hz, duration = 250ms
}
void Tone2() {
Sound_Play(698, 250); // Frequency = 698Hz, duration = 250ms
}
void Tone3() {
Sound_Play(784, 250); // Frequency = 784Hz, duration = 250ms
}
void Melody() { // Plays the melody "Yellow house"
Tone1(); Tone2(); Tone3(); Tone3();
Tone1(); Tone2(); Tone3(); Tone3();
Tone1(); Tone2(); Tone3();
Tone1(); Tone2(); Tone3(); Tone3();
Tone1(); Tone2(); Tone3();
Tone3(); Tone3(); Tone2(); Tone2(); Tone1();
}
void ToneA() {
Sound_Play( 880, 50);
}
void ToneC() {
Sound_Play(1046, 50);
}
void ToneE() {
Sound_Play(1318, 50);
}
void main() {
ADCON1=0x0F; //disable adc
CMCON=7; //disable comparator
Sound_Init(&PORTC,0);
Sound_Play(880, 1000); // Play sound at 880Hz for 1 second
while (1) {
ToneA();
delay_ms(100);
ToneC();
delay_ms(100);
ToneE();
delay_ms(100);
Melody();
}
}
Sound_Play(659, 250); // Frequency = 659Hz, duration = 250ms
}
void Tone2() {
Sound_Play(698, 250); // Frequency = 698Hz, duration = 250ms
}
void Tone3() {
Sound_Play(784, 250); // Frequency = 784Hz, duration = 250ms
}
void Melody() { // Plays the melody "Yellow house"
Tone1(); Tone2(); Tone3(); Tone3();
Tone1(); Tone2(); Tone3(); Tone3();
Tone1(); Tone2(); Tone3();
Tone1(); Tone2(); Tone3(); Tone3();
Tone1(); Tone2(); Tone3();
Tone3(); Tone3(); Tone2(); Tone2(); Tone1();
}
void ToneA() {
Sound_Play( 880, 50);
}
void ToneC() {
Sound_Play(1046, 50);
}
void ToneE() {
Sound_Play(1318, 50);
}
void main() {
ADCON1=0x0F; //disable adc
CMCON=7; //disable comparator
Sound_Init(&PORTC,0);
Sound_Play(880, 1000); // Play sound at 880Hz for 1 second
while (1) {
ToneA();
delay_ms(100);
ToneC();
delay_ms(100);
ToneE();
delay_ms(100);
Melody();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Now follow the next instructions .
Thanks admin, for sharing this helpful blog, i appreciate your effort and developing skill, but why to work so hard? do working smart and save time, i am a professional WordPress developer at Top WordPress Website Development Company In London - England , you install musical plugging and just drag and insert music background, you need any kind of help? so visit my site and get my personal email, 24/7 my team are available,
ReplyDeletei am reading many blog in our all life, but your blog topic is so different and informative, i think you are a professional researcher? i need your small favor? please upload blog for video animation studio in California related?
ReplyDeleteGreat writeup! I like the way you guide us. I didn't know that I got this kind of master piece which would help me alot. Would you mind sharing your first version? I want to study it, if you commented that would be great, well... If you wish to share it. I'm also with the taylorhill request. You should also work on the blog of animation video service to improve our knowledge regarding it. If someone in this field then he or she will get lot of benefits from it.
ReplyDeleteIf you don't know where to find a driving school in the UK, then connect driving school is your answer where you can find manual and automatic driving instructors who will teach you how to drive.
ReplyDeleteCarpet Nashville gives Carpet floors into grades. Our Heirloom grade functions with fewer knots and a version of in herbal character, even as our Signature grade presents greater natural functions, inclusive of mineral streaking and ingrown bark.
ReplyDeleteGenerate melodic notes (up to four at once), envelope these notes, Islamic Education and combine them all based on a brief melody kept in memory.
ReplyDeleteAfter create musical tone you can uplaod in your website you must see Free portfolio websites and think about your new journey.
ReplyDelete