I have a 20X2 accepting bytes of data via interrupt-monitored hserin with the bytes being placed in the scratchpad.
When I exceeded 127 bytes of data the scratchpad overflows and the program goes out of control, so I added some code that I thought would solve the problem.
Losing some data is OK but I don't want to re-read bytes previously read into the scratchpad; I would like to reset hserptr and ptr to zero and clear the scratchpad whenever hserptr approaches the 127 byte limit.
I've tried to do that with this code
but it does not seem to work, maybe because I'm only zeroing one byte at ptr. Can anyone suggest a way to make this code work so that the scratchpad never wraps around and the program does not reread bytes of data that were inserted previously? I'm thinking I'd like to zero out the scratchpad entirely but any other solution that works would be fine with me.
When I exceeded 127 bytes of data the scratchpad overflows and the program goes out of control, so I added some code that I thought would solve the problem.
Losing some data is OK but I don't want to re-read bytes previously read into the scratchpad; I would like to reset hserptr and ptr to zero and clear the scratchpad whenever hserptr approaches the 127 byte limit.
I've tried to do that with this code
Code:
IF hserptr > 120 THEN
hserptr = 1
ptr = 1
@PTR = 0
ENDIF
but it does not seem to work, maybe because I'm only zeroing one byte at ptr. Can anyone suggest a way to make this code work so that the scratchpad never wraps around and the program does not reread bytes of data that were inserted previously? I'm thinking I'd like to zero out the scratchpad entirely but any other solution that works would be fine with me.