| ??? 12/26/07 21:38 Read: times |
#148746 - absolutely, just worst case is not as bad Responding to: ???'s previous message |
Secondly, the timing should be always designed according to the worst case. There is no room to consider on average. Circular buffers extend the minumum character separation time to those multiplied by the buffer size. This span is compared with the maximum main loop time.
Absolutely, always design to 'worst case'. If you have a workloop that takes 1/2 character time most of the time and, say, every 2 seconds (e.g. on a timed ADC interrupt) do something that takes 2 character times you will die if you are polling and live happily ever after with a ring buffer of sufficient size. So, when using a ring buffer, worst case is not as bad, but a worst case, of course, still exist. This, of course does not allow you to insert 111 character time long 'occasional' processes. There always is a worst case to design to. This, actually is a typical ADC/UART case. If the ADC processing is lenghty and the ADC reads are 'rare' a ring buffer is just the recipe. Erik |



