ADC121C021 I2C problems


Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Jun 2009
    Location
    Cambridge, England
    Posts
    9

    Default ADC121C021 I2C problems

    I am having problems reading a ADC121C021 12 bit ADC with PBP.

    From the data sheet it appears that the slave address is 54h and the conversion result register is 0h.

    However, when I use the code below I get a read error.

    I have written a routine to cycle addresses from 0 to 255 to see if I could find a slave address that does work.

    I have found that a slave address of $A8 does return a result but whilst the result for an input of 0 to 5 volts produces an output of 0 to 4096, there seems to be gaps of 8 in the result i.e. 356,364,380 etc.

    I'm not sure what is going on.

    Any thoughts?

    i2cclock var portb.2
    i2cdata var portb.1
    slave_address var byte
    data_read var word
    adc_register var byte
    slave_address=$54
    adc_register=0
    I2Cread i2cdata,i2cclock,slave_address,adc_register,[data_read],error
    hserout [#data_read,13,10]
    program continues --

    error:
    hserout ["Read error",13,10]
    Attached Images Attached Images

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. I2C Read/Write problems
    By Dispersion123 in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 5th April 2008, 15:11
  4. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 19:33
  5. Please help with i2cslave i2c slave
    By cycle_girl in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st December 2005, 13:55

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