Author Topic: "Handle" to TX and RX buffers (Windows Api, or other)  (Read 4320 times)


  • Member
  • ***
  • Posts: 8
"Handle" to TX and RX buffers (Windows Api, or other)
« on: October 04, 2013, 06:00:12 pm »
I work with Serial ports all the time and have come quite adept to it, but in my language of choice (PowerBasic) as well as others they all seem to have functions for checking just the Transmit buffer or the Receive buffer but do not really elude to how they gather this information.

Over the years I have developed some code that using Windows Api that I can do some things that may be found as extreme but seemed to work. One thing I have never been able to do (and all my research points to posts that I have done) is to get a handle or a pointer or whatever to the TX and RX buffers separately 

In Windows API for example you can WriteFile or ReadFile but the handle passed is the handle to the port itself, so if I want to check a particular buffer then I give it the port and something "Magical" gives me the response.

My question is, if I have the handle to the do I check for info of just the RX buffer? (Size, chars waiting, etc)
My gut says its possible....but not many people have done it, so I thought I would ask somewhere that language was independent?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2844
    • Lakeview Research
Re: "Handle" to TX and RX buffers (Windows Api, or other)
« Reply #1 on: October 04, 2013, 09:51:37 pm »
At the lowest level, you can read the UART's registers directly. Reading the UART is part of the "magic" that the serial-port drivers perform. Under current Windows editions, you would need to write a low level driver to access the UART.

For more info, search on

uart programming

Also see:


  • Member
  • ***
  • Posts: 19
Re: "Handle" to TX and RX buffers (Windows Api, or other)
« Reply #2 on: November 24, 2013, 10:47:57 am »
Do you use Firefly as your designer? Jose is very active on Planet squires and is incredible with windows API's. But I think that you are going to have to develop your own DLL for this (abandon all hope, ye who enter here).

I'm in the market for a DLL suitable for use with modus RTU (timing dependent). The last windows low level timer that I tried blew up the OS.