I will send code to reproduce. It will basically do the following. Have NOTHING other than serial interface handling. It will understand 2 commands: "H\n" and "E\n" When you send H it will say "Hello\n". When you send E it will do exit(0) When you run E 10 to 20 times, and then say H it will send a messed up string. Give me a few hours to find some time to set it up. Quintin Beukes On Fri, Sep 25, 2009 at 2:21 PM, Tony Vandiver wrote: > A good starting point might be why are you calling exit(0)? =A0Next, what > does this call actually do in terms of assembly instructions? =A0i.e., > when you say it reboots, is it rebooting by jumping to the reset vector, > or by letting the watchdog timeout? =A0Next, what is going on in your > startup code? =A0Is your compiler actually initializing all the memory > you're using? =A0How soon after startup do you send this string? =A0When = you > say executing again, about 10-20 times, executing what? =A0Is this some > function that's executing in your code based on a message you're sending > the board, or some other trigger, or in a main loop, or is it rebooting > 10-20 times before clobbering the serial stream? =A0Can you strip down > your code to the "absolute" minimum required to make this happen and > post it? > > Tony > > > Quintin Beukes wrote: >> Hey, >> >> I have noticed that when I execute exit(0) too many times, and then >> writing to the serial port the data doesn't get to the other side >> correctly. >> >> I for instance send the string "HAS 0", and then the other side will >> sometimes receive it correctly, and sometimes as "HA 0", or "HASHAS >> 0", or "HAS 0 HAS 0", or "HAHAS 0", etc. >> >> This can be reproduced everytime by exiting exit(0), letting it >> reboot, executing again, about 10-20 times. Then it starts writing >> data in this way. >> >> It's not really something that happens in production, but still, why >> would it do this? It happens with all models I've tried it with (all >> being 18Fxxxx) >> >> Quintin Beukes >> > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist