I wonder what happens, when the UART buffer doesnt fill fast enough...
If readbytes() is called with the value returned by Serial.available(), there won't be a problem. Hard to say for certain with just these code snippets.
Shouldnt it use getch() in readbytes() also?
If readbytes() is called after Serial.available(), then no. Functions, like getch(), are great, but there is overhead involved with every function call. Too many functions slows things down, and consumes a lot pf memory. The key is to achieve a balance between modularity and speed.
oki - i will try both, when i got my fresh atmega chip...
but: Serial.available() should be >= n... just not-zero is not enough...
but when n is bigger than the buffer, it will never be true...
so getch() is better...
timing shouldnt be a problem (the buffer is filled, before the EEPROM is written, i guess)...
if getch() isnt inlined (there is a loop in it), there should be no difference in a getch() call...