May 11, 2024, 06:07:20 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Need help with prop1 and vmusic2

Started by tugman, April 09, 2009, 04:59:03 PM

Previous topic - Next topic

tugman

     I have an application where I would like to use a prop1 and a vmusic2 to play some sound bites on my boat.  I would like to have 8 sound bites loaded into the vmusic2.
     I want to use 8 separate push buttons and be able to chose the sound clip by pressing the corresponding button.  I don't need any  automated cycling of the clips. I am hopeful that if I can get this to work then I can move on pretty much on my own.
     Understandably, the efx-tek folks are overwhelmed in the attempt to help us all of us newbies, so if anyone out there can throw a little help this way, that would be great.
   
Thanks, Tugman

BigRez

April 09, 2009, 05:25:56 PM #1 Last Edit: April 09, 2009, 05:38:32 PM by bigrez
I believe it is worth waiting for Jon's info (four diodes, six pins, eight selections.)  I too am looking forward to that info.  :)

As he said, you'll need two of those connections for the VMusic player leaving six connections.  If you can't wait (which really shouldn't be long), then one suggestion could be to have four buttons and a hi/low indicator switch.  Kind of like what you would see on a blender.

For example, when switch1 is "off" (or low) then button1, 2, 3 and 4 play sounds 1, 2, 3, 4 respectively.  When switch1 is "on" (or high) then sounds 5, 6, 7 and 8 are played.

So, the connections would be something like:
PIN7 = VMusic Rx (Setup UP, No UNL)
PIN6 = VMusic Tx (Setup UP, No UNL)
PIN5 = Switch 1
PIN4 =
PIN3 = Button 4
PIN2 = Button 3
PIN1 = Button 2
PIN0 = Button 1

And you could get even more options by adding a second switch at PIN4 to give a total of 16 different combinations (2^4).  You could even create a little display box with LEDs indicating which sounds are to be played.

JonnyMac

April 09, 2009, 06:31:58 PM #2 Last Edit: April 09, 2009, 06:38:37 PM by JonnyMac
Sorry, we had to go out of town for a couple days to meet with a technology partner.  While I can put up with impatience, I won't put up with multiple threads from the same user on the same topic -- you don't find your self of my good list when you do that so don't do it again.  The "Evil JonnyMac" is ugly:


I'm just out of the car after a 7-hour drive so I don't have everything hooked up.  This should get you started but will require some effort on your part.  Let's start with using five inputs to read eight buttons; steering diodes cause PIN4 to be active when buttons 5 - 8 are pushed.


This program reads the buttons, ensures that only one was pressed, then converts that to an address in an EEPROM table for the name of the file to play.  Pretty easy, really.

' =========================================================================
'
'   File...... VMusic_8x.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK (www.efx-tek.com)
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 09 APR 2009
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  RX              = 7                     ' SETUP = UP, no ULN
SYMBOL  TX              = 6                     ' SETUP = UP, no ULN


' -----[ Constants ]-------------------------------------------------------

SYMBOL  Baud            = OT2400

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0

SYMBOL  Yes             = 1
SYMBOL  No              = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  song            = B0                    ' song selection
SYMBOL  bCount          = B1                    ' bit count
SYMBOL  shift           = B2
SYMBOL  eePntr          = B3                    ' EEPROM pointer
SYMBOL  char            = B4                    ' char to TX
SYMBOL  chNum           = B5                    ' characters sent


' -----[ Initialization ]--------------------------------------------------

Reset:
  PAUSE 2250                                    ' let VMUSIC power up
  GOSUB VM_Stop                                 ' stop if playing
  GOSUB VM_Wait_Prompt


' -----[ Program Code ]----------------------------------------------------

Main:
  song = PINS & %00011111                       ' get button(s)
  IF song = %00000000 THEN Main                 ' wait for press

Count_Buttons:
  bCount = 0
  bCount = bCount + BIT0
  bCount = bCount + BIT1
  bCount = bCount + BIT2
  bCount = bCount + BIT3
  IF bCount > 1 THEN Main                       ' no "chords" allowed

  LOOKDOWN song, (%1, %10, %100, %1000), song   ' convert bit to #
  shift = BIT4 * 4                              ' shift = 0 or 4
  song = song + shift                           ' add "shift" input
  eePntr = song * 8                             ' create EE pointer

Play_Song:
  SEROUT TX, Baud, ("VPF ")                     ' send play command
  chNum = 0                                     ' clear character count

Send_Name:                                      ' send file title
  READ eePntr, char                             ' get a character
  IF char = 0 THEN Finish_Cmd                   ' if zero, we're done
  SEROUT TX, Baud, (char)                       ' else send the character
  chNum = chNum + 1                             ' update character count
  IF chNum = 8 THEN Finish_Cmd                  ' abort on max length
  eePntr = eePntr + 1                           ' point to next character
  GOTO Send_Name

Finish_Cmd:
  SEROUT TX, Baud, (".MP3", 13)                 ' send extention + CR

  GOSUB VM_Wait_Start                           ' let song start
  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

VM_Stop:
  SEROUT TX, Baud, ("VST", 13)
  RETURN

' -------------------------------------------------------------------------

VM_Wait_Prompt:
  SERIN RX, Baud, (">")
  RETURN

' -------------------------------------------------------------------------

VM_Wait_Start:
  SERIN RX, Baud, ("T $")
  RETURN


' -----[ User Data ]-------------------------------------------------------

' Use file name only -- must be eight or fewer characters and followed
' by zero.  Do not change EEPROM address setting for any line.

Song_List:
  EEPROM $00, ("firefly", 0)
  EEPROM $08, ("serenity", 0)
  EEPROM $10, ("spalding", 0)
  EEPROM $18, ("file4", 0)
  EEPROM $20, ("file5", 0)
  EEPROM $28, ("file6", 0)
  EEPROM $30, ("file5", 0)
  EEPROM $38, ("file6", 0)
Jon McPhalen
EFX-TEK Hollywood Office

tugman

Sorry Jon, I had no way of knowing you were out of town.  I will work on this and thanks.

tugman

Jon, gotta a question.  Check out this link and let me know if I need to do these things to make the prop1 work with vmusic2 and your program?

http://us.mc01g.mail.yahoo.com/mc/showMessage?pSize=25&sMid=3&fid=Inbox&sort=date&order=down&startMid=0&filterBy=&.rand=664346990&midIndex=3&mid=1_1344_ANRgk0UAAObvSdniMQEATn82IOI&m=1_7505_ANhgk0UAAXLRSeEfSgquxFWQ3W0,1_159_ANZgk0UAAGsTSdnnIgrDTyaWBuE,1_748_ANhgk0UAAGy%2BSdnm6QVhknLXDy4,1_1344_ANRgk0UAAObvSdniMQEATn82IOI,1_2210_ANZgk0UAAIjKSdVWRwRH5VOAXYM,1_2688_ANhgk0UAAHQPSdPvTwg6nxKwzho,

JonnyMac

Got an answer: a) I don't go chasing external links on systems I'm not a part of, b) if it's not DIRECTLY part of this thread then start a new one with the pertinent information.  We're getting into season and I am crazy militant about keeping these forums clean.  Part of that means one topic per thread, and you (the user) are not a topic.  Please don't make me explain our forum guidelines to you again.
Jon McPhalen
EFX-TEK Hollywood Office

