Rolf wrote: > Here's one that will make you guffaw a little. > > I have just started programming a PIC, fresh project, etc. I set up new > MPLab 8.01. I copy and past a bunch of C18 code from another project I > did hoping to avoid issues with initialization. The previous project > meticulously goes through every peripheral and > enables/disables/configures it as required (I am using the same PIC as > that project). I thought if I copied that code it would ensure that I > got all the initialization right. I also copied some routines for > reading/writing the EEPROM. > > Well, I took an hour and went through the code to cut out all the cruft > I did not need, and was pretty certain that I had everything set up how > I wanted it (timers, ADCon, Interrupt Priorities, etc.). I decided that > I would add a blinking light to indicate the status of the program > during setup.... just to get things going. > > Well, first the LED would not blink, and I realized the initialization > routine was setting the TRIS to input. So, I set it to output, and the > LED started blinking, but it was blinking faster than I wanted... so I > slowed down the delay loop. Still blinking just as fast. > > Bugger, something was funny. I looked through the code, found no obvious > problems. Figured the WDT or some other reset was happening. Built code > to read the reset RCON status and interpret it. But, it was normal. Set > ICD2 to debug, and read RCON, and every reset was either POR or MCLR > Reset as expected from ICD2 debug. > > Finally, in frustration, I put a meter over the LED and discovered that > even though the output pin was constantly high, the LED was still > flashing..... > > Hmmm... I had pulled a 'flasher' LED from my junk box. Replaced it with > a standard LED, and wrote a mail to Piclist so that you can all laugh at > me.... ;-) > > 2 hours of debug, and now a flasher-LED that has been clearly marked > with a Sharpie... > > Rolf > It happens to us all, Rolf. Nobody is laughing hard, and certainly not at you. --Bob -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist