I2C write - value too big


Results 1 to 20 of 20

Threaded View

  1. #1

    Default I2C write - value too big

    Hi all,

    i have found a bug in my temperature logger (16F88 + 24LC512+LM35).
    I works pretty well until it reaches temp values of 124șC, for values above it are displayed as 0șC or 0,5șC.

    I've looked at my code and i think a know what the problem is: I need to separate the variable into lowbyte and highbyte.

    The problem is that i'm not being able to get this working that way. Here's why :


    This way does not work:
    Code:
    I2CWRITE SDA,SCL,CTW,ADDR,[tempe.highbyte]
    pause 10
    ADDR=ADDR+1
    I2CWRITE SDA,SCL,CTW,ADDR,[tempe.lowbyte]
    This way does not work:
    Code:
    I2CWRITE SDA,SCL,CTW,ADDR.highbyte,addr.lowbyte,[tempe.highbyte]
    pause 10    
    ADDR=ADDR+1
    I2CWRITE SDA,SCL,CTW,ADDR.highbyte,addr.lowbyte,[tempe.LOWBYTE]
    Only this way one works:
    Code:
    I2CWRITE SDA,SCL,CTW,ADDR.highbyte,addr.lowbyte,[tempe]
    pause 10    
    ADDR=ADDR+1
    I2CWRITE SDA,SCL,CTW,ADDR.highbyte,addr.lowbyte,[tempe]
    Long story short:
    I can make it work with the eeprom BUT only with Address high and low. If i try to separate the variable tempe into high and low it doesnt work

    Any ideas ?
    Thanks
    .
    Last edited by ruijc; - 5th April 2008 at 15:43.

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 22:31
  2. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  3. Replies: 5
    Last Post: - 29th May 2008, 18:03
  4. PIC16F877 I2C programme
    By cooqo in forum mel PIC BASIC
    Replies: 3
    Last Post: - 21st April 2008, 10:02
  5. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 19:33

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