Thread: Rtc ds1337

  1. #1
    Registered User
    Join Date
    May 2009
    Location
    Ireland
    Posts
    13

    Rtc ds1337

    Hi there,

    Just a quick question, does anyone have any experience using C to program the real time clock ship DS1337 (or one like it).

    I am trying to figure out where to start with this, so any advice etc would be great.

    Thanks

    Sean

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So, what have you already got?

    It's an I2C device, so you will need SOME way to do I2C communication from your code.

    The datasheet for the part can be found here:
    QuickView - DS1337, DS1337C I²C Serial Real-Time Clock

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    May 2009
    Location
    Ireland
    Posts
    13
    Hi, and thanks for the link (and reply).

    I have the data sheet, and an understanting (roughly) of what is going on with the RTC. I know that its a TWI, master/slave setup etc, but its the actual coding that I am not sure about. I just don't know where to start.

    I have checked online for example code etc, on places like avrfreaks.net, but there isn't a lot of information.

    Thanks

    Sean

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    It took me about 10 seconds to find this:
    Interfacing I²C Serial Real-Time Clocks to a Microcontroller - Maxim
    which appears to have something that resembles C code in it - I think it's your task to determine if it's useful or not.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    May 2009
    Location
    Ireland
    Posts
    13
    Thanks for the link, it seems like it could be helpful.

    Also, maybe it took you 10 seconds to find that because you are (I assume) vastly more experienced at this stuff that I am, and therefore you are more aware of where to look, and what you are look for.

    However, like I said, thats very much for your help.

    Sean

  6. #6
    Complete Beginner
    Join Date
    Feb 2009
    Posts
    312
    Also, maybe it took you 10 seconds to find that because you are (I assume) vastly more experienced at this stuff that I am, and therefore you are more aware of where to look, and what you are look for.
    I tried to beat matsp's time (and failed: ~15 secs), here's what I did:

    - searched Google for "real time clock ship DS1337", which is a verbatim quote from your initial post
    - clicked on the first hit
    - used the site's search to find "ds1337"
    - clicked on the eighth hit
    - tadaa

    I'm sure you could have come up with this technique, too. :P

    Greets,
    Philip
    All things begin as source code.
    Source code begins with an empty file.
    -- Tao Te Chip

  7. #7
    Registered User
    Join Date
    May 2009
    Location
    Ireland
    Posts
    13
    Well, you live and you learn don't you?

    Thanks

    Sean

  8. #8
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by feely View Post
    Thanks for the link, it seems like it could be helpful.

    Also, maybe it took you 10 seconds to find that because you are (I assume) vastly more experienced at this stuff that I am, and therefore you are more aware of where to look, and what you are look for.

    However, like I said, thats very much for your help.

    Sean
    Ok, so I did cheat a tiny bit: I started with the page I'd already posted, which has a link to the application notes, one of which is "connect this chip to microcontroller", and I just clicked through those two links and checked that the app-note was not a "here's the pins, you connect them to these pins on your microcontroller, we'll leave it to you to figure out how to write to code" application note.

    It would take a little bit longer if I'd started from scratch with just the part number. But google is USUALLY good at finding info on modern (still in production) parts from the part number alone.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #9
    Registered User
    Join Date
    May 2009
    Location
    Ireland
    Posts
    13
    I did use Google, and got links to people personal sites etc where they had posted up projects and that sort of stuff, nothing that really gave an explanation of what was going on, more like 'if you want to do this, here is the code for it' ....treating the code like a black box.

    I have never really had to go looking for app notes before, in college, they usually give us all the info we need, so that has its down sides.

    But now that I know the craic, I can look for them first off

    Thanks

    Sean

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  2. why it cause a Segmentation fault?
    By mycount in forum C Programming
    Replies: 1
    Last Post: 09-28-2006, 10:19 PM
  3. RTC problems
    By Crossbow in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 06-05-2002, 11:13 AM