November 21, 2024, 11:38:15 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Prop 1 comunication

Started by aquawilly54, October 21, 2015, 06:49:51 PM

Previous topic - Next topic

aquawilly54

Hi all.
  I'll make this as short as possible.  It's a communication issue between my prop 1 and AP-16+.  For this particular program it should have been straight forward, but apparently I'm missing something. Here's my issue complete with pictures, and the program below:  All I'm going for is one action, and one sound, which I have titled as SFX01.WAV.  I have formatted the card.  It works great in the AP-16+ as a stand alone.  The prop 1 is doing it's job with the action portion, but I'm not getting communication from it to the AP. 



  1.  UP POSITION:  In the first picture I have the jumper in the "up" position.  In this position the audio loops constantly.

  2. EXPERIMENT - PROP 1 TRAINER POSITION:  In the second picture I have the jumper in the "Trainer Installed set up.  In this position I get a green ready light, but no play.  I had to try.

  3.  I have also tried removing the jumper completely.  I get the same result as #2.

PIR is on P6, and serial control is from P7 to PIR pins on AP.
Audio select is in position 1
All option switches are off.

Both pictures wouldn't install, so here is the one that counts.  Nope, even one picture didn't load, but I think you all have it figured out.

My mistake has got to be in the program, so I'm hoping someone can spot what I've done wrong.  Your help is always appreciated.

Steve




' =========================================================================
'
'   File......      Witch jumper
'   Purpose...      Jump up with sound (witch's cackle)
'   Author....      Steve
'   E-mail....
'   Started...      10/20/2015
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
PIR activates controls.  Controls activate air solenoid, AND plays audio SFX01.WAV
Back TO main AND wait 30 seconds FOR NEXT trigger.



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


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

SYMBOL  Sio               = PIN7                  ' SETUP = UP; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  cylinder        = PIN0                  ' activate air cylinder


' -----[ 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  timer           = B2                    ' for debounce loop


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

Power_Up:
  PAUSE 3000                                    ' let AP-16+ initialize

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

  PAUSE 30000                                   ' 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
  HIGH cylinder                                 ' activate cylinder
  PAUSE 10000                                    ' pause for 10 seconds

  ' play audio file

  SEROUT Sio, Baud, ("!AP16", %00, "PS", 1, 1)

  GOTO Reset


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


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


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


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


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

aquawilly54

So in my searching for an answer I found this little tidbit:

A common definition error is this:

SYMBOL  Sio             = PIN7                  ' dangerous definition!!!


I changed it in my program and loaded it up, but no go.  It's still looping uncontrollably. 

Steve

JonnyMac

Things to verify:

1) You're using 7 instead of PIN7 as the pin (you fixed this; keep in)
-- you have to do the same thing with Cylinder if you want to use the HIGH instruction
2) Have you removed the ULN influence from P7?
3) The P7 SETUP jumper must be up
4) Verify that you have the orientation of the WRB wire correct
5) Make sure you are plugged into the SERIAL header of the AP-16+, not the PIR header
6) Verify the orientation of the WRB wire attached the the SERIAL header
7) Make sure your BR, A1, and A0 switches are set to OFF

Here's a small update with pin fixes. Everything else looks okay and the code does compile. Remember that white space is okay (it doesn't consume program space), and it does make one's code easier to read.


' =========================================================================
'
'   File......      Witch jumper
'   Purpose...      Jump up with sound (witch's cackle)
'   Author....      Steve
'   E-mail....
'   Started...      10/20/2015
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' PIR activates controls.  Controls activate air solenoid, then plays audio
' SFX01.WAV.  Back to Reset and wait 30 seconds for next trigger.


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


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

SYMBOL  Sio             = 7                     ' SETUP = UP; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Cylinder        = 0                     ' activate air cylinder


' -----[ 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  timer           = B2                    ' for debounce loop


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

Power_Up:
  PAUSE 3000                                    ' let AP-16+ initialize

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

  PAUSE 30000                                   ' 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

  HIGH cylinder                                 ' activate cylinder
  PAUSE 10000                                   ' pause for 10 seconds

  ' play audio file

  SEROUT Sio, Baud, ("!AP16", %00, "PS", 1, 1)

  GOTO Reset


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


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


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

aquawilly54

Ah Hah!  You nailed it.  I was plugged in to the PIR header instead of the serial header.  IT WORKS! 
I'll plug your program in now just to make sure everything is the way it should be.
Thank you very much.
Steve

JonnyMac

I rule!

I suspected the PIR header because you said it was repeating. A high signal -- which is the resting state of serial output -- is what the PIR header looks for.
Jon McPhalen
EFX-TEK Hollywood Office