Hi Alessandro, First thing to check - Are you clearing the watchdog timer flag after WDT timeout ? If not, the PIC will reset itself. If you are using the WDT timer, you will need to periodically clear the flag in code to prevent the PIC resetting. This is inherently how the watchdog works. If a point in code is not reached when it is supposed to, the WDT flag is not cleared, and the PIC assumes it has hung somewhere and resets itself. Hint: Use topic tags - you will get more responses from the list that way ;) Hint 2: I suggest reading the WDT section of the datasheet. This one should have the [PIC:] tag. Rgs Ian. > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Alessandro de Manzano > Sent: Sunday, 25 January 2004 9:43 am > To: PICLIST@MITVMA.MIT.EDU > Subject: weird periodic autoreset > > > Hello! > > This is my first post here so please be kind.. :-D > > I'm working on a 18F452 with MP Lab 6 C compiler and a ICD-U40 > programmer. > I'm experiencing a weird problem, I try to explain it as much clear as > I can :-)) > > My sample program is very simple, it just outputs alphabet letters (A > -> Z and repeat) on a 9600 bps software UART using MPLAB-provided > libraries, in an infinte loop. > > It would works correctly but after about 3 seconds of starts the PIC > seems to auto-reset itselfs, and it goes on autoresetting > every 3 secs. > (just to be sure, I also toggle a led in main() and it confirms this > autoresets) > > Reading RCON register just after main() and on every reset (but before > to setting it to 0x1f for clear) reports 23 decimal as > previous startup > cause. > If I'm right it should be WatchDog Timeout. > > But I don't understand why... further, I also tried disabling WD in > config-words (_and_ setting WDTCONbits.SWDTEN=0) but nothing changes. > Idem modifying WD prescaler, no-change :( > > Someone could, please, enlight me ? > What I miss ? Where am I wrong ? > > Many thanks in advance!! > > > > -- > > bye! > > Ale > > ale@unixmania.net > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.