Shop OBEX P1 Docs P2 Docs Learn Events
SERIN Command Question — Parallax Forums

SERIN Command Question

ToonzakaToonzaka Posts: 10
edited 2008-06-12 19:07 in BASIC Stamp
I have been looking at a line of code using the SERIN Command and it is confussing me.

SERIN 16, 16468, Interval, SetInterval, [noparse][[/noparse]DEC NewInteral]

I really have no idea what any of that means could someone explain it to me. I looked it up in the documentation but that was not really clear either. What exactly is going on here?

Comments

  • dandreaedandreae Posts: 1,375
    edited 2008-06-12 17:29
    The "Interval and·SetInterval" are optional labels and NewInteral is a variable that represents a decimal value.·

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Parallax Tech Support·
  • ToonzakaToonzaka Posts: 10
    edited 2008-06-12 17:40
    Well what purpose do they serve? Does the command set them to some value? Or does it read them?
  • dandreaedandreae Posts: 1,375
    edited 2008-06-12 18:10
    The "Intreval" is the Plabel which is a optional label that indicates where the program should go in the event of a parity error.· The "SetIntreval" is a Timeout which is an optional variable that tells the SERIN how long to wait for incoming data.



    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Parallax Tech Support·
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-06-12 19:07
    To expand on Daves explanation.

    You may be familiar with seeing the SERIN instruction written SERIN 16, 16468,[noparse][[/noparse]DEC NewInteral] , using this format the SERIN will wait indefinately for a serial value which means that if no value comes your program has locked up, which obviously you don't normally want to happen.

    SERIN has two values you can add which allow you to wait for a certain length of time and if no value comes within that time allows you to move on with your program. The two values are the Timeout which is the length of time you want to wait and the·Tlabel is·the label the program will jump to if the Timeout times out

    Below is your example written slightly differently, the SERIN will wait 200 milliseconds and if it sees no input within that time will jump to the label called Timeout.

    SERIN 16, 16468,200,Timeout,[noparse][[/noparse]DEC NewInteral]

    Timeout:·· 'jump here if no value within 200 mSec

    Jeff T.
Sign In or Register to comment.