Glen, I have had a few problems with what seemed to be infinite loops in the past. Once, the problem was that the watchdog timer was enabled and reset my circuit constantly. In MPLab 6.X unchecking the WDT switch in the menu, *and* specifying the _WDT_OFF directive in the code didn't help. It was fixed in a later release of MPLab. Have you considered using the Timer0 Interrupt instead of a delay loop? Just a few thoughts Werner ----- Original Message ----- From: "Glenn Davidson" To: Sent: Tuesday, April 15, 2003 7:10 AM Subject: [PIC]: Infinite Loop dilemma > Hello, > I am working on a Digital Calendar based around a PIC16F877 > operating at 20MHz, for part of my degree project. My deadline is > only a few weeks away, and I have been coming up against what seems > to be an infinite loop for the past few weeks. > I have written smaller test programs to try and ascertain the cause > of the problem, but so far with no luck. > Yet if I step through the code using MPLAB 5.11's simulator, it > appears to return from the particular sub-routine correctly. > The point in the code where it appears to simply stop is in the RTC_DELAY > sub-routine. > RTC_DELAY > MOVLW D'254' > MOVWF DELAY_COUNT ;set counter value > RTC_DELAY_LOOP > DECFSZ DELAY_COUNT,F ;dec delay_count, is zero? if yes, skip next > GOTO RTC_DELAY_LOOP ;no, else loop > RETURN ;yes, return > > It's a very simple routine, and I can't see how it is failing, > though I am currently worried about completing on time, at all. > > I am using an ICEBreaker In-Circuit Emulator from Magenta > Electronics (with the ICEBreaker programming and monitoring > software), with a PIC16F877, interfacing with a DS1302 Real-Time > Clock. Using MPLAB 5.11 for development/simulation/assembling. > I can include the test programs and full program source if > necessary. > Any help would be greatly appreciated. For this part, I am simply > trying to write-to and read-from the Real-Time Clock chip. > -- > All the best, > Glenn Davidson > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body