Page 1 of 1

MCP3421 I2C 18bit ADC help

Posted: Sun Jan 01, 2012 6:16 pm
by STibor
Hello to everyone!
Can you help someone example program uses the MCP3421 analog digital converter?
I looked at the datasheet, but I can not find a solution.
Thank you for your help!

Re: MCP3421 I2C 18bit ADC help

Posted: Thu Jan 05, 2012 1:00 pm
by Gary Freegard
Hi Simpi
http://ww1.microchip.com/downloads/en/D ... 22003b.pdf
I haven’t used this device but I have had a look at the datasheet, its slightly confusing if not familiar with I2C. Here is what I can get from it.
The slave address is $68, though it is possible to order the device with a different address (add 1 to 7), see bottom of page 12
The correct address to be used in I2C is the $68 <<1 (left shift), for a write operation use this and for a read operation add 1 to the address. i.e. write operation address is $D0 and read is $D1.
page 11 describes the configuration register. The key point about this register is bit 7 , this is used to start a conversion in one shot and is used to show that a conversion has taken place in continuous mode.

One shot mode (config 10001000, One shot, 15sps, 1v/v)
  • MI2C_Start
    MI2C_Transmit_Byte($D0)
    MI2C_Transmit_Byte($88)
    MI2C_Stop
    Delay(1/15)
    MI2C_Start
    MI2C_Transmit_Byte($D1)
    MI2C_Receive_Byte-hi byte
    MI2C_Receive_Byte-lo byte
    MI2C_Receive_Byte-config byte
    MI2C_Stop
MI2C_Recieve_Byte
For continuous conversion
  • MI2C_Start
    MI2C_Transmit_Byte($D0)
    MI2C_Transmit_Byte($18)
    MI2C_Stop
    Delay(1/15)
    MI2C_Start
    MI2C_Transmit_Byte($D1)
    MI2C_Receive_Byte-hi byte
    MI2C_Receive_Byte-lo byte
    MI2C_Receive_Byte-config byte
    MI2C_Stop
In 18 bit mode there are three bytes of data plus the config byte.
  • MI2C_Receive_Byte-hi byte
    MI2C_Receive_Byte-mid byte
    MI2C_Receive_Byte-lo byte
Using table 5-2 you would be able to determine if the data received was from a new conversion, if it is not new then read again.

Hope this helps

Gary

Re: MCP3421 I2C 18bit ADC help

Posted: Thu Jan 05, 2012 8:54 pm
by STibor
Hi!
Thank you for your answer, really helped a lot! :D
Charged flowchart simulator works.

Re: MCP3421 I2C 18bit ADC help

Posted: Thu Oct 11, 2012 6:38 pm
by STibor
J or K type thermocouple thermometer. 0 to 450 ° C degrees.
The thermocouple measures the MCP3421 18-bit ADC.
The MCP3421 and MCP9701 measured of cold junction compensation.
The program is 450 variable stored in data array of temperature / voltage compensation.
Gary Freegard Thanks for your help!
https://profiles.google.com/simonfitibo ... 3828111122