PDA

View Full Version : Rx buffers


cwkoehler
12-06-05, 07:17 AM
Hello,
I am receiving strings of 7 bytes over and over again containing my control information . What size Rx buffer would you recommend for this? Does the buffer need to be filled before it "releases" its entire contents or is it circular in that when filled the next byte in bumps one byte out? My knowlege of how this buffering works is slim and any insight would be greatly appreciated.

Chris

RMDumse
12-06-05, 10:31 AM
The buffer is a continuously wrapping circular buffer. It will overflow the oldest characters first. There is no sense of "releasing packets" with this buffer. Its purpose is to collect serial characters while you are away.

For instance. Let's say you are running at 9600 baud. You will get a character about once every millisecond. But perhaps you want your scheduled run to be every hundredth of a second. You could accumulate 10 to 11 characters between runs. So in this case, setting a buffer something like 22 characters, so you could accumulate characters from one run time and process them while the current run time was in operation, would be enough.

Generally, you will pull characters when you get around to taking them until the buffer is empty, and then let it fill until you return to deal with what you've captured. Hope that helps.

cwkoehler
12-08-05, 08:07 AM
Thanks. Yes that does help