PDA

View Full Version : 12F675 Calibration?



brodin
- 23rd December 2003, 12:48
I did something stupid today. I bought a 12F675, and without reading the datasheet i erased it the first thing i did. Very stupid!

Now the OSC calibration values are gone, aren't they? How can i get them back? The datasheet says something about that it is possible to get them form Microchip.

Help!!!

How shall i do?


Is the value uniqe for every single PIC, or is it the same for all of them

Melanie
- 23rd December 2003, 15:54
Apart from losing the OSCAL values you've probably also erased the BANDGAP presets.

Firstly, let's deal with OSCAL... the PIC will stilll work, but the internal oscillator will be off by an unknown amount. This OSCAL value is unique to each PIC, so reading mine and giving it to you will be pretty meaningless. If you are going to use an external xtal or resonator then again there is no problem. The problem remains if you are going to use the INTERNAL Oscillator with time critical applications (eg serial comms like SERIN/OUT etc).

Most good programmers have an option to preserve the OSCAL and BANDGAP bits when programming and erasing, and now is the time to ensure yours are set.

There's many methods to tune your OSCAL. Here's some depending on your patience and available hardware...

Method 1. Create a simple program (say LED Blink), set the OSCAL value to mid-way and PIC to have the oscillator output it's clock on OSC2/GP4 with the define...

@ DEVICE pic12F675, INTRC_OSC_CLKOUT

Attach a frequency counter to GP4 and trim your OSCAL value up or down accordingly (yes you need to reprogram the PIC each time) to what the frequency counter is telling you.

Method 2. Create a simple program and have say DEBUG at 4800 in a loop sending a series of 'U's... eg

DEBUG REP "U"\16,13,10

Now, connect to your PC and go thru OSCAL values until you reach a band of values that display the characters properly on your PC. Chose the mid-band value as your final OSCAL.

Now for the BANDGAP. There are only four possible settings, so life is easy. The BANDGAP trims the on-board voltage reference used for BOR and POR. If it's wrong, then most probably BOR and POR won't meet the published specs. Again, write a simple program, say to blink an LED and wind the voltage down on a variable PSU and read on an accurate DVM to see at which point BOR activates. Adjust accordingly.

Personally, it's so much aggrevation for so little gain, I'd put the PIC asside for the first non-critical application or toy I'd need to make, and go buy another one. They're only about $1.50 - so how much time do you want to devote to this?

Melanie

brodin
- 24th December 2003, 00:08
thanks a lot!

Mabybe you are right =) (about the price)

By the way, where do you buy your PICs and other components? $1.5 sound cheep for a 675. I pay like $2.5

How much do you pay for a PIC16F876A?

Melanie
- 24th December 2003, 03:50
We probably pay less because we usually bulk purchase. I don't use the 16F876A part, but the straight 16F876 is between $4 and $4.50 in volume. About 99% of all our PIC's are imported bulk from the far east. The remaining 1% or so are sourced locally in the UK. You should try Crownhill, they're really not too bad with their PIC pricing for small quantities and as a bonus you end up supporting this web site...

www.crownhill.co.uk

brodin
- 24th December 2003, 10:40
Okay.

I have another question about the 675. How good is the internal 4 MHz? Is it as good as a crystal when it is calibrated? I mean how stable and accurate is it?

I need it to an extremly timing accurate project, where i earlier have used a 16F84 and a 4MHz crystal.

mat janssen
- 24th December 2003, 12:43
look at this url: http://www.microchip.com/1010/suppdoc/appnote/all/an250/index.htm
and there is the sollution for you problem.
succes with it
greetings
Mat

Desterline
- 28th December 2003, 08:06
>I have another question about the 675. How good is the >internal 4 MHz? Is it as good as a crystal when it is calibrated?

No.

>I mean how stable and accurate is it?

Not very. It's fine for a lot of things, but I wouldn't even consider it for serial communications or RTC functions or the like.

>I need it to an extremly timing accurate project, where i earlier >have used a 16F84 and a 4MHz crystal.

The easy answer here is to use a crystal for this project too.

-Denny

jbirnsch
- 6th January 2004, 02:41
I get my PIC's at http://www.glitchbuster.com/

Great prices and cheap shipping.

Jason