Hello JoelMurphy
look at this thread, Darrel's post #16 the code includes a ring buffer.
http://www.picbasic.co.uk/forum/showthread.php?t=4972