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

    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

  2. #2
    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 00:27.
    regards

    Ralph

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



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