Help with realtime clock and timer


Closed Thread
Results 1 to 21 of 21

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    > I tried to do every thing by the book.

    Time to consign that book to land-fill.

    Darrel has already said that your schematic is screwed. The best code in the world isn't going to make it run and it's pointless even looking at it. Go away, create a circuit that is likely to actually work, then at least when you write some code you've half a chance it might do something sensible. While we're at it, you're using a CAD program, so let's layout the drawing that's easy to read.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    YES, I did say that. Many times infact!   I just don't remember typing it.

    Did you bug my computer again Melanie?

    Actually, I found so many problems with the schematic, I didn't want to say anything, for fear I'd have to come up with ways to fix it.

    I am however, fairly impressed with the program. Every time I thought I found something wrong, a quick look at the datasheet proved that whomever wrote it, spent a lot of time looking at the datasheets too.

    You definately gotta work on that circuit though.
    <br>
    DT

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Oh yeah, I forgot,

    The only real problem I found in the program was that the Comparator Interrupt section is resetting the Enable bit instead of the Interrupt Flag.

    After the first time through, the comparator won't cause an interrupt anymore. But, it will keep the External Interrupt section from ever executing.<br>
    Last edited by Darrel Taylor; - 1st October 2005 at 20:17.
    DT

  4. #4
    geselaw's Avatar
    geselaw Guest


    Did you find this post helpful? Yes | No

    Default

    Thank you Darrel for your suggestion ,here is the new code.

    COMP_INT BSF _Charger ;porta.0 will be on.it will be used for charging the battery
    MOVF CMCON,F ;read and clear comparator mismatch condition
    bcf PIR1, CMIF ;clear comparator interrupt flag
    movf _hour,w ;*** read hour to w register
    addlw 008h ;*** add 8 to hour which is in the w register
    movwf _Bat_hour ;move the result to the Bat_hour var
    goto Unsave

    The schematic was never meant to be published ,it was only for reference.I know this is lame excuse so I am working on it and I will post it ASAP.In the mean time you said you don't like the circuit,good. Which part do you think need improvement/change. I don't ask people to do my leg work for me .All I am asking is for suggestion.

    I am a Network Engineer by profession never had formal education in electronics. All the small things I know ,I learned it from internet. I really need to make this project work .Please help.

  5. #5
    geselaw's Avatar
    geselaw Guest


    Did you find this post helpful? Yes | No

    Default New Schematic

    I have tried to make the schematic readable. The schematic that I posted last time was unreadable even to me ,and I found so many silly mistakes and tried to correct them. If you find any more mistakes ,it is just because I don't know better for the time being ,but I am hear to learn.

    I have also made minor correction under the "Start" Label

    Start:

    'Initial Battery charging (if not intiated yet by low battery from assembely interupt)
    if (charger = 1) and (bat_hour != 0) then 'This will stop the programe from adding another charging-
    goto System_Start '-hour if the battery is already being charged caused by low battery-
    endif '-in the begining of the programe
    bat_hour = hour + 8 '*** charge the battery no matter what at start
    charger = 1 'Charge pin on
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default

    Look, lets start with basics...

    1. Go download the Datasheet for your PIC...
    2. Go see where the Crystal IS SUPPOSED TO BE CONNECTED

    Come back and tell us which pins it has got to be nailed to, and then tell us why you insist on having it on RB6/7 in your schematic. This I've got to hear...

    And whilst were teaching schematics, you never, ever, ever draw lines or connections through a component! Go around it.

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


    Did you find this post helpful? Yes | No

    Default

    Looks like he's using the internal osc with external crystal for Timer1, but there are still a TON of errors in that schematic.
    Regards,

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

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. Clock with timer interrupt0
    By boban in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 4th November 2009, 14:59
  3. Single digit 7 Seg LED clock - PIC16F88
    By thirsty in forum Code Examples
    Replies: 4
    Last Post: - 17th July 2009, 08:42
  4. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  5. clock and date without using real timer
    By eepro in forum Off Topic
    Replies: 1
    Last Post: - 21st September 2008, 02:38

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