November 21, 2024, 07:14:13 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 a car/p300 from a prop 2

Started by reddragon, September 27, 2009, 08:13:22 AM

Previous topic - Next topic

reddragon

September 27, 2009, 08:13:22 AM Last Edit: September 27, 2009, 10:16:24 AM by reddragon
 ;D Can some one help me out? I try-ed writting a simple code to start a sound on a car/p300 , play for 7 sec then, fwd one clip then play the next clip a event then has not been planed for yet. I'm jest trying to get a start on this now the rest of the code i should be fine on. Here is what i have so far and I'm getting a "exceeding 16 bits massage when i hit run. can anyone tell me were im going wrong?

' =========================================================================
'
'   File......prop code for 2009
'   Purpose... Halloween 2009
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


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


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


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

Sio             PIN     15                      ' SETUP = out; no ULN
Trigger         PIN     14                      ' SETUP = DN
sound           PIN      8                      ' play audio
fwd             PIN      0                      ' forward one clip
' -----[ Constants ]-------------------------------------------------------

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



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

timer           VAR     Byte


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

Reset:
 OUTH = $00000000     OUTL = $00000000         ' clear all outputs
 DIRS = $10000001     DIRH = $00000000         ' make p8 and p0 outputs


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

Main:
 timer = 0                                     ' reset timer
 DO WHILE (timer < 100)                        ' wait for 0.1 sec input
   PAUSE 5                                     ' loop pad
   timer = timer + 5 * Trigger                 ' update timer
 LOOP
 sound = ison                                  ' start clip
 PAUSE 70                                      ' play for 7 sec
 sound = isoff                                 ' sound off
 fwd = ison                                    ' forward one
 PAUSE 25                                      ' simulate pushing fwd on board
 fwd = isoff                                   ' release

 ' prop code here

 GOTO Main


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


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


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


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


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


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

JonnyMac

For binary values the indicator is %, not $.  Change your listing to:

Reset:
 OUTH = %00000000 : OUTL = %00000000         ' clear all outputs
 DIRH = %00000001 : DIRL = %00000001         ' make P8 and P0 outputs


Note that I've corrected the DIRH/DIRL line and set the correct bits to make P8 and P0 outputs.  You also need a colon ( : ) between statements on the same line.
Jon McPhalen
EFX-TEK Hollywood Office