Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pic 16f676 Lost OSCCAL

Status
Not open for further replies.

1Steveo

New Member
I don no know How I did it! But it is gone!
I did find a program at **broken link removed**
It is for a 12f675. I would Like to "port" the code for the Slave chip to work with a 16f676, But it is written in ASM
Can anyone help ?

Steve
 
1Steveo said:
I don no know How I did it! But it is gone!
I did find a program at **broken link removed**
It is for a 12f675. I would Like to "port" the code for the Slave chip to work with a 16f676, But it is written in ASM
Can anyone help ?

It should be easy enough to port, both are 14 bit PIC's.

However, do you have other 16F676's to compare it against?. If so, I would suggest reading them and seeing what their OSCCAL values are, you may just be able to copy their value? - often chips from the same batch have similar values.
 
I'm assuming that you don't have the equipment to measure frequency accurately. So without any other information I would pick the value in the middle of the range. Then I would construct an experiment which would determine if the value was fast or slow. An experimet like a one hour timer with an observable output, like an LED, or a buzzer.

Depending on the outcome you would know that the value was above or below the current value. The new range would be half the size of the original, and again pick the middle value and repeat the experiment.

This technique is called a binary search and is quite efficient in establishing an unknown value.
 
binary search will work and shouild converge in 8 trials but it seems to me that you should be able to figure out the best value for osccal with two runs. one with a max value of oscal and one with the min (most negative) vlaue. Assuming the spread is linear you should be able to calculate hz/oscal-increment and thus compute a near optimal osccal vlaue.
 
Thanks for the suggestions. I reprogramed the chip with a value from another Chip. My code is working with an LCD, But I have not tested the SERIAL code.
Wish Me luck!!

Steve
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top