Shop OBEX P1 Docs P2 Docs Learn Events
RS-232 cross device communication — Parallax Forums

RS-232 cross device communication

Chicago MikeChicago Mike Posts: 88
edited 2006-02-01 03:36 in BASIC Stamp
This is really two questions. But here it goes. I'm trying to use my BS2 to receive data from a device sending out serial packets·randomly. It works great with a small test program, but I'm obviously worried about losing my data when the BS-2 program is larger. (It will not always be looking for SerIN). Anyone know of an easy buffering method to get around this? Or is just setting up a sync method (Send a request from the stamp for a response packet with the real data), just the best way. I've heard of buffering, and I'm curious.....

Also I've seen some strange wiring diagrams regarding using resistors to temper the input line to the stamp from other serial devices. Anyone have recommendations on this for serial in and out. (Should I still be using a standard 220Ohm on both), or should I be using something higher. Is SEROUT really sending a true RS-232?. I've gotten mixed reviews on this. (Obivously the voltage is lower... 5 compared to 12).

Also, my other device is only 9600 baud. I'm sending a limited amount of data. I understand the BS2 is really not made to go this fast. Really? Would a buffer arrangement improve this?

Any help would be great! Thanks!

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-01-31 05:01
    The BS2 is capable of communications much higher than 9600 baud, but as you point out, it doesn't have a buffer. One solution is flow control. If that won't work for you then there are buffer chips available -- a search of the forums (use search.parallax.com) will turn them up.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-01-31 14:02
    The BS2 can recieve true, +- 12 volt RS-232 signals, by putting a 22 Kohm resistor in series with the pin recieving the data. This 22 Kohm resistor allows the BS2 'protection diodes' on the pin (inside the PIC chip) to 'clip' the signal without damage down to a 0 to +5 signal the BS2 can read.

    Now, to SEND true, +- 12 volt RS-232 signals, you'll need a driver chip, like the MAX232. This converts the BS2 0 to +5 volt levels into the RS-232 +- 12 volts. But it does no buffering, as in recieving multiple bytes while the BS2 is doing something else.

    Also note the BS2 is a single-tasking device. It can't send data in a SEROUT, and also listen at the same time for data in a SERIN. So the 'handshake' sync method you mention would be a good solution for this.
  • Chicago MikeChicago Mike Posts: 88
    edited 2006-01-31 23:29
    Great information! Thanks! I'm assuming I can forgo the 22K resistor when a device (such as another 5V microprocessor) is talking to the BS2.....

    The curious thing I've seen done on other websites is that the connection from the TX pin of the other device to the RX pin on the stamp in a straight connection, but has a 2.2K resisitor to ground on this run.

    TX
    +
    RX
    |
    Z2.2K
    |
    GND

    I can't quite figure that one out...... It works, but I'm not exactly sure what the 2.2K is doing here.
  • Chicago MikeChicago Mike Posts: 88
    edited 2006-02-01 03:04
    Actually, after thinking about this for a while, this opens a new question about your use of the 22K resistor. What formula did you use to come up with using the 22K value with the 12V source?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-01 03:36
    Using the 22K series resistor in the serial line limits the possible current into the pin to less than a milliamp. It's probably a bit conservative, but then, one doesn't always know what the voltage swings on an RS-232 system will be.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.