Help with realtime clock and timer


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    geselaw's Avatar
    geselaw Guest

    Cool Help with realtime clock and timer

    Hi

    I am working on this new project and I am new to PIC .I have problem with my code(of which some of it is collected from the web) .Every thing seems fine but it is not working. I have attached small part of the code that I have modified to test the real-time clock with the original setup. Could Any one please look it up and through any sugestion. If you are intersted, I could send the complet code with schematic.I am using Pic16f628A.
    Attached Files Attached Files
    Last edited by geselaw; - 29th September 2005 at 14:25. Reason: forget some thing

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


    Did you find this post helpful? Yes | No

    Default

    Hi geselaw,

    Are you aware that it's set-up for a 32.768kz crystal on RB6 and RB7?
    RB6 and RB7 are also the ICSP data and clock lines, so you can't have both things connected at the same time.

    The Comparator and External interrupts are also enabled, but there isn't anything to handle them in the interrupt routine. If one of them causes an interrupt and the flag is not reset in the handler, you will be "continuously interrupting", which won't allow the rest of the program to do anything.

    Also, as shown, the Start: section will "Fall Thru" into a subroutine. But then it might only be that it's a portion of the program.
    <br>
    DT

  3. #3
    geselaw's Avatar
    geselaw Guest


    Did you find this post helpful? Yes | No

    Default Full code

    Hi Darrel

    I have attached the full code.Can you please look at the device setup,assembly and the real-time clock that I made using Timer1 with 32.678khz crystal.I really tried to make this code work.I have also attached My schematic.
    Attached Images Attached Images  
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default

    Somehow I don't think you're going to drive your ACS108's like that! Have you read their Datasheet and noticed what it says there? I don't see a COMMON path for a NEGATIVE current to flow in order to turn them on.

  5. #5
    geselaw's Avatar
    geselaw Guest


    Did you find this post helpful? Yes | No

    Default Done

    Hi Melanie

    First of all, I would like to congratulate you for the great job that you are doing in this forum. It really helps guys like me with no experience with microcontroller.

    Yes I have seen that problem some time ago and corrected it in my design. But my problem right now is the code. The chip is not performing according to the program.Let me ask you a direct question.

    1. I used Timer 1 for real-time clock.Do you see any problem in that module ?
    2. I used Time var word and then I used high byte and low byte for hour and minute. Is that Ok?
    3. How about the assembly code. Do you think that could make the chips unstable. I tried my best not to live floating inputs.I also put a stabilizing capacitor near the chip b/n Vss and Vdd.I tried to do every thing by the book.

  6. #6
    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.

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