camerart
Well-Known Member
Hi R,You can just use the output part of the ring buffer as the data input for your original receive and parse routine.
Any time the buffer output pointer is different to the input pointer, get the value at the output point and treat it as you originally treated the received serial byte, loading it in to a linear buffer.
Your original problem was the processing or parsing time of a full buffer, if I remember right? It had to be completed between two interrupts.
Adding a small circular buffer ( eg. 8 or 16 bytes) gives you almost the time it would take the circular buffer to fill, to parse and do whatever you want with a complete received string, before timing matters again.
After that is complete and the main loop continues, it can rapidly move the content from the circular buffer and "catch up" with data coming in.
I think you're correct, but I wan't sure, well done. Now the INTERRUPT is as mentioned, 80uS, so much smaller.
I've been using what I've learnt plus the smaller INTERRUPT to repair the original LINEAR BUFFER, which I'll try first. At the moment I'm stuck on CSV's, but may be able to figure it out.
I'll have to re-read this post, later, as you appear to suggest that a RING BUFFER can be smaller that a LINEAR one, and be better.
Thanks,
C.