November 22, 2024, 09:25:45 AM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


Can I read a program from a Prop-1?

Started by SpookyDad, October 25, 2007, 07:02:05 PM

Previous topic - Next topic

SpookyDad

I have a halloween controller box I built for '05. I can't find the source code files at all.
The program is still in the prop-1 and I was wondering if I can read the program back into the editor from the Prop-1.

It uses a uMP3, and several relays.

Jon sent me a revised version of my program but that was 2 years ago on the old Parallax forums.

JonnyMac

Sorry, no.  The source file is converted to PBASIC tokens before downloading, and even if there was a token "decompiler" (there isn't, the token structure is information that Parallax holds in very strict confidence), there is no way for the IDE (BASIC Stamp editor) to pull the EEPROM image from the device.  When you do a Memory Map function in the IDE, you're actually seeing what the EE memory will look like after programming, not as it presently stands.

So... get a pad of paper, a stop watch, and something to drink.  You may be able to watch the program enough that with the [old] information you have you can reverse engineer it.  And, frankly, sometimes it's better to start over -- though a week from Halloween may not be the best time to do so.  ;)
Jon McPhalen
EFX-TEK Hollywood Office

SpookyDad

I am not looking to recreate that exact program. I just wanted the code as a basis for writing a new program.
The program is quite simple but I remember getting the uMP3 player working was a fair bit of code.
I am not that strong of a programmer but I can usually modify a working program to get what I need.

Vern Graner was helping me and had a good program to handle all the niceties of the uMP3 player.

I realize it is an extreme long shot but do you archive the programs you send to people?

SpookyDad

JonnyMac

If I wrote it, I probably have a copy of it.  What is the program called?

If you check the Completed Projects forum you'll see that I had a go with a uMP3 today and have learned a few new tricks dealing with it.  Some of those tricks I can thank Vern for as he forces the Rogue guys to reveal technical details about the product in their forums (like the small serial buffer that is easily overrun by prop programs).
Jon McPhalen
EFX-TEK Hollywood Office

SpookyDad

I don't know what the actual file was called. It was a control box for a pop-up skelly.
The picture is here: http://s13.photobucket.com/albums/a273/SpookyDad/Control%20Box/?action=view&current=controllerbox1.jpg

I realize it is an extreme longshot and I am not giving you much to go on, so don't waste much time looking for it.

You would likely have sent it to SpookyDad@gmail.com

Neil


JonnyMac

I've got hundreds of BS1 programs on my computer, and without more specifics I think it would be faster for me to write a new program than try to find the old one -- if I even have it.  We don't have the old Parallax EFX forums (the Parallax IT guys slimed us on that one), I don't have any records of Parallax e-mail, and EFX-TEK e-mail I only keep around for about six months.

So... why don't you tell me what you want it to do and I'll write a new program; it will probably be better than the first one.
Jon McPhalen
EFX-TEK Hollywood Office

SpookyDad

Ok here goes...

It would appear the uMP3 board is set up in 8 switch mode. There are 2 wires hooked up to pins 1 and 2 on the uMP3 board.
These, when triggered, play files "B0000.mp3" and B0001.mp3".

The prop-1 has :

' **************************************************************
' * Pin Configuration:
' * Pin 7- N.O. pushbutton to ground (pulled high)
' * Pin 6- Red LED
' * Pin 5- Fogger
' * Pin 4- Upper Relay (Light Plug)
' * Pin 3- Lower Relay (Air Cannon Plug)
' * Pin 2- Green LED
' * Pin 1- uMP3 Play file B0001.mp3
' * Pin 0- uMP3 Play file B0000.mp3
' **************************************************************

I would like it to repeat the first sound file (ambient sound) while waiting for a trigger on pin7
Turn on the Green LED (Pin 2) to let the actor know it is going to trigger.
Wait 2 seconds
Turn on the Light (Pin 4)
Play the second sound (interupting the ambient)
Wait 3 seconds
Turn on the Air Cannon (Pin3)
Wait 1/2 a second
Turn off the Air Cannon (Pin3)
Wait 2 seconds
Turn off the light. (Pin 4)
Turn off the Green LED (Pin 2)
Go back to playing the first sound file.


Thanks for your help.

Neil

JonnyMac

Do you have the ability to reconfigure the uMP3?  If yes, let me suggest serial mode.  It uses just two wires and gives full control over the uMP3.  Also, what is this prop called or what does it do? ( Knowing that I can give it an appropriate name so I can find it two years from now  :D )
Jon McPhalen
EFX-TEK Hollywood Office

SpookyDad

If I remember correctly, I would have to set up a homework board. I have several but it has been quite
a while since I have worked with one. If there is another way, please let me know.

Neil

JonnyMac

We'll, here's a version that matches your description, but as I've never used the parallel input bits I don't know if it will continue to loop your ambient audio.  Note, too, that those inputs on the uMP3 have weak pull-ups and the ULN acts as a weak pull-down, so I suggest clipping pins 7 (P1) and 8 (P0) from the ULN.  This thread has a diagram of the ULN that you can use as a guide.

http://www.efx-tek.com/php/smf/index.php?topic=130.0

And here's the program:

' =========================================================================
'
'   File...... SpookyDad_EZ.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2007 EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Recommend clipping pins 7 (for P1) and 8 (for P0) of the ULN as the uMP3
' as weak pull-ups on digital inputs and the ULN acts as a pull down.


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


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

SYMBOL  Trigger         = PIN7                  ' SETUP = DN
SYMBOL  RedLed          = PIN6                  ' no SETUP
SYMBOL  Fogger          = PIN5
SYMBOL  Light           = PIN4
SYMBOL  Canon           = PIN3
SYMBOL  GreenLed        = PIN2
SYMBOL  Audio           = 1
SYMBOL  Ambient         = 0


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

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


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

SYMBOL  timer           = B2                    ' for debouncing


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

Power_Up:
  PAUSE 2000                                    ' let uMP3 start

Reset:
  PINS = %00000000                              ' clear outputs
  DIRS = %01111100                              ' config output pins

  PAUSE 10                                      ' let switches clear
  LOW Ambient                                   ' start bkg audio

  timer = 0                                     ' clear for trigger


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

Main:
  PAUSE 10
  timer = timer + 10 * Trigger                  ' update trigger timer
  IF timer < 250 THEN Main                      ' wait for valid signal

  GreenLed = IsOn
  PAUSE 2000

  Light = IsOn

  INPUT Ambient                                 ' release bkg
  PAUSE 10
  LOW Audio                                     ' start prop audio
  PAUSE 3000

  Canon = IsOn
  PAUSE 500

  Light = IsOff
  GreenLed = IsOff

  INPUT Audio                                   ' stop audio

  GOTO Reset


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


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


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

I use the Parallax USB2SER for configuring the uMP3.  You can read about that in this article I wrote a while ago:
-- http://www.parallax.com/dl/docs/cols/nv/vol6/col/nv128.pdf
Jon McPhalen
EFX-TEK Hollywood Office

menehune

One tip:  When I build controllers and props, I printout the program and tape it into the case under the controller.  Then if the prop is sent back for updates, repairs, etc., I don't have to search for the source code.

SpookyDad

I wrote this program last night. It works a little wierd but it does work.
While the program is being downloaded, the ambient sound plays.
The first time through, the Ambient sound doesn't play but the roar does.
From then on, the Ambient sound plays after the trigger and then the roar plays correctly.

I switched out the 2803 for the shorter 2003 from my prop-1 trainer (not installed)
There doesn't seem to be any difference in the performance.

I don't know how to keep repeating the ambient while monitoring the trigger.
If I play the Ambient Sound then issue a pause XXXX until it finishes, then I will only be able to
trigger the main action is at the very end of the ambient sound.

Here is what I have right now

' {$STAMP BS1}
' {$PBASIC 1.0}\

' **************************************************************
' * Pop-up Skelly using the uMP3 for sound
' *
' * by Neil Gillbanks
' *
' * October 25, 2007
' *
' **************************************************************
'
' **************************************************************
' * Pin Configuration:
' * Pin 7- N.O. pushbutton to ground (pulled high)
' * Pin 6- Red LED
' * Pin 5- Fogger
' * Pin 4- Upper Relay (Plug)
' * Pin 3- Lower Relay (Plug)
' * Pin 2- Green LED
' * Pin 1- uMP3 Play file B0001.mp3
' * Pin 0- uMP3 Play file B0000.mp3
' **************************************************************

' *******************************
' * I/O Definitions             *
' *******************************
   SYMBOL LED = 2
   SYMBOL Light = 4
   SYMBOL AirCannon = 3
   SYMBOL Trigger = PIN7
   SYMBOL No = 0
   SYMBOL Ambient = PIN0
   SYMBOL Roar = PIN1

' *******************************
' * Main Program                *
' *******************************

HIGH Ambient
HIGH Roar
LOW LED
LOW Light
LOW AirCannon

MainLoop:

  IF Trigger = No THEN MainLoop
  DEBUG "Play Ambient Sound" , CR
  LOW Ambient
  DEBUG "Turn on LED" , CR
  HIGH LED
  PAUSE 5000
  DEBUG "Turn on Light" , CR
  HIGH Light
  DEBUG "Play Roar Sound" , CR
  LOW Roar
  PAUSE 3000
  DEBUG "Turn on Air Cannon" , CR
  HIGH AirCannon
  PAUSE 500
  DEBUG "Turn off Air Cannon" , CR
  LOW AirCannon
  DEBUG "Turn off Light" , CR
  LOW Light
  DEBUG "Turn off LED" , CR
  LOW LED
  PAUSE 2000
  HIGH Roar
  HIGH Ambient

GOTO MainLoop

JonnyMac

October 26, 2007, 09:45:38 AM #13 Last Edit: October 26, 2007, 09:47:18 AM by JonnyMac
Again, you're using P0 and P1 for uMP3 control, and the ULN2x03 has weak pull-downs on its inputs.  I would suggest that you clip the pins associated with P0 and P1 so that the ULN is not in play -- and changing from the 2803 to the 2003 made no difference because you're not using P7 for the uMP3.

The reason that I prefer serial control of the uMP3 is that you can tell it to go into looping mode with one command.  You would have to do some reconfiguration of your uMP3 to use this feature, but it might just be worth it.
Jon McPhalen
EFX-TEK Hollywood Office

SpookyDad

I have reconfigured the Prop-1

Pin 7 now has the trigger for the uMP3. I am using (R & B pins to provide power to the uMP3)
Pin 6 is now the trigger
Pin 0 is the Red LED (Not Used currently)

How do I make the change to serial mode?

Can I use the serial to Prop-1 adapter on the uMP3 Tx RX connnectors directly?
I need to reconfigure the mode of the uMP3.

Neil