Hi everybody. I've a question. I must modify the standard getkey function: #include <reg51.h> char _getkey () { char c; while (!RI); c = SBUF; RI = 0; return (c); } to know if it receives something by RS232 in 30 sec. If in this time i don't receive anything i must return an error. My problem is how to know if 30 seconds are passed. Thanks everybody.