First, let's make sure that we have a common understanding of how long it takes
to send or recieve a character at 9600 baud - that is in very
rough terms about 1 ms per byte (character).
Details include: number of "start" bits and the number of "stop" bits.
I don't know how many bytes the response contains or how the receiver
decides that it has not received a "timely reponse" - I mean if the "reponse" takes
say 8 characters just to send, then how is that judged against the
allowed "20 character" (20 ms) response time? You may have a lot less than 20ms to start
your response.
I can't test your code, but some parts do seem rather weird...
what is this usleep() stuff in a blocking loop about? Why?
I think that this $PortObj method may be being misused?
$gotit = $PortObj->lookfor(100); #blocking read
I saw a recent question about this.
It appeared to me at the time, that this serial port module could
be configured to report sucess after a particular stream of
input characters were seen - that would appear to me to be
inconsistent with this idea of "lookfor(100)", one hundred what?
What other stuff is running on this Windows machine?
Numbers like 116 ms are a looonnnng time, can you explain more how you calculated that? A process running under Normal priority in a blocking loop that essentially goes to the OS, should under usual circumstances be able to easily process your requirements.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.