View Single Post
  #7   Spotlight this post!  
Unread 06-10-2003, 16:39
ThomasTuttle ThomasTuttle is offline
2004 Beantown Blitz Scorekeeper 1
#0125 (NU-TRONS)
Team Role: Student
 
Join Date: Jan 2003
Location: Boston, MA
Posts: 19
ThomasTuttle is an unknown quantity at this point
Send a message via AIM to ThomasTuttle Send a message via MSN to ThomasTuttle Send a message via Yahoo to ThomasTuttle
Quote:
Originally posted by Sachiel7
My example isn't perfect. In reality, you would probably need 3 pins for it to work correctly. Why?
If your program loops are not exactly synced, this is what happens:

SENDS ERC:1
RECEIVES MRC:1
RECEIVES MRC:1
SENDS ERC: 0
RECEIVES MRC:0

So thus:
The ERC tried to send this data:
10
but the MRC got this:
110
Why did the MRC get an extra 1? Because it looped it input routine around 2 times before the ERC had the next bit ready.
A way to get around this would use 3 pins.
One that Represents a 1, one that represents a 0, and one that acts as a go-between, or I'll call it the "GB" bit.
When the ERC receives the "All Go" signal from MRC, it pings back one "All go signal", and if it gets another back, it begins sending data.
First, it activates it's GB pin. This tells the MRC to wait for the next value before it adds anything more to the string.
Then it begins sending the data as normal, with a GB signal in between each bit value. At the end, it pings back an all go signal. The mrc pings one back if it received everything fine, and the ERC trots on its merry little way.

This way, even though it might be a tad slower, it is absolutely stable data that you are receiving.
Anyway, I'll post more on this later, but I'm glad someone brought it up.
You could also have one line be a data line and another be a clock line. So it would look like this (to send 10010):
Code:
Line 1 1111000000001111100000
Line 2 0011110000111100001111
Result   1   0   0   1   0
So whenever the clock line toggles, the data would be considered new. I also came up with another way of doing it:
Code:
Line 1 01110111011101110111000
Line 2 00100000000000100000010
Result     1   0   0   1   0
This way, whenever Line 2 turns on, the receiver resets a variable. If Line 1 turns on while Line 2 is on, it sets the bit to 1. When Line 2 turns off, it stores/processes it. Once the nybble/byte/word/double/long/whatever length message is done, the EDU turns Line 2 on, telling the receiver to execute it or do whatever. The EDU could also pause between bits, waiting for the receiver to turn on one of the lines as a feedback signal. Two signals could mean start and next, so the receiver setting Line 1 high tells the sender to measure the data, then the sender sets Line 2 high. Then the receiver sets Line 1 low, the sender sets Line 2 low, and begins to send data. Between bits, the receiver would set Line 2 high to ask for the next bit, and the sender would start sending on Line 1. By making the communication two ways, this allows for the receiver to ask for data while it is doing mindless work, and not receive it when it is busy.