Shop OBEX P1 Docs P2 Docs Learn Events
capturing multiple serial values — Parallax Forums

capturing multiple serial values

ArchiverArchiver Posts: 46,084
edited 2001-09-28 22:43 in General Discussion
Hi all,
I'm trying to capture a serial string of values by the BS2.

The serial string are a series of numbers, such as:
101,1,3,4,5,10
The string can be formatted to have any characters bewteen them.

I need each of these stored into word or byte variables.
Using SERIN 16,84,[noparse][[/noparse]DEC num] I can catch the first, is there a way to
capture all at the same time?

Thanks,
Martin Hebel
Need a GUI interface for monitoring and control?
www.selmaware.com/s-plot
www.selmaware.com/tutorials

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-09-28 12:27
    Hi Martin,

    I use the following line of code in one of my app's to
    capture seven variables. The "Wait" will have the code
    sit and continuously poll the line until the ASCII "U" arrives,
    and then once triggered, the data will be captured.

    Serin 16, 84, [noparse][[/noparse]("U"), dec1 Transport, dec4 Size, dec4 Mask, dec5 LCD, dec5
    Lens, Dec4 Pre, Dec4 Post]

    As you can see, the Transport is a one place variable, the Size, Mask, Pre, and
    Post variables are 4 places,
    and the LCD and Lens variables are 5 places.
    You can set these up for different bit lengths as I did, however, be careful to
    "always" send your data
    in the prescribed size, or you will get errors. For example, if you want to send
    the number 100 to a variable capture set up for four places, you must send it
    as 0100, or the code will accept
    the first three numbers "100"and the first number of the next variable as its
    "fourth" number to satisfy the variable
    declaration of dec4. I hope I've made this clear.

    Russ






    Original Message
    From: <martin@s...>
    To: <basicstamps@yahoogroups.com>
    Sent: Thursday, September 27, 2001 11:51 PM
    Subject: [noparse][[/noparse]basicstamps] capturing multiple serial values


    | Hi all,
    | I'm trying to capture a serial string of values by the BS2.
    |
    | The serial string are a series of numbers, such as:
    | 101,1,3,4,5,10
    | The string can be formatted to have any characters bewteen them.
    |
    | I need each of these stored into word or byte variables.
    | Using SERIN 16,84,[noparse][[/noparse]DEC num] I can catch the first, is there a way to
    | capture all at the same time?
    |
    | Thanks,
    | Martin Hebel
    | Need a GUI interface for monitoring and control?
    | www.selmaware.com/s-plot
    | www.selmaware.com/tutorials
    |
    |
    |
    |
    |
    |
    |
    | To UNSUBSCRIBE, just send mail to:
    | basicstamps-unsubscribe@yahoogroups.com
    | from the same email address that you subscribed. Text in the Subject and Body
    of the message will be ignored.
    |
    |
    | Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    |
    |
    |
  • ArchiverArchiver Posts: 46,084
    edited 2001-09-28 14:14
    Thanks, tried your line, and similar, with no success.
    -MH


    --- In basicstamps@y..., "Russ Bassani" <RussBassani@a...> wrote:
    > Hi Martin,
    >
    > I use the following line of code in one of my app's to
    > capture seven variables. The "Wait" will have the code
    > sit and continuously poll the line until the ASCII "U" arrives,
    > and then once triggered, the data will be captured.
    >
    > Serin 16, 84, [noparse][[/noparse]("U"), dec1 Transport, dec4 Size, dec4 Mask, dec5
    LCD, dec5 Lens, Dec4 Pre, Dec4 Post]
    >
    > As you can see, the Transport is a one place variable, the Size,
    Mask, Pre, and Post variables are 4 places,
    > and the LCD and Lens variables are 5 places.
    > You can set these up for different bit lengths as I did, however,
    be careful to "always" send your data
    > in the prescribed size, or you will get errors. For example, if you
    want to send
    > the number 100 to a variable capture set up for four places, you
    must send it as 0100, or the code will accept
    > the first three numbers "100"and the first number of the next
    variable as its "fourth" number to satisfy the variable
    > declaration of dec4. I hope I've made this clear.
    >
    > Russ
    >
    >
    >
    >
    >
    >
    >
    Original Message
    > From: <martin@s...>
    > To: <basicstamps@y...>
    > Sent: Thursday, September 27, 2001 11:51 PM
    > Subject: [noparse][[/noparse]basicstamps] capturing multiple serial values
    >
    >
    > | Hi all,
    > | I'm trying to capture a serial string of values by the BS2.
    > |
    > | The serial string are a series of numbers, such as:
    > | 101,1,3,4,5,10
    > | The string can be formatted to have any characters bewteen them.
    > |
    > | I need each of these stored into word or byte variables.
    > | Using SERIN 16,84,[noparse][[/noparse]DEC num] I can catch the first, is there a
    way to
    > | capture all at the same time?
    > |
    > | Thanks,
    > | Martin Hebel
    > | Need a GUI interface for monitoring and control?
    > | www.selmaware.com/s-plot
    > | www.selmaware.com/tutorials
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > | To UNSUBSCRIBE, just send mail to:
    > | basicstamps-unsubscribe@y...
    > | from the same email address that you subscribed. Text in the
    Subject and Body of the message will be ignored.
    > |
    > |
    > | Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
    > |
    > |
    > |
  • ArchiverArchiver Posts: 46,084
    edited 2001-09-28 18:46
    Martin,
    What did your line look like?
    Russ
    Original Message
    From: <martin@s...>
    To: <basicstamps@yahoogroups.com>
    Sent: Friday, September 28, 2001 9:14 AM
    Subject: [noparse][[/noparse]basicstamps] Re: capturing multiple serial values


    | Thanks, tried your line, and similar, with no success.
    | -MH
    |
    |
    | --- In basicstamps@y..., "Russ Bassani" <RussBassani@a...> wrote:
    | > Hi Martin,
    | >
    | > I use the following line of code in one of my app's to
    | > capture seven variables. The "Wait" will have the code
    | > sit and continuously poll the line until the ASCII "U" arrives,
    | > and then once triggered, the data will be captured.
    | >
    | > Serin 16, 84, [noparse][[/noparse]("U"), dec1 Transport, dec4 Size, dec4 Mask, dec5
    | LCD, dec5 Lens, Dec4 Pre, Dec4 Post]
    | >
    | > As you can see, the Transport is a one place variable, the Size,
    | Mask, Pre, and Post variables are 4 places,
    | > and the LCD and Lens variables are 5 places.
    | > You can set these up for different bit lengths as I did, however,
    | be careful to "always" send your data
    | > in the prescribed size, or you will get errors. For example, if you
    | want to send
    | > the number 100 to a variable capture set up for four places, you
    | must send it as 0100, or the code will accept
    | > the first three numbers "100"and the first number of the next
    | variable as its "fourth" number to satisfy the variable
    | > declaration of dec4. I hope I've made this clear.
    | >
    | > Russ
    | >
    | >
    | >
    | >
    | >
    | >
    | >
    Original Message
    | > From: <martin@s...>
    | > To: <basicstamps@y...>
    | > Sent: Thursday, September 27, 2001 11:51 PM
    | > Subject: [noparse][[/noparse]basicstamps] capturing multiple serial values
    | >
    | >
    | > | Hi all,
    | > | I'm trying to capture a serial string of values by the BS2.
    | > |
    | > | The serial string are a series of numbers, such as:
    | > | 101,1,3,4,5,10
    | > | The string can be formatted to have any characters bewteen them.
    | > |
    | > | I need each of these stored into word or byte variables.
    | > | Using SERIN 16,84,[noparse][[/noparse]DEC num] I can catch the first, is there a
    | way to
    | > | capture all at the same time?
    | > |
    | > | Thanks,
    | > | Martin Hebel
    | > | Need a GUI interface for monitoring and control?
    | > | www.selmaware.com/s-plot
    | > | www.selmaware.com/tutorials
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > | To UNSUBSCRIBE, just send mail to:
    | > | basicstamps-unsubscribe@y...
    | > | from the same email address that you subscribed. Text in the
    | Subject and Body of the message will be ignored.
    | > |
    | > |
    | > | Your use of Yahoo! Groups is subject to
    | http://docs.yahoo.com/info/terms/
    | > |
    | > |
    | > |
    |
    |
    | To UNSUBSCRIBE, just send mail to:
    | basicstamps-unsubscribe@yahoogroups.com
    | from the same email address that you subscribed. Text in the Subject and Body
    of the message will be ignored.
    |
    |
    | Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    |
    |
  • ArchiverArchiver Posts: 46,084
    edited 2001-09-28 19:10
    Setup a BYTE array as an input buffer say 40bytes and let the serial port in
    the background put characters into the buffer. Then you test for data in
    the buffer and if there is any you grab the bytes FIFO one at a time and
    assign them to a byte variable. Simple, but you need a BEEXTWENTYFOUR to do
    it.

    Original Message
    From: martin@s... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=_UZkOGzDS_pPAWWw_bT9JsDNmjfjZK8X6EeAFg0RFPLffxuH97R7txQfpQ6vmoV1-v1VXbO44Hiy5A]martin@s...[/url
    Sent: Thursday, September 27, 2001 11:51 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] capturing multiple serial values

    Hi all,
    I'm trying to capture a serial string of values by the BS2.

    The serial string are a series of numbers, such as:
    101,1,3,4,5,10
    The string can be formatted to have any characters bewteen them.

    I need each of these stored into word or byte variables.
    Using SERIN 16,84,[noparse][[/noparse]DEC num] I can catch the first, is there a way to
    capture all at the same time?

    Thanks,
    Martin Hebel
    Need a GUI interface for monitoring and control?
    www.selmaware.com/s-plot
    www.selmaware.com/tutorials







    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-09-28 20:06
    What baud rate, Martin? All of the Stamp modifiers (DEC, WAIT, etc.)
    become problematic at 4800 baud and above. I have info on the
    execution times for the serial commands posted at
    <http://www.emesys.com/BS2rs232.htm>.

    Solutions:
    -- try a lower baud rate (if possible) and use WAIT modifiers
    -- use a BS2sx or BS2p to get faster response
    -- input the entire string using the STR modifier, and then parse
    it into decimal values later. This eats up the main RAM, but is the
    fastest way to capture data on a BS2.
    -- use a BS2p with the SPSTR modifier, to put up to 127 characters
    into the scratchpad RAM, very fast, and then parse the string into
    decimal values later.
    -- burn an SX18 chip with the code that Al included with his
    Stamps-in-class SX tutorial, an RS232 buffer. Then you could read
    the data at a leisurely pace from the buffer.

    best regards,
    -- Tracy


    >Hi all,
    >I'm trying to capture a serial string of values by the BS2.
    >
    >The serial string are a series of numbers, such as:
    >101,1,3,4,5,10
    >The string can be formatted to have any characters bewteen them.
    >
    >I need each of these stored into word or byte variables.
    >Using SERIN 16,84,[noparse][[/noparse]DEC num] I can catch the first, is there a way to
    >capture all at the same time?
    >
    >Thanks,
    >Martin Hebel
    >Need a GUI interface for monitoring and control?
    >www.selmaware.com/s-plot
    >www.selmaware.com/tutorials
  • ArchiverArchiver Posts: 46,084
    edited 2001-09-28 20:31
    Thanks Tracy, I am using pin 16, the programming port, so stuck there at
    9600 baud.

    Currenly I am requesting 6 different values from StampPlot Pro for
    interactive PID control, which the back-and forth time takes about 1 second.
    I was hoping to request all the data at once and parse it in to minimize the
    request/accept.

    But, unless I go in and modify SPP to have a delay between each character
    sent, looks like I am stuck for a general, universal example. I may test out
    using another pin at 2400 baud just to see if I can do it.

    I'll post the example when done this weekend and drop note.

    -Martin Hebel
    Need a GUI interface for monitoring and control?
    www.selmaware.com/s-plot
    www.selmaware.com/tutorials
  • ArchiverArchiver Posts: 46,084
    edited 2001-09-28 20:46
    Hi,

    Even the programming port can be used at lower baudrates!!

    regards peter


    Oorspronkelijk bericht
    Van: Martin Hebel [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=CCRmovvs1229nrTHnJvLja7mCb2XiGMHJqgZrysKRHJwYw9kC0zzH_B9O5CxsqDwrzHJy0ohzCW1Og]martin@s...[/url
    Verzonden: vrijdag 28 september 2001 20:32
    Aan: basicstamps@yahoogroups.com
    Onderwerp: [noparse][[/noparse]basicstamps] Re: capturing multiple serial values


    Thanks Tracy, I am using pin 16, the programming port, so stuck there at
    9600 baud.

    Currenly I am requesting 6 different values from StampPlot Pro for
    interactive PID control, which the back-and forth time takes about 1 second.
    I was hoping to request all the data at once and parse it in to minimize the
    request/accept.

    But, unless I go in and modify SPP to have a delay between each character
    sent, looks like I am stuck for a general, universal example. I may test out
    using another pin at 2400 baud just to see if I can do it.

    I'll post the example when done this weekend and drop note.

    -Martin Hebel
    Need a GUI interface for monitoring and control?
    www.selmaware.com/s-plot
    www.selmaware.com/tutorials





    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-09-28 21:17
    >Thanks Tracy, I am using pin 16, the programming port, so stuck there at
    >9600 baud.
    >
    >Currenly I am requesting 6 different values from StampPlot Pro for
    >interactive PID control, which the back-and forth time takes about 1 second.
    >I was hoping to request all the data at once and parse it in to minimize the
    >request/accept.
    >
    >But, unless I go in and modify SPP to have a delay between each character
    >sent, looks like I am stuck for a general, universal example. I may test out
    >using another pin at 2400 baud just to see if I can do it.
    >
    >I'll post the example when done this weekend and drop note.
    >
    >-Martin Hebel
    >Need a GUI interface for monitoring and control?
    >www.selmaware.com/s-plot
    >www.selmaware.com/tutorials

    The "programming port", logical p16, is not limited to 9600 baud. It
    can do all the same baud rates as the other pins.

    One other option I didn't mention is hardware flow control, but SPP
    would have to support that. Also, it would help out a lot if SPP
    could be set to send 2 stop bits.

    -- Tracy
  • ArchiverArchiver Posts: 46,084
    edited 2001-09-28 22:43
    DOH! Of course, you are right, I could use Serout and Serin instead
    (of course!) as I have often, so I may try slowing it down, and SPP
    supports all common baud/bit/stop bit configurations. But once I slow
    down the baud rate, may negate what I am trying to transmission.

    Thanks again,
    Martin


    --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    > >Thanks Tracy, I am using pin 16, the programming port, so stuck
    there at
    > >9600 baud.
    > >
    > >Currenly I am requesting 6 different values from StampPlot Pro for
    > >interactive PID control, which the back-and forth time takes about
    1 second.
    > >I was hoping to request all the data at once and parse it in to
    minimize the
    > >request/accept.
    > >
    > >But, unless I go in and modify SPP to have a delay between each
    character
    > >sent, looks like I am stuck for a general, universal example. I
    may test out
    > >using another pin at 2400 baud just to see if I can do it.
    > >
    > >I'll post the example when done this weekend and drop note.
    > >
    > >-Martin Hebel
    > >Need a GUI interface for monitoring and control?
    > >www.selmaware.com/s-plot
    > >www.selmaware.com/tutorials
    >
    > The "programming port", logical p16, is not limited to 9600 baud.
    It
    > can do all the same baud rates as the other pins.
    >
    > One other option I didn't mention is hardware flow control, but SPP
    > would have to support that. Also, it would help out a lot if SPP
    > could be set to send 2 stop bits.
    >
    > -- Tracy
Sign In or Register to comment.