A good starting point might be why are you calling exit(0)? Next, what does this call actually do in terms of assembly instructions? i.e., when you say it reboots, is it rebooting by jumping to the reset vector, or by letting the watchdog timeout? Next, what is going on in your startup code? Is your compiler actually initializing all the memory you're using? How soon after startup do you send this string? When you say executing again, about 10-20 times, executing what? Is 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? Can 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