November 21, 2024, 06:08:08 PM

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.


Serial Communications between Two Prop 2 Controllers

Started by PDoyle, July 16, 2010, 03:47:35 PM

Previous topic - Next topic

PDoyle

I'm attempting to link two Prop 2 controllers together, but I'm not sure what method whould best fit my needs.  The link only needs to allow one controller to trigger the other; no exchange of data is necessary.  If possible, the two controllers should also both be able to control the several DC-16's I'm running.  Can I simply hook the second controller into the same serial output line I'm using to control the DC-16's?  Would I be better off using the RS-485 Adapter?  How should Prop to Prop communications (or simply the trigger signal) be parsed in PBasic?

I'm sorry if this information is already in the forums somewhere.  I've run several searches but it's entirely possible I just entered the wrong keywords.

Thanks.

JonnyMac

If the controllers are in close proximity you can use one of our extender cables to go from the master to the slave device -- use any pin you want.  If it is simply a matter of a trigger signal, the master will make its pin HIGH (output and high) and the slave will look for that signal using our typical debouncing loop:

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


Note that you need to ensure that the trigger pulse from the master is removed after sufficient time has been provided for detection by the master.
Jon McPhalen
EFX-TEK Hollywood Office

BigRez

How do we define "close proximity"?   The length of one of your extender cables or can that be 10, 20, 30 feet with different size cables?

JonnyMac

I guess I'm defining "close proximity" within the reach of our 6-foot cable.
Jon McPhalen
EFX-TEK Hollywood Office

PDoyle

If I'm using one of the pins with a setup jumper, should the jumper on the slave be in the UP or DOWN position? 

Can I send the trigger signal using the same pin on the master that I'm using for serial communications to a DC 16?

JonnyMac

If you are using a pulse type start signal then use any pin, and if it has a SETUP jumper move it to the DN position.  Other pins can use the pull-down resistors in the front side of the ULN to hold the pin low when it is floating (not yet defined as an output).

No, you can't send pulses as you want to do on the same line that you're using serial comms for the DC-16 -- the polarity and signaling are different.
Jon McPhalen
EFX-TEK Hollywood Office

bsnut

Here's another way of doing a trigger from a long distance, longer than 6 feet. Use a 12 or 24vdc relay coil connected to one of Outs TB and the other end of the relay coil to Ground on your Master prop1 or a prop2, then the N.O. contacts on that same relay to the slave prop board I/O. Remember connect your relay contacts between 5vdc and your I/O pin on the slave prop board and also use the code Jon provided in this post.

If you need a drawing I can do one for you or someone else can do one to show you how its hooked up. I was typing this on my phone, so drawings are impossible on the Droid.
William Stefan
The Basic Stamp Nut

PDoyle

I decided instead to hook both controllers and all my accessories in into a single serial line.  In other words, I have an extender cable hooked onto Pin 15 of the master, through each of the aux. devices, and then onto Pin 15 of the slave.  I'm using the follow pair of programs to run the two controllers.  Everything works fine when I run a simple test script, but the DC 16's don't run when I run the full program.  I've tried testing individual sections of the full script and they all work fine, but as a whole something is wrong.  Can you find it?

' {$STAMP BS2}
' {$PBASIC 2.5}

'=========================== Story of the Beginning Script ==================================
            'This script drrives the master controller for "The Story of the Beginning"
            'light, fire, and water show.

'================================ Variables/Pins ==========================================

Times VAR Nib

Sky PIN 0                          'The blue lights in the sky
Trigger PIN 14
Sio PIN 15

'=================================== Main Program =========================================

Main:
  PAUSE 5000
  GOSUB Check_Trigger
  SEROUT Sio, 6, ["!EFX", 1]
  SEROUT Sio, 6, ["!AP16", %00, "X"]
  SEROUT Sio, 6, ["!DC16", %00, "X"]
  SEROUT Sio, 6, ["!DC16", %01, "X"]
  SEROUT Sio, 6, ["!DC16", %10, "X"]
  PAUSE 5000
  SEROUT Sio, 6, ["!AP16", %00, "PS", 0, 1]
  PAUSE 21250
  GOSUB Pulsar
  GOSUB Explosion
  GOSUB Sparkle_1
  GOSUB Explosion
  GOSUB Sparkle_2
  GOSUB Explosion
  GOSUB Sparkle_2
  GOSUB Explosion
  GOSUB Sparkle_3
  GOSUB Sparkle_4
  GOSUB Sparkle_5
  PAUSE 2350
  GOSUB Flashing_Fire
  GOSUB Tamok_and_Avarita
  SEROUT Sio, 6, ["!DC16", %00, "P", 7, 1]
  SEROUT Sio, 6, ["!DC16", %00, "P", 6, 1]
  PAUSE 4100
  SEROUT Sio, 6, ["!DC16", %00, "X"]
  LOW Sky
  PAUSE 3000
  SEROUT Sio, 6, ["!AP16", %00, "PS", 2, 1]
  END

'===================================== Check Trigger =======================================

Check_Trigger:
  PAUSE 100
  IF Trigger = 0 THEN GOTO Check_Trigger ELSE RETURN

'================================ Emergency Test/Emergency ==================================

Emergency_Test:
  IF Trigger = 0 THEN RETURN ELSE GOTO Emergency

Emergency:
  SEROUT Sio, 6, ["!AP16", %00, "PS", 2, 0]
  SEROUT Sio, 6, ["!DC16", %00, "X"]
  SEROUT Sio, 6, ["!DC16", %01, "X"]
  SEROUT Sio, 6, ["!DC16", %10, "X"]
  SEROUT Sio, 6, ["!RC4", %00, "X"]
  LOW 0
  LOW 1
  LOW 2
  LOW 3
  LOW 4
  LOW 5
  LOW 6
  LOW 7
  LOW 8
  LOW 9
  LOW 10
  LOW 11
  LOW 12
  LOW 13
  PAUSE 5000
    DO
    IF Trigger = 0 THEN PAUSE 1000 ELSE GOTO Main
    PAUSE 1000
    LOOP

'================================= Pulsar - 12.890 Seconds =================================

Pulsar:
  HIGH 1
  PAUSE 1700
  LOW 1
  PAUSE 150
  HIGH 1
  PAUSE 700
  LOW 1
  PAUSE 310
  HIGH 1
  PAUSE 2700
  LOW 1
  PAUSE 300
  HIGH 1
  PAUSE 2000
  LOW 1
  PAUSE 250
  HIGH 1
  PAUSE 1500
  LOW 1
  PAUSE 100
  HIGH 1
  PAUSE 1100
  LOW 1
  PAUSE 300
  HIGH 1
  PAUSE 2800
  LOW 1
  PAUSE 200
  HIGH 1
  PAUSE 90
  RETURN



'================================== Explosion ~ 0.5 Seconds ================================

Explosion:
  HIGH 1
  PAUSE 10
  HIGH 2
  PAUSE 22
  LOW 13
  HIGH 3
  PAUSE 14
  LOW 1
  PAUSE 15
  LOW 11
  LOW 2
  HIGH 4
  PAUSE 32
  LOW 3
  HIGH 5
  HIGH 11
  PAUSE 40
  LOW 4
  HIGH 6
  PAUSE 46
  LOW 5
  HIGH 7
  PAUSE 28
  LOW 10
  HIGH 12
  PAUSE 30
  LOW 6
  HIGH 8
  PAUSE 32
  LOW 11
  PAUSE 30
  LOW 7
  HIGH 9
  PAUSE 66
  LOW 8
  HIGH 10
  PAUSE 71
  LOW 9
  LOW 12
  HIGH 11
  PAUSE 75
  RETURN

'========================================== Sparkle_1 =====================================

Sparkle_1:
  LOW 10
  HIGH 13
  HIGH 2
  PAUSE 80
  HIGH 3
  PAUSE 70
  LOW 2
  LOW 11
  HIGH 4
  PAUSE 90
  LOW 13
  LOW 3
  HIGH 5
  HIGH 10
  PAUSE 80
  LOW 4
  HIGH 6
  HIGH 12
  PAUSE 85
  LOW 5
  PAUSE 90
  LOW 6
  LOW 10
  PAUSE 75
  HIGH 11
  PAUSE 95
  LOW 12
  HIGH 6
  PAUSE 80
  LOW 11
  HIGH 13
  HIGH 7
  PAUSE 95
  LOW 6
  HIGH 8
  PAUSE 105
  LOW 7
  HIGH 9
  PAUSE 100
  LOW 13
  LOW 8
  HIGH 10
  PAUSE 105
  LOW 9
  PAUSE 125
  HIGH 12
  PAUSE 95
  LOW 10
  HIGH 4
  PAUSE 120
  HIGH 11
  PAUSE 105
  LOW 12
  HIGH 6
  PAUSE 100
  HIGH 1
  PAUSE 125
  LOW 11
  HIGH 2
  PAUSE 115
  LOW 1
  LOW 4
  HIGH 3
  HIGH 11
  PAUSE 115
  LOW 2
  HIGH 13
  PAUSE 110
  LOW 3
  LOW 6
  HIGH 10
  PAUSE 105
  RETURN

