November 23, 2024, 10:39:57 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.


Right or wrong?

Started by aquawilly54, November 04, 2014, 02:18:50 PM

Previous topic - Next topic

aquawilly54

November 04, 2014, 02:18:50 PM Last Edit: November 05, 2014, 03:41:21 PM by aquawilly54
To all,
  I found out something new this season with the AP-16+.  I had difficulties last year, so when it happened again this season I didn't sweat it too much, but here is my "normal" situation.

After loading up a prop 1 program, inserting a loaded file in to the AP-16+, connecting some LED lights for the test run, hooking up the PIR, and waiting for the initializing to process, the program works and the AP light blinks, telling me it is playing the file.  However, I get no sound.  The results from what I did afterward surprised me.  I removed the serial cable end from the serial input on the AP, and touched it to the PIR start input.  At that moment I got an audible click from the speaker and the file played.  I then reconnected to the serial input, waited the allotted time, and triggered the sensor.  All worked well.   

The same situation occurred on my second set up, so I followed those same procedures right off the bat, and BINGO; all went well.  Now the question:

Why?
I've seen some postings where jumpering is mentioned, but I don't think it was in this particular context, so why would this have to happen?  Has anyone else experienced the same issue? 
Steve

JackMan

Why are you connecting a PIR to the serial header of the AP-16+?

aquawilly54

My mistake.  I meant the serial cable from the prop 1 to the AP.
Steve

JackMan

It would help if you post your program.  ;)

bsnut

Quote from: JackMan on November 04, 2014, 06:45:05 PM
It would help if you post your program.  ;)
I agree with Jack by posting your Prop-1 code for us to see.

BTW, it wouldn't be a bad idea to update your first post to make easier for others to follow what you're talking about. This would help you and others following this topic.
William Stefan
The Basic Stamp Nut

JonnyMac

I would suspect the SD card -- this is always the culprit when we hear these "sometimes it plays" issues.
Jon McPhalen
EFX-TEK Hollywood Office

aquawilly54

Ok, I modified the original posting.  I didn't have a program issue, they were both corrected by Jonny Mac and worked flawlessly, so I'm not worried about them being suspect.  Once I "jump started" each AP (2 different set ups) everything was fine and they played all night.  If that's what it takes to initialize them then I'm good with it.   I was only wondering if anyone else had experienced this.
Thanks much.
Steve

JackMan

That's not normal, that's why we asked to see your code, maybe there's something that throws up a flag. How long is the serial wire from the Prop-1 to the AP-16?

aquawilly54

Here's one of the programs.  I used a 12" serial cable for both set ups.  The SD cards are class 4 Sony 16GB, and class 4 PNY 8GB.  As stated earlier the AP's with these cards worked fine all night.  It was just an initializing issue, sort of like polarizing an automotive generator regulator.

By the way - how does one copy and paste a program in here where the colors show up?
Thanks again.
Steve

' =========================================================================
'
'   File...... Jack in the Box.bs1
'   Purpose... Movement, lights and sound
'   Author.... Steve ( with assist from JonnyMac! )
'   E-mail.... aquawilly54@yahoo.com
'   Started...
'   Updated... 24 OCT 2014
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio            = 7                     ' SETUP = UP; no ULN  (AP-16+)
SYMBOL  Trigger        = PIN6                  ' SETUP = DN  (PIR)

SYMBOL  Cylinder       = PIN2                  ' use OUT2/V+
SYMBOL  Lights         = PIN1                  ' use OUT1/V+
SYMBOL  Motor          = PIN0                  ' use OUT0/V+


' -----[ 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                    ' AP-16+ status byte
SYMBOL   playing       =  BIT7                 ' 1 when playing

SYMBOL  timer          = B2                    ' for debounce loop


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

Power_Up:
  PAUSE 3000                                   ' let AP-16+ initialize

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

  SEROUT SIO, Baud, ("!AP16", %00, "PW", "AMBIENT", 13, 0)
  PAUSE 25
  Motor = IsOn

  PAUSE 20000                                  ' PIR warm-up/delay


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

Main:
  timer = 0                                     ' reset timer

Check_Trigger:
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' update timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input

  SEROUT Sio, Baud, ("!AP16", %00, "PS", 0, 1)  ' Play SFX00 1 time

  Motor = IsOff
  PAUSE 25

  Lights = IsOn
  PAUSE 25

  Cylinder = IsOn

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

  GOTO Reset

bsnut

Quote
By the way - how does one copy and paste a program in here where the colors show up?
You do this by using the drop down menu at the top of the posting box and selecting

Font face > Font size > Color change

Like Jon, I like to use blue to post my code.
William Stefan
The Basic Stamp Nut

JackMan

November 06, 2014, 06:28:39 AM #10 Last Edit: November 06, 2014, 06:34:54 AM by JackMan
Taking into consideration that you have the same identical problem with two separate setups, there has to be a common denominator somewhere. One thing that jumped out at me after seeing your program was the SEROUT command for the AMBIENT loop track. Have you tried omitting that command and simply turn on the configuration loop switch?
The second thing I would do is change the 20 second PIR warm-up delay to at least 30 seconds or more.

aquawilly54

Thanks bsnut.

JackMan, the 2nd program does not contain an ambient with the SEROUT command, and since Jonny Mac helped me out with that I'm gonna call it good.  I'll play with the warm up time though just for gee whiz.  Other than that I'm ok with the start up issue as long as it isn't going to harm the device.
Thanks for the input.  I'll be throwing out a bunch more questions on programing later.
Steve

JonnyMac

Sometimes connections can be finicky, too. Make sure you have pin 1 of the ULN2803 clipped, and move the P7 SETUP jumper to the UP position.
Jon McPhalen
EFX-TEK Hollywood Office