Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I2C - salve device (PCF8574AP) is not responding

Status
Not open for further replies.

narithota

Full Member level 1
Joined
Apr 21, 2006
Messages
95
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
2,077
I2C

Hay
I am facing problem with LPC2114 inbuilt I2C, i interfaced LPC2114 with PCF8574AP Port Expander.
I have tested following code but the salve device (PCF8574AP) not responding.
My application is I have to read the Digital inputs from the PCF8574AP device
PCF8574AP device address Pins A0, A1, A2 connected to the ground
Please provide the information regarding how to read the inputs from the I2C Port Expander.



///////////////////////////////I2C-Testing-Code///////////////////////
#include<LPC21XX.h>

#define LED1 0x00000010 //P0.4
#define LED2 0x00000040 //P0.6
#define LED3 0x00000080 //P0.7
#define LED4 0x00000400 //P0.10

unsigned char I2CAddress = 0x71; // set I2C slave address for read from the chip

void init_pll()
{
PLLCFG=0x00;//multiplier and divider values are 00
PLLCON=0x00; //PLL is bypassed and the oscillator clock is used directly by the LPC2114,PLL is turned off
PLLFEED=0xAA; //Feed values
PLLFEED=0x55;
VPBDIV=0x01; //VPB bus clock is the same as the processor clock Pclk=14.7MHZ, Cclk=14.7MHZ
}

void I2C0_Isr(void) __irq
{
unsigned char st;
st = I2STAT;
switch(st)
{
case 0x08: //when start bit is enable status of the regeater is 0x08

I2CONCLR=0X20;//Clear start bit
IO0SET=LED1;
delay();
I2DAT=I2CAddress; //send the address with read bit 01110001=0x71
break;


case 0x40: //slave address +R,ACK

I2CONSET = 0x04; // enable ACK for data byte
IO0SET=LED2;
delay();
break;

case 0x48: //slave address+R, Not ACK

I2CONSET = 0x20; // Resend the start condition
IO0SET=LED3;
break;

case 0x10: //Repet Start condition Data Recived ,Not ACK
I2CONCLR = 0x20; // Clear the start condition
I2DAT=I2CAddress; //send the address with read bit 01110001
IO0SET=LED4;
delay();
break;

default:
break;
}
I2CONCLR=0x08; // clear SI
VICVectAddr = 0; // reset VIC
}

void main()
{
unsigned int i;
init_pll();
PINSEL0 |= 0x50; //select the SDA,SCL pins
IODIR0=0x00FFFFF0;
I2CONCLR=0x6c; /* clearing all flags */
I2CONSET=0x40; /* enabling I2C */
I2SCLH=0x08; /* 56.7 KHz */
I2SCLL=0x08;
/* Initialize VIC for I2C use */
VICVectAddr0 = (unsigned int) &I2C0_Isr;
VICVectCntl0 = 0x29; // Channel1 on Source#9 ... enabled
VICIntEnable |= 0x200;
/* ISR address written to the respective address register*/
/* Send start bit */
I2CONSET=0x60;
delay(); //

while(1)
{

i++;
delay();
i--;
}

}

Regards
Chandu
 

Re: I2C

Hi

PCF8574AP Port Expander is responding & it is giving ACK signal. Problam is with Pull up resisters (Vcc=3.3V), when I kept 10k pull up resisters device is not responding, I think bias current not sufficient for SCL &SDA Pins. When I kept 3.3K Resister devices is responding I think bias current sufficient for SCL &SDA Pins.

Regards
chandu
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top