Today 13:03
Forum: Absolute Beginners Section
Starter: amod
Views: 0
Replies: 4
Yesterday 19:39
Forum: Website / Forum Issues
Starter: Henk57
Views: 0
Replies: 7
+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: XTAL value for internal OSC 31KHz...212 days old

  1. #1
    Junior Member canilica's Avatar
    Join Date
    Jan 2016
    Posts
    3
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    622.19 MB

    0 Not allowed!

    Default XTAL value for internal OSC 31KHz...

    What is the XTAL value for internal OSC 31Khz(or 500kHz,.....).

    XTAL=?

  2. #2
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,524
    Thumbs Up
    Received: 100
    Given: 29
    Total Downloaded
    2.52 GB

    0 Not allowed!

    Default Re: XTAL value for internal OSC 31KHz...

    From the Manual:
    Oscillator Frequency Declare.
    12-bit core device XTAL values:
    Declare Xtal 4, 8, 10, 12, 16, or 20.

    Standard 14-bit core device XTAL values:
    Declare Xtal 3, 4, 7, 8, 10, 12, 14, 16, 19, 20, 22, or 24.

    Enhanced 14-bit core device XTAL values:
    Declare Xtal 3, 4, 7, 8, 10, 12, 14, 16, 19, 20, 22, 24, 32 or 48.

    18F device XTAL values:
    Declare Xtal 3, 4, 7, 8, 10, 12, 14, 16, 19, 20, 22, 24, 25, 29, 32, 33, 40, 48, or 64.

    So the slowest you can expect is 3MHz.
    However if you don't use any frequency dependent functions such as serial commands, Delays and so on then it doesn't matter what you use. The compiler just needs the number when it has to calculate frequency dependent matters.
    John

  3. #3
    Junior Member canilica's Avatar
    Join Date
    Jan 2016
    Posts
    3
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    622.19 MB

    0 Not allowed!

    Default Re: XTAL value for internal OSC 31KHz...

    Dear John,
    Thanks for request. Your text is on manual. I want to run PIC on internal oscillator 31.25kHz(PIC16F1503). But when i use delayms command, timing is shifting from normal operation. How can I do. For example "don't use XTAL command", thanks for all.

  4. #4
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,306
    Thumbs Up
    Received: 76
    Given: 23
    Total Downloaded
    3.63 GB

    0 Not allowed!

    Default Re: XTAL value for internal OSC 31KHz...

    Quote Originally Posted by canilica View Post
    But when i use delayms command, timing is shifting from normal operation. How can I do. For example "don't use XTAL command", thanks for all.
    That is exactly what John pointed out. I never did it but I think that you need to use interrupt to determine your delay.
    Regards

    Joseph

  5. #5
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,770
    Thumbs Up
    Received: 151
    Given: 152
    Total Downloaded
    2.96 GB

    0 Not allowed!

    Default Re: XTAL value for internal OSC 31KHz...

    Just to be clear if the given XTAL value is different than the actual clock (Fosc) all commands that use internal timing, Delay etc etc. will fail possibly in inexplicable ways.

    Is it vital that you use such a slow frequency? Perhaps is you describe what you are trying to acheive, an alternate way may be found.
    George

  6. #6
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,194
    Thumbs Up
    Received: 70
    Given: 37
    Total Downloaded
    2.68 GB

    0 Not allowed!

    Default Re: XTAL value for internal OSC 31KHz...

    I agree with George. I think the low frequency oscillator was only added to give such functions as the Watchdog timer etc.
    I don't think Microchip ever intended that the 31KHz oscillator be used as the main clock.

    Charlie

  7. #7
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,524
    Thumbs Up
    Received: 100
    Given: 29
    Total Downloaded
    2.52 GB

    0 Not allowed!

    Default Re: XTAL value for internal OSC 31KHz...

    Canilica,
    If the only frequency dependent command is delayms then the simplest way is to adjust the number (I'm assuming that the delay isn't super critical).
    e.g. if you had delayms 100 with no clock mentioned then you could use delayus 775
    The maths is no xtal mean the4MHz default is set by the compiler. 4000000/31000 = 129
    100/129 = 0.775 ms = 775 us
    Or generically delay_in_ms / 129 and if this is <1 then multiply by 1000 to make microsecs.

    I emphasise that this is only to be used if your program is just using delays. If you are also using other frequency dependent commands then you may have more complicated arithmetic to do so.
    John

  8. #8
    Junior Member canilica's Avatar
    Join Date
    Jan 2016
    Posts
    3
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    622.19 MB

    0 Not allowed!

    Default Re: XTAL value for internal OSC 31KHz...

    Thanks John,
    This solution is very good for me, congurlations.

  9. #9
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,770
    Thumbs Up
    Received: 151
    Given: 152
    Total Downloaded
    2.96 GB

    0 Not allowed!

    Default Re: XTAL value for internal OSC 31KHz...

    I still think it's a bad idea to run the device so slowly.
    George

  10. #10
    Junior Member flosigud's Avatar
    Join Date
    Oct 2013
    Posts
    46
    Thumbs Up
    Received: 8
    Given: 2
    Total Downloaded
    1.00 GB

    0 Not allowed!

    Default Re: XTAL value for internal OSC 31KHz...

    Quote Originally Posted by towlerg View Post
    I still think it's a bad idea to run the device so slowly.
    Why? The datasheets I have looked at had instructions how to use this slow speed.. Why is it a bad idea?
    Flosi Gu­mundsson
    ReykjavÝk

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. 18F26J13 Internal OSC Settings
    By NicHad in forum Oscillator Modules
    Replies: 5
    Last Post: 7th January 2014, 08:42
  2. Internal Osc control for PIC16F1847
    By Sterling101 in forum Proton Plus Compiler v3
    Replies: 25
    Last Post: 20th September 2012, 23:30
  3. Internal Osc and 19200
    By Tim in forum The Lounge
    Replies: 32
    Last Post: 15th September 2012, 17:19
  4. Internal OSC and PLL_REQ
    By peaps in forum Proton Plus Compiler v3
    Replies: 13
    Last Post: 6th March 2010, 12:42
  5. PIC16F628A Internal Osc.
    By Mohammed Tayem in forum Proton Plus Compiler v3
    Replies: 6
    Last Post: 27th February 2005, 20:21

Members who have read this thread since 11th September 2018, 00:37 : 0

Actions :  (Set Date)  (Clear Date)

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