Quote Originally Posted by RussMartin View Post
I'd like to run a 12F683 as close to 131.2 kHz as possible.
I presume I can select 125 kHz using OSCON.
But I'm not able to figure out how to use OSCTUNE (page 24 of the data sheet)--or can I even do that to get the desired result?
Should be able to do that. It doesn't say in that particular datasheet, but I seem to remember reading somewhere that OSCTUNE does about +/-12% worth of tweaking to the internal oscillator. You've got +15 and -15 steps to work with, each 'step' worth about .8% if that +/-12% total is correct.
So, presuming that the internal oscillator will actually run at exactly 125khz, you need 131.2khz, a 5% increase. 5 / .8 = 6.25, so OSCTUNE = 6 should give you +6.25% from the nominal 125Khz, which comes out to about 132.5khz.
Set your config's for INTOSC or INTOSCIO...
Set OSCCON = $11, internal oscillator selected, 125khz selected
Set OSCTUNE = 6 and assuming the config words took correctly, you should be running at 132.5khz.
And you'll probably have to change OSCTUNE by 1 or 2 in either direction to get nice and close to 131.2Khz.
If you set INTOSC instead of INTOSCIO, you should get Fosc/4 on the OSC2 pin, which in your case, you should get 32.8khz. Hope you've got a tight freq counter or a good o'scope!