'======================================== Sparkle_2======================================
Sparkle_2:
  LOW 10
  HIGH 13
  HIGH 2
  PAUSE 100
  HIGH 3
  PAUSE 95
  LOW 2
  LOW 11
  HIGH 4
  PAUSE 110
  LOW 13
  LOW 3
  HIGH 5
  HIGH 10
  PAUSE 105
  LOW 4
  HIGH 6
  HIGH 12
  PAUSE 95
  LOW 5
  PAUSE 115
  LOW 6
  LOW 10
  PAUSE 80
  HIGH 11
  PAUSE 125
  LOW 12
  HIGH 6
  PAUSE 110
  LOW 11
  HIGH 13
  HIGH 7
  PAUSE 125
  LOW 6
  HIGH 8
  PAUSE 95
  LOW 7
  HIGH 9
  PAUSE 105
  LOW 13
  LOW 8
  HIGH 10
  PAUSE 115
  LOW 9
  PAUSE 120
  HIGH 12
  PAUSE 125
  LOW 10
  HIGH 4
  PAUSE 115
  HIGH 11
  PAUSE 115
  LOW 12
  HIGH 6
  PAUSE 110
  HIGH 1
  PAUSE 120
  LOW 11
  HIGH 2
  PAUSE 105
  LOW 1
  LOW 4
  HIGH 3
  HIGH 11
  PAUSE 125
  LOW 2
  HIGH 13
  PAUSE 115
  LOW 3
  LOW 6
  HIGH 10
  PAUSE 95
  RETURN

'======================================= Sparkle_3 =======================================
Sparkle_3:
  Times = 0
  DO
    LOW 10
    HIGH 13
    HIGH 2
    PAUSE 80
    HIGH 7
    PAUSE 75
    LOW 2
    LOW 11
    HIGH 8
    PAUSE 100
    LOW 13
    LOW 7
    HIGH 5
    HIGH 10
    PAUSE 95
    LOW 8
    HIGH 6
    HIGH 12
    PAUSE 95
    LOW 5
    PAUSE 105
    LOW 6
    LOW 10
    PAUSE 110
    HIGH 11
    PAUSE 105
    LOW 12
    HIGH 6
    PAUSE 100
    LOW 11
    HIGH 13
    HIGH 1
    PAUSE 95
    LOW 6
    HIGH 3
    PAUSE 115
    LOW 1
    HIGH 9
    PAUSE 115
    LOW 13
    LOW 3
    HIGH 10
    PAUSE 125
    LOW 9
    PAUSE 120
    HIGH 12
    PAUSE 105
    LOW 10
    HIGH 4
    PAUSE 125
    HIGH 11
    PAUSE 115
    LOW 12
    HIGH 6
    PAUSE 110
    HIGH 1
    PAUSE 120
    LOW 11
    HIGH 8
    PAUSE 135
    LOW 1
    LOW 4
    HIGH 3
    HIGH 11
    PAUSE 125
    LOW 8
    HIGH 13
    PAUSE 125
    LOW 3
    LOW 6
    HIGH 10
    PAUSE 95
    Times = Times + 1
  LOOP UNTIL Times = 3
  RETURN

'=========================================== Sparkle_4 ====================================

Sparkle_4:
  LOW 10
  HIGH 13
  HIGH 2
  HIGH Sky
  PAUSE 3
  LOW Sky
  PAUSE 77
  HIGH 7
  HIGH Sky
  PAUSE 5
  LOW Sky
  PAUSE 70
  LOW 2
  LOW 11
  HIGH 8
  HIGH Sky
  PAUSE 7
  LOW Sky
  PAUSE 93
  LOW 13
  LOW 7
  HIGH 5
  HIGH 10
  HIGH Sky
  PAUSE 10
  LOW Sky
  PAUSE 85
  LOW 8
  HIGH 6
  HIGH 12
  HIGH Sky
  PAUSE 15
  LOW Sky
  PAUSE 80
  LOW 5
  HIGH Sky
  PAUSE 20
  LOW Sky
  PAUSE 85
  LOW 6
  LOW 10
  HIGH Sky
  PAUSE 25
  LOW Sky
  PAUSE 75
  HIGH 11
  HIGH Sky
  PAUSE 50
  LOW Sky
  PAUSE 55
  LOW 12
  HIGH 6
  HIGH Sky
  PAUSE 100
  LOW Sky
  LOW 11
  HIGH 13
  HIGH 1
  PAUSE 20
  HIGH Sky
  PAUSE 75
  LOW 6
  HIGH 3
  PAUSE 115
  LOW 13
  HIGH 4
  PAUSE 110
  LOW 3
  LOW 1
  PAUSE 115
  LOW 4
  LOW 6
  HIGH 10
  HIGH 11
  PAUSE 230
  LOW 10
  LOW 11
  RETURN

