ULPWU & PLVD on 12F635 & 16F684


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    What exactly is it you're trying to do?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2


    Did you find this post helpful? Yes | No

    Post

    I am trying to build an PIR sensor with PIC attached. My aim is to make PIC sleep and wake up like every few seconds or minutes (Which I know will be based on Res/Cap value on GPIO.0) and check for voltage OR wake up if the sensor makes its pin go high.

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I see. If it's battery powered, then you don't want to waste current with internal pull-ups,
    and you don't want one on GPIO.0 connected to the internal ULPWU current sink.

    You want GPIO.0 to charge the cap through the series resistor, go to input, and let the cap
    discharge through the internal current sink. Kind of defeats the purpose if you have the pin
    held high via the internal pull-up.

    And, if your sensor outputs logic 1 when active, you should probably avoid the while GPIO.4
    since it's detecting something when GPIO.4 = 1.

    A better approach might be to read the port immediately on wake-up, find out which pin
    caused the interrupt on change wake up, then jump to a routine to handle it.

    Maybe something like this?
    Code:
    @ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_ON & _BOD_OFF & _CPD_ON & _IESO_OFF & _FCMEN_ON & _WUREN_OFF
    
    Include "modedefs.bas"
    
    OSCCON = %01100000 ' Internal 4MHz select
    OPTION_REG.7 = 1 ' turn off current hog internal pull-ups
    CMCON0 = 7 ' disable comparator
    VRCON = 0 ' disable internal Vref
    GPIO = %00000000 ' LED off on boot
    TRISIO = %011000 ' GPIO.0 / 3,4= input, rest outputs
    PIR1 = 0 ' clear peripheral int flags
    IOCA.0= 1 ' int on change enabled for GPIO.0
    IOCA.4=1 ' int on change enabled for sensor @ GPIO.4
    
    Main:
      IF GPIO.4 THEN HandlePIR ' goto PIR detect routine
      GPIO.0= 1 ' set data latch on GPIO.0
      TRISIO.0= 0 ' GPIO.0 = output (charging cap)
      PAUSEUS 100 ' charge cap for 1
      PCON.5 = 1 ' ultra low power wakeup enabled
      TRISIO.0= 1 ' GPIO.0 = input to discharge cap
      INTCON= %00001000 ' globals disabled, int on change enabled, clear wake up int flag bit
      @ SLEEP ' put PIC to sleep
      IF GPIO.4 THEN
        PCON.5 = 0 ' disable current sink on ultra low power wakeup
        GOTO HandlePIR ' if PIR sensor woke us up, handle it
      ELSE
        GOSUB Test ' go test for under voltage condition AND send data if pin is made high by 
      ENDIF
      GOTO Main
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4


    Did you find this post helpful? Yes | No

    Post Thanks a lot

    Thanks Bruce. I am going to take your advice as it exactly was my aim towards increasing battery life. Thanks again

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    You're welcome, and good luck. Have a look at this when you have time.

    It has several good tips on power savings for battery apps:
    http://ww1.microchip.com/downloads/e...doc/41200B.pdf

    And this one too: http://www.ac-limoges.fr/sti_ge/IMG/...C_nanowatt.pdf

    Also take a peek in the Electrical Specifications section of the data sheet.

    It shows current required for various peripherals, oscillators, etc..
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6


    Did you find this post helpful? Yes | No

    Default Current consumption?

    Hello Bruce, can you tell me what is the lowest current consumption you have achieved with 12F635?
    The minimum I have is 320uA, using external 4MHz resonator. which I don't know is a lot or reasonable? Thanks

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I've never actually tested current consumption on anything I've done with a 12F635, but if
    you post your circuit & code I'm sure someone could help you get it below 320uA if it's
    sleeping during the time you're measuring current draw.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. 16F684 Basic Functionality
    By munromh in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 30th September 2009, 20:28
  2. ICSP and 16F684
    By onaclov2000 in forum Schematics
    Replies: 4
    Last Post: - 5th March 2009, 17:31
  3. help with HPWM on 16f684
    By kimvellore in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 23rd May 2006, 08:05

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