Mister Happy wrote: > > Here is why I'm an idiot. > > I foolishly erased my JW pic (12c508a), and didn't write down the osccal > value. How can I get it back? How many different combinations are there? > One thing I thought of would be to "zero in" on the value. If its between 0 > and 255, then I might try 128, see how it works, then goto 64, and 196. > then if 64 works best, try 32, and 96. then if 96 works best try 80, and > 112. and so on until I get close enough the the number thats it works. How > do I program these values back into the pic? > > Give me all of your osccal values, I'll take an average and see whats > happens. > > PLEASE HELP. Mr. Happy - - Use this code: ;---------------- OscVal EQU 0x80 ; ORG 0x1FF MOVLW OscVal ; ORG 0x000 MOVWF OSCCAL ; OSCCAL is defined as 0x0005 ; Your remaining startup code goes here. . . . END ;---------------- Then check your oscillator frequency and adjust OscVal up or down in 0x10 steps as needed. Next time you get a new JW part, check and record the value at 0x1FF (0x3FF for a 519) as your _first_ step in using it! You should download the 508 data sheet: http://www.microchip.com/Download/Lit/PICmicro/12C5XX/40139e.pdf Have fun, - Nick -