ScaryTinker

Can you provide the part number of appropriate diodes for the setup?

JonnyMac

1N4148 -- you can even get them at RadioShack (sometimes called 1N914).
Jon McPhalen
EFX-TEK Hollywood Office

tugman

Jon, I have this wired up but when I try to load the program it scans then gives me an error that says "no basic stamps found"

JonnyMac

Do you have power to the Prop-1?
Is the Prop-1 turned on?
Do you have the BS1 Serial Adapter plugged in correctly (as in docs )? -- writing down
If USB, did you install the USB driver? (there is a link on the BS1 page to Parallax who maintains the driver)
Jon McPhalen
EFX-TEK Hollywood Office

tugman

Yes, the power is on I have downloaded the usb driver.  The one thing I'm not sure about is your statement of
(writing down If USB) I don't know what that means- so that may be the problem.

BigRez

April 14, 2009, 09:24:33 AM #11 Last Edit: April 14, 2009, 09:26:20 AM by bigrez
"writing down" means the printing on the BS1 serial adapter should be facing down when plugged into the Prop-1

tugman

Thanks for the reply bigrez.  I checked it and I have that (the writing down) correct also.  It may be my USB to serial converter.  It's not from parallax.  I did use it on an avr project and it worked fine.  Guess I'll get one from parallax and try it.  I've tried everything else I can think of.

JonnyMac

The AVR only needs TX and RX which your adapter is providing; BASIC Stamps need another pin which most USB adapters don't pass through -- this is why Parallax went through the trouble of creating their own adapter; it's cheaper, too!  We carry it in our store as well.
Jon McPhalen
EFX-TEK Hollywood Office

tugman

That's great to know and yes I have ordered it from your company along with several other things.
That's the least I can do for all your help.