Shop OBEX P1 Docs P2 Docs Learn Events
Complex SERIN instructions — Parallax Forums

Complex SERIN instructions

ArchiverArchiver Posts: 46,084
edited 2002-09-09 20:12 in General Discussion
If I do a lot of math in inputData arguments, will SerIn miss any data
that was being sent to the stamp while the math was being carried out?

Say for example that I have this line in my program..

serin 0, 6, [noparse][[/noparse]wait ("Hi"), skip sin(10/5+2-b9*w1), b0, wait ("Bye")]

or something similar... i'm not doing that but it IS a legal
instruction...
basicly, doing too much math inside of serin would block the serin
instruction from continuing to parse any input... am I correct?

btw, this is not a problem that im having and an stuck on.. but rather a
question that i find intriguing

-John

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-09-09 20:12
    >If I do a lot of math in inputData arguments, will SerIn miss any data
    >that was being sent to the stamp while the math was being carried out?
    >
    >Say for example that I have this line in my program..
    >
    >serin 0, 6, [noparse][[/noparse]wait ("Hi"), skip sin(10/5+2-b9*w1), b0, wait ("Bye")]
    >
    >or something similar... i'm not doing that but it IS a legal
    >instruction...
    >basicly, doing too much math inside of serin would block the serin
    >instruction from continuing to parse any input... am I correct?
    >
    >btw, this is not a problem that im having and an stuck on.. but rather a
    >question that i find intriguing
    >
    >-John

    Hi John,

    Yes, the calculation would add nearly a millisecond before the Stamp
    figures out how many characters to skip. If the next character's
    start bit arrives before that, it will be missed and the whole string
    will get out of sync. The same thing is true of some of the modifiers
    like DEC and STR. There is a setup time that is around 0.5
    millisecond to set it up before the Stamp is ready to receive the
    start bit. (The '2sx and '2p are faster)

    If the other device paces the characters it sends, say, by 1
    millisecond each, then there is not a problem even at high baud
    rates. In general the BS2 has trouble receiving head to heal
    characters at 9600 baud and above. At 300 baud though, there is over
    3 milliseconds for each stop bit, so, no problem.

    More timing info at <http://www.emesys.com/BS2rs232.htm#sertime>

    -- Tracy
Sign In or Register to comment.