Yep, you got it. But no point in setting bits 1&2... they're read only.
This is what I use to set the 16F887 to 8MHz.:
OSCCON = %01110001 'Set Osc to 8MHz.
And don't forget to add to your define list: DEFINE OSC 8
For external xtal you will need a 20MHz crystal connected to OSC1 & OSC2 (RA7, RA6) and a small capacitor from each pin to ground. The recommended capacitor size will be in the xtal data sheet, but is typically a couple dozen pF or less.
steve




Bookmarks