Shop OBEX P1 Docs P2 Docs Learn Events
Need outputs of one to mirror inputs of another — Parallax Forums

Need outputs of one to mirror inputs of another

ArchiverArchiver Posts: 46,084
edited 2001-10-29 19:22 in General Discussion
Alright, I'm still figuring out how to work with this code well, so
this may be a simple question.

Basically, I have 2 BS2e's and I am using 6 inputs on one inputting
either a high or low. I need the I/O pins on the "receiving" end to
just respond the same by connecting the 2 by 1 serial line.

The goal is to eventually make this a wireless link. Any help in
structuring the code would be greatly appreciated. Thanks.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-10-29 19:22
    --- In basicstamps@y..., consigli@p... wrote:
    > Alright, I'm still figuring out how to work with this code well, so
    > this may be a simple question.
    >
    > Basically, I have 2 BS2e's and I am using 6 inputs on one inputting
    > either a high or low. I need the I/O pins on the "receiving" end
    to
    > just respond the same by connecting the 2 by 1 serial line.
    >
    > The goal is to eventually make this a wireless link. Any help in
    > structuring the code would be greatly appreciated. Thanks.

    At first glance, it sounds pretty simple. Read the 6 inputs into a
    byte of data, send the data byte serially (serout). At the other end,
    read one data byte serially (serin) and output the byte to 6 outputs.

    It would be a little easier if you had 8 bits in a group (a whole
    byte or input/output port) or could ignore the other two bits (maybe
    just don't connect outputs to them?). But its only a little more
    code, even if its 6 totally separate bits.

    A possible issue is error checking. The simplest thing for checking a
    single byte is to just send it multiple times and have the receiver
    check all of them to be sure they are the same. If they don't match,
    just ignore them and wait for the next transmission, rather than
    output any incorrect data. Or send the byte 3 times and "vote" - if 2
    of the 3 match (or all three match), use them as output. If all three
    are different, ignore them. The chance of all three matching and all
    three being wrong are pretty slim, assuming they are corrupted by
    random noise. A lot depends on how reliable the link needs to be -
    There are even better error checking/correcting techniques that could
    be employed, but they tend to get more complex. You could also
    acknowledge reception or request retransmission in case of error, but
    that would require a two way link and more complexity.

    Chuck
Sign In or Register to comment.