Joep, Thank you for your help on this. It was just brought to my attention by Eur, that be careful with JAL delay routines since we typically tell JAL we are running at 8 MHz (at compile-time) but at the beginning (just out of reset), we are only running at 32 kHz. Hmm, lets see, how long is a NOP at 32 kHz anyway... 32 / 4 = 8000 nops per second, or 125 uS per NOP.
William On Oct 17, 11:26 am, Joep Suijs <[email protected]> wrote: > Hi William, > > You're right. The errata sheet says it may take up to 60 ms for the clock to > become stable. And it reccomends to insert the delay before doing anything > *frequency-dependant*. In the original datasheet, they mentioned 1ms. 1ms is > also mentioned in the 16f88 datasheet and there is no errata, so it looks > they found an issue with the 16f819... > > What we should decide upon is if we put in a delay to prevent the pic from > doing *anything*, which could be frequency-dependant. > The only common frequency-dependant library that comes to mind is serial > comms, which requires the clock to be well within about 5%. I wonder how > much of that 60 ms it takes to get that close to 8 MHz. > > Joep > > 2009/10/17 William <[email protected]> > > > > > > > Sorry to bother you again, but reading the errata sheet, makes me > > think the problem is even worse that I remembered -- looks like 60mS > > delay is recommended? I hope I am wrong, that seems a long time. > > > My understanding is that the chip comes out of reset at 32 kHz, and I > > am switching to 8 MHz. > > > William > > > On Oct 17, 1:27 am, William <[email protected]> wrote: > > > Hi Joep, > > > > Actually, I'm glad you spoke up-- I really should replace the 2 nops > > > with a 1mS delay. See if you agree -- check the datasheet for the > > > device. > > > > Thanks, > > > > William > > > > On Oct 17, 12:47 am, Joep Suijs <[email protected]> wrote: > > > > > Hi William, > > > > > > About the nop's, I will add some comments to explain that when > > > > > changing the oscillator's frequency drastically, I think it is safest > > > > > to add a little delay before trying to do any 'real work'. In > > > > > retrospect, this might be a good place for me to use that nice inline > > > > > delay routine instead of the nops. > > > > > Is there any documentation (prefeably from microchip) that adding these > > > > instructions is good practice? > > > > > A nop instruction 'does nothing' and intuitive is safer. At second > > thought, > > > > I'd say there is not so much difference - the processor has to fetch > > the > > > > instruction, increment the IP, decode the instruction and carfully do > > it's > > > > stuff (which is this case is leaving all registers and memory alone). > > If it > > > > can do this, why can't it set a register to zero etc.? > > > > > If this is the case, I don't think it is a good idea to document the > > nop to > > > > be related to the oscillator change. > > > > > Joep --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