'=========================================== Sparkle_5 ====================================

Sparkle_5:
  Times = 0
  DO
    HIGH 13
    HIGH 2
    PAUSE 10
    LOW 2
    LOW 13
    PAUSE 650
    HIGH 7
    HIGH 3
    PAUSE 10
    LOW 7
    LOW 3
    PAUSE 700
    HIGH 6
    HIGH 12
    PAUSE 10
    LOW 6
    LOW 12
    PAUSE 590
    HIGH 11
    HIGH 5
    PAUSE 10
    LOW 11
    LOW 5
    PAUSE 690
    HIGH 1
    HIGH 8
    PAUSE 10
    LOW 1
    LOW 8
    PAUSE 730
    HIGH 9
    HIGH 4
    PAUSE 10
    LOW 9
    LOW 4
    PAUSE 590
    HIGH 10
    PAUSE 10
    LOW 10
    PAUSE 630
    Times = Times + 1
  LOOP UNTIL Times = 9
  RETURN

'======================================== Flashing Fire ====================================

Flashing_Fire:
  PAUSE 1100
  SEROUT Sio, 6, ["!DC16", %00, "P", 1, 1]
  PAUSE 5800
  SEROUT Sio, 6, ["!DC16", %00, "P", 3, 1]
  PAUSE 155
  SEROUT Sio, 6, ["!DC16", %00, "P", 4, 1]
  PAUSE 1900
  SEROUT Sio, 6, ["!DC16", %00, "P", 6, 1]
  PAUSE 4200
  SEROUT Sio, 6, ["!DC16", %00, "L", %00010001]
  PAUSE 2250
  SEROUT Sio, 6, ["!DC16", %00, "P", 5, 0]
  PAUSE 5000
  SEROUT Sio, 6, ["!DC16", %00, "P", 1, 0]
  RETURN

'====================================== Tamok and Avarita ===================================

Tamok_and_Avarita:
  PAUSE 30910
  SEROUT Sio, 6, ["!DC16", %10, "P", 3, 1]
  PAUSE 16770
  SEROUT Sio, 6, ["!DC16", %10, "X"]
  PAUSE 50000
  RETURN

' {$STAMP BS2}
' {$PBASIC 2.5}

'============================ Final Script 2 ===============================================
          'This script drives the second Prop 2 controller for "The Story of the
          'Beginning."  This controller is the slave, recieving its initial trigger
          'from the master controller.

'============================ Variables/Pins ==============================================

Times VAR Nib
Status VAR Bit

T PIN 0                         '"T" for Tamok, fire spirit
A PIN 1                         '"A" for Avarita, earth spirit
S PIN 2                         '"S" for Sonsente, water spirit
Fire PIN 3                      'four illuminating symbols around the Sun
Water PIN 4
Earth PIN 5
Air PIN 6
                                'Pins 7-10 are the four windows in the sky
Eyes PIN 11                     'Eyes in Sonsente
Red PIN 12                      'Color of the temple
Crystal PIN 13                  'Crystal inside the temple
Blue PIN 14                     'Color of the temple
Sio PIN 15

'============================== Main Program ==============================================

Main:
  PAUSE 3000
  GOSUB Receive_Trigger
  PAUSE 5000
  PAUSE 58230
  HIGH 7
  PAUSE 4000
  HIGH 9
  PAUSE 19000
  LOW 7
  LOW 9
  HIGH 8
  PAUSE 9650
  HIGH 10
  SEROUT Sio, 6, ["!DC16", %10, "P", 5, 1]
  PAUSE 100
  LOW 10
  SEROUT Sio, 6, ["!DC16", %10, "P", 5, 0]
  PAUSE 50
  HIGH 10
  PAUSE 7000
  LOW 8
  LOW 10
  PAUSE 6540
  HIGH T
  PAUSE 6100
  LOW T
  SEROUT Sio, 6, ["!DC16", %10, "P", 2, 1]
  GOSUB Tamok_Speaks
  GOSUB Rumbling_Rocks
  GOSUB Battle
  END

