Settings for internal oscillator


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Actually, on the 12F683 I use the following code and it defaults to 4MHZ

    DEFINE OSCCON_1K 1
    @ DEVICE MCLR_ON, INTRC_OSC_NOCLKOUT, WDT_ON, BOD_OFF, PWRT_ON, PROTECT_ON

    On the 16F819 & 16F88 I use this, otherwise it defaults to the slowest speed (I think 32KHZ)
    OSCCON = $60 'set int osc to 4mhz

  2. #2
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by peterdeco1 View Post

    DEFINE OSCCON_1K 1
    This is a new one for me. Can you tell me more about it?--syntax and such--or direct me to more information?

    And, yeah, I discovered the default-to-32 kHz thing the hard way.

    Thanks!
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

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


    Did you find this post helpful? Yes | No

    Default

    It's a new one for everyone I guess

    You'll have more chance to find DEFINE OSCCAL_1K, and it's explained a litlle bit in the manual.
    Steve

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

  4. #4
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    It's a new one for everyone I guess

    You'll have more chance to find DEFINE OSCCAL_1K, and it's explained a litlle bit in the manual.
    Yes, now that you mention it. I find it in my new manual on pp. 12 and 202.

    (My old manual is the one with all the handwritten notes in it!)

    But I find the explanation on p. 12 mysterious.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Code:
     Originally Posted by mister_e  
    It's a new one for everyone I guess 
    
    You'll have more chance to find DEFINE OSCCAL_1K, and it's explained a litlle bit in the manual.
    When I use DEFINE OSCCAL_1K, generates errors. "Error C:\PBP\PBPPIC14.LIB 7448:[225] Undefined Symbol 'OSCCAL'

    The only way I don't get an error is:
    DEFINE OSCCON_1K 1 ' Set OSCCON for 1K device

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


    Did you find this post helpful? Yes | No

    Default

    peterdeco1,
    if you have this error message it indeed mean that your particular PIC doesn't have the OSCCAL register.

    12F683 have an OSCCON register indeed, and it's directly accessible through your code. Some also have OSCTUNE register, this one is to tweak the internal oscillator in case you need to do so. But still, this one is also directly accessible in code and no need for DEFINEs.

    DEFINE can be everything, if it's not built-in in the compiler instruction set or the spelling (Case) is wrong, it will just do nothing, hence why we already discussed about their spelling.

    DEFINE MarryHadAlittleBoy_HisNameIsJerry 1

    will not return any error, and obviously it will not do anything unless you use it in ASM. This is handy when you want to customized your INCLUDE/Library or feature of your program. Check my Keypad routine for example.
    Last edited by mister_e; - 10th February 2009 at 19:02.
    Steve

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

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Yes Steve. I did see the Osctune in the datasheet, but haven't played with it yet. I'm using the HPWM in the 12F683 and it's dead-on accurate the way it is. I'm a great believer in "If it works, don't fix it." Besides, Osctune may make me pull more hair out! Thanks.

Similar Threads

  1. PBP and 18F2550
    By Fredrick in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 15th January 2012, 06:34
  2. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 00:55
  3. Oscillator Troubles
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th December 2007, 17:15
  4. Advice please - Warning message
    By malc-c in forum mel PIC BASIC Pro
    Replies: 50
    Last Post: - 23rd January 2007, 13:20
  5. PIC12F675, accuracy of baud rate with Internal Oscillator
    By Chris Mayhew in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st August 2005, 22:41

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