Two thoughts...
First, I made a typo when I posted the original code:
RCREG = dummy is bad. It should be
dummy = RCREG to clear out the buffer.
As far as catching the early data goes, it's probably more elegant to do something like
while x < aminus
'wait for a byte
'discard it
'increment x
WEND
This way, if aminus = 0 and your address = 1, the trashing routine is skipped altogether.
...
And you're exactly right - there's no reason why you should need to use HSERIN at all to grab the last byte. I was experimenting back and forth reading the registers and using HSERIN. Once I got it stable, I didn't change everything to match.
So you can leave it, or change it to say
newlevel1 = RCREG
Either way, it should work fine.
Curious - what are you building?
John
Bookmarks