No announcement yet.

XON XOFF on the COM Ports

  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    The maximum transfer rate of 9600 may well exceed the ability of
    some equipment, forcing it to return an XOFF signal when it
    cannot accept any more data. XOFF is suppose to tell YOU to
    quit sending data to it -- it could still have some data to
    send back to you, which it will do so. Which explains why you
    see more data coming back after the XOFF signal.

    The XOFF signal is not exact. Typically, the XOFF signal is
    triggered when the receive buffer is about 3/4ths full, meaning
    it can still accept some data beyond that point. The XON signal
    is usually triggered when the buffer falls to only 1/4th full.
    Between these two levels, you should be able to sustain a fairly
    regular flow of data.

    Depending upon the actions of the machine, it may go long
    periods where it has other tasks to perform and cannot remove
    data from the receive buffer. So the XOFF flag goes up. You
    have to wait until it clears with the XON flag before sending
    it more data.

    Sending data in smaller increments can be of some help if you
    then wait to see if the machine is trying to signal you in
    between. The optimum size of your output should be set at just
    under half of the target machine's buffer size - That way you
    should trigger an XOFF automatically so that you can then
    wait for the next XON. Between the 1/4th buffer when the XON
    occurs and the 1/2 buffers size that you send, you should not
    exceed 3/4ths of the target machine's capacity. The under 1/2
    size works so that the first and second groups together will
    not exceed the full buffer size.

    Note that the 1/4th and 3/4th levels are arbitrary - different
    designers could have selected other trigger points. You may
    have to read up on the machines or experiment for best results.

    If you need to work with several ports at once, you might need
    to look at a third party communications library, such as the
    ones from MarshallSoft. Check out the 3rd party links on the
    home page. These are very robust, and give you lots of added
    ports capability.

    PowerBasic is far more powerful and flexable than the QBASIC
    and QuickBASIC products from MicroSoft. Anything that you can
    do with those languages can be done as well or better in
    PowerBASIC, but you need to get into the language a bit to
    find out yourself. Be assured that your efforts will not be
    wasted. PowerBASIC also includes an inline assembler capability,
    whereas the MicroSoft products could only use data statements
    and poke them into memory, or use BLOAD to haul in a binary
    file. That means you can do all your development right within
    PowerBasic, which is not really true for QBASIC or QuickBASIC.

    Old Navy Chief, Systems Engineer, Systems Analyst, now semi-retired