Shop OBEX P1 Docs P2 Docs Learn Events
Serial Communication Application — Parallax Forums

Serial Communication Application

ArchiverArchiver Posts: 46,084
edited 2003-11-02 00:57 in General Discussion
I need help on the following application.
I need to monitor a serial stream where the start of the stream is @@
+ 121 bytes of data and the end 4 bytes.
What I need to do is monitor the 100th byte of data. bases on the
100th byte I need to do something. Can you please post an example of
the code that I would need when using a stamp II


Thank you

Mauro

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-11-01 23:17
    Hi Mauro,

    You could try something like this:

    InterestingByte var byte

    SERIN 0,16468,[noparse][[/noparse]WAIT("@@"), SKIP 99, InterestingByte]

    The SERIN command above will wait for the start of your serial data stream
    and after a further 99 bytes will store the value of the next (hundredth)
    data byte in the variable InterestingByte.

    Best regards,

    Russell Warburton
    email: russell@w...
    website: http://www.warburtech.com
    telephone: +44 (0)7814 044 754
    Original Message
    From: "mdbware2000" <mdbware@h...>
    To: <basicstamps@yahoogroups.com>
    Sent: Saturday, November 01, 2003 8:03 PM
    Subject: [noparse][[/noparse]basicstamps] Serial Communication Application


    > I need help on the following application.
    > I need to monitor a serial stream where the start of the stream is @@
    > + 121 bytes of data and the end 4 bytes.
    > What I need to do is monitor the 100th byte of data. bases on the
    > 100th byte I need to do something. Can you please post an example of
    > the code that I would need when using a stamp II
    >
    >
    > Thank you
    >
    > Mauro
    >
    >
    > 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 2003-11-02 00:33
    What is the baud rate? That makes a difference for using the Stamp
    II for this purpose. It is no problem at 2400 baud, but it would be
    at full out 9600 or more.

    -- Tracy

    >Hi Mauro,
    >
    >You could try something like this:
    >
    >InterestingByte var byte
    >
    >SERIN 0,16468,[noparse][[/noparse]WAIT("@@"), SKIP 99, InterestingByte]
    >
    >The SERIN command above will wait for the start of your serial data stream
    >and after a further 99 bytes will store the value of the next (hundredth)
    >data byte in the variable InterestingByte.
    >
    >Best regards,
    >
    >Russell Warburton
    >email: russell@w...
    >website: http://www.warburtech.com
    >telephone: +44 (0)7814 044 754
    >
    Original Message
    >From: "mdbware2000" <mdbware@h...>
    >To: <basicstamps@yahoogroups.com>
    >Sent: Saturday, November 01, 2003 8:03 PM
    >Subject: [noparse][[/noparse]basicstamps] Serial Communication Application
    >
    >
    >> I need help on the following application.
    >> I need to monitor a serial stream where the start of the stream is @@
    >> + 121 bytes of data and the end 4 bytes.
    >> What I need to do is monitor the 100th byte of data. bases on the
    >> 100th byte I need to do something. Can you please post an example of
    >> the code that I would need when using a stamp II
    >>
    >>
    >> Thank you
    >>
    >> Mauro
    >>
    >>
    >> 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/
    >>
    >>
    >>
    >
    >
    >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 2003-11-02 00:46
    Thank you for the reply.

    The baud rate will be 9600.
    I am ok in using a stamp II

    Thank you

    Mauro

    --- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
    > What is the baud rate? That makes a difference for using the
    Stamp
    > II for this purpose. It is no problem at 2400 baud, but it would
    be
    > at full out 9600 or more.
    >
    > -- Tracy
    >
    > >Hi Mauro,
    > >
    > >You could try something like this:
    > >
    > >InterestingByte var byte
    > >
    > >SERIN 0,16468,[noparse][[/noparse]WAIT("@@"), SKIP 99, InterestingByte]
    > >
    > >The SERIN command above will wait for the start of your serial
    data stream
    > >and after a further 99 bytes will store the value of the next
    (hundredth)
    > >data byte in the variable InterestingByte.
    > >
    > >Best regards,
    > >
    > >Russell Warburton
    > >email: russell@w...
    > >website: http://www.warburtech.com
    > >telephone: +44 (0)7814 044 754
    > >
    Original Message
    > >From: "mdbware2000" <mdbware@h...>
    > >To: <basicstamps@yahoogroups.com>
    > >Sent: Saturday, November 01, 2003 8:03 PM
    > >Subject: [noparse][[/noparse]basicstamps] Serial Communication Application
    > >
    > >
    > >> I need help on the following application.
    > >> I need to monitor a serial stream where the start of the stream
    is @@
    > >> + 121 bytes of data and the end 4 bytes.
    > >> What I need to do is monitor the 100th byte of data. bases on
    the
    > >> 100th byte I need to do something. Can you please post an
    example of
    > >> the code that I would need when using a stamp II
    > >>
    > >>
    > >> Thank you
    > >>
    > >> Mauro
    > >>
    > >>
    > >> 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/
    > >>
    > >>
    > >>
    > >
    > >
    > >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 2003-11-02 00:46
    Thank you for the reply.

    The baud rate will be 9600.
    I am ok in using a stamp II

    Thank you

    Mauro

    --- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
    > What is the baud rate? That makes a difference for using the
    Stamp
    > II for this purpose. It is no problem at 2400 baud, but it would
    be
    > at full out 9600 or more.
    >
    > -- Tracy
    >
    > >Hi Mauro,
    > >
    > >You could try something like this:
    > >
    > >InterestingByte var byte
    > >
    > >SERIN 0,16468,[noparse][[/noparse]WAIT("@@"), SKIP 99, InterestingByte]
    > >
    > >The SERIN command above will wait for the start of your serial
    data stream
    > >and after a further 99 bytes will store the value of the next
    (hundredth)
    > >data byte in the variable InterestingByte.
    > >
    > >Best regards,
    > >
    > >Russell Warburton
    > >email: russell@w...
    > >website: http://www.warburtech.com
    > >telephone: +44 (0)7814 044 754
    > >
    Original Message
    > >From: "mdbware2000" <mdbware@h...>
    > >To: <basicstamps@yahoogroups.com>
    > >Sent: Saturday, November 01, 2003 8:03 PM
    > >Subject: [noparse][[/noparse]basicstamps] Serial Communication Application
    > >
    > >
    > >> I need help on the following application.
    > >> I need to monitor a serial stream where the start of the stream
    is @@
    > >> + 121 bytes of data and the end 4 bytes.
    > >> What I need to do is monitor the 100th byte of data. bases on
    the
    > >> 100th byte I need to do something. Can you please post an
    example of
    > >> the code that I would need when using a stamp II
    > >>
    > >>
    > >> Thank you
    > >>
    > >> Mauro
    > >>
    > >>
    > >> 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/
    > >>
    > >>
    > >>
    > >
    > >
    > >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 2003-11-02 00:57
    Well, try the code that Russell suggested. If it doesn't work on
    your BS2 at 9600 baud, don't be too surprised. The code is good,
    it's just that the BS2 might have trouble keeping up. If you have
    any control over the transmission at the other end, the situation can
    be improved by setting it for 2 stop bits, or for 1 millisecond or
    more of pacing, or for a lower baud rate.

    If not, you might get better results with a Stamp 2sx or 2p, or, by
    using an external RS232 chip with a large enough buffer.

    -- Tracy


    >Thank you for the reply.
    >
    >The baud rate will be 9600.
    >I am ok in using a stamp II
    >
    >Thank you
    >
    >Mauro
    >
    >--- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
    >> What is the baud rate? That makes a difference for using the
    >Stamp
    >> II for this purpose. It is no problem at 2400 baud, but it would
    >be
    >> at full out 9600 or more.
    >>
    >> -- Tracy
    >>
    >> >Hi Mauro,
    >> >
    >> >You could try something like this:
    >> >
    >> >InterestingByte var byte
    >> >
    >> >SERIN 0,16468,[noparse][[/noparse]WAIT("@@"), SKIP 99, InterestingByte]
    >> >
    >> >The SERIN command above will wait for the start of your serial
    >data stream
    >> >and after a further 99 bytes will store the value of the next
    >(hundredth)
    >> >data byte in the variable InterestingByte.
    >> >
    >> >Best regards,
    >> >
    >> >Russell Warburton
    >> >email: russell@w...
    >> >website: http://www.warburtech.com
    >> >telephone: +44 (0)7814 044 754
    >> >
    Original Message
    >> >From: "mdbware2000" <mdbware@h...>
    >> >To: <basicstamps@yahoogroups.com>
    >> >Sent: Saturday, November 01, 2003 8:03 PM
    >> >Subject: [noparse][[/noparse]basicstamps] Serial Communication Application
    >> >
    >> >
    >> >> I need help on the following application.
    >> >> I need to monitor a serial stream where the start of the stream
    >is @@
    >> >> + 121 bytes of data and the end 4 bytes.
    >> >> What I need to do is monitor the 100th byte of data. bases on
    >the
    >> >> 100th byte I need to do something. Can you please post an
    >example of
    >> >> the code that I would need when using a stamp II
    >> >>
    >> >>
    >> >> Thank you
    >> >>
    >> >> Mauro
    >> >>
    >> >>
    >> >> 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/
    >> >>
    >> >>
    >> >>
    >> >
    >> >
    >> >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/
    >
    >
    >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/
Sign In or Register to comment.