Hi,
I wrote this function to inizialize the i2c0 devices but i think that is not correct init
function because the i2c interrupt is not activeted.
_BOOL init_i2c_0(void)
{
I2CSlaveState = I2C_IDLE;
I2CS_ReadLength = 0;
I2CS_RdIndex = 0;
//--- set pins ---
PINSEL0 = 0x50;
//--- set i2c pll ---
I2C0SCLL = 0xD;
I2C0SCLH = 0xC;
//--- set i2c slave ---
I2C0ADR = 0x20 << 1;
//--- clear flags ---
I2C0CONCLR = I2CONCLR_AAC | I2CONCLR_SIC | I2CONCLR_STAC | I2CONCLR_I2ENC;
//--- set flags ---
//I2C0CONSET = I2CONSET_AA;
//--- Install interrupt handler ---
if ( install_irq( I2C0_INT, (void *)I2C_0_SlaveHandler ) == FALSE )
{
return FALSE;
}
I2C0CONSET = I2CONSET_I2EN | I2CONSET_AA ;
return TRUE;
}
Please help me...thanks to all.
PS place even my function to inizialize the interrupt...
Uint32 install_irq( Uint32 IntNumber, void *HandlerAddr )
{
Uint32 i;
Uint32 *vect_addr;
Uint32 *vect_cntl;
VICIntEnClr = 1 << IntNumber; /* Disable Interrupt */
for ( i = 0; i < VIC_SIZE; i++ )
{
vect_addr = (Uint32 *)(VIC_BASE_ADDR + VECT_ADDR_INDEX + i*4);
vect_cntl = (Uint32 *)(VIC_BASE_ADDR + VECT_CNTL_INDEX + i*4);
if ( *vect_addr == (Uint32)NULL )
{
*vect_addr = (Uint32)HandlerAddr; /* set interrupt vector */
*vect_cntl = (Uint32)(IRQ_SLOT_EN | IntNumber);
break;
}
}
if ( i == VIC_SIZE )
{
return( FALSE ); /* fatal error, can't find empty vector slot */
}
VICIntEnable = 1 << IntNumber; /* Enable Interrupt */
return( TRUE );
}
I have copy this function to NXP Philips example...
------------------------------------

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )