Jump to content
Sign in to follow this  
RSABear

Read And Set Osccal

Recommended Posts

Please could you include for the PICs that requires an OSCCAL setting a function such as:

 

read_set_osccal()

 

This will neaten up the in-line assembly code:

 

asm //Load Factory Calibration Value Into OSCCAL

{

bsf _status,RP0

call 0x3FF

movwf _osccal

bcf _status,RP0

}

 

Thank you.

Share this post


Link to post
Share on other sites

This is rather debateable...

All the Microchip programmers (according to Microchip) are supposed to read

the osccal value for that chip and program it back in without any software

manipulation.

 

Btw every chip apperently has its own osccal value, its not a set value for each

family of devices. ( altho a close value will still work, i found this out the hardway

when a programmer i was using wrote zeros to it)

Share this post


Link to post
Share on other sites

RSABear

Please could you include for the PICs that requires an OSCCAL setting a function such as:

 

read_set_osccal()

 

This will neaten up the in-line assembly code:

 

asm //Load Factory Calibration Value Into OSCCAL

{

bsf _status,RP0

call 0x3FF

movwf _osccal

bcf _status,RP0

}

 

Thank you.

 

What would this function do exactly ??

 

Regards

Dave

Share this post


Link to post
Share on other sites

> What would this function do exactly ??

 

If you use the PIC12F629/675 internal oscillator and do not write the value at 3FFh back into the OSCCAL register you will get unpredictable timing issues, or in the worst case your code will not function at all. This is typically what happens with programmer software from a developer who did not read the fine print on the PIC12F629/675 Datasheet and ereases the value at 3FFh when ereasing the program memory contents during device programming.

 

The proposed function moves the Factory Band Cap calibration value stored at 3FFh into the OSCCAL register of the PIC12F629/675 in one line of code, the developer writes it in C and the job is done.

Edited by RSABear

Share this post


Link to post
Share on other sites

RSABear,

> What would this function do exactly ??

 

If you use the PIC12F629/675 internal oscillator and do not write the value at 3FFh back into the OSCCAL register you will get unpredictable timing issues, or in the worst case your code will not function at all. This is typically what happens with programmer software from a developer who did not read the fine print on the PIC12F629/675 Datasheet and ereases the value at 3FFh when ereasing the program memory contents during device programming.

 

The proposed function moves the Factory Band Cap calibration value stored at 3FFh into the OSCCAL register of the PIC12F629/675 in one line of code, the developer writes it in C and the job is done.

Doesn't look to be hugely benificial - imho.

 

Regards

Dave

Share this post


Link to post
Share on other sites
> What would this function do exactly ??

 

If you use the PIC12F629/675 internal oscillator and do not write the value at 3FFh back into the OSCCAL register you will get unpredictable timing issues, or in the worst case your code will not function at all. This is typically what happens with programmer software from a developer who did not read the fine print on the PIC12F629/675 Datasheet and ereases the value at 3FFh when ereasing the program memory contents during device programming.

 

The proposed function moves the Factory Band Cap calibration value stored at 3FFh into the OSCCAL register of the PIC12F629/675 in one line of code, the developer writes it in C and the job is done.

 

This is an useful function but the problem is it's useful only to PIC12F629/675 developers. Currently BoostC system headers contain functions that can be used by any supported PICs so I'm not sure how this one can be fit there nicely.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites
This is an useful function but the problem is it's useful only to PIC12F629/675 developers. Currently BoostC system headers contain functions that can be used by any supported PICs so I'm not sure how this one can be fit there nicely.

 

Regards,

Pavel

 

 

i am not so sure it is, every chip has a different number, altho some generic ones work as well,

but it is ultimately the programmers problem since it may erase the value before it reads it in

when it reprograms the device.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...