How to DEFINE OSC, in case of 32khz clock frequency?


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2013
    Posts
    1,078

    Default How to DEFINE OSC, in case of 32khz clock frequency?

    Hello.

    To reduce power, I want to run 12F1840 @ 32khz, but since there is no DEFINE OSC for that frequency, all timings are messed up. Any ideas how to fix it?

  2. #2
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default Re: How to DEFINE OSC, in case of 32khz clock frequency?

    Quote Originally Posted by CuriousOne View Post
    Hello.

    To reduce power, I want to run 12F1840 @ 32khz....
    http://www.picbasic.co.uk/forum/showthread.php?t=20161
    Why pay for overpriced toys when you can have
    professional grade tools for FREE!!!

  3. #3
    Join Date
    Feb 2013
    Posts
    1,078


    Did you find this post helpful? Yes | No

    Default Re: How to DEFINE OSC, in case of 32khz clock frequency?

    So the answer is NO ?

  4. #4
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: How to DEFINE OSC, in case of 32khz clock frequency?

    Correct timing for pbp is critical only for serin, serout,serin2, serout2, owin, owout, pause, and pauseus.
    32KHz is too slow for serin, serout, serin2, serout2, owin and owout, probably.
    So you are left only with pause.
    Instead trying to force PBP to 32KHz, create your own pause.
    Instruction clock is just around 8KHz, to be precise 8192Hz
    So you need only 8 instruction to get 1,024mS
    Code:
    My1msPause:
    ASM
     NOP
     NOP
     NOP
     NOP
     NOP
     NOP
     NOP
     NOP
    ENDASM
    And work from there to get pause that you need.

  5. #5
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: How to DEFINE OSC, in case of 32khz clock frequency?

    Ifn you're trying to conserve power you really need to look into SLEEP and IOC. Both can cut power consumption significantly and are much easier to implement that ASM. OK, that's IMLTHO but you never know.

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: How to DEFINE OSC, in case of 32khz clock frequency?

    Agree with using sleep and IOC. Years ago I had a similar problem. I contacted Charles at Melabs
    he gave me a solution where you set osccon to 500Khz which reduces the current to a couple hundred microamps (vdd3.3v). Then trick PBP by multipling your baud rates and dividing your pause statements. DEFINE OSC 4mhz, set osccon to 500khz. The pic will be running 8 times slower. So if you wanted a PAUSE 1 you would make it PAUSEUS 125. Serial out at 2400 baud would be written at 19200. For shorter pause statements you could use nops as suggested above. This combined with sleep you can acheive very low current consumption on average and still use PBP. Also this chip has clock switching between 31khz and high frequency, which you might want to study.

  7. #7
    Join Date
    Feb 2013
    Posts
    1,078


    Did you find this post helpful? Yes | No

    Default Re: How to DEFINE OSC, in case of 32khz clock frequency?

    The main problem is that PAUSEUS is not working properly. It won't give you short enough pulses as needed. I've opened thread on that matter before, with precise measurements given.

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,389


    Did you find this post helpful? Yes | No

    Default Re: How to DEFINE OSC, in case of 32khz clock frequency?

    PAUSEUS is not working properly
    NOT REALLY

    the smallest possible delay from pauseus @32khz is about 3mS . the smallest asm delay would be 125uS ie NOP

  9. #9
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: How to DEFINE OSC, in case of 32khz clock frequency?

    Are you using 12F1840 or the 12LF1840? Ifn I read the datasheet correctly you can achieve some significant power savings with the LF that you may not have to do the hokey pokey with the oscillator frequency. Though the LF is about 10% more cost if it gets you to your goal it may be worth it.

    Is this a battery application or an experiment? Just curious why a few nA would be important.

Similar Threads

  1. DEFINE OSC too limited
    By mytekcontrols in forum PBP Wish List
    Replies: 18
    Last Post: - 28th July 2015, 02:32
  2. 'DEFINE OSC 8' seems to be ignored by PBP ?
    By mr.sneezy in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 26th May 2010, 11:50
  3. Define osc 1
    By ronsimpson in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st October 2009, 06:35
  4. Define osc
    By jderson in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 2nd July 2009, 06:05
  5. Define Osc Not Working
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd February 2005, 11:23

Members who have read this thread : 1

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