I should have released this sooner... the "Saturday robotics club" that I participate in has a project going on where this is a perfect fit, and after cleaning it up a bit I thought I would pass it along.
Here is a derivative of the high speed 8.42 Meg Baud
(1.05 Million Bytes per second) Prop-to-Prop communication that I wrote some time ago. Last March there were several changes to the front end of both the Receiver and the Transmitter in the way that the handshaking took place. Before you had to make sure that the Receiver was up and running before you Transmitted... this is no longer the case, now it doesn't matter making it more user friendly.
For just the average user, it's pretty straight forward... there is only one command to Send, and there is only one command to Receive.
To receive, just specify the pin you want to listen on and the address of where you want the received data to go to. Remember, this transmission is designed to send large packets of data, so if your just sending a few bytes here and there, this object is probably not for you.
To Transmit, is basically the same thing with a few more parameters... you specify the pin you want to yell on, the address of where the data is coming from, How much data you want to send in longs.
Note: the last two fields are not used in the Basic setup, they will be discussed in Advanced Use.
So that's it for basic use.
The Receive is just the same as before, but it can be used as a function to return additional. information from the Server.
Command := RX(_Pin,_DataAddress)
This will receive data just as before and place it in the assigned address, but Command contains the size of the transmitted packet, a destination offset, and a Packet Command. Organized as such...
s = 14-Bit Packet Size
a = 14-Bit Destination Offset
c = 4 Bit Command
The Packet Size is obviously useful for determining how much data you received and allows support for variable width packets.
The Destination Offset is unique in the sense that the Server has some control as to where the Data will end up on the receiver. Basically this value gets added to the DataAddress that you specify on the receiver so that the incoming data is written to a location starting at the DataAddress plus the Offset. This feature allows random block writes from the Server to the Client.
The 4-Bit Command is just a way for the server to pass a specific command to the receiver. It can be used for anything you want. It's up to you.
For Transmission, it's just the same as the Basic Transmission as well, except the two parameters that were Zero'd out now have some meaning.
DataCommand as just mentioned is a 4-bit command you can pass directly to the Client and can be used for anything you want.
The Offset, also just mentioned, can be used to tell the receiver to write data to another location.
This is useful when you only want to update a block or section of memory on the Client.
Finally with the Demo programs supplied, shows a round-robin approach to sending data across multiple Propellers.
The Idea is that you have one buffer that every Propeller sends around the loop ... "infinitely"
To prevent collisions, ALL Propellers have access to reading the entire buffer, however, and this is what makes it work. Each Propeller can only write to a specific assigned location of that buffer.
<- This isn't exactly true, but it's a good programming practice to implement. There aren't any collisions for similar reasons that you don't have collisions from COG to COG on a single Propeller.
When a Propeller reads the Buffer, he is only allowed to write to the section that he is assigned to before sending the Buffer on to the next Propeller. (Note the Demo Code has this restriction lifted and can write to any location on the Buffer... But in my description, that's how you would typically manage the data across multiple Propellers and avoid collision. It works in the Demo, because there is only one Propeller writing to the buffer)
In the Ring, you can have as many Propellers as you want, with each Propeller only having a 3-wire interface... (Ground, TX, and RX) ... I have tested up to 5 Propellers with the supplied demo code.
One Propeller must be identified as the Server to initiate the data ring, but all of the other Propellers are identified as Clients.
Within each Propeller regardless of Server or Client ALL Propellers have equal access to the Data Buffer.
I Hope this makes sense... Enjoy!!
EDIT: added a slightly newer version that addresses detection of the USB plugged into the PC. This prevents unwanted resets.
EDIT: Check this
link out for a way to control switches across multiple Propellers, i.e. for lighting