Im looking for some advise on how to handle shared scratchpad between program data and hardware serial.
First a copy from the manual ...
1: Run the hserserup and change the hserptr right after to 100 (I will then use 0-99 myself), this will look "nice" in a memory map.
2: Move my own data to 20-119 and let hardware serial use the first 0-19bytes, this will not require to change the pointer after hsersetup.
What happens when the ptr is at the end, does it simply overflow ?
The data I will be recieving _should_ be just a few bytes, and the pc will wait for a responce before sending any more, and im only using hardware serial so that I dont have to worry about when to read it.
Alternativly I need an external ram thingy for my own stuff (or wait for x2 )
First a copy from the manual ...
I would like to use the scratchpad for some temporary data, but also use hardware serial, what would be the best way of doing that ?Upon the hsersetup command the serial pointer (hserptr) is reset to
0. When a byte is received it is saved to this scratchpad address, the hserptr
variable is incremented and the hserinflag flag is set (must be cleared by user
software). Therefore the value ‘hserptr -1’ indicates the last byte written, and
‘hserinflag = 1’ indicates a byte has been received (se also the setintflags
command). The scratchpad is a circular buffer that overflows without warning.
1: Run the hserserup and change the hserptr right after to 100 (I will then use 0-99 myself), this will look "nice" in a memory map.
2: Move my own data to 20-119 and let hardware serial use the first 0-19bytes, this will not require to change the pointer after hsersetup.
What happens when the ptr is at the end, does it simply overflow ?
The data I will be recieving _should_ be just a few bytes, and the pc will wait for a responce before sending any more, and im only using hardware serial so that I dont have to worry about when to read it.
Alternativly I need an external ram thingy for my own stuff (or wait for x2 )