+ Reply to Thread
Results 1 to 4 of 4

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

  1. #1

    Default 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!

  2. #2

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

    Version 3.0 of the documentation includes the commands for playing musical notes.

    http://www.parallax.com/Portals/0/Do...alLCD-v3.0.pdf

    and the old kickstarts page has some basic code examples.


    http://sites.google.com/site/paralla...al-lcd-backlit
    - Rick

  3. #3

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

    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.

  4. #4

    WBA Consulting's Avatar
    Location
    4.3 Light Years from Rigil Kentaurus
    Posts
    2,191
    Blog Entries
    26

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

    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:
    Code:
    ' 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.
    Code:
    ' 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
    Code:
    ' 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:
    Click image for larger version

Name:	piano-notes-chart.gif
Views:	17974
Size:	7.5 KB
ID:	91651

    Note length explanation:
    Click image for larger version

Name:	Wpid-learn-to-read-music-noteslearning-how-to-play-pianhghgmhhmgo-at-homeonline-4c5609a1a0d4b.gif
Views:	2515
Size:	14.4 KB
ID:	91652
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	drunkensailor.jpg‎
Views:	1026
Size:	116.4 KB
ID:	91653  
    Andrew Williams
    WBA Consulting

+ Reply to Thread

Similar Threads

  1. Parallax 2x16 Serial LCD (Backlit) not working with SX
    By Capt Magellan in forum SX Chips and Programming Tools
    Replies: 1
    Last Post: 11-03-2010, 02:40 AM
  2. Parallax 2x16 Serial LCD (Backlit)
    By ANumber in forum Javelin Stamp
    Replies: 1
    Last Post: 02-26-2009, 08:48 AM
  3. Parallax Backlit 2x16 LCD, #27977
    By PADT in forum BASIC Stamp
    Replies: 2
    Last Post: 11-16-2007, 10:39 AM
  4. Parallax 2x16 Serial LCD (Backlit)
    By vbNullString in forum BASIC Stamp
    Replies: 3
    Last Post: 09-21-2007, 10:47 PM
  5. Controlling Parallax 2x16 Serial LCD (Backlit)
    By vbNullString in forum BASIC Stamp
    Replies: 8
    Last Post: 09-17-2007, 10:26 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts