Announcement

Collapse
No announcement yet.

How do I get the internal oscillator running in a 16f887??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I get the internal oscillator running in a 16f887??

    I know that I am missing something really simple but I have come to my wits end with this. It is the first time that I have tried to use the internal 8MHz oscillator and for the life of me, I can not get it to work.

    I have reduced my circuit to 3 components now, the 16F887, a LED and the pull up resistor for the reset. I am trying to make the LED blink. It should be simple. I have many designs under my belt using an external crystal.

    Here's the code:

    #CONFIG
    __CONFIG _CONFIG1, _INTOSC & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _LVP_OFF & _IESO_OFF & _FCMEN_OFF
    __CONFIG _CONFIG2, _BOR21V & _WRT_OFF
    #ENDCONFIG
    OSCCON = %01110000
    DEFINE OSC 8


    MAIN:
    PORTD.1=1
    PAUSE 500
    PORTD.1=0
    PAUSE 500
    GOTO MAIN

    END:

    What the heck am I missing??

  • #2
    That will work for the internal OSC.
    But you'll need to set the pin to OUTPUT to get the LED to blink.

    OUTPUT PORTD.1
    PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
    Never download a PIC datasheet from anywhere but microchip.com

    Comment

    Working...
    X