Shop OBEX P1 Docs P2 Docs Learn Events
BS2 and Serial Communications — Parallax Forums

BS2 and Serial Communications

ShadowDragonShadowDragon Posts: 51
edited 2005-12-08 22:56 in BASIC Stamp
Hi, i was wondering how to send and receive data over a serial connection at the same time. Thanks

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I watch how the moon sits in the sky on a dark night,
shining with the light from the sun,
The sun doesn't give light to the moon,
Assuming the moons gonna owe it one,

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-12-06 16:41
    Two BASIC Stamp?· Seriously though, the BASIC Stamp is a single-tasking microcontroller, so you cannot send and receive at the same exact time.· You can SEROUT your data and then immediately SERIN, but not both at the same time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-12-06 20:44
    You could add an external receive UART to buffer character input while your Stamp is transmitting. As Chris pointed out, the BASIC Stamp is single tasking and serial commuications are "bit banged" so that they can happen on any I/O pin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • ShadowDragonShadowDragon Posts: 51
    edited 2005-12-07 15:58
    whats a UART?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I watch how the moon sits in the sky on a dark night,
    shining with the light from the sun,
    The sun doesn't give light to the moon,
    Assuming the moons gonna owe it one,
  • Buck RogersBuck Rogers Posts: 2,175
    edited 2005-12-07 16:06
    ShadowDragon said...
    whats a UARY?
    Hello from Buck Rogers
    A UART is a Universal Asychnronous Receiver Transmitter. They are used to encode serial data streams into a format that can be sent over either phone lines using a MODEM, or even a radio link. The basic technology goes back about twenty odd years to the first dialup lines for computers.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Buck Rogers

    www.gregg.levine.name
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-12-07 16:06
    I think at this point many would recommend reading Jan Axelson's Serial Port Complete and any other reference material regarding serial data hardware and protocols before you take on your project.· You will need to understand the basics of serial communication to complete your project from the sounds of things.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • ShadowDragonShadowDragon Posts: 51
    edited 2005-12-07 23:43
    Well, my project is another GPS based robot, using a old palm pilot (runing PalmOrb)for the LCD, and two BS2's. The entire project works very well, but i wanted to make the link between the two stamps faster by using sychnronous(i think this is the proper word) data transfers.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I watch how the moon sits in the sky on a dark night,
    shining with the light from the sun,
    The sun doesn't give light to the moon,
    Assuming the moons gonna owe it one,
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-12-08 22:16
    BS2's don't really run that fast. I believe the best communication (simplist, easiest, and fastest) is to use 19,200 baud SERIN/SEROUT where one sends and the other recieves. SERIN/SEROUT are "asynchronous", meaning that the recieving device regenerates its own clock, by knowing what the 'baud rate' of the sender is.

    "Synchronous Transfers" synchronize data transfers by using a 'clock' pin. The BS2 typically implements this using the "SHIFTIN/SHIFTOUT" keywords -- but it only acts as a clock 'master' (where the BS2 generates the clock signal) it cannot act as a clock 'slave', so this mode is no good for BS2 to BS2 communcations.

    So, while in 'normal' TTL circuitry, synchronous transfers can be twice as fast as asynchronous, the BS2 doesn't support the 'slave' mode to make this work. Nor does the BS2 run fast enough to make engineering in a 'slave' mode a useful thing to do.

    Conclusion: Use SERIN/SEROUT, and don't worry about whether it's "synchronous" or "asynchronous".
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-12-08 22:56
    ShadowDragon -

    You·CAN perform bi-directional asynchronous communication (RS-232) between two Basic Stamps, but NOT in native mode. You will need to add a UART to each of the Basic Stamps, which will provide the concurrent, bi-directional capability, and the necessary data buffering. The best UART that I know of for Basic Stamp use, since it uses a synchronous serial access (SPI/Microwire) method (as opposed to a parallel method), is the Maxim MAX-3100. I'd imagine you can order a couple of free samples from Maxim if you'd like to try it out.

    Thanks to Dr. Tracy Allen for the following applications note on using the MAX3100 with the Parallax Basic Stamp: http://www.emesystems.com/BS2IrDA.htm

    Although the thrust of that particular applications note deals with the IrDA capabilities of the MAX3100, it can also transmit and receive over a hard wire (RS-232) connection as well. The most important areas to review in this applications note are the format and use of the MAX3100's internal registers, and the format and use of the configuration word. Once you have that well in hand, the rest is simplicity itself.

    I have included a copy of the MAX-3100 data sheet for your inspection and perusal. Just as a side-note, there are other members of the Maxim MAX-31xx series as well, which may be of interest. Check the Maxim/Dallas web site for more information: http://maxim-ic.com·. Let us know how you make out with it.

    Regards,

    Bruce Bates
Sign In or Register to comment.