Connect with us

obscure microcontroller question - example code for 16F819?

Discussion in 'Electronic Basics' started by Robbs, Jul 13, 2003.

Scroll to continue with content
  1. Robbs

    Robbs Guest

    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.
     
  2. 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
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-