Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How To Generate Music Tone Using Pic Microcontroller?

Status
Not open for further replies.

earlbesario

New Member
HI...

I want to build music tone using pic16f84? so i can make a sound. This is to be used in our project in Microcontroller subject (ex: a pic musical doorbell project).

How to understand the conversion of the tones in assembly codes...?
How to do that?

Can anybody show me how to convert any music to an assembly program?
 
earlbesario said:
Can anybody show me how to convert any music to an assembly program?
It should be other way isn't it????.....:)
A beep is generated from turning on & off an output pin number of times. But for buzzers it different. & to generate a tone or Tune need some effort to do that.

A simple method is applied here for PIC16F84A
**broken link removed**
 
Last edited:
Thanks for the reference ()
...so i need to understand about RTTTL (Ringing Tones Text Transfer Language)..Can anybody explain what is RTTT..pls?
so i can convert music tone to assembly code...I will use piezo speaker of my project...i'll just hope that it will create a different sounds with 2 or more inputs...

i really need effort of this.....

tnx...
 
earlbesario said:
Thanks for the reference ()
...so i need to understand about RTTTL (Ringing Tones Text Transfer Language)..Can anybody explain what is RTTT..pls?
so i can convert music tone to assembly code...I will use piezo speaker of my project...i'll just hope that it will create a different sounds with 2 or more inputs...

The website above has links to everything you need to know, you don't have to use RTTL - it's just convenient if you want to play tunes.
 
earlbesario said:
Thanks for the reference ()
...so i need to understand about RTTTL (Ringing Tones Text Transfer Language)..Can anybody explain what is RTTT..pls?
so i can convert music tone to assembly code...I will use piezo speaker of my project...i'll just hope that it will create a different sounds with 2 or more inputs...

i really need effort of this.....

tnx...

You do not need to understand RTTT. It would be overkill.

The article mentioned by Gayan Soyza should be what you need to do.

A speaker is easier to use then a piezo. The hardware as laid out in the ringtone page would work. Use a 47uF cap.
 
I don't especially know much about microcontrollers, but couldn't you generate a bit more of a sine wave-type sound using cap(s) and an D/A convertor? Juuust wondering.

EDIT: Just to clarify, I meant by using a D/A convertor to step the voltage up, then down and caps to antialias the wave.
 
Last edited:
yes, you could certainly use a DAC. The ideas that people are putting forth are about using one or 2 pins. A parallel DAC will take 8-10-12 pins while a serial DAC will take fewer pin but is a bit more complex to use. I would not use parallel with a uC but rather a serial one. However, I didn;'t get the sense you needed all that great quality.

Look at the Roman Black page - his algorithm actually produces fairly good sound quality with 2 output pins.

By the way, a DAC doesn't step the voltage up or down but rather you tell it what voltage level to output, thus tracking the waveform you are trying to reproduce.
 
that's called an R-2R ladder and it is, in fact, a simple DAC. 8 bit, simple low pass filter.

it uses an RC oscillator for the clock so it will be pretty innacurate - better to use a real crystal.
 
philba said:
that's called an R-2R ladder and it is, in fact, a simple DAC. 8 bit, simple low pass filter.

it uses an RC oscillator for the clock so it will be pretty innacurate - better to use a real crystal.

It doesn't matter for this application, and it gives the advantage that you can add a poteniometer and make the speed variable if you want.
 
generating melody ...

Hello! I'm new at pic programming, is this pic : PIC16F87, is good for the

can i replace the PIC16F876 by the pic16f87?

thank you soo much!
Have a good night! :)
marC:)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top