This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC2103 I2C Problem

Hi,
I have a LPC2103 board. I read the samples, I applied it in Keil and simulate with proteus but it isn't working.

The sample is that; (Application notes.)
www.standardics.nxp.com/.../an10369.pdf

My circuit;
img440.imageshack.us/my.php

But i2c is not working I can't send the data to expander.

[code]
#include <LPC2103.h>

void I2C_ISR(void) __irq;

void ISR_8(void);
void ISR_18(void);
void ISR_28(void);

int main(){

MEMMAP = 0x02;

VICIntSelect = 0x00;
VICIntEnable = 0x200;
VICVectCntl0 = 0x29;
VICVectAddr0 = (unsigned long) I2C_ISR;

PINSEL0 = 0x50;

IODIR=0xF00000F0;
//IOSET=0xF0;

//
//I2C ayarlari
//
I2C0CONCLR = 0x6C;

I2C0CONSET = 0x40;

I2C0SCLH = 0xC;
I2C0SCLL = 0xD;

I2C0CONSET = 0x60;

while(1);
}

void I2C_ISR() __irq
{

int temp=0;

IOSET = 0xF0000000;

temp=I2C0STAT;

switch(temp) { case 8: ISR_8(); break;

case 24: ISR_18(); break;

case 40: ISR_28(); break;

default : break;
} VICVectAddr=0xFF;
}

void ISR_8(){

// Port Indicator
IOCLR=0x10;
// Slave address + write
I2C0ADR=0x74;
// Clear SI and Start flag
I2C0CONCLR=0x28;
// Port Indicator
IOSET=0x10;

}

void ISR_18(){

// Port Indicator
IOCLR=0x20;
// Data to be transmitted
I2C0DAT=0x55;
// clear SI
I2C0CONCLR=0x8;
// Port Indicator
//IOSET=0x20;

}

void ISR_28(){

// Port Indicator
IOCLR=0x80;
//Transmit stop c
I2C0CONSET=0x10;
//clear SI
I2C0CONCLR=0x8;
//Port Indicator
//IOSET=0x80;

}

[/code]