PIC16F15355 config setting to work on internal OSC with clock 4MHz


+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2015
    Posts
    10

    Question PIC16F15355 config setting to work on internal OSC with clock 4MHz

    Anyone can help about how to realize to make 16F15355 work correctly with Internal Oscillator on 4MHz clock frequency.
    How to adjust config 1 5 and other registers to realize that.
    Here is a default configs from 16F15355.INFO file

    MPASM __CONFIG Directive Options
    ;
    ; The PBP default configuration for the PIC16F15355 is:
    ;
    ; #CONFIG
    ; __config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT32 & _CLKOUTEN_OFF & _CSWEN_ON & _FCMEN_ON
    ; __config _CONFIG2, _MCLRE_ON & _PWRTE_ON & _LPBOREN_OFF & _BOREN_ON & _BORV_LO & _ZCD_OFF & _PPS1WAY_OFF & _STVREN_ON
    ; __config _CONFIG3, _WDTCPS_WDTCPS_11 & _WDTE_ON & _WDTCWS_WDTCWS_6 & _WDTCCS_SC
    ; __config _CONFIG4, _BBSIZE_BB512 & _BBEN_OFF & _SAFEN_OFF & _WRTAPP_OFF & _WRTB_OFF & _WRTC_OFF & _WRTSAF_OFF & _LVP_OFF
    ; __config _CONFIG5, _CP_OFF
    ; #ENDCONFIG

    What have to be changed from Available __CONFIG labels for PIC16F15355 from 16F15355.INFO file in above configs?
    Is it necessary to additionally add setting in OSCON1, OSCON2, OSCON3, OSCFRQ, OSCSTAT, OSCTUNE, OSCEN registers ?

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,992

    Default Re: PIC16F15355 config setting to work on internal OSC with clock 4MHz

    I do not have this chip but maybe you should do also this:

    OSCCON1=%00000011
    OSCCON2=%00000011

    So you will have a 32MHz/8=4MHz

    You also have the FCMEN_ON which means that if your main clock is not working you will be informed to do something.

    Ioannis

  3. #3
    Join Date
    Sep 2015
    Posts
    10

    Default Re: PIC16F15355 config setting to work on internal OSC with clock 4MHz

    Hi Ioannis
    thank you very much, it works !

  4. #4
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    328

    Default Re: PIC16F15355 config setting to work on internal OSC with clock 4MHz

    My understanding is that "FCMEN_ON" is only needed with an external oscillator. If it fails, the PIC reverts to INTOSC.

    Also, if you just configure your OSCCON1 for 32 MHZ, you can then select 4 MHZ in OSCFRQ.

  5. #5
    Join Date
    Sep 2015
    Posts
    10

    Question Re: PIC16F15355 config setting to work on internal OSC with clock 4MHz

    Here are what I did according to Ioannis sugestion:
    In Config word:
    __config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT32 & _CLKOUTEN_OFF & _CSWEN_ON & _FCMEN_ON

    ;HFINTOSC with OSCFRQ= 32 MHz and CDIV = 1:1 - means Int.Osc 32 MHz
    Then I put
    OSCCON1 = %00000011 ' 32 MHz divide by 8 = 4MHz
    OSCCON2 = %00000011 ' 32 MHz divide by 8 = 4MHz
    DEFINE OSC 4

    Do you mean that I have to do:
    __config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT32 & _CLKOUTEN_OFF & _CSWEN_ON & _FCMEN_ON

    ;HFINTOSC with OSCFRQ= 32 MHz and CDIV = 1:1 - means Int.Osc 32 MHz
    And then to define
    OSCFRQ = %00000010 'by HFINTOSC Frequency Selection bits define 4 MHz Osc.Freq.
    DEFINE OSC 4 'tell PBP that the operating frequency is 4 MHz

    To be all correct with HFINTOSC is it FCMEN_ON or FCMEN_OFF

  6. #6
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    328

    Default Re: PIC16F15355 config setting to work on internal OSC with clock 4MHz

    FCMEN is the Clock FailSafe Monitor for EXTOSC. If your crystal oscillator fails, FCMEN will revert to INTOSC, for safety sake. If you aren't running EXTOSC, you don't need FCMEN. It probably doesn't hurt having it on using INTOSC, though.

  7. #7
    Join Date
    Sep 2015
    Posts
    10

    Red face Re: PIC16F15355 config setting to work on internal OSC with clock 4MHz

    Hi mpgmike
    thank you very much on your suggestions and explanations.
    Have a nice time

Similar Threads

  1. Replies: 8
    Last Post: - 20th March 2017, 10:34
  2. Internal osc config PIC12F609
    By Pedro Pinto in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd April 2008, 16:23
  3. Setting up internal clock correctly?
    By JohnM in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th March 2008, 21:29
  4. Internal Osc help
    By BobK in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 12th January 2007, 21:50
  5. 4Mhz osc, pic18f4550 help please
    By ivymore18 in forum General
    Replies: 0
    Last Post: - 19th August 2006, 07:44

Posting Permissions

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