' Name : RECOVER.pbp ' Compiler : PICBASIC PRO Compiler 2.6 ' Assembler : PM or MPASM ' Target PIC : 8-pin PIC12F675 or similar types ' Hardware : Lab-X4 board ' Oscillator : 4MHz internal ' Keywords : SEROUT2, OSCCAL ' Description : PICBASIC PRO program for recovering factory OSCCAL calibration values. ' Run this program in a 12F675 on the LAB-X4 Experimenter Board. ' It will display gibberish on the LCD until the calibration value is incremented to a ' value that lets the serial communication work. It will continue to display hex ' calibration values until incremented beyond the working range. Let it run, monitor ' the LCD for values followed by "Correct?". Pick one of the values that work - midway ' after it starts working and before it stops working. ' LCD Var GPIO.1 ' LCD TX pin ANSEL = 0 ' disable A/D converter CMCON = 7 ' disable comparators OSCCAL = 0 ' starting value for OSCCAL register Pause 200 ' give the LCD time to start up mainloop: OSCCAL = OSCCAL + $10 ' increment calibration value ' Test to see if the serial comm works. Serout2 LCD,396,[$fe, 1] ' Clear screen Serout2 LCD,396,[HEX2 OSCCAL, " Correct?"] ' Display the hex value Pause 750 ' give time to read the value goto mainloop ' do it forever End