12F629/675 How read Calibration Value ?

Help
Zardoz
2009-12-30
2013-03-12
  • Zardoz

    Zardoz - 2009-12-30

    Hello. I'm using SDCC to develop a small program to control relays wich a 12F675 or 629 .
    I like to know how I could read the oscilator calibration value from FLASH program memory at 3ff in the program, to assign these value to OSCCAL ragister.

    Actually I'm putting these value directy in the register at the begin of main function, but I need read these value from the program flash, because I will flash around thousand of pics, and I can't manully reading these value and changing the program for every one!!!

     
  • Raphael Neider

    Raphael Neider - 2009-12-30

    I think

        #include <pic14regs.h>
       
        static __code unsigned char __at(0x3ff) calibration;

        void main(void) {
            OSCCAL = calibration;
        }

    should do the trick. Maybe you also need to declare `calibration` as volatile, but I doubt it.
    I cannot currently test this, so please report whether this helped you out or not.

    Best regards

    Raphael

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks