Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp communicate with RS-232 enabled module? — Parallax Forums

Basic Stamp communicate with RS-232 enabled module?

arrozkongandulezarrozkongandulez Posts: 5
edited 2013-09-29 12:07 in BASIC Stamp
Hello people!

i have a basic stamp that i'd like to interface with the Atlas Scientific ph meter probe.......

they specify that it can communicate through the RS-232 protocol

in their datasheet they give a little explanation:

"TX output delivers asynchronous serial data in RS232 format, except voltagesare 0-Vcc. The output is (up to twelve) ASCII characters representing the pHor status messages; all ending with a carriage return (ASCII 13). Example4.60<CR>
The baud rate is: 38400, 8 bits, no parity, with one stop bit.
The voltage swing 0-VCC, not +/- 12 volts
If standard voltage level RS232 is desired, connect an RS232 converter such as a MAX232. "

will i be able to interface the two? could anyone provide an example? thank you very much in advance!.

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2012-09-23 14:45
    Sounds like the signals are serial but at (inverted) TTL voltage levels, not true RS-232, but the Stamp can deal with that.

    However, at that baud rate, its been my experience that the Stamp will not be able to keep up with receiving more than a couple of characters because it has no communication buffer.

    If the instrument can be set down to 4800 baud or lower, everything will be fine.

    Also, if you move up to a BS2px, you may be able to run at the higher speed. More drastic solutions include an external communication buffer or a microcontroller with a comm buffer.

    Cheers,
  • arrozkongandulezarrozkongandulez Posts: 5
    edited 2012-09-23 14:58
    stamptrol wrote: »
    Sounds like the signals are serial but at (inverted) TTL voltage levels, not true RS-232, but the Stamp can deal with that.

    However, at that baud rate, its been my experience that the Stamp will not be able to keep up with receiving more than a couple of characters because it has no communication buffer.

    If the instrument can be set down to 4800 baud or lower, everything will be fine.

    Also, if you move up to a BS2px, you may be able to run at the higher speed. More drastic solutions include an external communication buffer or a microcontroller with a comm buffer.

    Cheers,

    i have 2 Basic Stamp 2e modules, i dont really want to buy another one... so you think the stamp couldn't keep up with a reading of about 6 ascii chars? (e.g XX.XX<CR>)? thanks for the help
  • Mike GreenMike Green Posts: 23,101
    edited 2012-09-23 15:23
    The Stamp cannot receive 38400 Baud. The BS2px can handle 19200 Baud, but all the others max. out at 9600 Baud. Even then, they can occasionally miss characters at 9600 Baud if you're using some of the more complex input "formatters" in your SERIN statements..
  • ericpineericpine Posts: 31
    edited 2013-09-28 12:03
    My BS2SX is pulling in one ASCII decimal at 115.2k, 7, inverted just fine. The data goes in the variable, and the DEC command ignores the CR/LF (Binary 13, Binary 10) that follows the number and just keeps listening for more ASCII decimal data (Binary 48 thru Binary 57). I would advise using something like Realterm to see what data is output from the unit, and then you can figure out how to process the data. Worst case, you might end up using a shift register to buffer the data, such as a cd4031b. Good luck!
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2013-09-29 12:07
    arroz... That is a nice device, I found the the link.

    You easiest path will be to lower the baud rate by using the Z3 command. Something like this (untested!).
    [SIZE=1][FONT=courier new]SEROUT TxAtlas, $4006,["Z3", 13]  ' send Z3 at 38.4bps, baud rate => 2400bps.
    atlasdata VAR byte[10]
    DO
      SEROUT TxAtlas, $418C,["R",13]   ' 2400 baud
      ' probe takes >300ms to make reading and respond
      SERIN RxAtlas,$418C, [str atlasdata\9\13]    ' get data as string, CR terminated, up to 9 bytes
      DEBUG ? str atlasdata, 13
      PAUSE 100
    LOOP[/FONT][/SIZE]
    
Sign In or Register to comment.