Shop OBEX P1 Docs P2 Docs Learn Events
Serial Communication from one Prop to another or Prop to Stamp? — Parallax Forums

Serial Communication from one Prop to another or Prop to Stamp?

Jim the HermitJim the Hermit Posts: 79
edited 2014-08-02 22:23 in Propeller 1
I have 2 Quickstart boards and would like to make them communicate with each other serially (basically to increase the amount of I/O lines)
Has anyone ever done that?

Speaking of serial communication. I have a "Mini SSC II Serial Servo Controller" from an old Lynxmotion robot I want to reuse

Here's the code for a basic stamp 2:
' Listing 2. BASIC Stamp II Program Demonstrating the Mini SSC
' Program: SCAN.BS2 (BS2 servo control demo)
' This program demonstrates servo control using the MiniSSC.
' It commands servo 0 slowly and smoothly through its full
' range of travel. To run this program, install a jumper at
' B on the Mini SSC board; leave all other jumpers off.
' Connect:
' BS2 Mini SSC Purpose
' ----- --------- -------------
' P0 S(in) pin S Serial signal
' Vss S(in) pin G Ground
' Plug a servo into Mini SSC output 0 and connect power as described
' in the manual. Run this program. The servo will slowly scan back
' and forth. Try changing the step values in the for/next loops
' to see the effect on servo movement.
svo con 0 ' Use servo 0.
sync con 255 ' Mini SSC sync byte.
pos var byte ' Byte variable holds position value.
n96n con $4054 ' Baudmode: 9600 baud (BS2-SX, change to $40F0).
n24n con $418D ' Baudmode: 2400-baud (BS2-SX, change to $43FD).
again:
for pos = 0 to 254 step 1 ' Rotate clockwise in 1-unit steps.
serout 0,n96n,[sync,svo,pos] ' Command the mini SSC.
next ' Next position.
for pos = 254 to 0 step 1 ' Rotate counter-clock, 1-unit steps.
serout 0,n96n,[sync,svo,pos] ' Command the mini SSC.
next ' Next position.
goto again ' Do it again.

Can anyone change it to spin?
All I really need to know is this line:
serout 0,9600,[255,svo,pos]

Thanks!

Comments

  • JonnyMacJonnyMac Posts: 9,105
    edited 2014-08-02 15:59
    FullDuplexSerial (which is in the default Propeller library) will do the trick. For Propeller-to-Propeller I would suggest using a single wire, and open-true baud mode. Connect a 3.3K pull-up to 3.3v on the serial line. Setup FDS for half-duplex open mode, and you're golden.
    Can anyone change it to spin?


    You'd be better off trying yourself. Yes, it will be difficult at first, and yet, you'll learn more in the process.
  • prof_brainoprof_braino Posts: 4,313
    edited 2014-08-02 22:23
    There is a way to have multiple props talk serial, but this method does not use spin.

    Propforth has a feature called Multichannel Serial (MCS) which allows two props to talk using synchronous serial (at clock speed) for a cost of one cog on each prop. Instead of only cogs 0-6 on Prop0 (cog 7 us used for the terminal communications) propforth will also show cogs 0-6 on Prop1. And you can add as many props as you like. The throughput on the remote cogs is the same as on the local cogs, as ithe communications are synchronous. Propforth just sees additonal cogs being available, there is not much other difference.

    MCS can also be used talk to a workstation, but you have to install the included driver. Propforth sees one more "cog" whcih happens to have communications, display, netowrk and large storage service; the PC sees one more "task" that happes to be really really good at determininstic execution.

    There also is plain old asynchronous serial, but the async method does not automatically come up as one pool of many cogs, the two prop would be two separate items.

    All the executables and source code are in the propforth 5.5 download, and instructions and examples are in the advanced package mygo.zip, another archive embedded in the download.
Sign In or Register to comment.