'============================== Receive Trigger =============================================

Receive_Trigger:
  Status = 0
  SERIN Sio, 6, [WAIT ("!EFX"), Status]
  IF Status = 1 THEN RETURN ELSE GOTO Check_Status

'============================== Check Status ===============================================

Check_Status:
  Status = 0
  SERIN Sio, 6, [WAIT ("!EFX"), Status]
  IF Status = 1 THEN RETURN ELSE GOTO Emergency

'============================== Emergency ================================================

Emergency:
  LOW T
  LOW A
  LOW S
  LOW 3
  LOW 4
  LOW 5
  LOW 6
  LOW 7
  LOW 8
  LOW 9
  LOW 10
  LOW 11
  LOW 12
  LOW 13
  LOW 14
  PAUSE 10000

Update:
  Status = 0
  SERIN Sio, 6, [WAIT ("!EFX"), Status]
  IF Status = 1 THEN GOTO Main ELSE GOTO Update

'===================================== Tamok Speaks =======================================

Tamok_Speaks:
  PAUSE 2580
  HIGH T
  PAUSE 500
  LOW T
  PAUSE 500
  HIGH T
  PAUSE 1680
  LOW T
  PAUSE 110
  HIGH T
  PAUSE 610
  LOW T
  PAUSE 630
  HIGH T
  PAUSE 1430
  LOW T
  PAUSE 100
  HIGH T
  PAUSE 1640
  LOW T
  PAUSE 40
  HIGH T
  PAUSE 110
  LOW T
  PAUSE 110
  HIGH T
  PAUSE 110
  LOW T
  PAUSE 830
  HIGH T
  PAUSE 4030
  LOW T
  PAUSE 100
  HIGH T
  PAUSE 510
  LOW T
  PAUSE 390
  HIGH T
  PAUSE 120
  LOW T
  PAUSE 120
  HIGH T
  PAUSE 120
  LOW T
  PAUSE 120
  HIGH T
  PAUSE 90
  LOW T
  PAUSE 2250
  HIGH T
  PAUSE 1640
  LOW T
  PAUSE 520
  HIGH T
  PAUSE 3270
  LOW T
  PAUSE 880
  HIGH T
  PAUSE 1600
  LOW T
  PAUSE 1450
  HIGH T
  PAUSE 1165
  LOW T
  PAUSE 1570
  HIGH T
  PAUSE 60
  LOW T
  PAUSE 1625
  HIGH T
  PAUSE 860
  LOW T
  PAUSE 1290
  HIGH T
  PAUSE 2860
  LOW T
  PAUSE 2360
  HIGH T
  PAUSE 390
  LOW T
  PAUSE 460
  HIGH T
  PAUSE 520
  LOW T
  PAUSE 1020
  HIGH T
  PAUSE 3260
  LOW T
  PAUSE 710
  HIGH T
  PAUSE 1730
  LOW T
  RETURN

'==================================== Rumbling Rocks =======================================

Rumbling_Rocks:
  PAUSE 5150
  HIGH A
  PAUSE 5540
  LOW A
  RETURN

'=================================== Battle ================================================

Battle:
  PAUSE 2000
  HIGH T
  PAUSE 10100
  LOW T
  PAUSE 400
  HIGH A
  PAUSE 14290
  LOW A
  PAUSE 50000
  RETURN

JonnyMac

For me, there are a lot of stylistic issues that could lead to problems down the road as you want to change the program.  I would STRONGLY encourage you to read and adopt "The Elements of PBASIC Style" that can be found in the help file.  Things you'll want to do in future:

-- Name all your pins
-- Use named baud constant
-- Debounce inputs
-- Avoid complex structures on a single line

I would change your trigger subroutine to this (requires a variable):

Check_Trigger:
  timer = 0
  DO WHILE (timer < 0)
    PAUSE 5
    timer = (timer + 1) * Trigger
  LOOP


Your present trigger code is subject to false starts from radiated noise.

Code like this is hard to read and can lead to troubles:

IF Status = 1 THEN RETURN ELSE GOTO Check_Status

