Sunday, December 07, 2014

Create Musical Tone Using PIC Microcontroller[Step by Step ]

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 :


Now  we need the source code .So create a project in MikroC and follow the instructions given below:

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();


  }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


Now follow the next instructions .
.
Now just run the project.

Thank You!

7 comments:

  1. 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,

    ReplyDelete
  2. i 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?

    ReplyDelete
  3. Great 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.

    ReplyDelete
  4. If 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.

    ReplyDelete
  5. Carpet 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.

    ReplyDelete
  6. Generate melodic notes (up to four at once), envelope these notes, Islamic Education and combine them all based on a brief melody kept in memory.

    ReplyDelete
  7. After create musical tone you can uplaod in your website you must see Free portfolio websites and think about your new journey.

    ReplyDelete

Ain't getting any visitors!
Please Share and Bookmark posts.

Tags

: (1) 18F2550 (1) 36KHz (3) and (1) arduino (1) Based (1) battery (1) Bipolar (1) Blinking (1) blinks (1) Bluetooth (1) bluetooth device interfacing (1) bluetooth module (1) button (1) circuit (1) clock (1) control (1) crystal oscillator (3) Db9 (1) DC Motor (2) digital (2) Digital Voting Machine (1) digital voting machine using pic (1) display (2) DS1307 (1) electronic (1) embedded c programming tutorial (11) embedded c tutorial (11) experiment kit (4) external interrupt (4) flash (1) flashing (1) Gas Leakage detector (1) HC-06 (1) home (1) how (1) How to (10) i2c tutorial (1) in (1) indicator (1) infrared Connection (3) interface (8) interfacing (3) Interrupt (3) Introduction (1) IR Connection (3) IR Receiver (4) IR Transmitter (4) key pad (1) keyboard (1) keypad (1) lavel (1) Lcd 16x2 (2) lcd 2x16 (2) led (1) lm35 (2) LPG (1) machine (1) make (1) Make bootloader (1) making (1) matrix (1) max232 (1) membrane keyboard (2) meter (2) Micocontroller (1) microchip (4) microchip pic (2) microchips (3) microcontroller (9) microcontroller based (3) microcontroller programming (3) Microcontroller Project (4) Microcontroller Projects (1) microcontroller_project (2) microcontrollers (4) Microprocessor (2) mikroC (5) mikroc code to start and stopstart and stop dc motor (1) mikroc pro for pic (2) Motion detector (1) MQ-9 Gas Sensor (1) musical (1) NEC Protocol (4) pcb (5) PIC (3) pic controller (11) pic microcontroller (11) pic microcontroller tutorial (11) pic programming (1) pic programming in c (12) pic proteus (1) Pic Tutorial (12) pic18 (2) pic18f2550 (11) picmicrocontroller (4) picRFモジュール (1) PIR Motion Sensor (1) printed circuit board (1) proteus (6) pulse width modulation (1) push (1) push button (1) PWM (1) real (1) rf transmitter (3) Rs 232 (1) Rs232 (1) scroll (1) scrolling (1) Serial communication (1) Serial Connection (1) Serial Port (1) serial port rs232 (1) Servo Motembedded c programming tutorial (1) simulation (2) Soil Moisture Meter (1) speed control (1) step by step (7) step bystep (1) Stepper Motor (2) text (2) Thief Detector (1) time (1) timer (4) timer0 (4) tone (1) TSOP38236 Receiver (4) tutorial (2) Unipolar (1) USART Connection (1) USB (1) usb 1.0 (1) USB bootloadere (1) USB HID (1) using (9) voltmeter (1) voting (1) water level indicator (3) with (2) work (1)

Traffic Feed


Live Traffic Feed
Visitor Tracking

Leave Your Message Here

Name

Email *

Message *

Like on Facebook