> Thank you for the reply. You said, "PICC takes care of the program location > automatically and the factory calibration value is loaded by default." > > Maybe this is a new feature? I use an old version 7.83PL4. That version > doesn't seem to give me a good 4MHz oscillation. The method I mentioned is > recommended for PIC12C671, and the _READ_OSCCAL_DATA() macro is defined in > the PICC library file "PIC1267X.H". After I used the method to load the > value, it made a big difference, I recall. > > Question: how do I know for sure that the factory calibration value is > loaded? Hi Tony, My experience with it is with the 16C505, but I'm pretty sure they handle it the same way. Also I was using 7.84 version of PICC. The very first instruction at program memory location 0 is movwf 0x05. 0x05 is the location of OSCCAL. When the 16C505 starts, it loads the value from the very top of memory(in my case and yours, 0x3FF) into W, then wraps around and executes the code at the beginning of memory, so the value stored at top of memory ends up in OSCCAL. I didn't have to do anything about it, PICC automatically put movwf 0x05 at the beginning of memory. When you buy a chip, it comes with the calibrated value already programmed. If you use a windowed part, you are supposed to read the value(I use a picstart+ and MPLAB) and write it down somewhere because when you erase the chip, goodbye calibration. Use the Window->Calibration Data feature to read it, and when you go to reprogram the chip, load your code in, then use the Calibration Data window to enter the number. Then program the chip. When programming OTP parts, just program the chip and either don't program the last location, or ignore the error MPLAB gives about already being programmed at that location. Cheers, Bob > > ----- Original Message ----- > From: "Bob Blick" > To: > Sent: Thursday, May 17, 2001 12:58 PM > Subject: Re: [PIC]: How to write C code to calibrate OSCCAL for PIC12CE519? > > > > > I am writing software in C for PIC12CE519. I want to calibrate the 4MHz > > > internal oscillation clock. I understand that the calibration value is > > > stored at location 03FFh. (Data book page 13.) I am supposed to load > this > > > value to the OSCCAL register. Can anyone tell me how to do it? > > > > Hi Tony, > > > > I don't know if you are trying to change the oscillator on the fly, I've > > never done that. > > > > However if you are just wanting the normal calibration to take effect, you > > don't need to do anything, PICC takes care of the program location > > automatically and the factory calibration value is loaded by default. > > > > > > Cheers, > > > > Bob > > > > -- > > http://www.piclist.com hint: PICList Posts must start with ONE topic: > > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > > > > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads