December 03, 2024, 10:00:24 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.


Triggering Car/P300 trouble

Started by meadowcreek, October 15, 2009, 11:18:25 PM

Previous topic - Next topic

meadowcreek

I have the CAR/P300 powered by the Prop-1 through V+ and ground as recommended & I have OUT2 and V+ connected to the trigger (board is set to 12v).  I am running in dual message mode so I have a message playing constantly until the trigger, which is supposed to start the message 2... once completed it should return to playing the original message.

I can't seem to get the desired result with the code I have. 
If I use the   "PULSOUT CARP, 50" line of code it does not play at all.
If I use "CARP = IsOn" it sometimes plays the message (sometimes not), however, when the message is played it does not return to the original message after message 2 is complete.

Any suggestions would be greatly appreciated... code below
' =========================================================================
'
'   File......
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 31 OCT 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  CARP            = PIN2
SYMBOL  Wick2           = PIN1
SYMBOL  Wick1           = PIN0

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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400                ' B/R jumper removed


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

SYMBOL  relays          = B0
SYMBOL   Lights         =  BIT0
SYMBOL   Strobe         =  BIT1
SYMBOL   Fogger         =  BIT2
SYMBOL   Wiper          =  BIT3

SYMBOL  state           = B2

SYMBOL  timer           = W4
SYMBOL  lottery         = W5
SYMBOL   lottoLo        =  B10
SYMBOL   lottoHi        =  B11


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

Reset:
  PINS = %00000000                              ' clear all
  DIRS = %00000111                              ' set outputs

  SEROUT Sio, Baud, ("!!!!!RC4", %00, "X")
  relays = %0000

  state = 0
  timer = 0


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

Main:
  PAUSE 25                                      ' loop pad
  timer = timer + 25                            ' update process timer
  GOSUB Update_Wicks                            ' flicker candles

Run_State:

  BRANCH state, (Pgm_Delay, Wait_Trigger, Start_Audio, Delay_3, Delay_8)
  state = 0


Pgm_Delay:
  GOSUB Update_Wicks
  IF timer < 30000 THEN Main                    ' delay done?
    state = 1
    timer = 0
    GOTO Main


Wait_Trigger:
  GOSUB Update_Wicks
  timer = timer * Trigger                       ' scan input
  IF timer < 125 THEN Main                      ' wait for valid signal
    state = 2
    timer = 0
    GOTO Main


Start_Audio:
  GOSUB Update_Wicks
  'CARP = IsOn
  PULSOUT CARP, 50
  Fogger = IsOn
  Lights = IsOn
  Strobe = IsOn
  GOSUB Set_RC4
  GOSUB Update_Wicks
  CARP = IsOff
  state = 3
  timer = 0
  GOTO Main


Delay_3:
  IF timer < 3000 THEN Main
    Wiper = IsOn
    GOSUB Set_RC4
    GOSUB Update_Wicks
    state = 4
    timer = 0


Delay_8:
  IF timer < 8000 THEN Main
    GOTO Reset


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

Set_RC4:
  SEROUT Sio, Baud, ("!RC4", %00, "S", relays)
  RETURN

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

Update_Wicks:
  RANDOM lottery
  Wick1 = lottoLo
  Wick2 = lottoHi
  RETURN


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

JonnyMac

This is a question for Carl, not EFX-TEK.  Please contact him and ask what kind of timing requirments for the start pulse are required -- with that information we can move forward. 

I have typically found a 50 to 100ms pulse works great.  PULSOUT is not a good idea here because it is in 10us units, so a PULSOUT value of 50 is only 0.5ms -- I'm sure this is too short for the CAR/P to validate the input.  PULSOUT is convenient as it handles the LOW-HIGH-LOW control of the pin; you might bump the value to 5000 (to get a 50ms pulse).
Jon McPhalen
EFX-TEK Hollywood Office