Battery backup with long delay


Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511

    Default Battery backup with long delay

    Hello folks,

    Name here is Dwayne, I am very much a neophyte to the PIC chips, and trying to learn them... I used to program philips chips, and the transition is quite a bit different.
    Through trial and error, and much help from a few folks out there, I have finally compiled the following Code for the 12f675 chip.

    Could someone take a look at it, can check it out for possible errors that I may not know of? Especially on the pin groundings and switches?
    I am accomplishing the following;

    ;When chip is started

    ;immediately take pin1a and ground it. (This activates the battery ;backup) .

    Loop:

    Begin Delay for 5 to 7 min.
    ;following 3 lines is a press of a switch
    ground another pin1b.
    Delay for 1/2 second.
    unground same pin1b.

    Delay for 1 min
    Unground first pin1a (this cancels battery backup).

    ****if power is still active do the following 4 lines ****
    counter++;
    if(counter==3)unground pin2a (KILL power totally to chip)
    delay 1 min.
    Goto Loop;
    *******************************************
    If chip loses power, start at beginning of loop.



    Seconds var byte ' 0-59
    Minutes var byte ' 0-5
    counter var byte ' 0-3
    counter=0;

    Loop:
    ;Battery backup pin toggles base of transistor to insure 5 volts
    Low GPIO.3;

    For Minutes=0 to 6
    gosub Delaymin
    Next Minutes

    ;the following routine acts like pressing a button..
    ;grounds pin 4 to ground (direct short to ground)
    Low GPIO.4;
    Pause 250;
    ;ungrounds pin 4
    High GPIO.4;

    gosub Delaymin

    ;takes battery backup off. If no power, chip stops.
    ;and starts over again when power is applied to it.
    ;if not, chip reassures battery backup for up to 3 times.
    High GPIO.3
    counter=counter+1
    if counter=3 then Low GPIO.3

    gosub Delaymin


    goto Loop

    Delaymin
    For Seconds=0 to 59
    Pause 1000
    ;flashing light for reference
    toggle GPIO.5
    Next Seconds
    return
    Last edited by Dwayne; - 4th January 2004 at 19:48.

Similar Threads

  1. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. RF Transmitter
    By et_Fong in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th October 2005, 16:34
  4. Memory Space of the PIC16F84...
    By Tear in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 1st July 2005, 19:55
  5. Problem with saving to EEPROM...
    By Tear in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st July 2005, 00:10

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