Shop OBEX P1 Docs P2 Docs Learn Events
RS232 communication objects: data, parity, start and stop bits? — Parallax Forums

RS232 communication objects: data, parity, start and stop bits?

MJHanaganMJHanagan Posts: 189
edited 2012-03-05 11:29 in Propeller 1
Hi everyone - I am trying to communicate with a Davis Weather instrument via its RS232 connection (it's actually the Weather Link unit). It uses a 2400 baud rate, 8 data bits, no parity bit and one stop bit. I have succesfully communicated with it using my laptop's RS232 port and some other software (WinWedge) so I verified that the Weather Link works.

I am using a non-inverting buffer to boost the Prop's Tx pin output voltage up to 5V and a pair of resistors on the Rx pin to keep the maximum incoming voltage at +3.3V (I am assuming the instrument is using TTL signals).

I have tried using the "Simple_Serial" and the "FullDuplexSerial" objects to communicate with it but so far nothing has worked.

Am I correct in assuming that both of these drivers handle the 8 data bits, and 1 stop bit protocol? I can't see anything in the code that specifically addresses things like stop bits (typically it's 1 but I have seen some instruments with 2 and a reference to 1.5), or start bits (I think all RS232 begin with a +V start bit), or parity bit (odd, even or none). I am beginning to wonder if I even have the necessary object to handle the 8 data bits, no parity bit and one stop bit protocol it seems to want.

Any thoughts?

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2012-02-18 16:56
    Assuming the baudrate is set correctly, have you tried inverting the signals (in s/w)? The objects you mention all handle 8N1.
    serial.start(31{rx}, 30{tx}, %00[COLOR="red"]11[/COLOR], baudrate)
    
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-02-18 19:16
    As kuroneko said, it is most likely you need to preform inversion in sw because you do not have RS232 inversion on the prop side.

    However, if this fails, you may have to check if your device needs some of the RS232 signals (like CTS and DSR). There is lots of info on the wiki about these signals.
  • kwinnkwinn Posts: 8,697
    edited 2012-02-18 20:59
    Standard RS232 require the signal to go both positive and negative (ie +- 3V to +- 12V) so if your signal out from the 5V buffer only goes between 0V and +5V the weather station may not see it.
  • StefanL38StefanL38 Posts: 2,292
    edited 2012-02-19 02:07
    If you tested the weather instrument with a real COM-port or a USB-to-serial converter they use -+12V.

    As kwinn has mentioned of you are just using 0V/5V this might not work. To achive this you can use a MAX3222 voltage-level-shifter.
    The MAX3222 needs a powersupply of just 3.3V. Exactly what your propeller-chip needs too. The Propeller-Chip-side then provides 0V/3.3V.
    So no current-limiting resistors needed.

    The other side provides +-12V like the RS232 V.24-standard wants to have it.

    Attention the mostly used MAX232 is a 5V-device which would require 5V-supply and current-limiting resistors again.
    So use the MAX3222 instead.

    From your sentence
    to keep the maximum incoming voltage at +3.3V
    I can conclude that your level of understanding Ohms law is just medium.
    These resistors do NOT keep the voltage down on 3.3V. They (should) limit the current below 500 microampere which the propeller-chip can stand for voltages sligthly above 3.3V e.g. 5V.
    The IO-pins have internal clamp-diodes that "drive-away" voltages above 3.6V. But they can only stand 500 microampere. If your resistors have a too small value you go over this limit
    and the IO-pin will burn out.

    keep the questions coming
    best regards

    Stefan
  • MJHanaganMJHanagan Posts: 189
    edited 2012-02-19 07:58
    I just checked the voltage on the Tx pin of the weather station and it measures -11.6V in the idle state. I'm off to get one of these MAX3222 devices!

    Thanks for the help!
  • MJHanaganMJHanagan Posts: 189
    edited 2012-03-05 06:15
    I got my MAX3222 in the other day and tested it over the weekend - everything now seems to be working just fine. Thanks for all the help!
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-03-05 11:29
    Pleased you now have it working. Thanks for letting us know.
Sign In or Register to comment.