May 03, 2024, 10:31:00 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.


Prop 1 with AP-8+

Started by aquawilly54, October 13, 2019, 11:49:50 AM

Previous topic - Next topic

aquawilly54

Is there anyone out there that uses an AP-8+?  I'm sure I'm overlooking something, but I'm having an issue.  If I use the start button on the board it will play just fine, but when I hook up the prop-1 it just sits there staring at me.  I'm submitting the program for review by all.  Hopefully it's something silly.  What I do know is that if I connect to my AP-16+ and change the program to reflect the 16 it all works well.  When I connect back to the AP-8+ and modify the program for the 8 I get nothing. 

Here we go:

I still can't figure out how to load up the actual program, so here it is in b&w. 

My apologies,
Steve

                     ' =========================================================================
'
'   File......      Dead body II
'   Purpose...      Relay for wiper motor, and screams
'   Author....      Steve
'   E-mail....
'   Started...      10/05/2019
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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



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


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

SYMBOL  Sio             = 7                     ' SETUP = UP
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Relay           = PIN2                  ' activate wiper motor


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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  TrOn            = 1                     ' active-high trigger
SYMBOL  TrOff           = 0

SYMBOL  IsOn            = 1                     ' active-high I/O
SYMBOL  IsOff           = 0

SYMBOL  Baud            = OT2400


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

SYMBOL  status          = B0                    ' status (B0 for bit access)
SYMBOL   playing        = BIT7                  ' 0 = idle, 1 = playing

SYMBOL  timer           = B2                    ' for debounce loop


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

Power_Up:
  PAUSE 3000                                    ' let AP-8+ initialize

Reset:
  PINS = %00000000                              ' all off
  DIRS = %00111111                              ' P5..P0 are outputs

  PAUSE 40000                                   ' PIR warm-up/delay


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

Main:
  timer = 0                                     ' reset debounce timer

Check_Trigger:
  PAUSE 5                                       ' scan delay
  IF Trigger = TrOff THEN Main                  ' check trigger input
    timer = timer + 5                           ' update timer
  IF timer < 100 THEN Check_Trigger             ' check timer

        T00:                                            ' start of sequence
  Relay        = IsOn

  PAUSE 3958                                    ' 4s - wiper motor is on

  ' play audio file, SFX00.WAV
  ' -- allows testing via AP-8+ start button


   T04:
  SEROUT Sio, Baud, ("!AP8", %00, "P?", 2, 1)  ' play SFX00.WAV thru SFX02.WAV one time (Select switch on #8 for randomization).




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



  GOTO Reset

Jeff Haas

Hi Steve,

I don't have an AP-8 anymore, but here are a few quick things to look at:

- Check the jumpers, see if you have any installed.  You should NOT have any on the board.  The baud rate and the serial address you're using are set without any jumpers.

- You have the command for the AP-8 slightly wrong, I think you're mixing it up with the version for the AP-16.  The PDF shows this as the command to play a sound on the AP-8:

SEROUT Sio, OT2400, ("!AP8", %11, "P", 7)

You have:

SEROUT Sio, Baud, ("!AP8", %00, "P?", 2, 1)

This has the commands for the AP-16..."P?" is to play a random file on the AP-16's SD card, with the two parameters it needs after it.

You should change your AP-8 command to:

SEROUT Sio, Baud, ("!AP8", %00, "P", 7)

Note that this plays the file in AP-8 audio segment 7, change it if you stored the sound in a different segment.  Remember to carefully check the docs when you jump back and forth between the various boards!

Jeff

Jeff Haas

Also, to drop in a section of code, click the # button above the area where you type.  Then paste the code in between the two words

[ code ]PASTE CODE HERE[ /code ]

Note that I added a space at the start before the word "code" and one at the end after the word "code" otherwise the board tries to show what I pasted as code!

aquawilly54

Thanks Jeff, but it still seems to be a no go.  Nothing with the changes, but as before plays fine if I hit the start button.  I'll just have to go without.


Thanks much for your time.

Steve




Jeff Haas

Last idea... Try a different serial cable.