Power Saving on 16f628


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237

    Default Power Saving on 16f628

    Hi All

    Thank you for putting up with me

    My recent Bluetooth project is sitting on a 12v Battery ... I am now looking to save some valuable Ah ...

    Suggestions as to how are welcome

    Changes in the __Config maybe ?

    Pulling unused inputs to Ov maybe?

    project is currently working fine 👍

    Just need to save battery where I can

    Andy

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Power Saving on 16f628

    Just my 2 cents here. On most of my 16F819 projects idling current is about 5mA. When I add NAP 0, it drops to 1/2 mA. I put it at the top of the program where it's waiting for something such as a button press.

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: Power Saving on 16f628

    wake on serial input example, you would need to add code to eliminate floating inputs and disable unused "modules" to get the
    absolute minimum power use.


    this wakes on any serial input and goes back to sleep if an "A" is not received


    Code:
    ;16f628a #CONFIG
      __config   _HS_OSC & _WDT_OFF & _PWRTE_OFF & _MCLRE_ON & _BODEN_ON & _LVP_OFF & DATA_CP_OFF & _CP_OFF
    #ENDCONFIG
    include "dt_ints-14.bas"
    
    
    DEFINE OSC 8
    
    
    RCSTA = $90 ' Enable serial port & continuous receive
    TXSTA = $20 ' Enable transmit, BRGH = 0
    SPBRG = 12  ' 9600 Baud @ 8MHz, 0.16%
    asm
    INT_LIST macro 
           INT_HANDLER RX_INT  , _RX, asm,NO      
          endm
          INT_CREATE
    ENDASM
    
    
    wsave var byte $20 system
    wsave1 var byte $a0 system ; If device has RAM in bank1
    wsave2 var byte $120 system ; If device has RAM in bank2
    
    
    LED VAR PORTB.7
    TRISB=%01111111 'Make RB0 input
    BUFF var byte
    FLAG var byte
    CMCON=7
    FLAG=0
    LED=1
    PAUSE 500
    HSEROUT["READY",13,10]
    @ int_enable RX_INT
    
    
    Main:
    LED=0
    @ SLEEP
    LED=1
      IF (FLAG) THEN
        GOSUB somewhere
      ENDIF
    PAUSE 50   
    Goto Main
    Somewhere:
       HSEROUT["I got an A", 13,10]
       FLAG=0
    RETURN
    
    
    
    
    RX:
    asm 
        MOVLW "A"
        BANKSEL RCREG
        SUBWF  RCREG,W
        BTFSS  STATUS,Z
        GOTO EXT
        BANKSEL _FLAG
        BSF   _FLAG,0
    EXT   
        BANKSEL 0
        INT_RETURN
    endasm
    Warning I'm not a teacher

  4. #4
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Power Saving on 16f628A

    Quote Originally Posted by richard View Post
    wake on serial input example, you would need to add code to eliminate floating inputs and disable unused "modules" to get the
    absolute minimum power use.


    this wakes on any serial input and goes back to sleep if an "A" is not received


    Code:
    ;16f628a #CONFIG
      __config   _HS_OSC & _WDT_OFF & _PWRTE_OFF & _MCLRE_ON & _BODEN_ON & _LVP_OFF & DATA_CP_OFF & _CP_OFF
    #ENDCONFIG
    All good help thank you will try ..... Just re:- Above.... I have done the same but turned BODEN_OFF

    All works ok ... And does give me a little saving

    BR
    Andy

  5. #5
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Power Saving on 16f628A

    Thank You


    All good help thank you

    Andy

Similar Threads

  1. PIC Power saving
    By comwarrior in forum Code Examples
    Replies: 0
    Last Post: - 18th December 2010, 02:08
  2. Power multiple electronics from 1 power source
    By koossa in forum Off Topic
    Replies: 2
    Last Post: - 2nd September 2010, 09:49
  3. ADC Max Impendance and Power saving
    By Michael Wakileh in forum Schematics
    Replies: 3
    Last Post: - 28th June 2009, 20:29
  4. Saving variable(s) contents before power is removed
    By emavil in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 15th July 2007, 18:26
  5. [16F871] Power on RA4 before power on vdd?
    By Buzzz in forum Schematics
    Replies: 14
    Last Post: - 5th September 2005, 17:48

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