Probably because, when your program receives "1", it sends out "1", but at the same time, it can't receive "2" because it's busy sending "1". Then it's done sending "1", "2" has already past by but "3" gets received. Then "3" gets sent, but now "4" is on the way. But "4" gets missed because "3" is being sent out.
Try 'pacing' your sending program. Send the characters with a bit of a delay.
Or receive a bunch of characters at a time using the STR instead of a single byte at a time.
Bookmarks