November 26, 2024, 05:36:55 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.


Help with a Simple Audio Program built on top of Prop Trainer Sample Program

Started by Spooky Dad, August 25, 2008, 12:21:44 PM

Previous topic - Next topic

Spooky Dad

Jonny - What am I doing wrong with the below code?  When the AP-8 is connected serially to the Prop-1, with Trainer module attached, I can not get the Prop-1 to trigger the sound in segment 0 when the pushbutton on the Trainer is depressed.  I have gotten segment 0 to trip manually by closing white and black on P, so I know the sound is there and working.  In what position should the L dipswitch be set (I read that 0 1 2 should always be open with a serial connection)?

Very sorry about hijacking the other topic!  I am extremely impressed with the information and order of the Support site. 

' {$STAMP BS1}
' {$PBASIC 1.0}
'
' =========================================================================
' -----[ I/O Definitions ]-------------------------------------------------
SYMBOL  Sio = 7
SYMBOL Leds = PINS ' on P0 - P5
SYMBOL Trigger = PIN6 ' active-high button
SYMBOL  Baud = OT2400                ' baud jumper out
SYMBOL  Addr = %00                   ' both address jumpers out

' -----[ Constants ]-------------------------------------------------------
SYMBOL Pressed = 1
SYMBOL NotPressed = 0

' -----[ Variables ]-------------------------------------------------------
SYMBOL stpIdx = B2 ' step index
SYMBOL delay = B4 ' fixed delay

' -----[ EEPROM Data ]-----------------------------------------------------
Pattern:
EEPROM (%000001, %000010, %000100, %001000, %010000)
EEPROM (%100000, %010000, %001000, %000100, %000010)
' -----[ Initialization ]--------------------------------------------------
Reset:
DIRS = %00111111 ' make P0 - P5 outputs
Leds = %00000000 ' clear outputs
stpIdx = 0 ' reset pointer
SEROUT Sio, Baud, ("!!!!!AP8", Addr, "X")     ' clear AP-8 outputs

' -----[ Program Code ]----------------------------------------------------
Main:
    IF Trigger = NotPressed THEN Reset ' wait for trigger button
    SEROUT Sio, Baud, ("!AP8", Addr, "P", 0)
    delay = 3000 'delay
    Cycle_Leds:
      READ stpIdx, Leds ' move step pattern to LEDs
      PAUSE delay ' hold
      stpIdx = stpIdx + 1//10 ' point to next step
      GOTO Main

JonnyMac

The Prop-1 Trainer does not have an external connection to P7 -- in short, you cannot use the Trainer and a serial accessory at the same time.  The header on the Trainer is actually an extension of P6 so that you can have a remote trigger. 

We have designed a second-generation Trainer that will have two headers and pass P7 through; but we have to work through current inventory before we can put that into production.  If you've got a Dremel tool and a soldering iron I can tell you how to hack your Prop-1 Trainer to use that header as a P7 connection.  You may want to buy a spare before doing that because you have to give up the potentiometer on the P1-T with the hack.

The "L" switch should be Open when under control from a Prop-1; we have that for looping when used in stand-alone mode.

Just a note on your code: You're not debouncing the input and, in "noisy" electrical environments, you may get false triggering.  Look at any of the code I've posted recently for a template on debouncing your trigger input.
Jon McPhalen
EFX-TEK Hollywood Office