Quote Originally Posted by Optech View Post
I set up the program as suggested and got a 6.2 KHz frequency readout +/-0.1 Khz.
The duty cycle is 50% +/-2%. (suggests about 27 us per command?)
Well, if you would've used that program EXACTLY as I wrote it, you would've seen nothing, since there were no port assignments, no TRISIO statements, no nothing.
So, let's see what you actually did write.
And while you're at it, open up your program's .lst file and look thru the actual PIC assembly code. There you'll see all the instructions that the PIC is actually executing. Take a look at the datasheet, and you'll see that most ASSEMBLY instructions take one cycle, gotos/branches/calls take 2 cycles, and conditional instructions can either take one or two cycles depending on results. That's one way to figure out how fast a loop should be.

The trace on the scope is not square; doen't even acheive the full amplitude - almost as though there is a stray capacitance somewhere.
Then that would tell me that maybe your 'scope's probes and/or the 'scope itself isn't capable of reading higher frequencies, or maybe they need to be cal'd.

Also, are you SURE that your CONFIG bits are being set correctly? You may think you're running 8Mhz external when you're actually running 125Khz on the internal clock, or worse, running on the 37Khz internal R/C clock.