How to detect low battery in battery powered F683 circuit


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: How to detect low battery in battery powered F683 circuit

    Your battery positive will be connected thru a 1K resistor to the adc, you may need a divider if v battery is greater than VDD? Then you take a normal acin reading and determine what number between 0 - 1024
    equals a low battery. If an < x then low_bat. else..

    To start

    Fixed voltage reference FVR page 137

    ADCIN will take care of the ADCON0 register

    FVRCON = %10000001 ' vref enabled 1.024v
    ADCON1 = %11110011 'Right just,FRC,+vref connected to FVR

  2. #2
    Join Date
    Sep 2008
    Location
    Maine, USA
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Re: How to detect low battery in battery powered F683 circuit

    Quote Originally Posted by mark_s View Post
    FVRCON = %10000001 ' vref enabled 1.024v
    ADCON1 = %11110011 'Right just,FRC,+vref connected to FVR
    Mark, thanks for the very helpful configuration settings. I got a test chip working fine using 8-bit reads and left justified results. I am in a similar position to peterdeco1 in that I have a circuit board designed for production and ready to go into volume assembly. Fortunately I already had two resistors connected to the A/D input creating a voltage divider so I am good to go - except for one minor problem. My test code works on the F683 chip just fine but when I try to implement it on my actual design I find that I do not have proper digital I/O on PortA.5 for some reason. My design uses portA.0 for the analog input and portA.2 for PWM out. I am struggling with what configuration error I have that is preventing portA.5 from operating as a digital output. I have been poring over the datasheet for an hour or so now and can't seem to find a configuration that seems to be setting that into something other than digital I/O. Any help would be appreciated.
    "Do or do not, there is no try" Yoda

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: How to detect low battery in battery powered F683 circuit

    These "enhanced" pics don't use the GPIO like the old ones. Use porta.5 to read
    and lata.5 to write. See page 13 and page 121 of the data sheet


    Add: See Hecklers code and configs
    http://www.picbasic.co.uk/forum/show...ght=pic12f1822
    Last edited by mark_s; - 30th October 2014 at 19:19.

  4. #4
    Join Date
    Sep 2008
    Location
    Maine, USA
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Re: How to detect low battery in battery powered F683 circuit

    Wow. Thanks Mark - I missed that. I just HATE all these whiz bang "features" that force us mere mortal coders to spend *days* learning a new chip! Grrrr. <end rant>
    SO to implement a pin as output only I use:
    GreenLED var lata.1 ' high = light power LED
    and also set:
    ' config
    TRISa = %011001 ' set I/O directions (0 = output, 1 = input)
    LATa = %011001

    - still not getting it to work with above settings. Do I have bit polarity right for LATA?
    "Do or do not, there is no try" Yoda

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: How to detect low battery in battery powered F683 circuit

    I think you would declare your variable as

    GreenLED var PORTA.1

  6. #6
    Join Date
    Sep 2008
    Location
    Maine, USA
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Re: How to detect low battery in battery powered F683 circuit

    Quote Originally Posted by mark_s View Post
    I think you would declare your variable as
    GreenLED var PORTA.1
    Been testing that and the compiler seems to accept either
    GreenLED var PORTA.1
    or
    GreenLED var LATA.1
    "Do or do not, there is no try" Yoda

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: How to detect low battery in battery powered F683 circuit

    At this point without posting your complete code it's hard to guess what's wrong.

Similar Threads

  1. How can a battery powered PIC turn itself off?
    By tekart in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 9th August 2012, 10:44
  2. Replies: 13
    Last Post: - 22nd January 2012, 04:48
  3. Battery powered applications
    By NavMicroSystems in forum Off Topic
    Replies: 7
    Last Post: - 22nd June 2009, 07:12
  4. 12F683 battery powered remote - energy consumption question
    By silentwol in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th April 2007, 13:23
  5. Battery Powered Need Help!
    By scottl in forum Off Topic
    Replies: 1
    Last Post: - 29th March 2006, 09:52

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