Jump to content

music with assembly language

Recommended Posts

I'm new to the msp430 and I want to make it play a song through a speaker when I push the button. However, I want to do this with assembly code and not in C. I am using IAR embedded workbench to do my programming. I'm connecting a speaker directly to the msp430 at p1.3 and ground. Are there any tutorials on how to do this? Or any assembly code I could look at that does something similar? I looked through the forum topics but could not find anything that matched with what I'm trying.



Link to post
Share on other sites

A variation of the RTTL player that adds a simple envelope to each note.





Some in assembly & C:


MIDI driven:





This has a bug that causes only half of the sine wave to be used. Look carefully at the 'scope and you will see it.



Table driven:


This has a bug that causes the frequency to be a bit off. Don't remember if I fixed the posted code.





Link to post
Share on other sites

Thanks, that all looks a bit advanced for where i'm at(i'm only a few weeks into this). If I can use tones to play happy birthday, then i'll be happy. Maybe something similar to opening a music box or a Christmas card and having it play a simple tone based melody.


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...