Re: Serial port methods
Manuel Borchers <[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <[email protected]> |
Hi! Am Di, den 30.03.2004 schrieb Mauro Farracha : Tyrex um 13:01: > Does anyone knows why when i use enableReceiveTimeout(2000), it doesnt > wait 2 seconds to read bytes!!! its instantaneous (after - before = 0) it > reads about ~100 characters. > But when i use enableReceiveTimeout(2000) and > enableReceiveThreshold(1024) the time elapse is 20ms and reads about 250 > characters... why it doesn't wait 2 seconds or better reads 1024 bytes!!! First off, I'm no expert in TINI's Java, but normally, what I know from programming on PC and other uCs, the receiveTimeout is the maximum time for the _first_ byte to become available before a read function will return with 0 bytes. And the Threshold is a _maximum_ threshold. So, if there are say 250 bytes in the buffer, you do a read() you will get those 250 bytes that are available. If you don't read this buffer will hold a maximum of 1024 bytes, after that bytes will be dropped. That's what the threshold is for... If I'm totally wrong here, feel free to correct me ;) Cheers, Manuel -- [email protected] http://www.matronix.de - http://www.elektronik-kompendium.de/public/borchers 17:44:16 up 2 days, 12:49, 2 users, load average: 0.48, 0.29, 0.23 _______________________________________________ TINI mailing list TINI-6tN4nzCoH/[email protected] To UNSUBSCRIBE, edit your profile, or see list archives: http://lists.dalsemi.com/mailman/listinfo/tini