On 2/20/2012 12:33 PM, KPL wrote: > Oh, well. > > I will never ever buy cheap crystals again. > I will never ever buy cheap crystals again. > I will never ever buy cheap crystals again. > I swear. > Seems like my 20MHz crystal was not 20MHz at all. With a different > crystal it counts correctly. > One of the first test I do on every setup is to set the timer to toggle=20 a pin at 500Khz and I measure that with a frequency counter before I=20 start to write code specific to the chip. That lets me know that=20 everything is running correctly clock wise . I have had issues before=20 that were crystal related and pic related where either one was at fault.=20 Especially useful for when using the internal clock of the pic chips=20 that have them . I used to assume that the internal clock is what it=20 says but depending on the application can be a source of problems if you=20 don't check it first. Mark --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .