November 21, 2024, 07:21:16 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.


CAR/P 300

Started by reddragon, August 25, 2009, 12:51:29 PM

Previous topic - Next topic

reddragon

Hi Jon, I jest received my car/p 300 and i was wonting to know how to trigger different sound clips for different events without using alot of memory i will be using a prop two to control it. Is there a way to write a code setup with a index of some sort? I dont know how carl has the micro controller interface setup on it. I do know it plays the mult. message in order put i would have to trigger it x times to get a clip to play witch would take a lot of space.

JonnyMac

August 25, 2009, 01:52:58 PM #1 Last Edit: August 25, 2009, 01:54:36 PM by JonnyMac
You'll be forced to use the push-button interface which is less than perfect due to the "circular memory" design of the ISD17240 (I know a lot about this having written the AP-16 firmware).

The following (untested -- I don't have a CAR/P-300) program uses two outputs OUT13 and OUT12 to connect to the PLAY\ and FWD\ headers on the CAR/R-300.  You must also connect the GND terminal to the CAR/P-300.

When you start the program you must make sure that the CAR/P-300 is "sitting" on sound #0 -- and, no, there is no way to use the push-button interface to get the board back to sound #0 (you have to use the SPI interface and requires four pins).  Once you're sitting on sound #0 then the program will work.  It keeps track of what file is played with a variable called carpFile.  This variable is updated whenever the Carp_Fwd subroutine is called.  Note that you must also set the NUM_FILES constant to match the number of sounds in the CAR/P-300, otherwise things will get out of sync.

I must state that we provide this code as-is with no warranty or guarantee of any sort.  What this means, then, is that I've given you the basics to get started with and it's no up to you to fine-tune (timing, etc.) to get the program to work.  Unless you want to buy me a CAR/P-300 and have it shipped to my Hollywood office!  ;D

' =========================================================================
'
'   File...... CARP_Advanced.BS2
'   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... 25 AUG 2009
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


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


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


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

Sio             PIN     15                      ' no ULN, SETUP = UP
Trigger         PIN     14                      ' SETUP = DN
Play            PIN     13                      ' SETUP = DN; use OUT13
Fwd             PIN     12                      ' SETUP = DN; use OUT12


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

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

Yes             CON     1
No              CON     0

T1200           CON     813
T2400           CON     396
T4800           CON     188
T9600           CON     84
T19K2           CON     32
T38K4           CON     6

SevenBit        CON     $2000
Inverted        CON     $4000
Open            CON     $8000

Baud            CON     Open | T38K4            ' for EFX-TEK accessories


NUM_FILES       CON     3                       ' 3 files on CAR/P-300


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

timer           VAR     Word

theFile         VAR     Byte                    ' file to play
carpFile        VAR     Byte                    ' CAR/P file selected


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

Reset:
 OUTH = %00000000 : OUTL = %00000000           ' preset IOs
 DIRH = %00000000 : DIRL = %00000000           ' define outputs (1s)


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

Main:
 timer = 0
 DO WHILE (timer < 100)                        ' debounce = 100ms
   timer = (timer + 5) * Trigger
   PAUSE 5
 LOOP

 theFile = 2                                   ' play file #2
 GOSUB Play_File
 PAUSE 10000

 GOTO Main


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

' Play desired file, 0 to N-1
' -- N is number of files on CAR/P-300

Play_File:
 IF (theFile < NUM_FILES) THEN                 ' valid file #?
   DO WHILE (theFile <> carpFile)              ' if not at right file
     GOSUB Carp_Fwd                            '  press "FWD"
   LOOP
   GOTO Carp_Play
 ENDIF
 RETURN

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

' Press "PLAY" button on CAR/P-300

Carp_Play:
 Play = IsOn
 PAUSE 25
 Play = IsOff
 RETURN

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

' Press "FWD" button on CAR/P-300

Carp_Fwd:
 Fwd = IsOn
 PAUSE 25
 Fwd = IsOff
 carpFile = carpFile + 1 // NUM_FILES
 PAUSE 25
 RETURN

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


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


Jon McPhalen
EFX-TEK Hollywood Office

reddragon

 :) Thank you Jon for the starter i will post the finnal code when i get all the skulls out. ;D thanks for the info.

reddragon

Jon, when i hook the car/p300 to the prop 2 can i use the servo headers so that i can use the 12v out putsfor my lights and vavles

JonnyMac

Please do not connect the TTL headers to any board not manufactured by EFX-TEK; a mistake could damage one or both boards.  The CAR/P-300 has a V-Trig input -- use that with one of the OUTx terminals.  It is not a good idea to try to share the audio start channel with a valve output (if that's what you wanted to do).
Jon McPhalen
EFX-TEK Hollywood Office

reddragon

Ok i didnt know for shure jest making shure before i hooked anything else up. Jest to be clear out12 is fwd , out13 is play , out14 is trigger. Ok now were do i hook the pin 15 to for the sio?

JonnyMac

As ever, you ask mysterious questions -- we're good programmers, not so good at mind reading.   ;D

Let me suggest you get your CAR/P-300 interface working and proven first, then move on to connecting EFX-TEK accessories to it.  Cool?
Jon McPhalen
EFX-TEK Hollywood Office