On Thu, 21 Apr 2011 06:53:37 -0700 (PDT) Oliver Seitz <[email protected]> wrote:
> > This issue affects all 10fxxx devices. In my opinion, the > > include files > > should be changed accordingly. > > > > Any thoughts? > > Hmmm... It really has to be done before anything happens to the w > register... > > I have the feeling this should be done by the compiler, as a user > program perhaps cannot assure that this will be the very first > machine code statement. Or can we rely that the compiler will not > produce anything before the user program? > > I think a compiler directive, perhaps fed with a pointer to the > location of the OSCCAL register, would be the cleanest and most > reliable way. > > Greets, > Kiste > The problem is that different PIC devices implement this feature differently, e.g. here is the information from the PIC12F629/675 Data Sheet: 9.2.5.1 Calibrating the Internal Oscillator A calibration instruction is programmed into the last location of program memory. This instruction is a RETLW XX, where the literal is the calibration value. The literal is placed in the OSCCAL register to set the calibration of the internal oscillator. Example 9-1 demonstrates how to calibrate the internal oscillator. EXAMPLE 9-1: bsf STATUS, RP0 ;Bank 1 call 3FFh ;Get the cal value movwf OSCCAL ;Calibrate bcf STATUS, RP0 ;Bank 0 This is not necessarily done at location 0x000, but can be done later on during the initialization sequence. Some processors don't even have this feature, so moving this to the compiler might be quite an effort, since for every new processor incarnation one might have to change the compiler ... Greetings, Karin -- You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
