Anyone ever written something to tell you the actual speed the PIC's processor is really running at?
Printable View
Anyone ever written something to tell you the actual speed the PIC's processor is really running at?
No, not really but depending on what type of accuracy you need it may be as simple as blinking a LED.Now put the scope or frequency counter on PortB.0, you should get a 2kHz signal, if you don't the PIC isn't running at 4MHz.Code:DEFINE OSC 4
TRISB.0 = 0
Main:
PortB.0 = 1
PauseUs 250
PortB.0 = 0
PauseUs 250
Goto Main
Sounds like the OP wants to do something like this:
Code:cpu_speed = ........ ' compute actual CPU speed
if cpu_speed = 5 then
' do something
else
' do somethingelse
end if
an external integrated oscillator feeding Timer1 in capture mode ???
using mains rectified to get a precise 100 ( or 120 ! ) Hz signal and measure the supposed 10 or 8.33 ms period ??? - "Pulsin" can be used here.
one could even think to an auto-adjustment through the OSCTUNE register ... if intosc used.
...
if only a rough idea is needed ... some RC external ladder with RC Time function ...
Alain
You might be able to use something like this
http://www.picbasic.co.uk/forum/showthread.php?t=9350