Maker Pro
Maker Pro

obscure microcontroller question - example code for 16F819?

R

Robbs

Jan 1, 1970
0
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.
 
H

Howard Henry Schlunder

Jan 1, 1970
0
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 <p16f819.inc>
__config _INTRC_IO & _CP_OFF & _DEBUG_OFF & _WRT_ENABLE_OFF & _CPD_OFF &
_LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_OFF & _WDT_OFF

See the end of the p16f819.inc 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
 
Top