June 01, 2024, 01:25:49 AM

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.


Cutting pins and eeprom full

Started by spookylake, September 29, 2007, 10:45:46 PM

Previous topic - Next topic

spookylake

What causes an EEPROM full error?

Also, i am using the Prop-1 with:

PIR trigger on pin 6
DC-16 on pin 7
UMP3 Player (will be on pin4 and pin5)

which pins do i have to clip off?

I ran the DC-16 test program and it works perfectly.  When I get my program however i get an eeprom error on testing........what is and eeprom error?


I'll include the program just for giggles:
' =========================================================================
'
'   File....... Halloween 2007.BS1
'   Purpose.... Control Prop1, UMP3, DC-16, SSR, Servo Board
'   Author..... Tony Shutters
'   E-mail..... shadow@spookylake.com
'   Started.... 13 Aug, 2007
'   Updated....
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Program sets all pins to neutral
' program will wait for trigger
' Prop is activated with a PIR sensor
' Bells sound clip will play
' O clip will begin
' Coffin lid will open
' Prop will sit up and turn toward crowd
' Organ sound clip will end
' Skull servo board will begin to play show
' Organ sound clip will begin
' Prop will turn back forward and lay down
' Coffin lid will close
' Program will pause for 5 minutes
' Show will begin again

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


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

SYMBOL Sio = 7

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


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


' -----[ EEPROM Data ]-----------------------------------------------------


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

Reset:
  PINS = %00000000
  DIRS = %10111111
  DEBUG "Allowing PIR to stabilize ", CR
'  PAUSE 30000                                                     ' let PIR stabilize

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

Main:

'  Beginning program sequence
  PAUSE 1000
'
  GOSUB DC16Reset
'
  DEBUG "Waiting for trigger",CR , CR
'  IF PIN6 = 0 THEN main
  SEROUT Sio, OT2400, ("!DC16", %11, "H", %10000000)              ' turn on backlight
'
  DEBUG "Playing Bells Sound From UMP3" ,CR
  GOSUB BellsSound
'
'  PAUSE 10000                                                    ' allow for bells to finish
'
  DEBUG "Opening Coffin Lid" ,CR
  GOSUB OpenLid
'
'  GOSUB OZZYSOUND
'
  GOSUB OpenLid
  PAUSE 28000
'                                                                 ' let lid open completely
  GOSUB PropUp
'
'  GOSUB SkullShow                                                 ' initiate the Cowlacious skull show

'
  PAUSE 3000
'
'  GOSUB ORGANSOUND
  DEBUG "LOWER BUCKY PROP" ,CR
  GOSUB PropDown                                                  ' lower the prop
'
  DEBUG "Closing Coffin Lid" ,CR
  GOSUB CloseLid                                                  ' Close the coffin lid
  LOW 1
'
  GOSUB DC16Reset
  PAUSE 300000
  GOTO Main



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

OpenLid:
  SEROUT Sio, OT2400, ("!DC16", %11, "P", 1, 1)                   ' Lid open on DC-9
  RETURN                                                          ' return to caller

CloseLid:
  SEROUT Sio, OT2400, ("!DC16", %11, "P", 1, 0)                   ' Lid Close DC-01
  PAUSE 28500                                                     ' pause 25 seconds to let lid close
  RETURN

SkullShow:
SEROUT Sio, OT2400, ("!DC16", %11, "P", 16, 1)                   ' activate Cowlacious card on DC-5 & blacklight
PAUSE 57000
SEROUT Sio, OT2400, ("!DC16", %11, "P", 16, 0)                   ' de-activate Cowlacious card on DC-5
RETURN                                                           ' return to caller

BellsSound:
SEROUT Sio, OT2400, ("!DC16", %11, "H", %00000001)               ' turn on backlight DC-09
RETURN                                                           ' return to caller

PropUp:
SEROUT Sio, OT2400, ("!DC16", %11, "S", %00000011, %01000000)    ' prop lifting relay on DC-02 & turn on strobe on DC-15
PAUSE 14000                                                      ' pause 12 seconds while prop rises
SEROUT Sio, OT2400, ("!DC16", %11, "S", %00000111, %01000000)    ' turn prop to crowd
PAUSE 3000                                                       ' pause till music finishes
SEROUT Sio, OT2400, ("!DC16", %11, "H", %10000000)               ' turn off strobe and turn on backlight
RETURN

PropDown:
SEROUT Sio, OT2400, ("!DC16", %11, "H", %01000010)               ' turn on strobe and turn off backlight
SEROUT Sio, OT2400, ("!DC16", %11, "L", %00000011)               ' hold arm in, turn back forward
PAUSE 14000                                                      ' pause while prop turns staight
'SEROUT Sio, OT2400, ("!DC16", %11, "S", %00000001, %10000000)    ' lay prop down
PAUSE 15000                                                      ' pause till music finishes and prop lays down
RETURN

DC16Reset:
  SEROUT Sio, OT2400, ("!DC16", %11, "X")
  RETURN

JonnyMac

September 30, 2007, 12:05:01 AM #1 Last Edit: September 30, 2007, 12:06:45 AM by JonnyMac
You ever notice how when you keep putting coffee into a cup and that if you don't stop the coffee eventually spills out and all over the counter?  You've just filled the program with too much stuff (especially redundant SEROUT instructions to the DC16 which can be minimized).  The Prop-1 is VERY small and you may not be able to fit this all in -- especially since you want to use the uMP3 as well an that takes a chunk of code to deal with.  It's very late and I was out all day, but I will try to squeeze your program into the Prop-1.

No promises, though, and you may want to think about ordering a Prop-2 (which has 8x the memory of the Prop-1).
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

Have a look at this program -- it uses a lot of efficiency techniques to fit everything (I may have missed a few bits, so check carefully).  Keep in mind that DEBUG statements are going to chew up memory so don't use them, and if you must, do it one at a time.  There is a tiny amount of memory left -- be careful with it.  Study how I designed the program.  Note, though, that the BS1 limits GOSUBs to 16, and there are already 13 in use -- the editor will balk if you add too many more.

' =========================================================================
'
'   File......
'   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 ]---------------------------------------------


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  PIR             = PIN6                  ' SETUP = DN
SYMBOL  TX              = 5
SYMBOL  RX              = 4


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

SYMBOL  Baud            = OT2400

SYMBOL  Yes             = 1
SYMBOL  No              = 0

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

SYMBOL  IsOpen          = 1
SYMBOL  IsClosed        = 0


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

SYMBOL  dc16            = W0                    ' B0 and B1
SYMBOL  dc16Lo          = B0
SYMBOL   lid            = BIT0
SYMBOL  dc16Hi          = B1
SYMBOL   backlight      = BIT8
SYMBOL   cowSound       = BIT15

SYMBOL  timer           = B2
SYMBOL  theMP3          = B3
SYMBOL  eePntr          = B4
SYMBOL  char            = B5


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

Reset:
  PINS = %00000000
  DIRS = %00000000

  dc16 = %0000000000000000
  GOSUB Set_DC16
  PAUSE 30000


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

Main:
  PAUSE 10
  timer = timer + 10 * PIR
  IF timer < 250 THEN Main

  PAUSE 1000
  backlight = IsOn
  GOSUB Set_DC16

  theMP3 = 0
  GOSUB Play_MP3
  PAUSE 10000

  lid = IsOpen
  GOSUB Set_DC16
  PAUSE 28000

Prop_Up:
  dc16 = %0100000000000011
  GOSUB Set_DC16
  PAUSE 14000
  dc16 = %0100000000000111
  GOSUB Set_DC16
  PAUSE 3000
  backlight = IsOn
  GOSUB Set_DC16

Skull_Show:
  cowSound = IsOn                               ' bad idea -- use local I/O
  GOSUB Set_DC16
  PAUSE 57000
  cowSound = IsOff
  GOSUB Set_DC16
  PAUSE 3000

  theMP3 = 2                                    ' organ
  GOSUB Play_MP3

Prop_Down:
  dc16 = %0100001000000011
  GOSUB Set_DC16
  PAUSE 14000
  dc16 = %1000000000000001
  GOSUB Set_DC16
  PAUSE 15000

Close_Lid:
  lid = IsClosed
  GOSUB Set_DC16
  PAUSE 28500

  GOTO Reset


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

Set_DC16:
  SEROUT Sio, Baud, ("!DC16", %11, "S", dc16Lo, dc16Hi)
  RETURN

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

' Put file # to play in "theMP3"
' -- add starting location(s) of file names manually

Play_MP3:
  LOOKUP theMP3, (0, 6, 11), eePntr

Send_Cmd:
  SEROUT TX, Baud, ("PC F /")                   ' start play command

Send_Name:                                      ' send file title
  READ eePntr, char
  eePntr = eePntr + 1
  IF char = 0 THEN Finish_Cmd
    SEROUT TX, Baud, (char)
    GOTO Send_Name

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

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


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


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


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


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


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

Audio_Files:
  EEPROM ("bells", 0)                           ' bells.mp3 in uMP3
  EEPROM ("ozzy", 0)                            ' ozzy.mp3
  EEPROM ("organ", 0)                           ' organ.mp3
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

September 30, 2007, 10:30:30 AM #3 Last Edit: September 30, 2007, 10:36:57 AM by JonnyMac
Here's another approach; this is an advanced sequencer engine -- that you have to program manually.  The framework is complete, but the show data is not completely filled out because, frankly, I'm confused as to what is mapped to what.  This program nearly fills the memory, but you may not need all of the show records that I've padded into the listing.

Note how the high bit of the "local" data field is used to set the end of the show.


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


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  PIR             = PIN6                  ' SETUP = DN
SYMBOL  TX              = 5
SYMBOL  RX              = 4


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

SYMBOL  Baud            = OT2400

SYMBOL  Yes             = 1
SYMBOL  No              = 0

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

SYMBOL  IsOpen          = 1
SYMBOL  IsClosed        = 0

SYMBOL  ShowStart       = $11                   ' start of show data


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

SYMBOL  showPntr        = B0                    ' pointer to show data
SYMBOL  local           = B1                    ' local outputs (P0..P3)
SYMBOL   showDone       = BIT15                 ' high bit of local data
SYMBOL  dc16Lo          = B2
SYMBOL  dc16Hi          = B3
SYMBOL  sfx             = B4
SYMBOL  tix             = B5
SYMBOL  chrPntr         = B6
SYMBOL  char            = B7


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

StartUp:
  PAUSE 2000                                    ' let uMP3 start

Prod_uMP3:
  SEROUT TX, Baud, (13)                         ' send CR
  SERIN  RX, Baud, char                         ' get response
  IF char <> ">" THEN Prod_uMP3                 ' wait for ">"

Reset:
  DIRS = %00001111
  PAUSE 30000                                   ' PIR delay
  tix = 0                                       ' clear for PIR timing


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

Main:
  PAUSE 10
  tix = tix + 10 * PIR
  IF tix < 250 THEN Main                        ' wait for valid PIR

  showPntr = ShowStart                          ' point to start of show

Get_Record:                                     ' read show record
  READ showPntr, local
  showPntr = showPntr + 1
  READ showPntr, dc16Hi
  showPntr = showPntr + 1
  READ showPntr, dc16Lo
  showPntr = showPntr + 1
  READ showPntr, sfx
  showPntr = showPntr + 1
  READ showPntr, tix
  showPntr = showPntr + 1

Update_Outputs:
  PINS = local & %00001111
  SEROUT Sio, Baud, ("!DC16", %11, "S", dc16Lo, dc16Hi)

Check_Audio:
  IF sfx = 99 THEN Run_Timer                    ' run uMP3?
    GOSUB Play_MP3                              ' yes

Run_Timer:
  IF tix = 0 THEN Check_Show_Done               ' time left
    PAUSE 1000                                  ' hold one second
    tix = tix - 1                               ' update timer
    GOTO Run_Timer                              ' check again

Check_Show_Done:
  IF showDone = Yes THEN Reset                  ' show finished?
    GOTO Get_Record                             ' no, keep going


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

' Put file # to play in "theMP3"
' -- add starting location(s) of file names manually

Play_MP3:
  LOOKUP sfx, (0, 6, 11), chrPntr

Send_Cmd:
  SEROUT TX, Baud, ("PC F /")                   ' start play command

Send_Name:                                      ' send file title
  READ chrPntr, char
  chrPntr = chrPntr + 1
  IF char = 0 THEN Finish_Cmd
    SEROUT TX, Baud, (char)
    GOTO Send_Name

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


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

Audio_Files:
  EEPROM ("bells", 0)                           ' bells.mp3 in uMP3
  EEPROM ("ozzy", 0)                            ' ozzy.mp3
  EEPROM ("organ", 0)                           ' organ.mp3


'          local      DC-16 H    DC-16 L   sfx  tix
'
Show:
  EEPROM (%00000000, %00000000, %00000000,  99,   1)  ' 1 sec delay

  EEPROM (%00000000, %10000000, %00000000,   0,  10)  ' backlight, 10s

  EEPROM (%00000000, %00000000, %00000001,   1,  28)  ' coffin lid

  EEPROM (%00000000, %01000000, %00000011,  99,  14)  ' prop up
  EEPROM (%00000000, %01000000, %00000111,  99,   3)
  EEPROM (%00000000, %10000000, %00000111,  99,   0)

  ' rest of show here

  EEPROM (%00000000, %00000000, %00000000,  99,   0)
  EEPROM (%00000000, %00000000, %00000000,  99,   0)
  EEPROM (%00000000, %00000000, %00000000,  99,   0)
  EEPROM (%00000000, %00000000, %00000000,  99,   0)
  EEPROM (%00000000, %00000000, %00000000,  99,   0)
  EEPROM (%00000000, %00000000, %00000000,  99,   0)
  EEPROM (%00000000, %00000000, %00000000,  99,   0)
  EEPROM (%00000000, %00000000, %00000000,  99,   0)

  ' I/O clean-up / end-of-show marker

  EEPROM (%10000000, %00000000, %00000000,  99,   0)


Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

Just another note: Your final record -- the one with the high bit of "local" set -- should clear all I/O pins or put them into the default state of your choice.  The Reset section of the program doesn't clear I/O pins.
Jon McPhalen
EFX-TEK Hollywood Office

spookylake

I've wired the boards together.
I have the PIR connected to the prop-1 on pin #6....I cut the pin off of the 2803 chip for position #6
I have the DC-16 wired from the serial pin connection to the prop-1 pin 7....I cut the pin off of the 2803 chip for position #7
I have the UMP3 plugged into the Prop-1 using pins 4 and 5...I cut the pins off of the 2803 for position #4 & 5.  The UMP3 pulls power from the Prop-1 just as your instructions in a previous posting.

The PIR is triggering perfectly
The DC-16 is triggering the pneumatic solenoid valves perfectly.
I'm having fits with the UMP3.  It will pull the first song that is listed in the "user data" fine but getting it to pull any other file is touch and go. 

I made a really generic program:

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


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


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


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

SYMBOL  TX              = 5
SYMBOL  RX              = 4


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

SYMBOL  Baud            = OT2400

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

SYMBOL  theMP3          = B3
SYMBOL  eePntr          = B4
SYMBOL  char            = B5


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

Reset:
  PINS = %00000000
  DIRS = %00000000

  PAUSE 10000


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

Main:
  theMP3 = 0
  GOSUB Play_MP3
  PAUSE 15000

  theMP3 = 1
  GOSUB Play_MP3
  PAUSE 15000

  theMP3 = 2
  GOSUB Play_MP3
  PAUSE 15000

  GOTO Reset


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

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

' Put file # to play in "theMP3"
' -- add starting location(s) of file names manually

Play_MP3:
  LOOKUP theMP3, (0, 6, 11), eePntr

Send_Cmd:
  SEROUT TX, Baud, ("PC F /")                   ' start play command

Send_Name:                                      ' send file title
  READ eePntr, char
  eePntr = eePntr + 1
  IF char = 0 THEN Finish_Cmd
    SEROUT TX, Baud, (char)
    GOTO Send_Name

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

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

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

Audio_Files:
  EEPROM ("bells", 0)                           ' file #0
  EEPROM ("ozzy-short", 0)                      ' file #1
  EEPROM ("organ", 0)                           ' file #2

When you run this program it plays "bells" first then "ozzy".....but "organ" never plays.  It just sits through the pause and starts over.


If you change the "Main:" of the program to look like the following:
Main:
  theMP3 = 2
  GOSUB Play_MP3
  PAUSE 15000

  theMP3 = 1
  GOSUB Play_MP3
  PAUSE 15000

  theMP3 = 0
  GOSUB Play_MP3
  PAUSE 15000

  GOTO Reset

It still will not play "organ"...it will pause, play "ozzy" then "bells"

Now, change the "User Data" order of the songs to:

Audio_Files:
  EEPROM ("organ", 0)                           ' file #0
  EEPROM ("ozzy-short", 0)                      ' file #1
  EEPROM ("bells", 0)                           ' file #2

With this song order and the main playing 2, 1 then 0 ........you get a pause, "ozzy" then organ.

So, I can play songs in positions 0 and 1 but any position number of 2 and above doesn't play..........? any ideas?

JonnyMac

You're having problems because you didn't update the LOOKUP table of song address values.  With these song names:

Audio_Files:
  EEPROM ("organ", 0)                           ' file #0
  EEPROM ("ozzy-short", 0)                      ' file #1
  EEPROM ("bells", 0)                           ' file #2


"organ" is at address 0
"ozzy-short" is at address 6
"bells" is at address 17

... so change the lookup table in the Play_MP3 subroutine to:

Play_MP3:
  LOOKUP theMP3, (0, 6, 17), eePntr


I wrote about the process of manually mapping the song title addresses in a LOOKUP table in this thread:
-- http://www.efx-tek.com/php/smf/index.php?topic=39.0
Jon McPhalen
EFX-TEK Hollywood Office