Shop OBEX P1 Docs P2 Docs Learn Events
verify serin serout — Parallax Forums

verify serin serout

ArchiverArchiver Posts: 46,084
edited 2003-07-25 23:03 in General Discussion
Is there anyway for one stamp to send a byte to another, have the
other receive that byte and then have the receiver verify to the
transmitter that the receiver got that byte.

This is very important for my project.


Many thanks


Paul

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-07-25 21:19
    In a message dated 7/25/2003 3:59:02 PM Eastern Standard Time,
    pjw24@c... writes:


    > Is there anyway for one stamp to send a byte to another, have the
    > other receive that byte and then have the receiver verify to the
    > transmitter that the receiver got that byte.
    >
    >

    There are several wys. You could use flow control, which will assure
    positive transmission. If you want "visual" proof, then when Stamp 2 receives
    the
    data, have that Stamp serout to the sending Stamp "R" or some similar
    character. If the sending Stamp gets an "R" back then it will know that the
    receiving
    Stamp has the data.

    Sid Weaver
    W4EKQ
    Port Richey, FL


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-25 23:03
    Sure! Use the SERIN/SEROUT pair of commands.
    ' *** SLAVE BS2 ***

    MyByte VAR BYTE

    MAIN:
    MyByte = 0 ' Just to prove 'MyByte' is changed by SERIN...
    SERIN 4, 84, [noparse][[/noparse]MyByte] ' NOTE: Will wait forever, till byte.
    ' Use timeout parameter if this is not good
    PAUSE 100 ' Pause allows Sender to get into SERIN
    SEROUT 5, 84, [noparse][[/noparse]MyByte]
    GOTO MAIN
    '**** END of Slave BS2 Code '

    '*** Sender BS2 ****
    ' (Start this program AFTER 'Slave' )
    MyByte VAR BYTE
    GotByte VAR BYTE

    MyByte = 65 ' 65 is ascii "A"
    MAIN:
    GotByte = 0
    SEROUT 4, 84, [noparse][[/noparse]MyByte]
    PAUSE 100
    SERIN 5, 84, [noparse][[/noparse]GotByte]
    IF GotByte = MyByte THEN Success
    ' ELSE
    SEROUT 16, 84 + 16384, [noparse][[/noparse]"Didn't Match", 13] ' Tell TERMINAL
    GOTO Skip1
    Success:
    SEROUT 16, 84 + 16384, [noparse][[/noparse]"'A' Matched" , 13]
    Skip1:
    GOTO MAIN

    Note this program expects the 'Slave' to
    listen on its Pin4, 'Sender' to talk on
    ITS Pin4. 'Sender' will listen on its
    Pin5, 'Slave' will talk on ITS Pin5. A
    220 series Resistor between the two
    BS2 pin 4's and another between the
    pin 5's will prevent damage in case of
    accidents.

    To use this, program the 'Slave' BS2
    with its program, and set it off by itself.

    Program the 'Sender' BS2, wire its pin 4,
    5, and GND to the 'Slave' BS2. Keep the
    PC connected to the 'Sender' BS2's serial
    port -- you can put a Terminal on this
    at 9600 baud and receive the status messages.

    Note this assumes the two chips are pretty
    close, as we're not putting an extra driver
    between them or anything.

    --- In basicstamps@yahoogroups.com, "justforgoyourmove" <pjw24@c...>
    wrote:
    > Is there anyway for one stamp to send a byte to another, have the
    > other receive that byte and then have the receiver verify to the
    > transmitter that the receiver got that byte.
    >
    > This is very important for my project.
    >
    >
    > Many thanks
    >
    >
    > Paul
Sign In or Register to comment.