Ds3231 rtc usage


Closed Thread
Results 1 to 25 of 25

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,632


    Did you find this post helpful? Yes | No

    Default Re: Ds3231 rtc usage

    again
    from the book (i2cread)




    The upper 7 bits of the


    Control byte contain the control code along with chip select
    or additional address information, depending on the particular device. The low
    order bit is an internal flag indicating whether it is a read or write command and
    should be kept clear.

  2. #2
    Join Date
    Dec 2012
    Location
    Türkiye
    Posts
    103


    Did you find this post helpful? Yes | No

    Default Re: Ds3231 rtc usage

    Quote Originally Posted by richard View Post
    again
    from the book (i2cread)
    So there is no use of the lsb of the control bit , then it's determined by the command's itself ... I mean if it is I2CREAD op then it automatically determines this bit itself ... Am I correct ? I'll give it a try once more by using

    Code:
    i2cREAD SDA,SCL,%11010000,$00,var
    At least I may read the control or the status register ...

    Thanks ..
    - Ipsa scientia potestas est -

  3. #3
    Join Date
    Dec 2012
    Location
    Türkiye
    Posts
    103


    Did you find this post helpful? Yes | No

    Default Re: Ds3231 rtc usage

    Quote Originally Posted by gunayburak View Post
    So there is no use of the lsb of the control bit , then it's determined by the command's itself ... I mean if it is I2CREAD op then it automatically determines this bit itself ... Am I correct ? I'll give it a try once more by using

    Code:
    i2cREAD SDA,SCL,%11010000,$00,var
    At least I may read the control or the status register ...

    Thanks ..
    No luck with that either ... I have even pulled the scl and sda up with 4.7 k resistors ... neither I can write nor read the control and status registers ... 😕
    - Ipsa scientia potestas est -

  4. #4
    Join Date
    Feb 2013
    Location
    Quebec, Canada
    Posts
    67


    Did you find this post helpful? Yes | No

    Default Re: Ds3231 rtc usage

    I don't want to be rude but RTFM, p.156:

    The Address size sent (byte or word) is determined by the size of the variable that is used. If a byte-sized variable is used for the Address, an 8-bit address is sent. If a word-sized variable is used, a 16-bit address is sent. Be sure to use the proper sized variable for the device you wish to communicate with. Constants should not be used for the Address as the size can vary dependent on the size of the constant. Also, expressions should not be used as they can cause an improper Address size to be sent.
    Pull-up resistors are mandatory for I2C. Keep trying, the DS3231 has nice features like alarms and is more accurate than the DS1307.

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,632


    Did you find this post helpful? Yes | No

    Default Re: Ds3231 rtc usage

    you keep showing this
    i2cREAD SDA,SCL,%11010000,$00,var
    it should be (apart from what michelj has pointed out)
    i2cREAD SDA,SCL,%11010000,0,[var]

    yet to be addressed :-
    none of the code you have posted seems to have the correct syntax for i2c commands .
    do you have a accurate schematic of your setup ?
    can you flash a led with your pic ? do the scl,sda pins do anything ?
    do you have a oscilloscope or a logic analyser to check output ?
    what do you get when you read the command and status regs of the ds3231 (0x0e,0x0f) ?

  6. #6
    Join Date
    Dec 2012
    Location
    Türkiye
    Posts
    103


    Did you find this post helpful? Yes | No

    Default Re: Ds3231 rtc usage

    I'm a total idiot ... I'll correct the code ...
    Thanks guys ...
    - Ipsa scientia potestas est -

Similar Threads

  1. Usage of built-in DAC ?
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 16th December 2014, 05:59
  2. Accurate serin usage?
    By sccoupe in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th July 2009, 08:36
  3. Interrupt usage
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 20th April 2008, 16:20
  4. Serin usage?
    By champion in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 24th January 2007, 00:57
  5. HPWM usage with the 18F6520
    By slxrti in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th November 2005, 16:57

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