problems with I2C.... and ideas why dosent work?


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    snood's Avatar
    snood Guest


    Did you find this post helpful? Yes | No

    Default

    i got the datasheet here: http://pdfserv.maxim-ic.com/en/ds/DS1307.pdf

    under the "Slave Receiver Mode (Write Mode)" section of page 11

    also on page 12 the data diagram shws a word address.

    this is highly confusing.

    Snood

    edit: equaly it says: The DS1307 operates as a slave device on the I2C bus. Access is obtained by implementing a START
    condition and providing a device identification code followed by a register address.

    not "serial" but "i2c"

    are you looking at an old version maybe?
    Last edited by snood; - 25th April 2005 at 23:22.

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Hi Arch,

    Snood has got more than one tested and working examples.

    If one doesn't accept that 8 bits make a byte
    and 16 bit make a word
    and decimal 25 is different from hex 25
    there is nothing we can do in addition.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  3. #3
    Join Date
    May 2004
    Location
    New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    Just down-loaded the sheet in your link, and it is different than the one I got from Maxim's site on March 19 of this year.

    The "I2C" vs "serial" wording I think was just due to some patent / copyright issues.

    Since the 1307's register map only goes to $3F, writing a WORD for the register address probably causes problems. Use a BYTE instead - works for me!

    Arch

  4. #4
    snood's Avatar
    snood Guest


    Did you find this post helpful? Yes | No

    Default

    thanks Arch

    where did hex come into the equation ralph? the calender is written in BCD so what's wrong with using 25 in the variable as PBP will just convert it into 00011001 if i defined the data as $25 then yes... i would be trying to use hex which would of course give 100101 or 37 decimal. but i AM using decimal so thats no problem

    who said that i was denying that 8bits = byte and 16bits = word? i didnt

    please refrain from being so scathing and be polite like Arch

    thankyou

    Paul

  5. #5
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    The RTC works in BCD Format.

    If you want to set the date to the 25th. you would have to write $25 not a decimal 25 (which is $19)

    If you write a decimal 25 for the 25th of a month you are in trouble:
    at midnight the RTC will increment the decimal 25 ($19) to $20 (NOT $1A, because we are talking BCD!),
    which results in decimal 32, which is an invalid date in your decimal coding!

    If you want decimal numbers for easier editing/calculation you have got to convert them.

    See the examples you have got.
    Last edited by NavMicroSystems; - 26th April 2005 at 01:27.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  6. #6
    Warrier's Avatar
    Warrier Guest


    Did you find this post helpful? Yes | No

    Default

    Hi Sood:

    Just thought I might ask the obvious... your PIC is running at 4MHz or less, correct? DS1307 has the standard clock frequency and may not run above 4MHz.

    Try making the I2C clock line bipolar by DEFINE I2C_SCLOUT 1.

    You need to allow some time for the write to I2C completion - 10msec may be enough.

    For initialization of a virgin DS1307 take a look at Ms. Neuman's discussion at http://www.picbasic.co.uk/forum/show...ght=non-eeprom

    -warrier

Similar Threads

  1. I2C problems
    By Mad_Labs in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 25th September 2005, 06:22

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