Shop OBEX P1 Docs P2 Docs Learn Events
Receiving a string Serially — Parallax Forums

Receiving a string Serially

kt88seampkt88seamp Posts: 112
edited 2010-06-28 01:43 in Propeller 1
The fullduplexserial object provides a means to transmit a string. How do you receive the string on the other end?

FDSER.str(string("Some Text"))




How do you read in the "Some Text" on the other end?

Post Edited (kt88seamp) : 6/28/2010 12:09:53 AM GMT

Comments

  • bill190bill190 Posts: 769
    edited 2010-06-28 00:18
    If on a PC, with a serial "Terminal"·program like Parallax Serial Terminal, Hyperterminal, Realterm, etc.
  • kt88seampkt88seamp Posts: 112
    edited 2010-06-28 00:23
    I am using another propeller to receive the string.
  • kuronekokuroneko Posts: 3,623
    edited 2010-06-28 00:24
    What's wrong with simply reading the incoming characters (and displaying them)?
  • wjsteelewjsteele Posts: 697
    edited 2010-06-28 00:26
    There are great examples in the Obex. Take a look at the Propeller Serial Terminal Demo and the GPS Demos.

    They both show how to read from a serial input.

    Bill
  • kt88seampkt88seamp Posts: 112
    edited 2010-06-28 00:26
    I am not displaying them. I am doing string compare operations.
  • kuronekokuroneko Posts: 3,623
    edited 2010-06-28 00:28
    kt88seamp said...
    I am not displaying them. I am doing string compare operations.
    Well, then simply store them in a byte array. You might want to introduce some kind of End-Of-String character so that you receiver knows when to stop.
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-06-28 01:43
    Perhaps something like this:

    pub rxstr(pntr) | c
    
      bytefill(pntr, 0, 32)
    
      repeat
        c := serial.rx
        if (c == 13) or (c == 0)
          quit
        else
          byte[noparse][[/noparse]pntr++] := c
    


    This assumes you have a 32-character buffer (array of bytes) at the address indicated by pntr, and an object called serial that has an rx method (like FullDuplexSerial).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
Sign In or Register to comment.