Internal Osccillator help


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2013
    Posts
    31

    Default Internal Osccillator help

    I try to use the Pic18F family of MCU,I notice that it have internal oscillator and need no external crystal oscillator,but how to set it to work?I have try it and nothing happen,the code works fine with Pic16f877a,I need the long word to process some timing input

  2. #2
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: Internal Osccillator help

    Hi Sabahan,

    I would start by going to the "device_reference" folder for PBP (what version of PBP are you using?)
    C:\PBP3\DEVICE_REFERENCE

    then open up the .info file for your device
    inside there you should find information for what to put in your configuration statements

    partial example of a .info file ...
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;
    ; File: PIC18F45K22.INFO
    ; Date: 07/24/11
    ; Generated by melabs File Manager
    ;
    ; PICBASIC PRO(tm) Compiler version: 3.0.0.x
    ;
    ; Copyright 2011 microEngineering Labs, Inc. All Rights Reserved
    ; The content herein is intended to facilitate embedded development using
    ; PICBASIC PRO Compiler. Reproduction or utilization for other purposes
    ; is prohibited without written permission from microEngineering Labs, Inc..
    ;
    ; microEngineering Labs, Inc.
    ; 2845 Ore Mill Road STE 4
    ; Colorado Springs, CO 80904
    ; 719-520-5323
    ; fax: 719-520-1867
    ; http://melabs.com
    ; [email protected]
    ;
    ; Modifications to this file in the \DEVICE_REFERENCE folder will be overwritten when
    ; you install future upgrades.
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;MPASM CONFIG Directive Options
    ;
    ; This section is included for reference only. The following options may
    ; be used with the MPASM CONFIG directive to specify configuration settings
    ; in the source program using the #CONFIG/#ENDCONFIG block.
    ; Example:
    ;
    ; #CONFIG
    ; CONFIG OSC = HS
    ; CONFIG WDTE = ON
    ; #ENDCONFIG
    ;
    ;
    ; Oscillator Selection bits
    ; CONFIG FOSC = RC ;111X External RC oscillator, CLKOUT function on RA6
    ; CONFIG FOSC = ECLPIO6 ;EC oscillator (low power, <500 kHz)
    ; CONFIG FOSC = ECLP ;EC oscillator, CLKOUT function on OSC2 (low power, <500 kHz)
    ; CONFIG FOSC = ECMPIO6 ;EC oscillator (medium power, 500 kHz-16 MHz)
    ; CONFIG FOSC = ECMP ;EC oscillator, CLKOUT function on OSC2 (medium power, 500 kHz-16 MHz)
    ; CONFIG FOSC = INTIO7 ;Internal oscillator block, CLKOUT function on OSC2
    ; CONFIG FOSC = INTIO67 ;Internal oscillator block
    ; CONFIG FOSC = RCIO6 ;External RC oscillator
    ; CONFIG FOSC = RC ;External RC oscillator, CLKOUT function on OSC2
    ; CONFIG FOSC = ECHPIO6 ;EC oscillator (high power, >16 MHz)
    ; CONFIG FOSC = ECHP ;EC oscillator, CLKOUT function on OSC2 (high power, >16 MHz)
    ; CONFIG FOSC = HSMP ;HS oscillator (medium power 4-16 MHz)
    ; CONFIG FOSC = HSHP ;HS oscillator (high power > 16 MHz)
    ; CONFIG FOSC = XT ;XT oscillator
    ; CONFIG FOSC = LP ;LP oscillator
    ;
    ; 4X PLL Enable
    ; CONFIG PLLCFG = OFF ;Oscillator used directly
    ; CONFIG PLLCFG = ON ;Oscillator multiplied by 4
    ;
    ; Primary clock enable bit
    ; CONFIG PRICLKEN = OFF ;Primary clock can be disabled by software
    ; CONFIG PRICLKEN = ON ;Primary clock is always enabled
    ;
    ; Fail-Safe Clock Monitor Enable bit
    ; CONFIG FCMEN = OFF ;Fail-Safe Clock Monitor disabled
    ; CONFIG FCMEN = ON ;Fail-Safe Clock Monitor enabled
    ;
    ; Internal/External Oscillator Switchover bit
    ; CONFIG IESO = OFF ;Oscillator Switchover mode disabled
    ; CONFIG IESO = ON ;Oscillator Switchover mode enabled
    ;
    ; Power-up Timer Enable bit
    ; CONFIG PWRTEN = OFF ;Power up timer disabled
    ; CONFIG PWRTEN = ON ;Power up timer enabled
    ;
    ; Brown-out Reset Enable bits
    ; CONFIG BOREN = SBORDIS ;Brown-out Reset enabled in hardware only (SBOREN is disabled)
    ; CONFIG BOREN = NOSLP ;Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled)
    ; CONFIG BOREN = ON ;Brown-out Reset enabled and controlled by software (SBOREN is enabled)
    ; CONFIG BOREN = OFF ;Brown-out Reset disabled in hardware and software
    ;
    ; Brown Out Reset Voltage bits
    ; CONFIG BORV = 190 ;VBOR set to 1.90 V nominal
    ; CONFIG BORV = 220 ;VBOR set to 2.20 V nominal
    ; CONFIG BORV = 250 ;VBOR set to 2.50 V nominal
    ; CONFIG BORV = 285 ;VBOR set to 2.85 V nominal
    ;
    ; Watchdog Timer Enable bits
    ; CONFIG WDTEN = ON ;WDT is always enabled. SWDTEN bit has no effect
    ; CONFIG WDTEN = SWON ;WDT is controlled by SWDTEN bit of the WDTCON register
    ; CONFIG WDTEN = NOSLP ;WDT is disabled in sleep, otherwise enabled. SWDTEN bit has no effect
    ; CONFIG WDTEN = OFF ;Watch dog timer is always disabled. SWDTEN has no effect.
    ;
    then at the top of your code do something like this...
    Code:
        #CONFIG
               __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_OFF & _MCLRE_OFF & _CP_ON & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
               __CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_25 & _LVP_OFF
        #endconfig
    good luck
    dwight
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  3. #3
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: Internal Osccillator help

    you can also do something like this to allow your code to compile for different processors...

    Code:
    #IF __PROCESSOR__ = "16F1828" or __PROCESSOR__ = "16F1829"
        #CONFIG
               __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_OFF & _MCLRE_OFF & _CP_ON & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
               __CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_25 & _LVP_OFF
        #endconfig
    #else
    
    #IF __PROCESSOR__ = "16F690"
        #CONFIG
               __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_OFF & _MCLRE_OFF & _CP_ON & _CPD_OFF & _BOD_OFF & _IESO_OFF & _FCMEN_OFF
        #endconfig
    #ELSE 
        #ERROR "Program does not support " + __PROCESSOR__
    #ENDIF
    #endif
    #msg "compiling for target " + __PROCESSOR__
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

Similar Threads

  1. Internal osilator
    By Andre_Pretorius in forum General
    Replies: 1
    Last Post: - 13th March 2011, 16:08
  2. Internal Oscillator
    By jhorsburgh in forum General
    Replies: 2
    Last Post: - 10th December 2007, 03:13
  3. How to use Internal Oscillator?
    By xobx in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 18th September 2007, 20:49
  4. Internal Osc help
    By BobK in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 12th January 2007, 21:50
  5. using internal xtal
    By jojokatada in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd April 2005, 17:25

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts