November 23, 2024, 05:47:15 PM

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.


Using the Prop-1, an AP-8, and a DC-16 to direct segments to a single speaker

Started by Spooky Dad, August 24, 2008, 07:55:43 PM

Previous topic - Next topic

Spooky Dad

I am playing around with the Prop-1 and an AP-8 for adding sound effects to my haunted house (the rest of the year its a 3-car gargage).  What I would like to do is have four (4) IR sensors placed around the spook house that when a victim is sensed, it would trip both a output on the Prop-1 for powering a device (motor, relay, solenoid), but also ONLY make the appropriate connection for the speaker near the PIR, for localizing the sound.  To keep things simple (too late) here is the sequence of the action for each of the four sounds (plus I'd appreciate seeing how to wire the speaker through the output, assuming its the output contact and ground, but wanted confirmation):

- Wait for victim
- PIR #1 senses victim and triggers Prop-1
- Trigger input sets off the following actions
      - Random delay value to keep the victim from identifying the sensor
      - Relay output for the nearest speaker "makes" a connection for 8 seconds
      - AP-8 plays Segment 0 (let's assume its not over the 6.4 seconds)
      - The output for the device (relay, solenoid, motor) is set to high for 8 seconds
      - After 8 seconds, the relays are reset (for the speaker, the connection is broken)
      - Inability to trigger again for 10 seconds

One thing that I thought would also be necessary is to check to see if an audio file was already playing and prevent the new sound from playing until the other was finished.  Thanks!

JonnyMac

I think this will do it.  I uses the Prop-1 as the sensor interface and control of the DC-16 and AP-8, the DC-16 activates two outputs per sensor: one for the speaker relay, the other for whatever you have defined for that sensor.

This is a moderately sophisticated program as far as prop control goes; I encourage you to study it and try to figure out why I did what I did.

' =========================================================================
'
'   File...... Spooky_Dad_4x.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 24 AUG 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN

SYMBOL  PIR4            = PIN3                  ' uses ULN as pull-down
SYMBOL  PIR3            = PIN2
SYMBOL  PIR2            = PIN1
SYMBOL  PIR1            = PIN0


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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400


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

SYMBOL  status          = B0
SYMBOL   playing        =  BIT7

SYMBOL  sensors         = B2
SYMBOL  idx             = B3
SYMBOL  mask            = B4
SYMBOL  ctrlBits        = B5

SYMBOL  delay           = W4
SYMBOL  lottery         = W5


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

Reset:
  SEROUT Sio, Baud, ("!!!!!!AP8", %00, "X")     ' resync and kill sound
  SEROUT Sio, Baud, ("!DC16", %00, "X")


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

Main:
  sensors = %00001111                           ' assume active
  FOR idx = 1 TO 10
    sensors = sensors & PINS                    ' scan PIRs
    PAUSE 10
    RANDOM lottery
  NEXT
  IF sensors = %00000000 THEN Main

Find_Sensor:
  RANDOM lottery                                ' re-stir
  idx = lottery // 4                            ' random, 0 to 3
  LOOKUP idx, (%0001, %0010, %0100, %1000), mask
  mask = sensors & mask                         ' isolate one sensor
  IF mask = %0000 THEN Find_Sensor              ' if not this one, try again

  RANDOM lottery                                ' re-stir
  delay = lottery // 2501 + 500                 ' random, 0.5 to 3 seconds
  PAUSE delay

Activate:
  LOOKUP idx, (%00000011, %00001100, %00110000, %11000000), ctrlBits
  SEROUT Sio, Baud, ("!DC16", %00, "L", ctrlBits)
  PAUSE 100

Start_Audio:
  SEROUT Sio, Baud, ("!AP8", %00, "P", 0)

Audio_Hold:
  PAUSE 100
  SEROUT Sio, Baud, ("!AP8", %00, "G")
  SERIN  Sio, Baud, status
  IF playing = Yes THEN Audio_Hold

  PAUSE 10000                                   ' retrigger delay
  GOTO Main


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


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


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

Spooky Dad

Wow!  That's a turnaround.  Thanks Jonny!  I will be studying this after work tonight and get back to you with any questions.  I can already see that you wrote one set of logic and based upon the sensor that is triggered, identifying through a variable, versus four sets of code.   Very elegant (even if I don't understand it all quite yet). 

JonnyMac

There's another bit of trick in there: if more than one sensor goes active at the same time the program will randomly pick just one
Jon McPhalen
EFX-TEK Hollywood Office

Spooky Dad

Jon - I have taken what you provided me and have come up with an upgraded set of code based on exactly what I would like to accomplish in my spookhouse (see attached spreadsheet).  I think I have found a way, using variables and lookups, of configuring the outputs, both the DC-16 and an RC-4 (new from original post), as well as the AP-8 segments.  Please take a look and let me know if you think this code will work.  I do intend for the sound to loop until the next attraction is tripped and I do not want the attractions to retrip until idx = 7.  I realize I might be stretching the rules by posting this here, but you did tell me to go study and this is what I am turning in as homework.   ;D

' =========================================================================
'
'   File...... Spooky_Dad_Halloween_2008.BS1
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 24 AUG 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN

SYMBOL  GoAway          = PIN6                  ' uses ULN as pull-down
SYMBOL  Skeleton        = PIN5
SYMBOL  Snakes          = PIN4
SYMBOL  Ghost           = PIN3
SYMBOL  Graveyard       = PIN2
SYMBOL  TCT             = PIN1
SYMBOL  Entrance        = PIN0

SYMBOL  relays          = B0
SYMBOL   FogAtGrave     = BIT0
SYMBOL   FogAtSnakes    = BIT1
SYMBOL   StrobeAtGhost  = BIT2
SYMBOL   FogAtCauldron  = BIT3


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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400


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

SYMBOL  status          = B0
SYMBOL   playing        =  BIT7

SYMBOL  Motion          = B2
SYMBOL  idx             = B3
SYMBOL  lctrlBits       = B4
SYMBOL  hctrlBits       = B5
SYMBOL  timer           = B6
SYMBOL  track           = B7
SYMBOL  trip            = B8

SYMBOL  delay           = W4                    ' used for creating random delay between input and activation
SYMBOL  lottery         = W5                    ' variable where random number generator is stored


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

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00000000                              ' no direct outputs on Prop-1, all inputs

  SEROUT Sio, Baud, ("!!!!!AP8", %00, "X")     ' resync and kill sound
  SEROUT Sio, Baud, ("!!!!!DC16", %00, "X")    ' Clear all DC-16 outputs
  SEROUT Sio, Baud, ("!!!!!RC4", %00, "X")     ' Clear all RC-4 outputs

  idx = 0                                      ' Clear idx of input to start looking for 1st input

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

Main:
  timer = 0                                     ' reset timer
  idx = idx + 1

Check_Motion:
  PAUSE 5                                       ' loop pad
  LOOKUP idx, (Entrance, TCT, Graveyard, Ghost, Snakes, Skeleton, GoAway), Motion
  timer = timer + 5 * Motion                    ' update timer
  IF timer < 200 THEN Check_Motion              ' wait for 0.2 sec input

  SEROUT Sio, Baud, ("!!!!!DC16", %00, "X")    ' Clear all DC-16 outputs
  SEROUT Sio, Baud, ("!!!!!RC4", %00, "X")     ' Clear all RC-4 outputs

  RANDOM lottery                                ' re-stir
  delay = lottery // 2501 + 500                 ' random, 0.5 to 3 seconds
  PAUSE delay

Activate:
  LOOKUP idx, (%00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01000000), lctrlBits   ' speaker connections
  LOOKUP idx, (%00000000, %00000001, %00000000, %00000100, %00001000, %00000000, %00010000), hctrlBits   ' output connections
  LOOKUP idx, (0,1,3,4,5,6,7), track                                                                     ' Segment 2 is apart of TCT
  LOOKUP idx, (%0001, %1000, %0010, %0100, %1000, %0001, %0010), relays                                  ' configures RC-4

Configure_Outputs:
  SEROUT Sio, Baud, ("!DC16", %00, "L", lctrlBits)
  SEROUT Sio, Baud, ("!DC16", %00, "H", hctrlBits)
  SEROUT Sio, Baud, ("!RC4", %00,  "S", relays)
  PAUSE 100

Start_Audio:
  SEROUT Sio, Baud, ("!AP8", %00, "L", track, 0)

TrashCanTrauma:
  IF Motion = TCT THEN
    PAUSE 3000
    SEROUT Sio, Baud, ("!AP8", %00, "X")
    SEROUT Sio, Baud, ("!DC16", %00, "H", %00100000)     'Turns on wiper motor to raise lid
    PAUSE 2000
    SEROUT Sio, Baud, ("!DC16", %00, "H", %00000011)     'Turns on both vibrating motors
    SEROUT Sio, Baud, ("!AP8", %00, "P", 3)
    Motion = Graveyard                                   'To prevent replaying this special sequence
  END IF

  PAUSE 5000

  IF idx = GoAway THEN GOT0 Reset

  GOTO Main

Spooky Dad

Jon - I am getting EEPROM full message when I try to load the program in my Prop-1, after fixing the two IF THEN errors I had.  How can I shrink this down without loosing functionality.  I realize I am asking the Prop-1 to do alot. 

JonnyMac

Okay, there are a lot of problems with your code but I really appreciate you trying.  Tell me what it's supposed to do (pretend I'm stupid and don't understand your chart) and I'll help you.  You've made a lot of unsafe assumptions with your program, and I don't' want to do the same -- you tell me what the code is supposed to do, I will make it happen.

I am really confused by your use of idx and six different sensors.  Does the sensor determine the show element, or does idx and, in fact, and a sensor just trips things.

A couple pointers:

1) You only need the exta "!" in front of the first serial message in the Reset section -- any others are just wasting space
2) Using subroutines will save program space.
3) Sometimes READ can be used instead of LOOKUP to save code space (with a little extra work, however)

