May 01, 2024, 05:35:38 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.


P7 and ULN

Started by aquawilly54, October 20, 2012, 09:01:25 PM

Previous topic - Next topic

aquawilly54

Hi folks.
  Still confused over here.  As you know by now I (we) got the AP working as a stand alone.  Now I'm trying to use it thru the prop 1.  Here's what I've done:

I loaded up a program, thanks to you all.
I connected the serial cable from P7 to the serial pins on the AP.
I swapped the ULN2803 out for the ULN2003 (from the prop-1 Trainer)
I made sure it was bottom aligned, but nothing happens.  The status light stays steady.  We've been thru the card issue and I know it's good. 

I went back to the stand alone set up just to make sure.  It played fine.

Back to the prop control and nothing. 

I then modified the ULN2803 by removing pin 1, and tried that.  Still nothing.

Here's a copy of the program.


' {$STAMP BS1}


' ($STAMP BS1)
' ($PBASIC 1.0)


SYMBOL Pir         = PIN6
SYMBOL IsOff       = 0
SYMBOL Sio         = 7

Main:
IF Pir  = IsOff THEN Main       ' wait for Pir activity
SEROUT Sio, OT2400, ("!AP16", %00, "PW",  "PIPES", 13, 1)
PAUSE 5000                      ' wait 5 secnds before PIR activation
GOTO Main                       ' back to Main

Any ideas?

If we can get this going, I'll have some other questions on timing.
Thanks much.
Steve

bsnut

There is a minor problem with your program and I will fix it for you.
William Stefan
The Basic Stamp Nut

JackMan

Steve,
      Please go back to your first thread and try the program I provided. There are several things wrong with yours. A PIR needs a warm up/calibration period before it is ready to operate properly. You also need a trigger "debounce" in the code to prevent false triggers. These are included in the program I gave you. Just to verify, you do have a file on the SD card named PIPES.WAV, correct?

bsnut

Here's the program that Jack did for you from the first thread that you started earlier and copy and paste the program code into the Basic Stamp Editor.
Quote
Here is what your program should look like. The option switches 1 thru 4 on the AP-16+ should be off.


' =========================================================================
'
'   File...... prop-1_template.bs1
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = UP; no ULN
SYMBOL  PIR             = PIN6                  ' SETUP = DN



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

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

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

SYMBOL  timer           = B2                    ' for debounce loop



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

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00111111                              ' make P0-P5 outputs
  PAUSE 30000                                   ' 30 second PIR warm up/post delay

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

Main:
  timer = 0                                     ' reset debounce timer

Check_Trigger:
  PAUSE 5                                       ' scan delay
  IF PIR = IsOff THEN Main                      ' check trigger INPUT
    timer = timer + 5                           ' update timer
  IF timer < 200 THEN Check_Trigger             ' wait for .02 second trigger

  SEROUT Sio, OT2400, ("!AP16", %00, "PW", "PIPES", 13, 1)
  GOTO Reset
William Stefan
The Basic Stamp Nut

aquawilly54

Thanks guys. 
I knew it was something like that.  I didn't realize that whole thing had be in there.  I will do it as soon as I get back this afternoon and give you the results.
I really appreciate all this help.  After Halloween this will be a year of learning, so I'm not such a pain next year.  ;)
Talk to ya later. 
Steve

JackMan

You're not a pain at all, there's always someone here to help. Like Jon said, don't put yourself down, at some point we all started out needing assistance, heck I still have a LOT to learn.  ;)

JonnyMac

I am locking this tread because -- as Jack pointed out -- it seems to be the continuation of another. Please... help us keep the forums organized by maintaining one thread per project.
Jon McPhalen
EFX-TEK Hollywood Office