Shop OBEX P1 Docs P2 Docs Learn Events
reading incoming serial data greater than 1 byte — Parallax Forums

reading incoming serial data greater than 1 byte

ArchiverArchiver Posts: 46,084
edited 2000-05-23 19:32 in General Discussion
Hello, I am having trouble reading incoming serial data greater than
one Byte. I have connected my Stamp 2 to a modem, and am trying to
read the responses it gives when I send a command to it. The commands
are successfully sent using the SerOut command.

The particular command I use should solicit a response in excess of
150 characters that terminates with "OK". What happens is OK comes
back , but the message content is lost. I use
serin p,b[noparse][[/noparse]wait("OK"), serData]
This only gives me nothing or just 1 byte!

Ideally, the entire response would be stored in a string.

Please help, I need to see where I am going wrong!

Thank you

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-05-22 22:27
    > Hello, I am having trouble reading incoming serial data greater than
    > one Byte. I have connected my Stamp 2 to a modem, and am trying to
    > read the responses it gives when I send a command to it. The commands
    > are successfully sent using the SerOut command.
    >
    > The particular command I use should solicit a response in excess of
    > 150 characters that terminates with "OK". What happens is OK comes
    > back , but the message content is lost. I use
    > serin p,b[noparse][[/noparse]wait("OK"), serData]
    > This only gives me nothing or just 1 byte!

    The command stores the characters AFTER the WAIT qualifier is received,
    not the characters before it.

    Bean, thitt@i...
  • ArchiverArchiver Posts: 46,084
    edited 2000-05-22 22:38
    Thank you, but I never mentioned that I also used a wait command to trap all
    data thereafer as well.
    The modem gives me "xzy" at the start of the string, 150 bytes then OK. So,
    I used WAIT(xyz), and it will never filled the string.

    What do you suggest?

    Thank you
    SmD


    Original Message
    From: Bean [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=eZd194CSViLjsQ-PjxuVcrAZhJPXmx-5jofM2ReKgw6EjitHQLFm-wpIhLLKtGYkik8-MlUMQaa0]thitt@i...[/url
    Sent: Monday, May 22, 2000 5:28 PM
    To: basicstamps@egroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] reading incoming serial data greater than 1
    byte


    > Hello, I am having trouble reading incoming serial data greater than
    > one Byte. I have connected my Stamp 2 to a modem, and am trying to
    > read the responses it gives when I send a command to it. The commands
    > are successfully sent using the SerOut command.
    >
    > The particular command I use should solicit a response in excess of
    > 150 characters that terminates with "OK". What happens is OK comes
    > back , but the message content is lost. I use
    > serin p,b[noparse][[/noparse]wait("OK"), serData]
    > This only gives me nothing or just 1 byte!

    The command stores the characters AFTER the WAIT qualifier is received,
    not the characters before it.

    Bean, thitt@i...
  • ArchiverArchiver Posts: 46,084
    edited 2000-05-22 22:42
    If I understand what you are saying:

    You will not be able to store 150 bytes in the Stamp. There is simply not
    enough memory.

    Wait("xxx") causes serial input to stall until XXX appears. Anything after
    that can be read, but still not 150 bytes worth.

    Regards,

    Al Williams
    AWC
    *Floating point math for that Stamp, PIC, SX, or any microcontroller:
    http://www.al-williams.com/awce/pak1.htm


    >
    Original Message
    > From: sdye@m... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=Pp5clublS71MCllC-sg2nhgqH_pLnLNF1G23CCaaj2yhM-1yJtyU-efzSUPRKRnodoM2cCD0LBq0uw]sdye@m...[/url
    > Sent: Monday, May 22, 2000 3:48 PM
    > To: basicstamps@egroups.com
    > Subject: [noparse][[/noparse]basicstamps] reading incoming serial data greater than 1 byte
    >
    >
    > Hello, I am having trouble reading incoming serial data greater than
    > one Byte. I have connected my Stamp 2 to a modem, and am trying to
    > read the responses it gives when I send a command to it. The commands
    > are successfully sent using the SerOut command.
    >
    > The particular command I use should solicit a response in excess of
    > 150 characters that terminates with "OK". What happens is OK comes
    > back , but the message content is lost. I use
    > serin p,b[noparse][[/noparse]wait("OK"), serData]
    > This only gives me nothing or just 1 byte!
    >
    > Ideally, the entire response would be stored in a string.
    >
    > Please help, I need to see where I am going wrong!
    >
    > Thank you
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-05-22 22:50
    OK that's a blow!
    I was hoping the stamp had some on-board space for processing data.
    OK, is there someway the incoming data can be directly ported out to another
    pin in a manner that would ensure all data is not lost- i.e. linking two
    pins together software wise?
    Thank you
    SmD
    ++++++++++++++++++++++++++
    If I understand what you are saying:

    You will not be able to store 150 bytes in the Stamp. There is simply not
    enough memory.

    Wait("xxx") causes serial input to stall until XXX appears. Anything after
    that can be read, but still not 150 bytes worth.

    Regards,

    Al Williams
    AWC
    *Floating point math for that Stamp, PIC, SX, or any microcontroller:
    http://www.al-williams.com/awce/pak1.htm


    >
    Original Message
    > From: sdye@m... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=pCd_c5BPd_UydaYRGtd1sKWmrBYeQZqO-d0UANwGmHWD1wF712Ybj-D7nxbwkkT9EIuynpNG-XWcGSiK]sdye@m...[/url
    > Sent: Monday, May 22, 2000 3:48 PM
    > To: basicstamps@egroups.com
    > Subject: [noparse][[/noparse]basicstamps] reading incoming serial data greater than 1 byte
    >
    >
    > Hello, I am having trouble reading incoming serial data greater than
    > one Byte. I have connected my Stamp 2 to a modem, and am trying to
    > read the responses it gives when I send a command to it. The commands
    > are successfully sent using the SerOut command.
    >
    > The particular command I use should solicit a response in excess of
    > 150 characters that terminates with "OK". What happens is OK comes
    > back , but the message content is lost. I use
    > serin p,b[noparse][[/noparse]wait("OK"), serData]
    > This only gives me nothing or just 1 byte!
    >
    > Ideally, the entire response would be stored in a string.
    >
    > Please help, I need to see where I am going wrong!
    >
    > Thank you
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-05-23 19:32
    Let me know if you figure it out. I wrote some code that picks apart the
    rs-232 output of a gps receiver although I don't know if you can store that
    many bites.

    Ralph
    Original Message
    From: <sdye@m...>
    To: <basicstamps@egroups.com>
    Sent: Monday, May 22, 2000 4:47 PM
    Subject: [noparse][[/noparse]basicstamps] reading incoming serial data greater than 1 byte


    > Hello, I am having trouble reading incoming serial data greater than
    > one Byte. I have connected my Stamp 2 to a modem, and am trying to
    > read the responses it gives when I send a command to it. The commands
    > are successfully sent using the SerOut command.
    >
    > The particular command I use should solicit a response in excess of
    > 150 characters that terminates with "OK". What happens is OK comes
    > back , but the message content is lost. I use
    > serin p,b[noparse][[/noparse]wait("OK"), serData]
    > This only gives me nothing or just 1 byte!
    >
    > Ideally, the entire response would be stored in a string.
    >
    > Please help, I need to see where I am going wrong!
    >
    > Thank you
    >
    >
    >
    >
    >
    >
Sign In or Register to comment.