November 22, 2024, 03:18:16 PM

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.


Karn-Evil Ticket Booth

Started by Eddie, October 19, 2010, 08:51:54 PM

Previous topic - Next topic

Eddie

Hi all,
I am in need of a complete Prop1 program, here are the elements;
All equipment is EFX-TEK.
I have a prop1 controller, RC-4 with 4 relays, and an AP-16+.
This prop will be on a loop cycle.

AP-16+ elements.
There will be three wav files, the first one I will call A-0 will be the ambient.wav, the second one I will call A-1 will be talking.wav, the third one I will call A-2 will be laugh.wav.
A-0 will start and end the loop cycle, the first instance of
A-0 will start at T=0 and run for 20 seconds followed by
A-1 will start at T=20 and run for 10 seconds followed by
A-2 will start at T=30 and run for 10 seconds followed by
A-0 will start at T=40 and run for 20 seconds

RC-4 elements.
Rly-1 will be a rotating red police light, that I will call Rly-1,
Rly-2 will be the first strobe light, that I will call Rly-2
Rly-3 will be the second strobe light, that I will call Rly-3
Rly-4 will be the fog machine, that I will call Rlyf-1
Rly-1, Rly-2, Rly-3 will run from T=20 thru T=40, Rlyf-1 will run from T=20 thru T=25 and again at T=35 thru T=40

Prop1 elements.
Using the ULN 2003 chip in place of the ULN 2803 chip for serial communication between the boards , I would like to use the out0 to trigger a pnuematic solenoid, I will call P-1 this will be the only out that I will use.

The following is a rough idea of what I am looking for.
Using T= as the time line
T=0 start of program
T=0 thru T=20 ambient.wav will be playing
at T-20 Rly-1, Rly-2, Rly-3, A-1, P-1, Rlyf-1 will start
at T=25 Rlyf-1 will stop
at T=30 A-1 will stop and A-2 will start
at T=35 Rlyf-1 will start
at T=40 Rly-1, Rly-2, Rly-3, Rlyf-1, P-1,  A-2 will stop and A-0 will start and run thru T=60
at this point the program should go back to T=0 and repeat the program until the power is disconnected.
I think I have covered all info needed, but in case I have not please let me know.

JonnyMac

Here's a program that matches your description.  It counts on you naming the WAV files on your AP-16+ as you've noted.  The file AMBIENT.WAV will play without software control, you need to enable the Ambient Loop switch on the player.

Note that the odd PAUSE values are there because I subtracted the time required to send serial messages to the AP-16+ and the RC-4 (4ms per byte/character).


' =========================================================================
'
'   File......
'   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  Solenoid        = PIN0                  ' V+/OUT0


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

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

SYMBOL  AllOn           = %1111

SYMBOL  Baud            = OT2400


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

SYMBOL  relays          = B0
SYMBOL   Police         =  BIT0                 ' RC-4, K1
SYMBOL   Strobe1        =  BIT1                 ' RC-4, K2
SYMBOL   Strobe2        =  BIT2                 ' RC-4, K3
SYMBOL   Fogger         =  BIT3                 ' RC-4, K4


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

Power_Up:
  PAUSE 2000                                    ' let AP-16+ power up

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

  relays = IsOff
  GOSUB Set_RC4


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

T_00:
  PAUSE 20000                                   ' let ambient.wav play


T_20:
  SEROUT Sio, Baud, ("!AP16", %00, "PW", "talking", 13, 0)
  relays = AllOn
  GOSUB Set_RC4
  Solenoid = IsOn
  PAUSE 4900


T_25:
  Fogger = IsOff
  GOSUB Set_RC4
  PAUSE 4927


T_30:
  SEROUT Sio, Baud, ("!AP16", %00, "PW", "laugh", 13, 0)
  PAUSE 4940


T_35:
  Fogger = IsOn
  GOSUB Set_RC4
  PAUSE 4927


T_40:
  SEROUT Sio, Baud, ("!AP16", %00, "X")                 ' back to ambient
  relays = IsOff
  GOSUB Set_RC4
  Solenoid = IsOff
  PAUSE  19944

  GOTO T_00


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

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

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


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office

Eddie

Thank You Jon.
I will load up this and let you know.