High Power Consumption in Sleep Mode


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2005
    Location
    GREECE
    Posts
    120

    Default High Power Consumption in Sleep Mode

    Hello boys and girls,


    I use for a first time sleep mode with my 16F627 pic after searching and reading to the forum.
    I manage to send my pic to sleep mode and I can wake it up with interrupt on portb.0.


    My problem is the big Consumption in sleep mode.It is about 370uA

    That is my code:
    Code:
    @ DEVICE  PIC16F627, XT_OSC 
    @ DEVICE pic16F627, WDT_OFF 
    @ DEVICE pic16F627, PWRT_ON
    @ DEVICE pic16F627, MCLR_OFF
    @ DEVICE pic16F627, BOD_OFF 
    @ DEVICE pic16F627, LVP_OFF 
    @ DEVICE pic16F627, CPD_OFF 
    @ DEVICE pic16F627, PROTECT_OFF
    DEFINE  OSC 4
    DEFINE NO_CLRWDT 1
                                                                                                                                                                                                                                                                   
    CMCON = 7  'Turn off comparators
    VRCON=%01101100 'VRCON bit7 is OFF for no current drain
    OPTION_REG.7 = 0 ' 1=DISABLE INTERNAL PULLUPS,0=ENABLE 
    
    LED VAR PORTA.2
    
    INTCON=%00010000 ' Interrupt Control Register
    ' 7=0 - GIE - Global Interrupt Enable
    ' 6=0 - PEIE - Peripheral Interrupt Enable
    ' 5=0 - TOIE - TMR0 Overflow Interrupt Enable
    ' 4=1 - INTE - RB0/INT Enable
    ' 3=1 - RBIE - PORTB change interrupt Enable
    ' 2=0 - TOIF - TMR0 Overflow Flag
    ' 1-0 - INTF - RB0/Ext Interrupt Flag
    ' 0=0 - RBIF - PORTB Interrupt Flag
    
    OPTION_REG.6=1 ' 1=RB0 Rising-Edge Trigger, 0=Falling-Edge Trigger
    
    CYCLE:
    
    INTCON.1=0 ' Reset RB0 Flag
    INTCON.0=0 ' Reset PORTB change Flag
    
    '
    ' Sleep
    ' -----
    LOW LED
    
    @ SLEEP
    @ nop
    @ nop
    @ nop
    
    Pause 100 ' Needed for system Wake-Up
    
    HIGH LED 
        PAUSE 5000
        LOW LED
    GOTO CYCLE
    
    END
    My hardwarev is simply a resistor from porta.2 with a Led to GND and XTL with 2capasitors.NOTHING MORE

    Please advice
    Nikos

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Nikos,
    Check this thread out, same problem, different chip.
    http://www.picbasic.co.uk/forum/showthread.php?p=75528
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Nikos,
    using this code:
    Code:
    ;@ DEVICE  PIC16F648A, INTRC_OSC_NOCLOCKOUT 
    ;@ DEVICE pic16F648A, WDT_OFF 
    ;@ DEVICE pic16F648A, PWRT_ON
    ;@ DEVICE pic16F648A, MCLR_OFF
    ;@ DEVICE pic16F648A, BOD_OFF 
    ;@ DEVICE pic16F648A, LVP_OFF 
    ;@ DEVICE pic16F648A, CPD_OFF 
    ;@ DEVICE pic16F648A, PROTECT_OFF
    @ __CONFIG _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _LVP_OFF & _BODEN_OFF & _BOREN_OFF
    DEFINE  OSC 4
    DEFINE NO_CLRWDT 1
    PORTA=0
    TrisA = 255
    trisb = %00000001 'RB0 as  input                                                                                                                                                                                                                                                               
    CMCON = 7        ' Turn off comparators
    'VRCON = %01101100  ' VRCON bit7 is OFF for no current drain
    OPTION_REG.7 = 1 ' 1=DISABLE INTERNAL PULLUPS,0=ENABLE 
    OPTION_REG.6 = 1 ' 1=RB0 Rising-Edge Trigger, 0=Falling-Edge Trigger
    
    LED VAR PORTA.2
    
    INTCON = %11010000 ' Interrupt Control Register
                     ' 7=0 - GIE - Global Interrupt Enable
                     ' 6=0 - PEIE - Peripheral Interrupt Enable
                     ' 5=0 - TOIE - TMR0 Overflow Interrupt Enable
                     ' 4=1 - INTE - RB0/INT Enable
                     ' 3=1 - RBIE - PORTB change interrupt Enable
                     ' 2=0 - TOIF - TMR0 Overflow Flag
                     ' 1-0 - INTF - RB0/Ext Interrupt Flag
                     ' 0=0 - RBIF - PORTB Interrupt Flag
    
    
    on interrupt goto cycle2
    CYCLE:
    LOW LED
    'pause 500
    
    @  SLEEP
    ;@ nop
    ;@ nop
    ;@ nop
    
    disable
    
    
    cycle2:
    HIGH LED 
        PAUSE 500
        LOW LED
        PAUSE 500
    INTCON = %11010000  
    
    enable
    GOTO CYCLE
    end
    Which is a derivitive of your code, I fought with the interrupt a bit.
    By setting port a as all inputs the sleep current dropped from 3.71 ma to 0.12 ma
    The 16F648A was as close a chip to yours as I have.
    Last edited by Archangel; - 19th August 2009 at 20:52.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Feb 2005
    Location
    GREECE
    Posts
    120


    Did you find this post helpful? Yes | No

    Default

    Thanks Joe for your code...

    I have just test it with the same results.
    The Consumption is still 0.37 ma or 370uA.

    I do not understand what is wrong.The setup is the minimal it ca be...

  5. #5
    Join Date
    Feb 2005
    Location
    GREECE
    Posts
    120


    Did you find this post helpful? Yes | No

    Default

    I find it.....
    Now it sleeps with the minimum current...just 0.1 ma or 100uA.

    The pin MCLR was flatting and I add the 4.7k to Vcc.

    Many Many thanks joe for your code.


    Regards
    Nikos

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ngeronikolos View Post
    I find it.....
    Now it sleeps with the minimum current...just 0.1 ma or 100uA.

    The pin MCLR was flatting and I add the 4.7k to Vcc.

    Many Many thanks joe for your code.


    Regards
    Nikos
    You are welcome. I had turned MCLRE off in my config.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  7. #7
    Join Date
    Sep 2014
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: High Power Consumption in Sleep Mode

    Quote Originally Posted by Archangel View Post
    You are welcome. I had turned MCLRE off in my config.
    I added & _BODEN_OFF to __CONFIG and reduced the current from 120uA to 5uA

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


    Did you find this post helpful? Yes | No

    Default Re: High Power Consumption in Sleep Mode

    Just looking at your code and decided to ask a question or two.

    Why do you set the same configs twice? I think either will accomplish the task but they may be contradictory also.

    Why are some configs spelled differently from one to the other? PWRT/PWRTE, INTRC_OSC_NOCLOCKOUT/INTOSC_OSC_NOCLKOUT and MCLR/MCLRE are the ones I see as different.

  9. #9
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: High Power Consumption in Sleep Mode

    Hi,
    Just looking at your code and decided to ask a question or two
    Which code is that exactly? I'm sort of guessing here so if I'm referring to the wrong one please disregard this.

    Why do you set the same configs twice?
    The only code in this thread, which could be interpreted as if that's happening is in the third post, by Archangel, but he's not setting the same config twice. One set is commented out:
    Code:
    ;@ DEVICE  PIC16F648A, INTRC_OSC_NOCLOCKOUT 
    ;@ DEVICE pic16F648A, WDT_OFF 
    ;@ DEVICE pic16F648A, PWRT_ON
    ;@ DEVICE pic16F648A, MCLR_OFF
    ;@ DEVICE pic16F648A, BOD_OFF 
    ;@ DEVICE pic16F648A, LVP_OFF 
    ;@ DEVICE pic16F648A, CPD_OFF 
    ;@ DEVICE pic16F648A, PROTECT_OFF
    @ __CONFIG _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _LVP_OFF & _BODEN_OFF & _BOREN_OFF
    Why are some configs spelled differently from one to the other? PWRT/PWRTE, INTRC_OSC_NOCLOCKOUT/INTOSC_OSC_NOCLKOUT and MCLR/MCLRE are the ones I see as different.
    My guess is that one set (the ones that are commented out) is/was targeting the now obsolete PM-assembler which came bundled with PBP while the other is for Microchips MPASM assembler.

    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default Re: High Power Consumption in Sleep Mode

    My bad. I sincerely apologize for any confusion I might have generated. In the future I'll cut and paste the code to which what I refer to eliminate any obfuscation.

    Sorry for using your time but thanks for a possible explanation and pointing out my error.

Similar Threads

  1. Replies: 4
    Last Post: - 9th October 2009, 09:01
  2. Battery powered applications
    By NavMicroSystems in forum Off Topic
    Replies: 7
    Last Post: - 22nd June 2009, 08:12
  3. SERIN MIDI out of Synch?
    By jncortes in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th June 2009, 21:08
  4. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 16:23
  5. sample code for M25P32
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th January 2007, 03:37

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