Menu

Ultra-low current drain

Help
2015-04-21
2015-04-22
  • Reginald Neale

    Reginald Neale - 2015-04-21

    What is the proper way to specify the ultra-low power oscillator speeds in GCB Synwrite? I want to run a 16F1829 at 31kHz. I've tried various numbers following the "#chip 16F1829" declaration, but the current drain doesn't seem to correlate well with those numbers, and never gets down into the tens of microamps level that the data sheet shows.

     
  • Anobium

    Anobium - 2015-04-21

    You can write the speed in MHz with decimal points. For example, if you wanted to run a 16F1827 at 24576000 Hz, you could write this:

    ~~~~
    #chip 16F1829, 24.576

     

    Last edit: Anobium 2015-04-21
  • kent_twt4

    kent_twt4 - 2015-04-21

    Ultra low current is a real challenge. Presumably, this would entail putting the device to sleep (which runs on the 31Khz clock I believe). Lots of things to consider to go low, like making sure the WDT, TMR1, No floating inputs, and the like are turned off if you can. There is a check list in the sleep chapter of the data sheet. Also the low power claims are made at low voltage levels, like 1.8V for most of the enhanced midrange devices. The difference between 5v and 2.5V would be like seeing 40ua or 20ua.

    Apparently the BOREN uses a couple of ua. So turn that off in #config.

    So at 2.5V, BOREN turned off, the 12f1822 goes to 18-19ua in sleep. I would like to go to nano amp sometime like they say in the literature, who knows? I think you need the LF version to get there.

    EDIT: Here was the code:

    #chip 12f1822,4
    #config  BOREN=off
    #DEFINE LED PORTA.2
    DIR LED out
    
    Main:
    SET LED ON
    WAIT 5 S
    SET LED OFF
    wait 5 s
    dir PortA out
    PortA = 0
    asm sleep
    nop
    goto Main
    
     

    Last edit: kent_twt4 2015-04-21
    • Reginald Neale

      Reginald Neale - 2015-04-22

      Thanks Kent. What is the impact of "ask sleep" and how much time does the chip spend in sleep in your example above? The GCB programming manual has a section on using assembly on a command line, but your example is different.

       
  • kent_twt4

    kent_twt4 - 2015-04-22

    GCB has allowed the use of inline assembly for as long as I can remember. The newer GCB Help has a very short chapter on Using Assembler. There was a time when "asm sleep" was required, and I have carried over that usage. "sleep" works too.

    Without further context it is hard to recommend which way to wake the device from sleep. The data sheet goes into all the ways to wake from sleep.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.