Maker Pro
Maker Pro

obscure microcontroller question - example code for 16F819?



Jan 1, 1970
First off, I apologize if sci.electronics.basics isn't the appropriate
group, but I've seen questions on this topic here before.

I'm new to microcontrollers, and I'm trying learn to program Microchip's
16F819. I've reviewed the code included in MPLAB, but it doesn't explain how
to use the micro's internal oscillator. I've reviewed the datasheets and
general reference manual to no avail. Have I missed something?

Sorry, again, if this isn't the appropriate group.

Howard Henry Schlunder

Jan 1, 1970
I've not used the 16F819, but in general, you enable the internal oscillator
by setting the proper configuration bits at program time. You can set your
configuration up in your assembly file using something like:

#include <>

See the end of the file (Program Files\MPLAB IDE\MCHIP_Tools) to
see the other configuration options. The __INTRC_IO option will tell it to
use the internal oscillator, and make the RA6/OSC2/CLKO pin a digital I/O.
Using the _INTRC_CLKOUT would make the clock frequency/4 externally
outputted according to the datasheet on RA6/OSC2/CLKO.

Once you've got the proper configuration setup, you can adjust the actual
operational frequency by writing to the OSCCON register in your code.

Howard Henry Schlunder