Log in

View Full Version : 12F675 - another issue



fratello
- 26th August 2011, 17:25
Hello ! I use in many projects PIC 12F675. For programming I use WinPic 3.55b.
I wrote one code like this :

@ DEVICE PIC12F675, INTRC_OSC_NOCLKOUT, WDT_OFF, PWRT_ON, MCLR_OFF, BOD_OFF, PROTECT_ON
DEFINE OSCCAL_1K 1
DEFINE OSC 4
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50

CMCON = 7
OPTION_REG = %10000110
TRISIO = %00011110 ' if 1 then GPIO=input ; if 0 then GPIO=output
ANSEL = %00011000
ADCON0 = %10001101
etc.
When I try to programming the PIC, I receive this message. Usually I choose the "Yes" option, but I wonder if is OK ? Which option it's better ? Thanks in advance for help !

mister_e
- 26th August 2011, 17:35
If your application is not that much timing sensitive, get rid of the DEFINE OSCCAL line.

There's a thread in here showing how to recover the OSCCAL value.

Before ereasing the PIC, you may want to read the OSCCAL value, write it on a label, stick it on the top of your PIC and then set it manually your code.

Same goes for the Bandgap value

^Note 1: The Bandgap Calibration bits are factory programmed and must be read and saved prior to erasing
the device as specified in the PIC12F629/675 Programming Specification. These bits are reflected
in an export of the configuration word. Microchip Development Tools maintain all calibration bits to
factory settings.

fratello
- 26th August 2011, 19:11
Thank You !
...and if I need the DEFINE OSCCAL too ?
What it's the right answer ? NO ?

mister_e
- 26th August 2011, 19:26
Your screen shot only talk about the BandGap, not the OSCCAL. read the PIC and see what's written to 0x3ff, should be something like 3480. If there's a value there, you're up to go.

My feeling is that some less sensitive device programmer software will erase the BandGap value BECAUSE it is located in the CONFIG register... the same who set your configuration fuses... nothing you can really do. However the Bandgap is for BOD and POR you may set them the way you like. I would dare to say to click on YES which seems to say it actually read the existing one BEFORE doing anything 'bad'.