Please use [c ode] tags iso quote-tags for posting code (I know there is a bug in the IDE) - you can modify your previous post.
ÿ = char 255 , it means there is no char
the char array must be volatile too.
That said, your ISR has several
- sizeof buf => sizeof(buf)
- it misses characters if pos >= 149
- it can receive characters while loop() has not printed it yet
You must rewrite the ISR.
- One way is to do double buffering, There is one array that can be printed, and the other can be filled.
- another way is to use a queue, the ISR fills the queue (including a '\0' if needed) and loop reads from it.
HOpes this helps...