Dallas 3231


Closed Thread
Results 1 to 11 of 11

Thread: Dallas 3231

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    10

    Default Dallas 3231

    Hi All,

    I m having trouble talking to a DS3231 RTC. I have searched and didn't find any posts directly related to this chip. I have been trying sample code from other Dallas RTC's but no luck so far.

    I can talk to the RTC with another uC. Problem is that most of the code is in ASM, so I can't pluck out what I need, I don't grok ASM. I do know the chip is working though, as I can set and read the time.

    Does anyone have a simple snip that works for sure with the 3231? I can post what I have tried so far, but I thought I'd see if anyone had a snip first and waste less of everyones time.

    Very sorry if there are posts addressing this chip, I really did look.

    Jonathan

  2. #2
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: Dallas 3231

    The major issues will likely be (in order):
    1) Understanding and implementing I2C communicaitons with a PIC and PBP (and get the hardware correct)
    Lots of Info on the protocol is available online.
    2) How to use the I2C protocol to access the DS3231 specific registers – Both to set the device and retrieve data
    The datasheet will help here once you have #1 sorted out.
    3) How to manipulate/convert the received data in PBP do display on an LCD.

    This link may help you in overcoming the issues above. http://www.rentron.com/PicBasic/i2c_communication.htm
    Last edited by SteveB; - 3rd May 2012 at 23:44. Reason: premature posting

  3. #3
    Join Date
    Jan 2009
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Dallas 3231

    Steve,

    Thanks for the reply. I have used I2C stuff with PICbasic pro before and the display is no problem. I must not be sending it the right commands. As I understand it, with PBP pro which has the built in I2C commands, all I should have to do is something like:

    I2CRead sda,scl,%11010000,$0,[seconds]

    in order to retrieve the seconds data, but I ain't getting it. I can read and set the time from another uC, so I'm pretty sure I have the hardware connected correctly.

    Thanks!

    Jonathan

  4. #4
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: Dallas 3231

    Something to remember with the DS3231, you need to write the address of the register you want to read first (no data)
    Then, when you read, you will get the data in the register.

    I've been happier using the hardware I2C. But try these PBP statments:
    :
    I2CWRITE sda, scl, %11010000,%0
    I2CREAD sda, scl, %11010000, [seconds]

  5. #5
    Join Date
    Jan 2009
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Dallas 3231

    Drat, no luck. I'll keep looking. Thanks!

  6. #6
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: Dallas 3231

    I'll offer these up if you are interested in trying the hardware I2C if it's available on your device.

    Some things to mention:
    The path of the include file needs to be specified for where you have it saved.
    This is very bare bones and only ment to get you started in incorporating it into your own code.
    Attached Files Attached Files

Members who have read this thread : 1

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