PIC18LF13K50 Extremly low power counter


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Thanks Jerson,

    The main reason I ask is I think it would make a great little Wiki with some time/power results. I don't recall seeing anything like that on the forum. If there is not an interest here, then I will try working something up.

    Walter
    http://www.scalerobotics.com

  2. #2
    Join Date
    Feb 2010
    Location
    USA, New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    Can any of you folks share how you measure the average current draw? I've done a few extremely low power projects and have always sort of "eyeball averaged" the current on a standard multimeter. I'd love to learn a better method.

    Best Regards,
    Paul
    The way to avoid mistakes is to gain experience. The way to gain experience is to make mistakes.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I use a Fluke 83. It has a MIN/MAX button.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    967


    Did you find this post helpful? Yes | No

    Default

    Well almost all the folks who have tested use a multimeter to check. The benchmark is the datasheet which would show a typical draw of 40uA. Anything over that indicates something is drawing power and you need to check on it. I've listed some of the tricks that I used.

    This is the code I use that puts the PIC into low power sleep
    Code:
    StopNow:
            
            PORTB = $f8         ' turn all rows low for interrupt to occur
            INTCON = $8         '  RBIE = 1 to wakeup from sleep, not necessary to have GIE enabled for this
    asm
            sleep
            nop                      ' the 2 nops are a workaround for some pics 
                                       ' that slip on the  sleep
            nop
    endasm
    
            PORTB = $ff         ' turn off all rows
            INTCON = 0         ' turn off the interrupts as I don't need them now
            goto  loopstart     'start right at the front
    Besides this, things like BOR, Watchdog all consume power. You should consider if your application needs these features more than the minimized power drain.

    Check each pin of the PIC to see that it is turned to a state which does not cause power drain due to itself or connected circuitry. For example, if you have the PORTB pullups turned on, putting a PORTB pin to 0 will cause a current drain there. Turning the port to all inputs may not be the best solution always.

  5. #5
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Current measurement

    Quote Originally Posted by prstein View Post
    Can any of you folks share how you measure the average current draw? I've done a few extremely low power projects and have always sort of "eyeball averaged" the current on a standard multimeter. I'd love to learn a better method.

    Best Regards,
    Paul
    Hi Paul,
    I used to use this meter for the low current stuff:
    Name:  uA meter.jpg
Views: 1256
Size:  34.3 KB
    But just as Jerson outlined the necessary steps and precautions of putting that baby to Sleep, I saw the current drop off the bottom edge, now that was exciting!
    I bought the Fluke 8050A that can measure into the 10's of nano Amps to see what was really happening.
    Last edited by LinkMTech; - 15th October 2010 at 18:40. Reason: Fix quote
    Louie

  6. #6
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default

    scalerobotics, Here is it, but not whole code.
    Code:
                define OSC 4
                'RTC
                SYMBOL SCL = PORTC.3
                SYMBOL SDA = PORTC.6
                symbol CLCK_Alrm = portc.7
                input clck_alrm
                'Input
                symbol In1 = PORTA.1
                symbol In2 = PORTA.0
                symbol In3 = PORTA.5
                symbol In4 = PORTC.5
                INPUT PORTA.1
                INPUT PORTA.0
                INPUT PORTA.5
                INPUT PORTC.5
                'Pull
                symbol Pull= PORTA.4
                OUTPUT Pull
                output portc.4 'just for testing
                OSCCON=%01010110
                OSCCON2.2=0
                ANSEL=0            
                ANSELH=0           
                SLRCON=0           
                RCON.7=1   
    
                UCON.3=0       ' disable usb, to alow use of ra0 and ra1
                IOCA=3         ' set ioc on ra0 and ra1 EDIT: bits 0 and 1 must be set, to use ra0, ra1...
            
                INTCON=0  
                INTCON2=%10000000  
                INTCON3=%00000000  
                PIR1=0
                PIR2=0
                PIE1=0
                PIE2=0
                IPR1=0
                IPR2=0
    
        
    
                
    disable
    PWR_On:                                       
    pause 10
    I2CWrite sda,scl,$a2,$02,[1,1,1,1,1,1,1]    ' just put some valid time/date in rtc
    I2CWrite SDA,SCL,$A2,1,[%00000010]
    I2CWrite SDA,SCL,$A2,$0D,[%10000010]        'enable clockout @ 32Hz
    enable
    INTCON=%10010000                            'enable interrapt's
    on interrupt goto int
    
    
    Start:
    sleep 60                'sleep until int0                    
    goto start 
    disable interrupt
    
    Int:
    pull=1 'enable pull up
    Toggle portc.4 'do something :)
    'Read/write to portst etc.
    pull=0 ' disable pull up
    INTCON=%10010000 
    goto start   
    end
    In file ppb/18F13K50.INC I'm just put OFF where ON was
    Code:
            __CONFIG    _CONFIG1L, _CPUDIV_NOCLKDIV_1L & _USBDIV_OFF_1L
            __CONFIG    _CONFIG1H, _FOSC_IRC_1H & _PLLEN_OFF_1H & _PCLKEN_OFF_1H & _FCMEN_OFF_1H & _IESO_OFF_1H 
            __CONFIG    _CONFIG2L, _PWRTEN_OFF_2L
            __CONFIG    _CONFIG2H, _WDTEN_OFF_2H & _WDTPS_512_2H 
            __CONFIG    _CONFIG3H, _MCLRE_OFF_3H 
            __CONFIG    _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _BBSIZ_OFF_4L & _XINST_OFF_4L
    Still I wonder why TMR0 was not stable...
    Code is a similar, i just enabled tmr0osc and overflow interrupt.
    Edit2: I'm using UNI-T UT81B
    Attached Images Attached Images  
    Last edited by pedja089; - 15th October 2010 at 14:24.

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