(once more with the correct subject) Right, I had no good reason for enabling interrupts. I pasted in some usart code to try to get something working fast and never expected interrupts to occur so didn't pay that much attention to them. It took me quite a while to figure out what was wrong with the program and to isolate the problem to the setting those bits, but when I did, I wanted to know exactly which ones were causing the problem. And it turned out it was all of them. I accept your statement that a signal on the RX pin probably caused the problem but why do both GIE and PEIE need to be set for the unplanned interrupt to occur? On Oct 22, 2007, at 2:06 PM, Don French wrote: > For the record, the delay routine is not code that I wrote. It is > supplied with the CC5X compiler. But it does work every time except > the first time after setting all five of the enable bits I mentioned: > Serial port enable (SPEN), Continuous receive enable (CREN), > Peripheral interrupt enable (PEIE), Global interrupts enable (GIE), > Recieve interrupts enable (RCIE). If I omit setting any one of these, > the delay works perfectly. > > My test program has no interrupt processing as it doesn't expect to > receive any, but that may be a mistake. If you have no interrupt processing, then why the heck are you enabling interrupts? With those five bits set, any noise on the RX pin will trigger an interrupt (after a delay set by your baud rate setting). -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist