November 22, 2024, 09:13:32 PM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


VMUSIC Demo Program for Prop-2 -- Use This First!

Started by JonnyMac, May 28, 2009, 12:21:49 PM

Previous topic - Next topic

JonnyMac

May 28, 2009, 12:21:49 PM Last Edit: May 28, 2009, 12:25:37 PM by JonnyMac
As the VMUSIC has shown itself to be mostly... well, junk! -- I suggest that you start with this program to get it going; once the VMUSIC part is working then you can add in triggering and control features.

IMPORTANT: You must change the file names at the end of the listing to match what you have on your media!  Also, the file name must be no longer than eight characters.  You don't need to add ".mp3" in the names list as the code does that for you.

Pay very close attention to the connections: P15 (RX on the Prop-2) connects to the TX pin of the VMUSIC (think ear [RX] to mouth [TX]), and P14 (TX on the Prop-2) connects to the RX pin of the VMUSIC (think mouth [TX] to ear [RX]).  The pins of the ULN that correspond to P15 and P14 must be removed.  The P15 and P14 SETUP jumpers must be in the UP position.

I'm really sorry I ever recommended the VMUSIC because it has turned out to be a big mess for so many of our loyal customers -- okay, two customers, but that's two too many for us!

Updated and re-tested: 28 MAY 2009 (this code works if connected correctly to Prop-2)

' =========================================================================
'
'   File...... VMusic.BS2
'   Purpose...
'   Author.... Jon Williams, EFX-TEK (www.efx-tek.com)
'   E-mail.... jwilliams@efx-tek.com
'              Copyright (c) 2008-2009 EFX-TEK
'              Some Rights Reserved
'              see: http://creativecommons.org/licenses/by/3.0/us/
'   Started...
'   Updated... 28 MAY 2009
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Demo for VMUSIC2 player
' -- P15 and P14 SETUP jumpers need to be in the UP position
' -- clip pins 1 and 2 from ULN2803, or pin 1 from the ULN2003
' -- use P13 for Sio (no ULN, SETUP = UP) to EFX-TEK accessories
' -- use P12 for (active-high) trigger (SETUP = DN)


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


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

RX              PIN     15                      ' no ULN / SETUP = UP
TX              PIN     14                      ' no ULN / SETUP = UP
Sio             PIN     13                      ' no ULN / SETUP = UP
Trigger         PIN     12                      ' SETUP = DN


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

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

Yes             CON     1
No              CON     0

VolMax          CON     $00
VolMin          CON     $FE

T2400           CON     396
T9600           CON     84
T19K2           CON     32
T38K4           CON     6

SevenBit        CON     $2000
Inverted        CON     $4000
Open            CON     $8000
Baud            CON     Open + T38K4            ' fast baud for EFX-TEK


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

idx             VAR     Byte                    ' loop controller
theMP3          VAR     Byte                    ' MP3 file pointer
char            VAR     Byte                    ' character value
eePntr          VAR     Word                    ' EEPROM memory pointer

mute            VAR     Byte

panCtrl         VAR     Word
muteLeft       VAR     panCtrl.BYTE0
muteRight      VAR     panCtrl.BYTE1


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

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


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

Main:
  DEBUG CLS, "Playing FIREFLY.MP3", CR
  theMP3 = 0
  GOSUB VM_Play
  GOSUB VM_Wait_Start
  DEBUG "-- file started", CR

  PAUSE 5000
  mute = 25
  GOSUB VM_Mute
  GOSUB VM_Wait_Prompt
  DEBUG "-- volume level reduced", CR

  GOSUB VM_Wait_Prompt
  DEBUG "-- ready for new song", CR

  mute = VolMax                                 ' restore full volume
  GOSUB VM_Mute
  GOSUB VM_Wait_Prompt
  DEBUG "-- volume reset to max", CR, CR

  DEBUG "Playing SERENITY.MP3", CR
  theMP3 = 1
  GOSUB VM_Play
  GOSUB VM_Wait_Start
  DEBUG "-- file started", CR, CR

  GOSUB VM_Wait_Prompt
  DEBUG "VMUSIC demo done", CR, CR

  PAUSE 5000
  GOTO Main

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

VM_Wait_Prompt:
  SERIN RX, Baud, [WAIT(">")]
  RETURN

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

' Pass file # (index in DATA table) to play in "theMP3"

VM_Play:
  SEROUT TX, Baud, ["VPF "]
  GOTO Play_MP3

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

' Pass file # (index in DATA table) to play in "theMP3"

VM_Repeat:
  SEROUT TX, Baud, ["VRF "]

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

' Pass file # (index in DATA table) to play in "theMP3"

Play_MP3:
  eePntr = (8 * theMP3) + Song_List

Send_Name:                                      ' send file title
  FOR idx = 1 TO 8                              ' max is 8 characters
    READ eePntr, char                           ' get a character
    IF char = 0 THEN Finish_Cmd                 ' if 0, we're at end
    SEROUT TX, Baud, [char]
    eePntr = eePntr + 1
  NEXT

Finish_Cmd:
  SEROUT TX, Baud, [".MP3", CR]                 ' send extention + CR
  RETURN

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

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

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

VM_Stop:
  SEROUT TX, Baud, ["VST", CR]
  RETURN

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

' Pass mute level (0 = loudest, 254 = muted) in "mute"

VM_Mute:
  mute = mute MAX VolMin                        ' limit per spec

  ' copy to pan register for future use

  muteLeft = mute
  muteRight = mute

  SEROUT TX, Baud, ["VSV ", DEC mute, CR]
  RETURN

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

' Pass levels (0 = loudest, 254 = muted) in "muteLeft" and "muteRight"
'
' NOTE: The VPF/VRF commands seems to reset volume levels so you must use
'       a pan command while the file is playing for it to work.
'
' NOTE: Over-use can result is unwanted audio "clicks" and "pops"

VM_Pan:
  muteLeft = muteLeft MAX $FE                     ' limit per spec
  muteRight = muteRight MAX $FE

  SEROUT TX, Baud, ["VWR $0B", HEX4 panCtrl, CR]
  RETURN


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

' File names are stored on 8-byte boundaries -- this is very important for
' correct program operation.  This strategy uses a little more EE space but
' is easier to update and maintain

Song_List       DATA    @$00, "firefly"         ' theMP3 = 0
                DATA    @$08, "serenity"        ' theMP3 = 1
                DATA    @$10, "fruity"
                DATA    @$18, "angel"
                DATA    @$20, "spalding"
                DATA    @$28, "file5"
                DATA    @$30, "file6"
                DATA    @$38, "file7"
Jon McPhalen
EFX-TEK Hollywood Office

Ryanm0085

hey jon i tried hooking up one of the VMusic players for the first time.  i used ur prop-2 VMusic test and ran it.  the debug window opens but that was it.  so i put some more messages to find out where it was getting held up at VM wait.  i put a message right after the subroutine which i got, then one after the SERIN RX, Baud, [WAIT(">")] but i didnt get anything, so i figured its getting held up here.  i checked the wiring about 300 times and cant find anything wrong.  i didnt hook up anything to P12 or P13 which you said was the trigger and the SIOout.  i didnt see anything in the script for them so i didnt use them.  any ideas what could be wrong

JonnyMac

If the program is getting hung-up at VM_Wait then the Prop-2 is not seeing a response from the VMUSIC.  These are the things that could interfere:

1) Broken wire between P15 and VMUSIC.TX (yellow)
2) Broken wire between ground (black) and VMUSIC.CTS (this allows the VMUSIC to respond)
3) P15 SETUP in DN position (should be UP)
4) Pin 1 of ULN2803 (should be removed, along with pin 2)
Jon McPhalen
EFX-TEK Hollywood Office