Hardware I2C and DS3231 RTC Problems


+ Reply to Thread
Results 1 to 4 of 4

Thread: Hardware I2C and DS3231 RTC Problems3719 days old

  1. #1
    Senior Member SimonJA's Avatar
    Join Date
    Mar 2006
    Posts
    844
    Thumbs Up
    Received: 14
    Given: 16
    Total Downloaded
    1.03 GB

    0 Not allowed!

    Default Hardware I2C and DS3231 RTC Problems

    I am trying to read the time from a Ds3231 RTC using HBus commands and canít seem to get things working.

    I have used the DS3231 on several projects over the past year but all using the software commands and donít have any problems.

    I am using a 18F4450 and this is my code which works fine if I remove the H in front (and assign the clock and data pins).

    HBStart
    HBusIn %11010001, 0, [SEC, MN, HOUR, DAY, DATE, MONTH, YEAR, Ctrl]
    HBStop

    I also have two other port expanders on the I2C bus and hardware commands to these work fine but as soon as I try the above code it just hangs.

    Iíd be very grateful for any help.

    Thanks
    Simon

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Junior Member Handyman's Avatar
    Join Date
    Sep 2007
    Posts
    49
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    10.79 GB

    0 Not allowed!

    Default Re: Hardware I2C and DS3231 RTC Problems

    This worked for me.

    '---------------[CONSTANTS]-------------------------------------
    Symbol WriteCtrl = %11010000
    Symbol ReadCtrl = %11010001
    Symbol RegAddress = %00000000
    '
    '
    '
    '
    '
    '---------------[SUBROUTINES]-----------------------------------
    READ_DS3231:
    HBStart ' Start
    HBusOut WriteCtrl '
    HBusOut RegAddress
    HBStop ' Stop
    HBusIn ReadCtrl, [Seconds,Minutes,Hours,Day,Date,Month,Year]'read seven registries
    Return


    Hope it helps.

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Senior Member SimonJA's Avatar
    Join Date
    Mar 2006
    Posts
    844
    Thumbs Up
    Received: 14
    Given: 16
    Total Downloaded
    1.03 GB

    0 Not allowed!

    Default Re: Hardware I2C and DS3231 RTC Problems

    Thanks for the reply but I can't get that to work either, though it doesn't halt like my original code.

    I notice that you you have a HBStop in the middle??

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Senior Member SimonJA's Avatar
    Join Date
    Mar 2006
    Posts
    844
    Thumbs Up
    Received: 14
    Given: 16
    Total Downloaded
    1.03 GB

    0 Not allowed!

    Default Re: Hardware I2C and DS3231 RTC Problems

    Working now, seems it was a config issue.

    I am not exactly sure what it didn't like but I tried some different settings and it worked.

    As pic's get more advanced I seem to get more problems with config settings, working with 16F's there wasn't much to do now with chips like the 18F14K... you're screwed if you don't get everything right.

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Best aproach for I2C coms with DS1307 RTC
    By katesfb in forum Proton Plus Compiler v3
    Replies: 13
    Last Post: 14th February 2014, 09:59
  2. Multiple hardware I2C
    By ricardourio in forum Proton Plus Compiler v3
    Replies: 0
    Last Post: 6th January 2012, 11:28
  3. I2C RTC Giving me a headache
    By pciebiera in forum Proton Plus Compiler v3
    Replies: 7
    Last Post: 14th January 2010, 05:10
  4. DS3231 RTC to replace DS1307 - Can't get it working
    By SimonJA in forum Proton Plus Compiler v3
    Replies: 10
    Last Post: 20th January 2009, 10:25
  5. Why should I use the hardware I2C bus?
    By Frizie in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 19th February 2008, 09:25

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts