> > I am designing a product that generates some precisely timed signals. I am > using a PIC16C84-4 with a 4Mhz XTAL. Testing the code in mpsim shows that > my timing meets the spec. (min 55 usec max 61 usec 58 usec nominal) MPSIM > shows my timing to be 57 usec and 59 usec using a 1 usec clock cycle (4 Mhz). > Analysis shows that +- 3% tolerance will work. This should be no problem for > a XTAL right? Well I put the device on the scope and my actual numbers were > min 60.6 usec max 62.2 usec. This is about +- 5% and puts me out of spec. I > could lower my time in software (short term fix) but this will make the design > difficult to produce. I also have lots of stuff to do during the time between > transitions and lowering the time will impact my time line. Any ideas on how > to adjust the frequency or why it would be 5% low? I am using 30pf cap for > C1 and C2 of the crystal and am running the PIC in XT XTAL mode. I do not > have the resistor between the XTAL and OSC2 pin. (Ref data book p2-758) The > XTAL is one from a local surplus shop but I have never had problems with their > crystals before. > > Thanks for any help > > Norm > Put your scope probe on the XTAL pins and look at the waveform. On the pin which is an output, you should see 5v p-p swing and a decent 4MHz signal. On the other pin, which is an input, you should see the same signal at a reduced level, depending somewhat on the characteristics of your scope probe. But if you set your timebase at, say, 10us/div and you see a ragged waveform with chunks ripped out of it, you definitely have a crystal problem. Also, a 1 meg across the crystal cannot hurt and will probably improve startup reliability. Good luck, Reg