Well, then that is likely the problem - or one of them... If you look at page 355 in the datasheet you'll see that the maximum x-tal frequency WITHOUT PLL is 25 MHz and with using the PLL it's 10MHz (resulting in 40Mhz). You're trying to use 40Mhz which is out of specs in both cases.Of course the crystal is stamped at 40MHz
The fact that your pulses are 4.4us wide while mine are 3us means that your chip is running way SLOWER than mine while in fact it "should" be running twice as fast.
Get the oscillator sorted and verify that the PIC is running at the speed you think. One way to do that is a simple program like:If you DON't get a 500Hz signal with 1ms wide pulses the chip isn't running at the correct and/or DEFINE'd oscillator speed.Code:DEFINE OSC 20 'Don't forget to DEFINE the correct OSC speed. TRISB.0 = 0 Main: PortB.0 = 1 Pause 1 PortB.0 = 0 Pause 1 Goto Main.




Bookmarks