November 21, 2024, 03:35:46 AM

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.


Having trouble triggering COW/P300 board

Started by deadhaunts, August 26, 2009, 06:45:54 PM

Previous topic - Next topic

deadhaunts

I am having trouble triggering a COW/P300.  I am using the code you wrote (see below, it works with the Prop-1 trainier) and I have the P300 hooked up like you suggest.



P300 is powerd via prop-1 board (LED's are on both boards)
Sound file stored in P300, will trigger if I push the play button on the P300)

P6 on Prop-1 (PIR)
out 5 to V-trig on P300

I do not have the popup and the light hooked up, it should still trigger the P300 shouldn't it?


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


' -----[ Program Description ]---------------------------------------------
'
' Sio     :: Serial IO to EFX-TEK accessories (RC-4, FC-4, etc.)
'            -- clip pin 1 of ULN2803 or replace with ULN2003
'
' Trigger :: Parallax-compatible PIR or N.O. button (mat switch, etc.)
'            -- connect N.O. button between P6.W and P6.R


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


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

SYMBOL  Sio             = 7                     ' SETUP = UP; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  CapAudio        = PIN5                  ' use V+/OUT5 to V-Trig
SYMBOL  PopUp           = PIN1                  ' use V+/OUT1
SYMBOL  Light           = PIN0                  ' use V+/OUT0


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

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

SYMBOL  IsUp            = 1
SYMBOL  IsDown          = 0

SYMBOL  Yes             = 1
SYMBOL  No              = 0


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

SYMBOL  timer           = B2


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

Reset:
  PINS = %00000000                              ' preset IOs
  DIRS = %00100011                              ' set output pins (1s)


' -----[ 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

  GOSUB CAP_Start                               ' start audio

  Light = IsOn
  PopUp = IsUp

  PAUSE 2000                                    ' adjust for audio

  Light = IsOff
  PopUp = IsDown

  PAUSE 20000                                   ' retrigger delay
  GOTO Main


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

CAP_Start:
  CapAudio = IsOn                               ' pull OUTx low
  PAUSE 50                                      ' hold for CAP debounce
  CapAudio = IsOff                              ' release OUTx
  RETURN

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


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

JonnyMac

As I stated, I don't actually have CAR/P-300 so you may have to adjust.  I suggest that you experiment with the timing CAP_Start subroutine.  Also, I think Carl allows for multiple input voltages; make sure you have the board set for 12v and that you're using the V+ and OUT5 terminals from the Prop-1.  Finally, the Prop-1 power switch needs to be in position 2 for V+ to work.
Jon McPhalen
EFX-TEK Hollywood Office

deadhaunts

I have it hooked up exactly like you suggest, board set at 12v and using the V+ and OUT5 on the Prop-1, and of course the power switch in position 2.  I also tried going from Prop-1 P5, R & W to V-Trig.  When I powewed up with this setup,  the sound played, but will not trigger via the PIR.  I know the PIR works, because when I ran some code on the prop-1 trainer, it was working.

JonnyMac

Are you sure you're not being caught out by the re-trigger delay? -- I run into this all the time and find I have to comment out long delays when testing.  You should test the CAP_Start subroutine independently to get it working first.  Then fold it into a program.

None of this stuff is rocket science, and I'm sure it's a very tiny gremlin that playing with you.
Jon McPhalen
EFX-TEK Hollywood Office