Better style that is less error prone and easier to read is:

Check_Status:
  DO
    PAUSE 10
  LOOP UNTIL (status = 1)
  RETURN





 

Jon McPhalen
EFX-TEK Hollywood Office

PDoyle

Thanks.  I'll give those a try and see if that fixes the problem.

PDoyle

I tried your suggested changes and the DC 16's still do not run.  Any thoughts?

bsnut

I scanned through your code that you posted and  I noticed that this line of code is wrong

  SEROUT Sio, 6, ["!AP16", %00, "X"]

and it needs to look like this.

SEROUT Sio, Baud, ["!AP16", %00, "X"]

You didn't define the baud rate, which tells the Prop2 how fast to communicate to your AP16 and DC16. I would suggest you read the PDF files on the AP16 and DC16 that is on this site for help and the test code.

I also noticed that you did this and this is the other part of your problem.

  SEROUT Sio, 6, ["!AP16", %00, "X"]
  SEROUT Sio, 6, ["!DC16", %00, "X"]
  SEROUT Sio, 6, ["!DC16", %01, "X"]
  SEROUT Sio, 6, ["!DC16", %10, "X"]

and it needs to look like this. Because, you cannot have the same addresses for different devises(AP16 or DC16) on the same serial connection.

  SEROUT Sio, Baud, ["!AP16", %00, "X"]
  SEROUT Sio, Baud, ["!DC16", %11, "X"]
  SEROUT Sio, Baud, ["!DC16", %01, "X"]
  SEROUT Sio, Baud, ["!DC16", %10, "X"]

You will need to insert this code below in your program in order for the AP16 and DC16 to work correctly and it should be listed under your Constants group. You also need to remove pin 1 on ULN2803A in order for pin 15 to be used for serial communications in order to work right  by removing it from its socket and cutting it or bending it out of the way like do and reinserting it back into its socket.   

#SELECT $STAMP
  #CASE BS2, BS2E, BS2PE
    T2400       CON     396
    T38K4       CON     6
  #CASE BS2SX, BS2P
    T2400       CON     1021
    T38K4       CON     45
  #CASE BS2PX
    T2400       CON     1646
    T38K4       CON     84
#ENDSELECT

SevenBit        CON     $2000
Inverted        CON     $4000
Open            CON     $8000
Baud            CON     Open + T38K4            '9600 baud rate for accessories

I agree with Jon on the fact that you may want to follow "The Elements of PBASIC Style" that can be found in the help file. I use Jon's template style for the BS1 for the Prop1 and BS2 for the Prop2, I try too ;D. Below is an example of the style that Jon is talking about.

' =========================================================================
'
'   File......
'   Purpose...
'   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


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

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

#SELECT $STAMP
  #CASE BS2, BS2E, BS2PE
    T2400       CON     396
    T38K4       CON     6
  #CASE BS2SX, BS2P
    T2400       CON     1021
    T38K4       CON     45
  #CASE BS2PX
    T2400       CON     1646
    T38K4       CON     84
#ENDSELECT

SevenBit        CON     $2000
Inverted        CON     $4000
Open            CON     $8000
Baud            CON     Open + T38K4            ' fast baud for accessories


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

timer           VAR     Byte


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

Reset:
  OUTS = $0000                                  ' clear all outputs
  DIRS = $3FFF                                  ' make P0-P13 outputs


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

Main:
  timer = 0
  DO WHILE (timer < 100)                        ' wait for 0.1s signal
    PAUSE 5                                     ' loop pad
    timer = timer + 5 * Trigger                 ' update timer
  LOOP

  SEROUT Sio, Baud, ["!DC16", %00, "P", 7, 1]
  SEROUT Sio, Baud, ["!DC16", %00, "P", 6, 1]

  GOTO Main


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


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


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


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


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


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


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

I hope this helps you out and answers your questions.     
William Stefan
The Basic Stamp Nut

PDoyle

I does!   My mistake was the use of several different accessories with the same address.  The DC 16's work perfectly now.  Thanks so much for your help!

I finally understand the debouncing loop now.  I was wary about adopting before I understood how it works.

Since I know that I'm using a Prop 2 at 38.4 kHz, can I simply shortcut the "#Select $Stamp" process and state "Baud CON 6"?

bsnut

I am glad to help. Test small to build big programs. I always test my code in small chucks and also "comment out" code when I have problems. Now you see what Jon and I was talking about.
William Stefan
The Basic Stamp Nut