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

    Quote Originally Posted by snood
    ...can you explain to me what the purpose of a pullup resistor is and why it is needed in this instance.
    OK, I'll try it in brief:

    A PullUp is required when you have an output pin that is open Drain (or open Collector)
    An open collector output is "open" if not set "LOW"
    The PullUp pulls this open Pin "HIGH"

    The SDA pin on an I2C device is such an open Drain output as it is bi-directional.

    Melanie has written an excellent example for the DS1307, see: MN1307.txt

    Another thread about RTC's with a lot of useful information can be found here

    Take some time to read it from the beginning, you can really learn a lto from it.
    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

    so would not having the resistors in explain why i'm getting "00" displaying on my LCD for all the values afrer trying to read?

    i ask again.... would i be right in just writing "0" for the seconds value in order to initialise it. i figure this cos surely BCD for 0 is %00000000 and the 7th bit is 0 so this should work... right?

    Snood

  3. #3
    snood's Avatar
    snood Guest


    Did you find this post helpful? Yes | No

    Default

    could anyone confirm the above.... i kinda need to know quite quickly.

    Snood

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


    Did you find this post helpful? Yes | No

    Default

    That'll work fine to set bit.7 assuming your I2C write is working properly.
    Program the chip and give it a go.

    Arch

  5. #5
    snood's Avatar
    snood Guest


    Did you find this post helpful? Yes | No

    Default still not working

    okay, ive added in the pullup resistors, ive ensured everything is connected to the correct things, ive made sure that i am addressing correctly, as far as i can see, i'm doing everything as i should.... now when i try set the time/dats as above and then read it back i get the values "16"

    this is also true of the i2C EEPROM i am using on the same bus.

    any ideas?

    Snood

    edit: i just thought that the value 16 is a hex "F" any ideas?
    Last edited by snood; - 25th April 2005 at 19:00.

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


    Did you find this post helpful? Yes | No

    Default

    Snood,
    this is a perfect time to have a look at the datasheet and the examples you have got.

    If you are expecting any further assistance post your schematic and code.
    (please cut the code down to the minimum required for reading writing the RTC / EEPROM)

    But before posting please do some reading!
    regards

    Ralph

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



  7. #7
    snood's Avatar
    snood Guest


    Did you find this post helpful? Yes | No

    Default

    please..... i have read the data sheet over and over again, ive read various places about I2C and i have studied the sample codes that i have been pointed to and still not a clue


    TRISB = %11111111

    second VAR BYTE
    minute VAR BYTE
    hour VAR BYTE
    day VAR BYTE
    date VAR BYTE
    month VAR BYTE
    year VAR BYTE

    ITCDEVICE VAR BYTE
    ITCADDRESS VAR WORD

    SDA VAR PORTC.4
    SCL VAR PORTC.3

    ITCDEVICE = $D0
    ITCADDRESS = $00

    second = 0
    minute = 0
    hour = 12
    day = 2
    date = 25
    year = 5

    I2CWrite SDA, SCL, ITCDEVICE, ITCADDRESS, [second, minute, hour, day, date, month, year]

    Pause 500

    I2CRead SDA, SCL, ITCDEVICE, ITCADDRESS, [second, minute, hour, day, date, month, year]

    at this point i dend the variables to my LCD and what comes up on the screen is "16"

    thanks

    Snood

    edit: 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

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