Parallax 2x16 Serial LCD (27977) Backlit, w/ Spkr - Example Prop snd SPIN code??

I bought one of these from Radio Shack a week or so back and it says that version F has a speaker for music but there is no example code for the Propeller (nor BS2).

I had a few of these in an earlier version when I programmed the SX chip sometime back but wanted to hear the sound capability in this new one for the Propeller.

Why is the released datasheet incomplete?

Has anyone written any example code for the music tones? I'm a bit surprised no one has brought this up yet - from what I searched on in the forum posts.

I'm just learning the Propeller and would like somewhere's to start as I know nothing about music either.

Thanks!

Comments

  • 4 Comments sorted by Votes Date Added
  • edited April 2012 Posts: 0Vote Up0Vote Down
    Version 3.0 of the documentation includes the commands for playing musical notes.

    http://www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/27976-7-9-ParallaxSerialLCD-v3.0.pdf

    and the old kickstarts page has some basic code examples.


    http://sites.google.com/site/parallaxinretailstores/home/2x16-serial-lcd-backlit
    - Rick
  • edited April 2012 Posts: 121Vote Up0Vote Down
    RDL2004,

    I didn't know about the Kickstart site. Thanks. However, version 3 nor the Kickstart site has example code on how it is implemented to let's say play a tune in either the BS2 or Propeller. Commands and documentation are nice about the notes but not complete if the user isn't shown HOW they are supposed to be implemented like they barely do for the basic LCD commands for text.

    I'm not trying to be negative but just pointing out that version 3 of the document needs to be updated for music/notes implementation for the Propeller/BS2 (especially if they are being sold in the off the Parallax website for new users not knowing what to do).

    I can figure this out as I have written many SX/B programs for the LCD before, but it would have been nice to have had example code possibly showing tricks/tips or a good way to do this for Music on the Propeller and BS2.

    Thanks again.
  • edited April 2012 Posts: 0Vote Up0Vote Down
    tg8934, I can somewhat agree because I had the same trouble trying to figure out how to handle music with the new LCD. However, after digging deeper and talking with a few people with more knowledge than my own, it was brought to my attention that although the datasheet lacks demo code, it does contain all of the necessary information to do nearly anything with music notes. If you have working knowledge of using the propeller and some basic objects like Full Duplex Serial or Simple Serial, you would also have the required knowledge to make the LCD tend to your musical needs. Of course, for us newbies, we don't already have that fully working knowlede. Here is a breakdown of how I figured things out:

    To send commands from the command set, the datasheet has you covered by explaining that the appropriate bytes need to be sent. For example, to clear the screen and turn on the backlight:
    ' for the propeller
    lcd.tx(12)
    lcd.tx(17)
    
    'for a stamp
    SEROUT TxPin, Baud19200, [12]
    SEROUT TxPin, Baud19200, [17]
    

    So, using the same methods, we can send commands from the command set table to play an 'A' quarter note. Decimal 210 sets the note length to a quarter and decimal 220 plays an A note at whatever length and scale is currently active.
    ' for the propeller
    lcd.tx(210)
    lcd.tx(220)
    
    'for a stamp
    SEROUT TxPin, Baud19200, [210]
    SEROUT TxPin, Baud19200, [220]
    

    So, here is a short little bit of SPIN code where I laid out the music data in a DAT table
    ' messing with music 
      repeat idx from 0 to 8    ' send the first 8 "byte sets" to the LCD
        lcd.tx(muzak[idx])
    
      repeat idx from 0 to 8    ' send the 2nd 8 "bytes sets" to the LCD
        lcd.tx(muzak2[idx])
        
    
    DAT
    
      Muzak       byte      210, 216, 220, 226, 230, 217, 226, 230, 220
      '                    1/16, 4th, A   , D#,  G,  5th, D# , G ,  A 
      Muzak2      byte      210, 216, 220, 220, 220, 211, 220, 220, 220
      '                    1/16, 4th, A  , A  , A  , 1/8, A  , A  , A
    

    Once a length or scale has been setThe entire code and more explanations for it is on this thread here, where someone had the same question as you.

    As for reading music, here are a couple simple pictures that help me.

    Lettered music scale:
    piano-notes-chart.gif


    Note length explanation:
    Wpid-learn-to-read-music-noteslearning-how-to-play-pianhghgmhhmgo-at-homeonline-4c5609a1a0d4b.gif
    Andrew Williams<br>WBA Consulting
Sign In or Register to comment.