Shop OBEX P1 Docs P2 Docs Learn Events
A simple application for parallel transmission between Popeller chips. — Parallax Forums

A simple application for parallel transmission between Popeller chips.

RichardFRichardF Posts: 168
edited 2007-07-02 21:22 in Propeller 1
I want to have more than 8 cogs in order to simultaneously process more than 7 sensors; so, I have written a simple program that sends parallel data between two or more Propeller chips·using 9 pins. The below program· simulates two Propeller chips for demo purposes, but I am confident it will work with multiple Propeller chips. Also, I am just sending byte data, but in my application I will be sending longs using 4-byte transmissions. Also, I will need to distinguish which sensors/cogs in the second chip the data is coming from. That is easy also; just send a byte telling the receiver what to do with the next 4 bytes, etc. Note that a wait of (400 + cnt) from the time a receiver ready signal is sent until data can be sent is required. Maybe someone with better knowledge of timing issues can explain why the 400 minimum. Please look this over and give me any ideas for improvement you may have. I must keep it simple because this is a hobby and I won't use anything I don't understand.
Thanks,
Richard


Post Edited (RichardF) : 7/2/2007 9:20:01 PM GMT

Comments

  • rokickirokicki Posts: 1,000
    edited 2007-07-02 20:53
    This looks good. I would recommend using *two* control wires, though, a data strobe and an
    acknowledge. The data strobe goes in the same direction as the data, and the acknowledge
    goes the other way. You can either send data on both edges, or only on one edge, your
    choice. This way you don't need any arbitrary waits, and you can speed up either end as
    you want (usually by coding them into assembly). The usual signaling (four phase) is:

    send:
       repeat until acknowledge == 0 ' receiver ready
       datawires := byte
       strobe := 1
       repeat until acknowledge == 1 ' receiver got it
       strobe := 0
    
    receive:
       repeat until strobe == 1 ' data on wire
       byteread := datawires
       acknowledge := 1
       repeat until strobe == 0 ' let sender reset
       acknowledge := 0
    
    



    To do data on each edge, either you *always* send two bytes at a time
    and you use something like this:

    send:
       repeat until acknowledge == 0 ' receiver ready
       datawires := byte1
       strobe := 1
       repeat until acknowledge == 1 ' receiver got it
       datawires := byte2
       strobe := 0
    
    receive:
       repeat until strobe == 1 ' data on wire
       byteread1 := datawires
       acknowledge := 1
       repeat until strobe == 0 ' let sender reset
       byteread2 := datawires
       acknowledge := 0
    
    



    or else can just look at your own strobe to
    determine what to do:

    send:
       repeat until acknowledge == strobe ' receiver ready
       datawires := byte
       strobe := !strobe
    
    receive:
       repeat until strobe <> acknowledge ' data on wire
       byteread := datawires
       acknowledge := !acknowledge
    
    
  • RichardFRichardF Posts: 168
    edited 2007-07-02 21:22
    rokicki,
    Perfect! Thanks.. and I understand it!
    Richard
Sign In or Register to comment.