16F88 internal clock configuration


Closed Thread
Results 1 to 29 of 29

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    There are many options here… so here‘s just one of them…

    1. Ensure that your Device Oscillator Configuration Bits are set to INTRC_OSC_NOCLKOUT (if you don’t know how to do this, see the new FAQ section). This option also means that the two OSC pins are made available for I/O. If you need the Oscillator to output on OSC2, then select the appropriate option (again see FAQ section).

    2. Somewhere at the start of your program (where you normally initialise your processors registers) add the line…

    OSCCON=%01111000

    I refer you to the Datasheet section 4, especially Register 4.2 OSCCON to discover what I have done.

    3. If stabilising your clock to other events is important to you, then you may need to add this piece of code after the above OSCCON setting (otherwise it is not necessary)…

    While OSCCON.2=0:Wend

    This will ensure the PIC does not continue processing until the new Oscillator Frequency is stable by introducing a 4mS delay (see datasheet 4.6.5 item 4).

    As with ALL the queries regarding the set-up of PICs – Read the Datasheet! – it’s all there waiting for you to discover.

  2. #2
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125


    Did you find this post helpful? Yes | No

    Question INT_OSC Questions for 16F88

    As I am new to this, reading the data sheets sometimes pose more questions than they answer. Such is with trying to figure out how to use the Internal Osc on the 16F88.

    I am moving from a 16876A where I used and external Osc - and have a program running fine there. Now, I want to move this program to the 16F88, and rather than use external Osc, use an internal. I have recompiled, tweaked the PORT.X settings, and am ready to go, BUT.

    I see the F88 is an 8 mhz OSC, when I was using 4... Sure, I'd like to go faster, but just sticking to the same as the first pic is fine.

    I have seen mention of setting the config bits to INTRC_OSC_NOCLKOUT in the include file.

    As well I have seen advise to use OSCCON=%01111000 at the start - which mapping back to the data sheet looks like it is selecting a speed, but I can't find a table that maps to this..

    I have also seen several references to OSC as RA6, etc... I just simply need to know what to read to find out how to use the internal oscillator and set it appropriately.. anyone have a few mintues to help out with a reply..

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Not quite sure as i didn't see any parts of your code but, if your 8MHZ setting is ok, you also must add DEFINE OSC 8 at the top.. did you?

    for the internal setting, see datasheet in the OSCCON. all the setting are there.

    in your case for 8MHZ
    OSCCON=%01111000

    for 4MHZ
    OSCCON=%01101000

    and so on for the other type of setting
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125


    Did you find this post helpful? Yes | No

    Default OSC settings on F88 .. cont'd

    Much closer.. THANKS!

    I now see data on the LCD and on the 4800b Hyperterm screen, but the numbers are incorrect.. and the routines run differently..

    Where data was reporting '1009', the text tag is fine, but the actual data is different..... like '3345', etc.

    It looks like a timing problem some way?

    Would the config bits effect this?

    TG

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    As we don't have any more info on your current project, it's still hard too see what's wrong with.. BUT at least, since your LCD and your serial communication are working without any kind of garbage display, it's a good sign that your PIC and code are running at the good speed.

    If you did some assembler delay or something using TIMERs you must set your prescallers, rates, and delay with the new crystal speed

    Did you try with the internal 4MHZ setting???
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125


    Did you find this post helpful? Yes | No

    Default Trying settings..

    Hmmm.. I have tried with:

    DEFINE OSC 4 'I want to use 4 mhz?
    OSCCON=%01101000

    and with setting these to 8Mhz ..

    DEFINE OSC 8
    OSCCON=%01111000 '8 Mhz

    Both work about the same - 'some' plain text comes through, but the code is resetting because I am getting the initialization routine, which does not happen usually.

    I am not doing any interrupts or anything, no jumps to assmbly code - pretty straightforward.

    I did change the INC files:

    changed the "XT_OSC" for "INTRC_OSC_NOCLKOUT" - It looks like this now:

    ;************************************************* ***************
    ;* 16F88.INC *
    ;* *
    ;* By : Leonard Zerman, Jeff Schmoyer *
    ;* Notice : Copyright (c) 2003 microEngineering Labs, Inc. *
    ;* All Rights Reserved *
    ;* Date : 08/13/03 *
    ;* Version : 2.45 beta *
    ;* Notes : *
    ;************************************************* ***************
    ; Modified by THG - changed clock settin from XT_OSC
    NOLIST
    ifdef PM_USED
    LIST
    include 'M16F88.INC' ; PM header
    device pic16F88, INTRC_OSC_NOCLKOUT, wdt_on, pwrt_on, lvp_off, protect_off
    XALL
    NOLIST
    else
    LIST
    LIST p = 16F88, r = dec, w = -302
    INCLUDE "P16F88.INC" ; MPASM Header
    __config _CONFIG1, INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _LVP_OFF & _CP_OFF
    NOLIST
    endif
    LIST

    The strangest thing is that the program appears to be restarting when it should not. It should be looping through the main routine, but on the F88, it is picking up the initialization routine every few seconds.

    scratching head....

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Hehe... i guess i found the problem

    Here's all the configuration fuse available for you 16F88
    Code:
    ;Configuration Byte 1 Options
    _CP_ALL                      EQU     H'1FFF'
    _CP_OFF	                     EQU     H'3FFF'
    _CCP1_RB0		    		 EQU     H'3FFF'
    _CCP1_RB3                    EQU     H'2FFF'
    _DEBUG_OFF                   EQU     H'3FFF'
    _DEBUG_ON                    EQU     H'37FF'
    _WRT_PROTECT_OFF             EQU     H'3FFF'	;No program memory write protection
    _WRT_PROTECT_256             EQU     H'3DFF'	;First 256 program memory protected
    _WRT_PROTECT_2048            EQU     H'3BFF'	;First 2048 program memory protected
    _WRT_PROTECT_ALL             EQU     H'39FF'	;All of program memory protected
    _CPD_ON                      EQU     H'3EFF'
    _CPD_OFF                     EQU     H'3FFF'
    _LVP_ON                      EQU     H'3FFF'
    _LVP_OFF                     EQU     H'3F7F'
    _BODEN_ON                    EQU     H'3FFF'
    _BODEN_OFF                   EQU     H'3FBF'
    _MCLR_ON		   		     EQU     H'3FFF'
    _MCLR_OFF                    EQU     H'3FDF'
    _PWRTE_OFF                   EQU     H'3FFF'
    _PWRTE_ON                    EQU     H'3FF7'
    _WDT_ON                      EQU     H'3FFF'
    _WDT_OFF                     EQU     H'3FFB'
    _EXTRC_CLKOUT		    	 EQU     H'3FFF'
    _EXTRC_IO		    		 EQU     H'3FFE'
    _INTRC_CLKOUT                EQU     H'3FFD'
    _INTRC_IO		    		 EQU     H'3FFC'
    _EXTCLK			    		 EQU     H'3FEF'
    _HS_OSC                      EQU     H'3FEE'
    _XT_OSC                      EQU     H'3FED'
    _LP_OSC                      EQU     H'3FEC'
    
    ;Configuration Byte 2 Options
    _IESO_ON                     EQU     H'3FFF'
    _IESO_OFF                    EQU     H'3FFD'
    _FCMEN_ON                    EQU     H'3FFF'
    _FCMEN_OFF                   EQU     H'3FFE'
    use _INTRC_IO instead... i'm sure that will work.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    Join Date
    Feb 2011
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Re: 16F88 internal clock configuration

    Quote Originally Posted by Melanie View Post
    There are many options here… so here‘s just one of them…

    1. Ensure that your Device Oscillator Configuration Bits are set to INTRC_OSC_NOCLKOUT (if you don’t know how to do this, see the new FAQ section).
    Hi everybody, I have just started to learn about pic programming. My searches through Google end up in this forum most of the time.

    Could you please guide me to this FAQ section mentioned? I tried every FAQ link on the pages but I am unable to find the correct one which will take me to the place where this INTRC_OSC_NOCLKOUT and other options are explained.

    Thanks.

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: 16F88 internal clock configuration

    I think this is what you are looking for
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    Dave
    Always wear safety glasses while programming.

  10. #10
    Join Date
    Feb 2011
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Re: 16F88 internal clock configuration

    Quote Originally Posted by mackrackit View Post
    I think this is what you are looking for
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    It is! Thank you.

Similar Threads

  1. 16F88 bootlader with Internal OSC
    By HenrikOlsson in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 2nd August 2009, 10:15
  2. external clock / internal clock
    By grounded in forum General
    Replies: 4
    Last Post: - 31st May 2008, 17:44
  3. Setting up internal clock correctly?
    By JohnM in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th March 2008, 20:29
  4. 16F688 Internal clock and MCLR
    By manxman in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 18th August 2007, 18:38
  5. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36

Members who have read this thread : 0

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