# 12F675 Calibration?

Status
Not open for further replies.

#### brodin

##### New Member
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?

#### Nigel Goodwin

##### Super Moderator
brodin said:
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?

It's unique for each one, although those from the same production batch may well be the same (or similar).

I wouldn't have thought MicroChip could tell you what it might be, they would need to be able to recognise that exact chip to do so.

I've got some at home, I'll check what their calibration bytes are and let you know later (unless someone does it first?).

Apart from that you will have to measure it - write a program to output a frequency on one of the pins and measure the frequency. Run the same program on a known correct chip (even a 4MHz 16F84 will do) and compare the frequencies. Adjust the calibration byte in the 12F675 until it runs at as close a frequency as possible.

If you have access to an oscilloscope you could compare them side by side with one feeding the X input and the other the Y input.

Although it's not much help to you, the current working version of WinPicProg (which will be the next released version) reads the calibration byte before erasing or programming - and writes it back for you :lol:

I haven't been caught out (yet!), but I made sure my software made it difficult to be caught out.

#### brodin

##### New Member
Ok, yeah i have an oscilloscope. It would be great if you could send me your bytes, so i have something to start from!

#### Nigel Goodwin

##### Super Moderator
brodin said:
Ok, yeah i have an oscilloscope. It would be great if you could send me your bytes, so i have something to start from!

I've got four 12F675's, their calibration bytes are:

$347C$3478
$3478$3470

#### Exo

##### Active Member
I tested 3 of 'em

3478h for 2 of 'em
347Bh for the other one

#### brodin

##### New Member
Okay, thanx! Now i have something to start on!

#### brodin

##### New Member
How do i set the value in the code?

I am using PicBasic Plus 2.13

I tried this:

DEVICE 12F675
SET_OSCCAL
OSCCAL = \$3478

But then the compiler says:
*** Value will overflow a BYTE size variable! ***

How do i do it in ASM?

#### Nigel Goodwin

##### Super Moderator
brodin said:
How do i do it in ASM?

In assembler just add the lines:
Code:
            ORG     0x03FF
RETLW   0x78
Where '0x78' is the last half of the hexadecimal word (the RETLW is the first half), address 0x3FF is where it's stored.

Status
Not open for further replies.

Replies
10
Views
2K
Replies
1
Views
1K
Replies
2
Views
3K
Replies
0
Views
690
Replies
12
Views
3K