ADS1115: ADS1115 not responding for the address 0x48

Prodigy 160 points

Replies: 1

Views: 45

Part Number: ADS1115

hello everybody,

I am interfacing ADS1115 with Nuvoton N76E003 using I2C.

I am using adc channel A0 and 5V suppy voltage.

I have connected ADDR pin of ADS1115 to GND.

When I am giving address 0x48 through master it gives 0x20 i.e.Master Transmit Address NACK as a reply.

so I am stuck here. Please find my attached code and suggest solution.

#define EEPROM_SLA 0x48
#define 	EEPROM_WR  0
#define     EEPROM_RD  1
#define SET_BIT3        0x08
#define SET_BIT4        0x10
#define P13_OpenDrain_Mode		P1M1|=SET_BIT3;P1M2|=SET_BIT3
#define P14_OpenDrain_Mode		P1M1|=SET_BIT4;P1M2|=SET_BIT4


#define I2C_ACK			0
#define I2C_NACK		1				 
#define timeout_count	1000
void INIT_I2C(void);
void ADS1115_config();
void ADS1115_read();
void I2C_start();
void I2C_stop();
void I2C_Master_Write(unsigned char value);
unsigned int I2C_Master_Read(unsigned short a);
void main()
{
	//MODIFY_HIRC_166();	
//---------------------I/O DEFINATION-----------------------------	
	
	//P1M1 = 0X80;	//FOR NORMAL PROGRAM

	
//----------------------FUNCTION CALLS----------------------------	
	
	INIT_I2C();
	I2C_start();
	ADS1115_config();
    ADS1115_read();
	 I2C_stop();
	while(1)
	{	     
    }
}

//----------------------------------I2C COMMUNICATION FOR DISPLAY--------------------------
void INIT_I2C(void)
{
	P13_OpenDrain_Mode;
	P14_OpenDrain_Mode ;
	SDA = 1;
	SCL = 1;
	I2CPX=0;  //SCL= P1.3 ,SDA=P1.4
	I2CEN=1;
	I2CLK=42;  //  400KBPS FOR 16MHZ CLOCK
}
//_________________________ADS1115 CONFIG AND DATA BLOCK_______________________//

void I2C_start(void)
{
	signed int t = timeout_count;
	
	STA = 1;                                
    SI = 0;
   
}

void I2C_stop(void)
{
	signed int t = timeout_count;
	
	SI = 0;
    STO = 1;    
}
void ADS1115_config()
{
 I2DAT = (EEPROM_SLA | EEPROM_WR);

 if(I2STAT == 0x18)
 {
 	LED = 1;
 }
 I2C_Master_Write(0x01);//Command to config registers    0x01
 I2C_Master_Write(0x80);//PGA: +-6.144V, Inputs: default (A0), continuous conv. mode		0x80
 I2C_Master_Write(0x83);//128 SPS, Traditional comparator, active low, nonlatching, dis. ALERT/RDY 	0x83
 
}
void I2C_Master_Write(unsigned char value)
{
 I2DAT = value; //Write data to SSPBUF
}
void ADS1115_read()
{
unsigned int datah;
unsigned int datal;

//float data;
I2C_Master_Write(0x90); 			//0x90
I2C_Master_Write(0x00); 			//0x00
I2C_Master_Write(0x91); 		   //0x91
datah = I2C_Master_Read(1);
datal = I2C_Master_Read(0);

}

unsigned int I2C_Master_Read(unsigned char ack_mode)
{
	signed int t = timeout_count;
	unsigned char value = 0x00;
	I2DAT = (EEPROM_SLA | EEPROM_RD);
	t = timeout_count;
	AA = 1;                             
    SI = 0;
    while((SI==0)&&(t>0)) 
	{
		t--;
	};   	
	
	value = I2DAT;

	if(ack_mode == I2C_NACK)
	{
		t = timeout_count;
		AA = 0;   
		SI = 0;
		while((SI == 0)&& (t>0)) 
		{
			t--;
		};   		
	}
	
	return value;

}

1 Reply

  • Hello,

    Can you please share a capture of the I2C communication waveforms using an oscilloscope?  Our ADS111x experts will get back with you early next week.

    Regards,
    Collin Wells
    Precision ADC Applications