Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 1st March 2007, 08:31 AM   (permalink)
Post How To Generate Music Tone Using Pic Microcontroller?

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 is offline  
Old 1st March 2007, 09:01 AM   (permalink)
Default

Essentially you just turn a pin ON and OFF to generate a tone, you might have a look at this C example for ring tones
http://www.beyondlogic.org/pic/ringtones.htm
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 1st March 2007, 09:36 AM   (permalink)
Default

Quote:
Originally Posted by earlbesario
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
http://www.talkingelectronics.com/Pr...nts_page1.html
__________________
Gayan

My Website
http://gsmicro.blogspot.com/

Last edited by Gayan Soyza; 1st March 2007 at 09:51 AM.
Gayan Soyza is offline  
Old 1st March 2007, 09:46 AM   (permalink)
Default

You find a good one in the Labcenter Electronic's Proteus examples.
szabi is offline  
Old 1st March 2007, 10:13 AM   (permalink)
Default

Thanks for the reference (http://www.beyondlogic.org/pic/ringtones.htm)
...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 is offline  
Old 1st March 2007, 11:08 AM   (permalink)
Default

Quote:
Originally Posted by earlbesario
Thanks for the reference (http://www.beyondlogic.org/pic/ringtones.htm)
...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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 1st March 2007, 11:12 AM   (permalink)
Thumbs up

Quote:
Originally Posted by earlbesario
Thanks for the reference (http://www.beyondlogic.org/pic/ringtones.htm)
...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.
3v0 is offline  
Old 1st March 2007, 11:22 AM   (permalink)
Default

Quote:
Originally Posted by 3v0
The article mentioned by Gayan Soyza should be what you need to do.
I have built that circuit and tried the programs on the site and can confirm that it works fine.
House0Fwax is offline  
Old 1st March 2007, 01:43 PM   (permalink)
Default

I managed to do this on an AVR and plays decent music (Square Wave) I shall post the programme soon... It is capable of playing 4 octaves...
__________________
Bharath Bhushan Lohray.
M.Sc. Electronics.
lord loh. is offline  
Old 1st March 2007, 05:16 PM   (permalink)
Default

check out roman black's BTC algorithm. especially the 2 bit version with produces better sound. http://www.romanblack.com/btc_alg.htm
philba is offline  
Old 2nd March 2007, 04:17 AM   (permalink)
Default

Or maybe this is more what you were looking for?
Generating sound
SPDCHK is offline  
Old 3rd March 2007, 02:44 AM   (permalink)
Default

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 by ArtemisGoldfish; 3rd March 2007 at 02:51 AM.
ArtemisGoldfish is offline  
Old 3rd March 2007, 03:13 AM   (permalink)
Default

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.
philba is offline  
Old 6th March 2007, 05:21 AM   (permalink)
Default

Here is another link I searched when I was Researching.



http://www.qsl.net/yo5ofh/pic/tone_generator.htm
See if it's suits you.But I haven't try that.
__________________
Gayan

My Website
http://gsmicro.blogspot.com/
Gayan Soyza is offline  
Old 6th March 2007, 06:09 AM   (permalink)
Default

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 is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
adc/dac interfacing with pic microcontroller bebo670 Electronic Projects Design/Ideas/Reviews 3 16th February 2007 12:47 AM
HOW TO generate 3pwm output using one pwm in a pic microcontroller Anniyan_x Electronic Projects Design/Ideas/Reviews 13 15th November 2006 02:01 AM
Microcontroller Music - Harmonic Distortion. lord loh. General Electronics Chat 10 6th November 2006 09:42 AM
Newcomers, please read! (PIC regarded) Upd. 0xD Jay.slovak Micro Controllers 0 17th April 2005 02:05 PM



All times are GMT. The time now is 07:21 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker