JimLS:

Try adding a sleep 1; statement between the commands.

Frequently embedded systems don't have buffers on the serial lines. (In fact, many microcontrollers don't have UARTs in them, and simulate the UART in software.) In many cases like this, the command software simply waits for a command, and once it gets one, it runs off and performs it. When the command is complete, it starts waiting for the next command. So when you send it a command, there'll be a delay before it will start looking for the next command, and anything sent before this will just "fall on the floor".

You're sending 8 bytes, which takes roughly 8*(8+2)/9600 seconds (8.3ms) to send to the controller. Since the serial port in your computer probably *is* buffered, you're probably queueing up the second command before the first one has been fully transmitted! (Unless, of course, you're using a computer with no outbound serial buffer, or a horrendously low clock speed.)

...roboticus

When your only tool is a hammer, all problems look like your thumb.


In reply to Re: Disabling buffering of serial port? by roboticus
in thread Disabling buffering of serial port? by JimLS

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.