16F88 internal clock configuration


Closed Thread
Results 1 to 29 of 29

Hybrid View

  1. #1
    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.

  2. #2
    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

  3. #3
    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.

  4. #4
    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....

  5. #5
    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.

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


    Did you find this post helpful? Yes | No

    Default Thanks.. this is getting closer!

    I am using the _INTRC-IO, and also tweaked the serin2 stuff, so I have 'data' coming across all com lines now. Problem is that it is just 'off'..

    1. ) It is resetting. I have one routine at the front which only happens on power up. The data from this is showing up off and on.

    2.) the math is off. Where a value should sa 4.9volts it reads 3.3. Were a GPS lat should be 47.xxx, it reads 65,511, or some such. Same with all the other values, so I am sure the loops are off.

    I made a simpler program that just spewed data to the different com ports - out on RB2, RA0, RA1. This just said "text", #counter - and looped from 1-100.. that worked fine. When I put the full program in, it gives bad data.

    I think the original program for the 16F876/a was a 4Mhz program (??).. Does running this at 8 Mhz mess that up? Is there some setting that is needed? Does not seem like there should be....

    Thanks a bunch for your assistance - I've never 'ported' from one PIC to another. This program works great on the other one... but we need to be on the F88.. did not know it was going to be so hard.

    Tom

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


    Did you find this post helpful? Yes | No

    Default

    o.k now it seems more a hardware problem than a software problem. be sure your supply line is neat an un-noisy. 10uF tantalum+0.1uF must be place close to your PIC... AS close as you can.

    AND be sure your MCLR pin is tie to VCC via resistor.

    Enable power-up timer can be great. Also as Melanie previously said it can be interesting to test the 'oscillator frequency is stable bit' before proceed to any of your initialisation process.

    look at the a/d register setting(ADCON and others)... i'm sure that they're different from the PIC you used before.
    Steve

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

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