HSERSETUP Background Receive Scratchpad limits


New Member
Given that the background receive feature is the godsend I've been waiting for... a question occurs to me regarding putting some limits around it.

Once a background receive is set up with HSERSETUP and it starts working, at what point does it stop receiving? Never? When the scratchpad is full? Circular?

Is it possible to place some limit on how many characters will be received into the scratchpad? I'm thinking primarily of the need to possibly use the scratchpad for other purposes too (array storage) and the danger of having the array over-written by an uncontrolled 'blurp' of received serial data.

Jeremy Leach

Senior Member
Hi, I've had the same thoughts and I think you just have to ensure that you either turn receive off, or reset the pointer before other data comes in and overwrites other data in the Scratchpad.

I'm using the scratchpad for other purposes too, and receive GPS data everysecond, and have to make sure I process this data and reset the pointer before the new lot of data arrives, otherwise it would corrupt my other data.


Technical Support
Staff member
Circular buffer, overflows from 127 to 0 without warning.
Use the 'hserptr' variable to keep track of how many bytes have been received (and 'hserflag' to indicate when a new receive has occurred (clear in your program)).