• 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.

12c508A internal clock, how close to 4mhz should it be?

Status
Not open for further replies.

SnM

New Member
I have writting a program than does something for x amount of time. on MPLAB, it runs perfectly. I just burned the chip today, and my program works :), but i noticed that my operation run for about 5% longer than designed.

what is the range that the internal clock is suppose to run? I didn't see anything in the data sheet.

thanks,

steve
 

Nigel Goodwin

Super Moderator
Most Helpful Member
SnM said:
I have writting a program than does something for x amount of time. on MPLAB, it runs perfectly. I just burned the chip today, and my program works :), but i noticed that my operation run for about 5% longer than designed.

what is the range that the internal clock is suppose to run? I didn't see anything in the data sheet.

thanks,

steve
Are you installing the calibration value, the 4MHz oscillator is only free running (so will drift with temperature somewhat) but the calibration byte allows you to adjust it.

The first line of your code should be:

MOVWF OSCCAL ; Store the factory osc. calibration value
 

SnM

New Member
no, i didn't do anything with the osccal

if i add that line as the first in my code, what is the value of "W" when i move it to the osccal???

i'll look more into the osccal when i get a chance....probably tomorrow.

thanks.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
SnM said:
no, i didn't do anything with the osccal

if i add that line as the first in my code, what is the value of "W" when i move it to the osccal???
The reset vector of a 12C50x isn't 0x000, it's the highest byte of available memory - which is where the calibration byte is stored. On a reset this last word is executed, it consists of MOVLW ??, where the ?? is the actual oscillator calibration data. The address counter than rolls over, moving to 0x000 where you store the contents of W in the required register.

It's all explained in the datasheet!.
 

SnM

New Member
I understand now. Thanks, I really appreciate your help! I am new to pic microcontrollers, so I must have overlooked that part :oops:

Thanks again!

Steve
 

Nigel Goodwin

Super Moderator
Most Helpful Member
SnM said:
I understand now. Thanks, I really appreciate your help! I am new to pic microcontrollers, so I must have overlooked that part
It's very commonly overlooked, you wouldn't believe how many people erase their UV 12C508's without making a note of the calibration value :lol:

I've tried to make my programming software more user friendly, giving warnings if you try to erase it, or overwrite it with another value, or even try to write to a chip with a blank calibration value. For the 12F675, an 8 pin FLASH chip, which also has a calibration byte, my software automatically reads and restores the calibration byte whenever you erase or write the chip.
 

SnM

New Member
Now that i changed my program by adding movwf OSCCAL as the first line after org 0, I am having trouble programming it :x

it gets so far, and then displays an error that it expected something that wasn't there. it worked the other day perfectly the first try.

If i figure out the problem, is there anyway to save the two chips that didn't get burned correctly, or did I lose them? :cry: they are non-UV 12C508A

thanks

steve
 

Nigel Goodwin

Super Moderator
Most Helpful Member
SnM said:
Now that i changed my program by adding movwf OSCCAL as the first line after org 0, I am having trouble programming it :x

it gets so far, and then displays an error that it expected something that wasn't there. it worked the other day perfectly the first try.

If i figure out the problem, is there anyway to save the two chips that didn't get burned correctly, or did I lose them? :cry: they are non-UV 12C508A
I presume you are using brand new blank 12C508's?, they are OTP (One Time Progammable) so if you've written to them already you can't use them again. A better choice now is probably the 12F675, an 8 pin FLASH chip.
 

SnM

New Member
probably would have been better to use that chip;)

well, i tried to burn a 16f84A and it worked....was thinking there was a problem with the software, or my computer.... so i tried to burn another 12c508A chip, but it got farther, and then stopped. now i figured it could be something weird with my computer. i then booted to dos so i could use the dos version of my programmer, and i tried to reburn the last chip that got screwed up and it worked. not sure why. the other two wouldn't even try to burn.

put the newly burned chip in my circuit, and the time is much better now.... Thanks for your help with the osccal!!

steve
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top