On 2010-7-17 08:10, Daniel Drotos wrote: > On Sat, 17 Jul 2010, 谢继雷 wrote: > >> This reminds me. But as main just read from it to check whether >> buffer is filled, even though it maybe changed by ISR, it's just fail >> the test but not the buffer contents. So later in the next loop, >> main() will find that recvp pointer is moved, and the filled contents >> will be read out correctly. > > You are right, my modification of using recvp is not needed, but not > bad anyway and makes it more safe. > >> I've just debugged into with s51, and set breakpoint on RI, in fact >> before main first time to start to check the ring buffer, the frame >> lost is already happened. > > Finaly I've found the problem. Your main() is in sunit.h and there you > set ES and REN to 1 before calling test function, so before setting up > uart and timer. > > Simulator (as real cpu) starts to read in input when there is clock > for uart (timer1 started) and REN=1, so for correct operation TR1=1 or > REN=1 must be the last step, when everyting is set up. See my diff > (against the original sources), it works correctly. > > See the changes about sending, which are also required to make it work. > > Daniel Yes, great mod! I've discovered this too last night. Replace TI with sending is very clear.
Thanks, Lenik ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user