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


Closed Thread
Results 1 to 26 of 26

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Code:
    ITCADDRESS VAR WORD
    the RTC requires a BYTE address, not WORD !
    Code:
    second = 0
    minute = 0 
    hour = 12
    day = 2
    date = 25
    year = 5
    
    I2CWrite SDA, SCL, ITCDEVICE, ITCADDRESS, [second, minute, hour, day, date, month, year]
    1. there is no explicit value in "month"

    2. the RTC uses BCD format, the decimal values you are writing to the RTC don't make much sense.
    -----
    Now it's up to you to find out what the correct format would look like.
    it's been suggested to me that as i'm recieving "16" or a single "f" that maybe something is holding the data line up? still clueless other than that
    without a schematic we can't help
    You have already got more information than you would ever need to solve this problem.

    Do some work on your own.
    regards

    Ralph

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



  2. #2
    snood's Avatar
    snood Guest


    Did you find this post helpful? Yes | No

    Default

    the pic will automaticaly transmit the numbers in BCD.... even mel uses just regular numbers... and the missing month value is just a typing error, it is infact in my program.

    a direct quote from the DS1307 datasheet:

    "After the DS1307 acknowledges the slave address + write bit, the master transmits a word address to the DS1307."

    WORD address

    as fror the schematic... it's connected in the same fassion as the typical operating citcuit in the datasheet with 4k7 pullups... the Square wawe pin is just left hanging as i'm not using it.

    please stop telling me to do my own work... the questions i ask are simply what i cant find myself so i'm calling upon the expertese of other people. if you dont know how to solve my problem then just say so.

    Snood

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


    Did you find this post helpful? Yes | No

    Default

    This DOES work:
    Code:
    I2CWrite SDA, SCL, $D0,0, [second, minute, hour, day, date, month, year]
    
    Pause 500
    
    I2CRead SDA, SCL, $D0, 0, [second, minute, hour, day, date, month, year]
    what more do you want?

    we can't fix your hardware remotely.

    the pic will automaticaly transmit the numbers in BCD....
    WOW, that's great, so I can save a lot of codespace by removing all those conversions from my programs and let the PIC do it on it's own.
    But how do you tell the PIC what format you want/need?
    (or is there some kind of "Do What I Mean" Wizzard I didn't know about yet?)

    please stop telling me to do my own work...
    OK, there will be silence on this thread now...
    regards

    Ralph

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



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


    Did you find this post helpful? Yes | No

    Default

    Hi snood,
    Odd... You've got this:
    a direct quote from the DS1307 datasheet:
    "After the DS1307 acknowledges the slave address + write bit, the master transmits a word address to the DS1307."

    I can't find that quote at all in my 1307 data sheet. Mine says this:
    "The DS1307 operates as a slave device on the serial bus. Access is obtained by implementing a START condition and providing a device identification code followed by a register address."

    "device identification code" and "register address" are both bytes.
    My code works fine with bytes for both items.

    Are you certain you're reading a 1307 data sheet - sounds more like the sheet for the 1340?

    Arch
    Last edited by Archilochus; - 25th April 2005 at 22:04.

  5. #5
    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 22:22.

  6. #6
    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 ...
    _______________________________________________



  7. #7
    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

  8. #8
    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

Similar Threads

  1. I2C problems
    By Mad_Labs in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 25th September 2005, 05: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