RTC - code not working - Mel's example


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    malc-c's Avatar
    malc-c Guest

    Default RTC - code not working - Mel's example

    Ok so now I've sussed out why the RTC module wasn't working, I've used Mel's code to test the RTC and have stumbled into a problem which for the life of me can't get working.

    When powered up it displays the time on the 1st line and date on the second (incidentally it seems to skip the pre-sets in the code and use the date set in a previous bit of code used to test the module). The code responds to RA5 going low and jumps to set mode. However the LCD just sits there at Set Mode with the 12HR / 24HR overwriting itself every half a second. Pressing any of the buttons on PORT A has no affect, and the code doesn't jump back to normal clock mode if left for several seconds with out input.

    Your help would be appreciated... Code attached
    Attached Files Attached Files

  2. #2
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Sorted...

    I'm gonna give up tonight....

    I had the LEDs set to confirm the switches were working, and it must of been taking the port low enough to register as an input.... turning these off and it is now stable !

  3. #3
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Maybe I spoke too soon...

    I can now run through the set up, however setting it up for 10:45PM on 22nd March 2010, however pressing RA5 the display states "Memorised" but then displays the current time and date as : 4:46 AM Sat 28 Apr 2018

  4. #4
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Anyone have any ideas ?

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


    Did you find this post helpful? Yes | No

    Default

    If I have time in the next day or two I'll revisit this... but I'd have thought if there was a problem someone would have mentioned it in the eight years it's been around.

    Despite the fact it's incorrect - is the Time incrementing?

    Looks to me like the Data to/from the RTC is corrupt.

    You got correct pull-up's on the CLK and Data lines to the RTC?

    Download a fresh source copy and recompile... you may have changed something accidentally without noticing.

  6. #6
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Mel, thank for replying.

    Yes the clock runs fine. The module has the pull ups fitted


    I'll try your suggestion when I get home from work in a couple of hours. Maybe I did edit something I shouldn't have, but AFAIK the only changes were to portB for the LCD and port A for the switches

  7. #7
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post

    Download a fresh source copy and recompile... you may have changed something accidentally without noticing.
    Mel,

    I've downloaded a fresh copy of the code from http://www.melabs.com/resources/samp...ted/MN1307.txt

    The only things I've changed are making PORTA all input, PORTB output, the LCD to work on PORTB and the config setting s so it compiles on an 16F877A. - all the code that handles the setup of the clock is unchanged. I have all LEDS turned off so there is nothing else connected to either the RTC lines or switch inputs. RA4,5 and 6 are tied high via pull-up resistors, with switch's to gnd when pressed.

    Code compiles and loads into PIC. time is shown on line 1 Hrs:min:sec, a date is shown on line two (which was the date set using a very basic example found on the web that simply writes values in a "string" to the device eg I2CWRITE SDA,SCL,$D0,$00,[$00,$00,$19,$7,$14,$2,$10,$90] )

    All seems as it should, however pressing RA5 the display changes to "SET MODE :" with the 12 / 24 HR constantly over-writing itself. Pressing RA4, 5 or 6 has no effect, and if left doesn't auto switch back to display the clock.

    Code attached

    Any ideas ?
    Attached Files Attached Files

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