PS: Do me a favor, please: When you update one of my programs, please change the authorship from my name to yours.
Jon McPhalen
EFX-TEK Hollywood Office

Spooky Dad

Noted on the change of authorship (thought about doing it but stopped since the code is primarily a compilation of code examples.  Now I know).

In regards to idx, I was attempting to define a variable that would I could use in a LOOKUP function to store in Motion to identify not only the next motion sensor to watch for activation on (what Pin), but also in identifying the pattern and/or segment to load into the DC-16 low bits, DC-16 high bits, RC-4 relays, and the AP-8, respectively.  For all the show elements, only TCT has additional steps, the rest are very similar in sequence.  The exact order, which I want to enforce, of the show elements in the haunted house are:

1.  Entrance - A motion detector will be placed at the entrance of the haunted house for catching the victims before going inside.  I am looking for the program to ONLY look for a particular motion sensor input, in a specific order.  All others inputs should be ignored (in an attempt not to have speaker connections made and other sounds interrupt the intended sound effect).
                  - Entrance Motion is tripped and sensed on P0 (Entrance)
                  - Configure DC-16 Low Bits (%00000001) for "activating" the appropriate speaker for the sound effect

I updated the PDF file (really a spreadsheet I used for organizing my thoughts) with RC-0 through RC-3, to be consistent with my description above. 
                  - Configure DC-16 High Bits (%00000000) to all zeros since I don't need any more outputs
                  - Pause for .1 seconds to let output set for speaker
                  - AP-8 Segment 0 is played in a looped fashion until the next sound is triggered
                  - RC-4 Relay 0 is tripped firing off the Graveyard Fog Machine (a), hence the LOOKUP for applying the %0001 to relays
                  - PAUSE for 5 seconds and return to Main, where idx is incremented for next show element

