And last but not least: static ram?


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2004
    Posts
    81

    Default And last but not least: static ram?

    Hi all,

    My little odometer is comming along very well. Now I only have one last problem I need some ideas on...

    Since this is an odometer, it has to some how retain the current reading when the device is powered off. I tried writing to eprom for every 10th mile change, however thats writing to the eeprom quite a bit and actually ends up messing up the display. So I figure its better to just write to eeprom say, when the key is turned off. But Turning the key off also cuts the power to the whole unit...

    I know its a little off topic, but again... just reaching for some Ideas.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    well, the only suggestion that spring to my mind is to use 2 voltage source. 12V constant from battery for the PIC, switched 12V for the rest of your unit. You can also use the switch 12V to turn your PIC into SLEEP mode.... in this case it will get few uA from the car battery + few mA for voltage regulator... 78L05 in TO92 need less minimum current than 7805 in TO220 package.

    Usually car cluster work almost like this. There's alway one constant 12Volt going into.

    That way, you will be able to do what you want. Will be easier to save data to EEPROM then switch off external stuff(LCD,BacKlite...etc), then turn to SLEEP mode.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Default

    This is quite simple... consider the appended circuit...

    Normal power for the PIC is supplied via D1 to the PIC's +5v Power Supply, eg 78L05 or whatever you have. R1/R2 is a potential divider to give you no more than 5v cut down from the maximum vehicle supply. You can have say a 4.7v Zener if you feel uneasy in lieu of R2 to make sure the PIC never gets anything over 5v on it's Power-Fail detect pin.

    When the +12v Supply is switched off, the pic detects this via R1/R2, however charged Capacitor C1 keeps it running for another 500mS (or whatever's needed), which is enough time to save the appropriate Data to EEPROM and go into a endless loop waiting for the eventual total Power Loss. Value of C1 will be dependant on your PIC's current draw and how long you need to keep the PIC running after Power-Off.

    Melanie
    Attached Images Attached Images  

  4. #4
    Join Date
    May 2004
    Posts
    81


    Did you find this post helpful? Yes | No

    Default

    Both Excelt suggestions: I think I'll have to give Melanie's a shot though because Not only do I have to account for power just being switched off normally, but I also have to account for some sadistic mechanic disconnecting the battery at inoppertune times.

    I'll let you know how it works out.

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    >but I also have to account for some sadistic mechanic disconnecting the battery at inoppertune times.

    in this case of mecanic.... usually engine is previously turn off. Case not, alternator gives you the voltage again.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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