Close

Improvement - Using independent PWM modules.

A project log for Case study: A polyphonic PIC18F music box

Does this work? An online article discusses about building this music box.

yh-workshopYH-workshop 11/26/2017 at 08:300 Comments

Some of the newer PIC12F and PIC16F have three independent PWM modules - it means that these PWM can be configured to operate at different frequencies. Since we are here to minimize component count, these microcontrollers are helpful to get this done.

I happened to have a PIC12F1572 on my hand, and this is the smaller microcontrollers that have these three independent modules. So, over the day I whipped up a prototype and hook it up to an LM386 speaker, and importing (and porting) whatever it is from my github, I managed to replicate that mini-music box that the PICBasic's website offered, but using Len Shustek's midi parser system.

The program uses MikroC and it can compile within the demo limit.

As usual, the link: https://github.com/uncle-yong/PIC12F1572-Music-Box

The sound is, of course, square waves, and not really a pleasant thing to hear for some people.


I'm attaching the remaining decay generator that I discussed later - I'm gonna need to solder the whole thing so that it won't fall apart or make more bad sounds!

Discussions