News 8051 Projects
- Thu Nov 04 2010, 07:15 PM
On the occasion of Indian festival Diwali, here is another plug and play library for musical tone generation using your 8051 microcontroller. The basic idea behind melody is to produce the correct musical note note.
There are seven pitch classes which are represented by first seven letters of Latin alphabets (A, B, C, D, E, F and G). A musical note is represented by Pitch class and octave level, So according to pitch classes there are basic 7 notes and 8th note is represented with as same pitch class as first but double the frequency. The octave is used to differentiate between two notes and is a representation of frequency ratio of two.
Musical notes start from C0, c0#, D0, D0#,.... the lowest note frequency i.e. for C0 is 16.35Hz (based on center frequency A4, 440Hz). Another major component of musical note is duration. There are total 10 durations which are Quarter, Whole, Half, Eighth, Sixteenth, Thirty Two, Sixtyfour, six, twelve and twenty four. These durations vary depending on tempo (beats per minute) of the music/tone.
In music library we focused on notes from C5 to B6 as they coveres almost all variations for simple tone generation and octave level is produce good sound level on hardware (lower frequency means lower sound, higher the frequency higher the sound).
Generating a particular frequency is nothing but a square wave with desired time period. We can use one of the 8051's timer to generate a particular frequency. Lets say if you want to generate C5 note which has a frequency of 523.25Hz, the time period for C5 will be 1911.132µS. The output square wave with 50% duty cycle will have high and low time of 955.566µS (= 1911.132/2).
Lets say your controller running at 12Mhz oscillator will have one Machine cycle of 1µs. To generate 955.566µs we need 956 (~=955.566/1) machine cycles. We can load timer with a value of 64580 (65536-956) and toggle any I/O pin at that interval will give us the reqired frequency. Now this I/o pin can be connected to a speaker to produce sound for that note.
In the library provided we are using Timer2 in auto reload mode for square wave generation. You can use any timer i.e. timer0 or timer1 in 16bit mode for frequency generation. For your convenience I have provided an excel sheet that will generate timer values for a given crystal oscillator frequency.
You can also download the sample tone recorded and tested using this library:
The sample program and hex file produces following tones:
1. Adam's Family
2. Looney Toons
4. Pink Panther
5. Beethoven Play
6. SaReGaMa (Basic Indian sound 7 tones in forward and reverse order).
Download: Musical Tone Library for 8051 Microcontroller
If you have any doubt regarding this library please make use of forum
Have a musical diwali
Fri Apr 09 2021, 02:02 PM
Quality articles is the secret to interest the users to visit the site, that's what this web page is providing. christian dating sites https://datingsitesww.com
Fri Apr 09 2021, 03:53 AM
I have a small question for you
Thu Apr 08 2021, 06:26 PM
Post writing is also a fun, if you be familiar with afterward you can write otherwise it is complex to write. dating sim https://onlinedatingtind.com/
Thu Apr 08 2021, 12:35 PM
Thanks, Fredericka Horn
Thu Apr 08 2021, 12:03 PM
- Automatic Railway Gate Control by: Nimar & Pawandeep Kaur in: 8051 Projects
Thu May 31 2018, 07:17 AM
- Yet Another DTMF Controlled Robot by: Parambir, Harman, Pragati, shikha, Manpreet in: 8051 Projects
Fri May 19 2017, 09:15 AM
- Simple 3 Digit Temperature Meter by: Rakesh Suthar in: PIC Projects
Sat Jul 05 2014, 06:15 AM
- Electronic Voting machine with Managed Control Unit (Project Report Included) by: Shivani, Geetika Gupta, Vibhore Aggarwal, Megha Singh in: 8051 Projects
Sat May 17 2014, 02:16 PM
- LED Scrolling message Display using 8051 by: Pratik Suthar in: 8051 Projects
Thu May 08 2014, 10:58 AM
- Pure Sine Wave Inverter Using Atmel 89S2051 by: ExperimenterUK
Thu Jan 07 2021, 12:54 PM
- Pure Sine Wave Inverter Using Atmel 89S2051 by: MUNIKOJR
Wed Jan 06 2021, 06:36 AM
- Frequency Counter using AT89C2051 and LCD (Assembly) by: ExperimenterUK
Mon Nov 23 2020, 02:40 PM
- Frequency Counter using AT89C2051 and LCD (Assembly) by: Auden
Mon Nov 23 2020, 08:43 AM
- Frequency Counter using AT89C2051 and LCD (Assembly) by: Chinh 299
Sat Jun 13 2020, 01:18 PM
Thu Jun 25 2020, 03:46 PM
Mon Jun 22 2020, 03:03 PM
Tue Jun 16 2020, 05:10 PM
Sat Jun 13 2020, 09:43 PM
Thu May 21 2020, 12:44 PM
Thu May 21 2020, 01:28 AM
Wed May 20 2020, 07:05 PM
Wed May 20 2020, 11:52 AM
Embedded Systems designed 8051 ebook mmc interfacing 8051 tutorial proteus nokia 3310 lcd DFT scan insertion RPM to velocity at command sim900 ftp classification of channel models ebook rapidshare push button interfacing ADC0809 code CMOS fabrication programming embedded system keil 8051 ASIC designs PIC oscilloscope project writing stepper motor project updates LM35 interfacing Microchip dsPIC30F4011 microcontroller ARM7-TDMI