Minimizing power use w/ 12f683


Closed Thread
Results 1 to 7 of 7

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Minimizing power use w/ 12f683

    Thanks for the suggestion. I will try a FET. Although even with the relay the average power use is considerably decreased. The chip itself takes about 4 mA, the LEDs about 20mA (remember only one is lit at at time), and the relay another 20mA. This draw will be only for about 10 seconds maybe 6 times a day. Just running the chip without the relay, granted without sleep/nap or interrupt, all day long at 4 mA/24 hrs would be alot more power overall.

    As for rearranging and using a pin to create an interrup, well, I was trying to light 20 LEDs off one chip with as little extra stuff as possible. The only way that can be done is use all 5 I/O pins and make gpio.3 an input for the start of the program. It's somewhat shown here

    http://ww1.microchip.com/downloads/e...Doc/01146B.pdf

    If I'm missing something then please let me know.

  2. #2
    Join Date
    Feb 2011
    Posts
    26


    Did you find this post helpful? Yes | No

    Default Re: Minimizing power use w/ 12f683

    there's not much in your circuit than should be drawing power when 'off'.

    1. change the 1k on pin4 ra3 to 47k
    2. use TRIO=$FF when you want to turn off stuff completely
    3. have you considered running the chip slower?
    -- you can use 125khz and use "9600 baud serial" out to give you "real" 300 baud
    --my usb>serial won't work on 75baud otherwise I'd use 32khz for debugging

    Code:
    'low speed osccon 31khz 
    'bit 6-4 IRCF<2:0>: Internal Oscillator Frequency Select bits
    '                               correction 
    '                               by shifting
    '                                   |
    '                                   v   Min Pause times
    '       111 =8MHz
    '       110 =4MHz (default)         0
    '       101 =2MHz                   1   2
    '       100 =1MHz                   2   4
    '       011 =500kHz                 3   8
    '       010 =250kHz                 4   16
    '       001 =125kHz                 5   32
    '       000 =31kHz (LFINTOSC)       7   128
    
            OSCCON.6 = 0
            OSCCON.5 = 0
            OSCCON.4 = 1
    speed_shift  con   5   '  use 0-7 : oscillator / delay correction by shifting
    ' PAUSE is affect by this, see the above minimum pause times
           
    '
    ' FOR LOW POWER DISABLE AS MANY FEATURES AS POSSIBLE.
    ' ** FOR 12F675 un-COMMENT CMCON=7, ANSEL=0, ADCON0=0
    ' ** FOR 12f683 un-COMMENT CMCON0=7, ANSEL=0, ADCON0=0
    ' ** FOR 12F629 COMMENT ALL
    '   CMCON = $07  '12F675 CMCON — COMPARATOR CONTROL REGISTER  ALL DIGITAL
       CMCON0 = $07  '12F683 CMCON0 — COMPARATOR CONTROL REGISTER  ALL DIGITAL
    '    TRISIO = %11111011   'SET TO ALL OUTPUTS  1=INPUT
    '	ADCON1 = %01100000	' Set a2d convert at clk/6 [slowest]
    '	ADCON1 = %00000000	' Set a2d convert at clk/2 [fastest]
    	ANSEL  = %00000000  ' AN0/RA0 as analog input     1=ANALOG
    '	ADCON0 = %00000001	' .7=10bits left justify result!! / .0 1=a2d ON
    	ADCON0 = %00000000	' .7=10bits left justify result!! / .0 1=a2d ON
    '   WPUA =   %00000000  ' TURN ON WEAK PULLUP 1=ON VALID=.5.4.2.1.0
    
    'constants
    
    ALL_INPUTS          CON     $FF     ' Set to all inputs to save power
    LAMP_OFF            CON     $00   
    LAMP_ALL            con     $36     'GPIO.1.2.4.5
    
    
    'IO assignments
    SERIAL_PIN  var GPIO.2

    Main code snippets:
    Code:
            X= 250              ' DELAY TIME in milliseconds
            led = lamp
                gosub Lamp_ON
    ' turn OFF LED        time = 750mS
            X= 750  : gosub OFF_Lamp

    those called subroutines
    Code:
    ' Speed affected by the CPU clock speed
    Lamp_ON:
        TRISIO = ALL_INPUTS - led
        GPIO =   led
        Pause X >> speed_shift ' Delay for on time in milliseconds
        TRISIO = ALL_INPUTS    ' Set to all inputs to save power
    Return
    
    OFF_Lamp:
        TRISIO = ALL_INPUTS 
        Pause X >> speed_shift ' Delay for on time in milliseconds
    Return
    
    ' *** SLEEP & NAP Speed *NOT* affected by the CPU clock speed
    ' NAP uses slow clock mS 0=18,1=36,2=72,3=144,4=288,5=576,6=1.52s,7=2.304s
    ON_Lamp_Short:
        TRISIO = ALL_INPUTS - LAMP
        GPIO =   LAMP
        NAP x 
        TRISIO = ALL_INPUTS   ' Set to all inputs to save power
    Return
    
    OFF_Lamp_Short:
        TRISIO = ALL_INPUTS   ' Set to all inputs to save power
        NAP x 
    Return

Members who have read this thread : 0

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