2. Trash Can Trauma (TCT) - This show element should only be activated after Entrance has been tripped and executed (hence the attempt at incrementing idx by the command "idx = idx +1" in the main section and doing a new LOOKUP for Motion).  The TCT is the only show element with a series of additional steps, which I attempted to handle with an IF THEN statement for dumping into a subroutine, aptly named "TrashCanTrauma".  Here is what is supposed to happen:
                  - TCT Motion is tripped and sensed on P1 (TCT)
                  - Configure DC-16 Low Bits (%00000010) for "activating" the appropriate speaker for the sound effect
                  - Configure DC-16 High Bits (%00000001) to activate vibrating motor #1 (b)
                  - Pause for .1 seconds to let output set for speaker
                  - AP-8 Segment 1 is played in a looped fashion until the next sound is triggered
                  - RC-4 Relay 3 is tripped firing off the Cauldron Fog Machine (h), hence the LOOKUP for applying the %1000 to relays
Here is where the IF THEN statement comes in if the variable Motion is equal to TCT, then run the additional sub routine, which should do:
                  - Pause for 3 seconds to let the first part finish
                  - Silence the AP-8 (so the creature can open the lid and look around silently)
                  - Configure DC-16 High Bits (%00100000) to activate the wiper motor (j)
                  - Pause 2 seconds
                  - Configure DC-16 High Bits (%00000011) to deactivate wiper motor (j) activate vibrating motors #1 and #2 (b and c) for an angry creature
                  - Play segment 2 on the AP-8 (in my original code, I have segment 3, which is wrong)
                  - Do I need a return statement here?
                  - PAUSE for 5 seconds and return to Main, where idx is incremented for next show element

3. Graveyard - After Motion is populated with Graveyard (idx = 3), does the program begin looking for activation on P2 (Graveyard).  When an input is detected, the following actions for the graveyard happen:
                  - Graveyard Motion is tripped and sensed on P2 (Graveyard)
                  - Configure DC-16 Low Bits (%00000100) for "activating" the appropriate speaker for the sound effect
                  - Configure DC-16 High Bits (%00000000) since no additional outputs are needed
                  - Pause for .1 seconds to let output set for speaker
                  - AP-8 Segment 3 is played in a looped fashion until the next sound is triggered
                  - RC-4 Relay 1 is tripped firing off the Snake Crossing Fog Machine (d), hence the LOOKUP for applying the %0010 to relays
                  - PAUSE for 5 seconds and return to Main, where idx is incremented for next show element

4.  Ghost - After Motion is populated with Ghost (idx=4), does the program look for activation on P3 (Ghost).  When an input is detected, the following actions take place:
                  - Ghost Motion is tripped and sensed on P3 (Ghost)
                  - Configure DC-16 Low Bits (%00001000) for "activating" the appropriate speaker for the sound effect
                  - Configure DC-16 High Bits (%00000100) to activate vibrating motor #3 to shake ghost
                  - Pause for .1 seconds to let output set for speaker
                  - AP-8 Segment 4 is played in a looped fashion until the next sound is triggered
                  - RC-4 Relay 2 is tripped firing off the Strobe at the Ghost (f), hence the LOOKUP for applying the %0100 to relays
                  - PAUSE for 5 seconds and return to Main, where idx is incremented for next show element

5. Snake Crossing - After Motion is populated with Snakes (idx=5), does the program look for activing on P4 (Snakes).  When an input is detected, the following actions take place:
                  - Snake Motion is tripped and sensed on P4 (Snakes)
                  - Configure DC-16 Low Bits (%00010000) for "activating" the appropriate speaker for the sound effect
                  - Configure DC-16 High Bits (%00001000) to activate solenoid #1 (g) to move snake tubes
                  - Pause for .1 seconds to let output set for speaker
                  - AP-8 Segment 5 is played in a looped fashion until the next sound is triggered
                  - RC-4 Relay 3 is tripped firing off the Cauldron Fog Machine (h), hence the LOOKUP for applying the %1000 to relays
                  - PAUSE for 5 seconds and return to Main, where idx is incremented for next show element

6. Skeleton - After Motion is populated with Skeleton (idx=6), does the program look for activing on P5 (Skeleton).  When an input is detected, the following actions take place:
                  - Skeleton Motion is tripped and sensed on P5 (Skeleton)
                  - Configure DC-16 Low Bits (%00100000) for "activating" the appropriate speaker for the sound effect
                  - Configure DC-16 High Bits (%00000000) as no additional outputs are needed
                  - Pause for .1 seconds to let output set for speaker
                  - AP-8 Segment 6 is played in a looped fashion until the next sound is triggered
                  - RC-4 Relay 0 is tripped firing off the Graveyard Fog Machine (a), hence the LOOKUP for applying the %0001 to relays
                  - PAUSE for 5 seconds and return to Main, where idx is incremented for next show element

7. GoAway Air Cannon - After Motion is populated with GoAway (idx=7), does the program look for activing on P6 (GoAway).  When an input is detected, the following actions take place:
                  - GoAway Motion is tripped and sensed on P6 (GoAway)
                  - Configure DC-16 Low Bits (%01000000) for "activating" the appropriate speaker for the sound effect
                  - Configure DC-16 High Bits (%00010000) to activate solenoid #2 (i) to move snake tubes
                  - Pause for .1 seconds to let output set for speaker
                  - AP-8 Segment 7 is played in a looped fashion until the next sound is triggered
                  - RC-4 Relay 1 is tripped firing off the Snake Crossing Fog Machine (d), hence the LOOKUP for applying the %0010 to relays
                  - PAUSE for 5 seconds and return to Reset since Motion = Goaway, reseting the Spookhouse

I updated the PDF file using the correct RC relay references (0-3 versus 1-4).  More for my benefit.

Spooky Dad

Jon - Please ignore the line "I've update my file..." that's been inserted in the description of Show Element #1 - Entrance.  That statement was suppose to go at the bottom of the post (in fact, I couldn't find it and retype another one).  Sorry.

JonnyMac

Okay, here's a new take that just barely fits.  Please... study it carefully before attempting to modify; everything I've done is very deliberate -- I have 14 years of practice squeezing a lot of code into the BS1, so if you attempt to understand my logic I think (perhaps, egotistically) that you'll be better for it.

Have fun.

' =========================================================================
'
'   File...... Spooky_Dad_Halloween_2008.BS1
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  GoAway          = 6                     ' SETUP = out or DN
SYMBOL  Skeleton        = 5                     ' ULN as pull-dn
SYMBOL  Snakes          = 4
SYMBOL  Ghost           = 3
SYMBOL  Graveyard       = 2
SYMBOL  TCT             = 1
SYMBOL  Entrance        = 0


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

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

SYMBOL  Baud            = OT2400


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

SYMBOL  idx             = B0                    ' selected sensor
SYMBOL  sensors         = B1                    ' sensor bits
SYMBOL  timer           = B2                    ' debounce timer
SYMBOL  mask            = B3                    ' inputs mask
SYMBOL  pntr            = B4                    ' EEPROM data pointer
SYMBOL  relays          = B5                    ' RC-4 bits
SYMBOL  track           = B6                    ' AP-8 track
SYMBOL  cmd             = B7                    ' AP-8 command

SYMBOL  outBits         = W4
SYMBOL   outBitsL       =  B8                   ' DC-16 bits
SYMBOL   outBitsH       =  B9

SYMBOL  lottery         = W5                    ' random value


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

Reset:
  DIRS = %00000000                              ' all inputs

  idx = Entrance
  mask = %00000001                              ' mask for idx = 0
  outBits = 0
  relays = 0
  GOSUB Kill_AP8
  GOSUB Set_DC16
  GOSUB Set_RC4


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

Main:
  sensors = %01111111                           ' assume active
  FOR timer = 1 TO 20                           ' debounce inputs
    RANDOM lottery                              ' stir random value
    PAUSE 10
    sensors = sensors & PINS                    ' scan inputs
  NEXT
  sensors = sensors & mask                      ' isolate current sensor
  IF sensors = %00000000 THEN Main              ' try again if not active

  pntr = 4 * idx                                ' point to data for idx

Set_Outputs:
  READ pntr, outBitsL
  pntr = pntr + 1
  READ pntr, outBitsH
  GOSUB Set_DC16
  pntr = pntr + 1
  READ pntr, relays
  GOSUB Set_RC4

Start_Audio:
  pntr = pntr + 1
  READ pntr, track
  GOSUB Loop_AP8

Run_TCT:
  IF idx <> TCT THEN Audio_Delay
    PAUSE 3000
    GOSUB Kill_AP8
    outBitsH = %00100000
    GOSUB Set_DC16
    PAUSE 2000
    outBitsH = %00000011
    GOSUB Set_DC16
    track = 3
    GOSUB Play_AP8

Audio_Delay:
  PAUSE 5000

  IF idx = GoAway THEN Reset
    idx = idx + 1                               ' next sensor #
    mask = mask * 2                             ' update sensor mask
    GOTO Main


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

Kill_AP8:
  SEROUT Sio, Baud, ("!!!!!AP8", %00, "X")
  RETURN

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

Loop_AP8:
  cmd = "L"
  GOTO Cmd_AP8

Play_AP8:
  cmd = "P"

Cmd_AP8:
  SEROUT Sio, Baud, ("!AP8", %00, cmd, track, 0)
  RETURN

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

Set_DC16:
  SEROUT Sio, Baud, ("!DC16", %00, "S", outBitsL, outBitsH)
  RETURN

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

Set_RC4:
  SEROUT Sio, Baud, ("!RC4", %00, "S", relays)
  RETURN

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


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


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

'          DC-16 L    DC-16 H    RC-4  AP-8
'
Show_Data:
  EEPROM (%00000001, %00000000, %0001, 0)       ' idx = 0
  EEPROM (%00000010, %00000001, %1000, 1)       ' idx = 1
  EEPROM (%00000100, %00000000, %0010, 3)       ' idx = 2
  EEPROM (%00001000, %00000100, %0100, 4)       ' idx = 3
  EEPROM (%00010000, %00001000, %1000, 5)       ' idx = 4
  EEPROM (%00100000, %00000000, %0001, 6)       ' idx = 5
  EEPROM (%01000000, %00010000, %0010, 7)       ' idx = 6
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

Let me show you an error you made -- that is a common one.  You have a line like this:

  IF idx = GoAway THEN GOTO Reset

In fact, the proper syntax should be:

  IF idx = GoAway THEN Reset

... but that's not the problem.  The BS1 sees this line as:

  IF idx = PIN6 THEN Reset

Here's the problem: When you use PINx on the right side of = the BS1 thinks you want to know the present value of that pin which can only be 0 or 1.  In fact, what you want to do is have a constant called GoAway that has a value of 6.  Now that I'm suggesting it I'm going to update your program.
Jon McPhalen
EFX-TEK Hollywood Office

Spooky Dad

I think with your assistance to get the program into the available memory that my old program is now more educational.  If not a constant, then I should have said IF idx = 6.  Got it.  In fact, the IF statement for the TCT should now read " IF idx = 1" in my old program, too.

As far as the new program goes... I got it.  Very elegant.  The pointer moving from 0-3 with idx = 0, the multiplying of the initial mask by two to continue to update the mask looking for the right sensor, and the two separate subroutines for the audio play and loop.  Excellent!  And now that I took the time to explain to you exactly what I wanted to happen, I see no reason to monkey with your code..... this year!!!  Thanks Jon and I will let you know how it goes as I wire things up and begin testing!

Spooky Dad

Jon - I get the code, but now I have a question on how to wire the speaker's up through the lowbits (Outputs 0-7) of the DC-16.  From the DC-16 documentation (and the Prop-1), I have the Power switch in position 1.  Since the AP-8 is essentially providing an external power source, one side of ALL the speakers are connected together and hooked into one of the AP-8 speaker outputs.  The other side of all the speakers are spread across 0-7, with the other output of the AP-8 connected to ground.  Does this sound right?

JonnyMac

DISCLAIMER: We would never do what you're suggesting you want to do.  If you let out the blue smoke, it's on you, and there will be no warranty replacement of your EFX-TEK products that go up in smoke.  END OF DISCLAIMER

Sorry, I don't mean to seem harsh, but you're attempting to use our products in a fashion that we never intended.  In theory, your suggestion might work (if the DC-16 ULN holds up), but ONLY if the AP-8 and DC-16 are running from the same power supply.  Please, if you don't have a really good grip on electronics, find a friend (not me) that does -- we'd hate to have you damage your products.
Jon McPhalen
EFX-TEK Hollywood Office

Spooky Dad

Disclaimer acknowledged.  When I wired it up last night (no blue smoke), I was getting feedback over power (using different power supplies for the AP-8 and DC-16) when the output went active (output was pulled to ground).  I think I know what's missing between the DC-16 output and one side of the speaker.... a 12 volt relay per channel.  That should provide the electrical separation of power and allow a "clean" connect to be made.