May 20, 2024, 07:17:08 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.


Multiple Prop-1's

Started by davisgraveyard, June 10, 2007, 08:03:40 AM

Previous topic - Next topic

davisgraveyard

I thought I read somehwere or someone told me that you can connect multiple prop-1's together?   I am working on a project where I need an additional input and output and I am using a Prop-1.  I have another Prop-1 handy and am wondering if I could use it?   Do I just connect it like I would a RC4 or AP8 and then address the extra ports with a SEROUT command?  How is this done exactly?

Jeff

JonnyMac

June 10, 2007, 11:52:16 AM #1 Last Edit: June 10, 2007, 11:55:08 AM by JonnyMac
Yes, you can connect one Prop-1 to another using SEROUT on the master and SERIN on the slave.  The process below will describe how to make a simple slave that you could add in a chain with other EFX-TEK devices (slave Prop-1 should be last; if using an RC-4 it must be the first device in the chain).

Connections:
  -- replace the ULN2803 in the master and slave with a ULN2003 to free P7; or remove pin 1 of the ULN2803s in each
  -- use a 3-pin extender cable to connect P7 of the master to P7 of the slave
  -- move the master's P7 SETUP jumper to UP; remove the slave's P7 SETUP jumper

Slave code:
  -- this program has three commands "X" to reset all pins, "P" to set the state of all pins, and "B" to blip a pin for 0.1 to 10 seconds
  -- all commands require a secondary two data bytes; "X" uses neither, "P" uses only the first
  -- the BS1 is not fast enough to do processing between bytes, so you must always send two bytes after the command

' =========================================================================
'
'   File...... Serial_Slave.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 10 JUN 2007
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' no ULN, remove SETUP
SYMBOL  Outs            = PINS                  ' remove P6 SETUP


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

SYMBOL  Addr            = 0                     ' slave address


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

SYMBOL  cmd             = B0

SYMBOL  param1          = B2
SYMBOL  param2          = B3


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

Reset:
  Outs = %00000000                              ' clear all outputs
  DIRS = %01111111                              ' set to output mode


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

Main:
  SERIN Sio, OT2400, ("!SLV", Addr), cmd, param1, param2

  IF cmd = "x" THEN Reset
  IF cmd = "X" THEN Reset

  IF cmd = "p" THEN Set_Pins
  IF cmd = "P" THEN Set_Pins

  IF cmd = "b" THEN Blip
  IF cmd = "B" THEN Blip

  GOTO Main


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

' pass new pins state in param1
' param2 is not used

Set_Pins:
  Outs = param1 & $7F                           ' set new state
  GOTO Main

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

' pass pin (0..6) to "blip" in param1
' pass delay (in 0.1 second units) in param2

Blip:
  IF param1 > 6 THEN Main                       ' in range?
    HIGH param1                                 ' yes, pin on

Blip_Timer:
  param2 = param2 MAX 100                       ' max time is 10 secs
  IF param2 = 0 THEN Blip_Done                  ' timer expired?
    PAUSE 100                                   ' no, keep running
    param2 = param2 - 1                         ' update timer
    GOTO Blip_Timer

Blip_Done:
  LOW param2                                    ' pin off
  GOTO Main


' -----[ EEPROM Data ]-----------------------------------------------------



You can now treat you slave like any other EFX-TEK accessory (these are commands from the master)

  ' all pins off
  SEROUT Sio, OT2400, ("!SLV", 0, "X", 0, 0)

  ' pins 0 - 3 on
  SEROUT Sio, OT2400, ("!SLV", 0, "P", %00001111, 0)

  ' blip pin 6 for one second
  ' -- other pins are not changed
  SEROUT Sio, OT2400, ("!SLV", 0, "B", 6, 10)


Jon McPhalen
EFX-TEK Hollywood Office