November 21, 2024, 06:46:12 AM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


CAP 275 does not always start

Started by H3Tank, October 21, 2010, 07:12:34 PM

Previous topic - Next topic

H3Tank

I am have (what I think is) a simple MIB project. The overall concept is to have a PROP1 trigger the Audio from a CAP275 and then the Wiper motor via RC4. I have a extra motor kick so that the lid wont stay open. I currently have a homemade push button trigger (idea from Garage of Evil clan) where I can hold it in my hand then press when the victim approaches.

I started out slow with the CAP275 and then added the RC4. All the time I notice that the CAP275 didn't always start even though the debug message stated playing. When I connected/programmed to use the RC4, again sometimes the CAP275 wouldn't start playing but the RC4 always started when it should.

Here is the code and any suggestions would be appreciated.

' =========================================================================
'
'   File...... SP_MIB_2010.BS1
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated... 05 OCT 2010 - S. Palazzolo - Original program from Jon Williams
'                                           Chg Comment on SYMBOL CapAudio
'
'
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


' -----[ Revision History ]------------------------------------------------
'    14 OCT 2010 - S. Palazzolo - Add steps to control RC-4 along with CAP
'
' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  CapAudio        = PIN5                  ' white->OUT5, black->V+


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

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

SYMBOL  Baud            = OT2400
SYMBOL  Addr            = %00                   ' %00 - %11 address for RC-4

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

SYMBOL  timer           = B2


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

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00111111                              ' make P0-P5 outputs

  SEROUT Sio, Baud, ("!RC4", Addr, "X")         ' reset all relays to OFF

  PAUSE 1000                                    ' let CAP initialize


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

Main:
  DEBUG "Ready. "
  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

  DEBUG "Playing...", CR

  GOSUB CAP_Start                               ' Start audio subroutine
  PAUSE 2000                                    ' adjust for sound
  GOSUB Motor_Start                             ' Start Motor subroutine
  PAUSE 1000                                    ' Delay
  GOSUB Motor_kick                              ' Start Motor kick subroutine


  GOTO Main


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

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

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

Motor_Start:
' RC-4 (K1) CLOSE THE RELAY CIRCUIT / TURN IT ON
  SEROUT Sio, Baud, ("!RC4", Addr, "R", 1, 1)
  PAUSE 6000                                    ' Wait 6 seconds
' RC-4 (K1) OPEN THE RELAY CIRCUIT / TURN IT OFF
  SEROUT Sio, Baud, ("!RC4", Addr, "R", 1, 0)
  SEROUT Sio, Baud, ("!RC4", Addr, "X")         ' reset all relays to OFF
  RETURN

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

Motor_kick:
' RC-4 (K1) CLOSE THE RELAY CIRCUIT / TURN IT ON
  SEROUT Sio, Baud, ("!RC4", Addr, "R", 1, 1)
  PAUSE 500                                    ' Wait .5 seconds
' RC-4 (K1) OPEN THE RELAY CIRCUIT / TURN IT OFF
  SEROUT Sio, Baud, ("!RC4", Addr, "R", 1, 0)
  SEROUT Sio, Baud, ("!RC4", Addr, "X")         ' reset all relays to OFF
  RETURN


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

Thanks,

Steve

JonnyMac

You need to talk with Carl about this one.  If it ever started then I'd suggest your connections are fine (and the RC-4 is not interfering as it's on another pin).  You might try bumping the timing from 250ms to 500ms just in case the 250ms is on the low end of the input requirement.
Jon McPhalen
EFX-TEK Hollywood Office

H3Tank

Thanks Jon, I will try the 500ms first.

Steve

H3Tank

BTW.. Just curious as to what this pause is for?

Steve

gadget-evilusions

The pause here:

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

is how long the output is held to trigger the cowlacious board. Sometimes 250ms or less isn't long enough for the cowlacious board to recognize the trigger.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

H3Tank

Thanks for the information.

BTW... Jon I changed the pause to 500 and have been triggering it for the past hour without a glitch. This apparently did the trick.

Thank you again for the assistance/guidance and QUICK response!

JonnyMac

The reason for the long-ish pulse to start the board is to prevent transients (e.g., someone keying a radio nearby) from creating a false start.  There's a section in the Prop-1 program doing the same thing  (using a 100ms period).
Jon McPhalen
EFX-TEK Hollywood Office